diff --git a/src/java/org/apache/poi/hssf/record/DBCellRecord.java b/src/java/org/apache/poi/hssf/record/DBCellRecord.java index 499c6cbe7..c4080f0ad 100644 --- a/src/java/org/apache/poi/hssf/record/DBCellRecord.java +++ b/src/java/org/apache/poi/hssf/record/DBCellRecord.java @@ -100,8 +100,13 @@ public final class DBCellRecord extends StandardRecord implements Cloneable { } /** - * @return the size of the group of DBCellRecords needed to encode - * the specified number of blocks and rows + * @param nBlocks number of blocks + * @param nRows number of rows + * + * @return the size of the group of DBCellRecords needed to encode + * the specified number of blocks and rows + * + * @deprecated in POI 3.15-beta2, scheduled for removal in POI 3.17 - this method is not used within POI */ public static int calculateSizeOfRecords(int nBlocks, int nRows) { // One DBCell per block. diff --git a/src/java/org/apache/poi/hssf/record/DVALRecord.java b/src/java/org/apache/poi/hssf/record/DVALRecord.java index 91c1f13ec..fd7163a52 100644 --- a/src/java/org/apache/poi/hssf/record/DVALRecord.java +++ b/src/java/org/apache/poi/hssf/record/DVALRecord.java @@ -114,14 +114,14 @@ public final class DVALRecord extends StandardRecord implements Cloneable { } /** - * get Object ID of the drop down arrow object for list boxes + * @return the Object ID of the drop down arrow object for list boxes */ public int getObjectID() { return field_cbo_id; } /** - * Get number of following DV records + * @return the number of following DV records */ public int getDVRecNo() { return field_5_dv_no; diff --git a/src/java/org/apache/poi/hssf/record/EndSubRecord.java b/src/java/org/apache/poi/hssf/record/EndSubRecord.java index dc8c5f82c..f0a676b18 100644 --- a/src/java/org/apache/poi/hssf/record/EndSubRecord.java +++ b/src/java/org/apache/poi/hssf/record/EndSubRecord.java @@ -37,7 +37,7 @@ public final class EndSubRecord extends SubRecord implements Cloneable { /** * @param in unused (since this record has no data) - * @param size + * @param size must be 0 */ public EndSubRecord(LittleEndianInput in, int size) { if ((size & 0xFF) != ENCODED_SIZE) { // mask out random crap in upper byte diff --git a/src/java/org/apache/poi/hssf/record/ExtendedFormatRecord.java b/src/java/org/apache/poi/hssf/record/ExtendedFormatRecord.java index ccc3935b5..3d043681b 100644 --- a/src/java/org/apache/poi/hssf/record/ExtendedFormatRecord.java +++ b/src/java/org/apache/poi/hssf/record/ExtendedFormatRecord.java @@ -41,145 +41,145 @@ import org.apache.poi.util.LittleEndianOutput; public final class ExtendedFormatRecord extends StandardRecord { - public final static short sid = 0xE0; + public static final short sid = 0xE0; // null constant - public final static short NULL = (short)0xfff0; + public static final short NULL = (short)0xfff0; // xf type - public final static short XF_STYLE = 1; - public final static short XF_CELL = 0; + public static final short XF_STYLE = 1; + public static final short XF_CELL = 0; // borders - public final static short NONE = 0x0; - public final static short THIN = 0x1; - public final static short MEDIUM = 0x2; - public final static short DASHED = 0x3; - public final static short DOTTED = 0x4; - public final static short THICK = 0x5; - public final static short DOUBLE = 0x6; - public final static short HAIR = 0x7; - public final static short MEDIUM_DASHED = 0x8; - public final static short DASH_DOT = 0x9; - public final static short MEDIUM_DASH_DOT = 0xA; - public final static short DASH_DOT_DOT = 0xB; - public final static short MEDIUM_DASH_DOT_DOT = 0xC; - public final static short SLANTED_DASH_DOT = 0xD; + public static final short NONE = 0x0; + public static final short THIN = 0x1; + public static final short MEDIUM = 0x2; + public static final short DASHED = 0x3; + public static final short DOTTED = 0x4; + public static final short THICK = 0x5; + public static final short DOUBLE = 0x6; + public static final short HAIR = 0x7; + public static final short MEDIUM_DASHED = 0x8; + public static final short DASH_DOT = 0x9; + public static final short MEDIUM_DASH_DOT = 0xA; + public static final short DASH_DOT_DOT = 0xB; + public static final short MEDIUM_DASH_DOT_DOT = 0xC; + public static final short SLANTED_DASH_DOT = 0xD; // alignment - public final static short GENERAL = 0x0; - public final static short LEFT = 0x1; - public final static short CENTER = 0x2; - public final static short RIGHT = 0x3; - public final static short FILL = 0x4; - public final static short JUSTIFY = 0x5; - public final static short CENTER_SELECTION = 0x6; + public static final short GENERAL = 0x0; + public static final short LEFT = 0x1; + public static final short CENTER = 0x2; + public static final short RIGHT = 0x3; + public static final short FILL = 0x4; + public static final short JUSTIFY = 0x5; + public static final short CENTER_SELECTION = 0x6; // vertical alignment - public final static short VERTICAL_TOP = 0x0; - public final static short VERTICAL_CENTER = 0x1; - public final static short VERTICAL_BOTTOM = 0x2; - public final static short VERTICAL_JUSTIFY = 0x3; + public static final short VERTICAL_TOP = 0x0; + public static final short VERTICAL_CENTER = 0x1; + public static final short VERTICAL_BOTTOM = 0x2; + public static final short VERTICAL_JUSTIFY = 0x3; // fill - public final static short NO_FILL = 0 ; - public final static short SOLID_FILL = 1 ; - public final static short FINE_DOTS = 2 ; - public final static short ALT_BARS = 3 ; - public final static short SPARSE_DOTS = 4 ; - public final static short THICK_HORZ_BANDS = 5 ; - public final static short THICK_VERT_BANDS = 6 ; - public final static short THICK_BACKWARD_DIAG = 7 ; - public final static short THICK_FORWARD_DIAG = 8 ; - public final static short BIG_SPOTS = 9 ; - public final static short BRICKS = 10 ; - public final static short THIN_HORZ_BANDS = 11 ; - public final static short THIN_VERT_BANDS = 12 ; - public final static short THIN_BACKWARD_DIAG = 13 ; - public final static short THIN_FORWARD_DIAG = 14 ; - public final static short SQUARES = 15 ; - public final static short DIAMONDS = 16 ; + public static final short NO_FILL = 0 ; + public static final short SOLID_FILL = 1 ; + public static final short FINE_DOTS = 2 ; + public static final short ALT_BARS = 3 ; + public static final short SPARSE_DOTS = 4 ; + public static final short THICK_HORZ_BANDS = 5 ; + public static final short THICK_VERT_BANDS = 6 ; + public static final short THICK_BACKWARD_DIAG = 7 ; + public static final short THICK_FORWARD_DIAG = 8 ; + public static final short BIG_SPOTS = 9 ; + public static final short BRICKS = 10 ; + public static final short THIN_HORZ_BANDS = 11 ; + public static final short THIN_VERT_BANDS = 12 ; + public static final short THIN_BACKWARD_DIAG = 13 ; + public static final short THIN_FORWARD_DIAG = 14 ; + public static final short SQUARES = 15 ; + public static final short DIAMONDS = 16 ; // fields in BOTH style and Cell XF records private short field_1_font_index; // not bit-mapped private short field_2_format_index; // not bit-mapped // field_3_cell_options bit map - static final private BitField _locked = BitFieldFactory.getInstance(0x0001); - static final private BitField _hidden = BitFieldFactory.getInstance(0x0002); - static final private BitField _xf_type = BitFieldFactory.getInstance(0x0004); - static final private BitField _123_prefix = BitFieldFactory.getInstance(0x0008); - static final private BitField _parent_index = BitFieldFactory.getInstance(0xFFF0); + private static final BitField _locked = BitFieldFactory.getInstance(0x0001); + private static final BitField _hidden = BitFieldFactory.getInstance(0x0002); + private static final BitField _xf_type = BitFieldFactory.getInstance(0x0004); + private static final BitField _123_prefix = BitFieldFactory.getInstance(0x0008); + private static final BitField _parent_index = BitFieldFactory.getInstance(0xFFF0); private short field_3_cell_options; // field_4_alignment_options bit map - static final private BitField _alignment = BitFieldFactory.getInstance(0x0007); - static final private BitField _wrap_text = BitFieldFactory.getInstance(0x0008); - static final private BitField _vertical_alignment = BitFieldFactory.getInstance(0x0070); - static final private BitField _justify_last = BitFieldFactory.getInstance(0x0080); - static final private BitField _rotation = BitFieldFactory.getInstance(0xFF00); + private static final BitField _alignment = BitFieldFactory.getInstance(0x0007); + private static final BitField _wrap_text = BitFieldFactory.getInstance(0x0008); + private static final BitField _vertical_alignment = BitFieldFactory.getInstance(0x0070); + private static final BitField _justify_last = BitFieldFactory.getInstance(0x0080); + private static final BitField _rotation = BitFieldFactory.getInstance(0xFF00); private short field_4_alignment_options; // field_5_indention_options - static final private BitField _indent = + private static final BitField _indent = BitFieldFactory.getInstance(0x000F); - static final private BitField _shrink_to_fit = + private static final BitField _shrink_to_fit = BitFieldFactory.getInstance(0x0010); - static final private BitField _merge_cells = + private static final BitField _merge_cells = BitFieldFactory.getInstance(0x0020); - static final private BitField _reading_order = + private static final BitField _reading_order = BitFieldFactory.getInstance(0x00C0); // apparently bits 8 and 9 are unused - static final private BitField _indent_not_parent_format = + private static final BitField _indent_not_parent_format = BitFieldFactory.getInstance(0x0400); - static final private BitField _indent_not_parent_font = + private static final BitField _indent_not_parent_font = BitFieldFactory.getInstance(0x0800); - static final private BitField _indent_not_parent_alignment = + private static final BitField _indent_not_parent_alignment = BitFieldFactory.getInstance(0x1000); - static final private BitField _indent_not_parent_border = + private static final BitField _indent_not_parent_border = BitFieldFactory.getInstance(0x2000); - static final private BitField _indent_not_parent_pattern = + private static final BitField _indent_not_parent_pattern = BitFieldFactory.getInstance(0x4000); - static final private BitField _indent_not_parent_cell_options = + private static final BitField _indent_not_parent_cell_options = BitFieldFactory.getInstance(0x8000); private short field_5_indention_options; // field_6_border_options bit map - static final private BitField _border_left = BitFieldFactory.getInstance(0x000F); - static final private BitField _border_right = BitFieldFactory.getInstance(0x00F0); - static final private BitField _border_top = BitFieldFactory.getInstance(0x0F00); - static final private BitField _border_bottom = BitFieldFactory.getInstance(0xF000); + private static final BitField _border_left = BitFieldFactory.getInstance(0x000F); + private static final BitField _border_right = BitFieldFactory.getInstance(0x00F0); + private static final BitField _border_top = BitFieldFactory.getInstance(0x0F00); + private static final BitField _border_bottom = BitFieldFactory.getInstance(0xF000); private short field_6_border_options; // all three of the following attributes are palette options // field_7_palette_options bit map - static final private BitField _left_border_palette_idx = + private static final BitField _left_border_palette_idx = BitFieldFactory.getInstance(0x007F); - static final private BitField _right_border_palette_idx = + private static final BitField _right_border_palette_idx = BitFieldFactory.getInstance(0x3F80); - static final private BitField _diag = + private static final BitField _diag = BitFieldFactory.getInstance(0xC000); private short field_7_palette_options; // field_8_adtl_palette_options bit map - static final private BitField _top_border_palette_idx = + private static final BitField _top_border_palette_idx = BitFieldFactory.getInstance(0x0000007F); - static final private BitField _bottom_border_palette_idx = + private static final BitField _bottom_border_palette_idx = BitFieldFactory.getInstance(0x00003F80); - static final private BitField _adtl_diag = + private static final BitField _adtl_diag = BitFieldFactory.getInstance(0x001fc000); - static final private BitField _adtl_diag_line_style = + private static final BitField _adtl_diag_line_style = BitFieldFactory.getInstance(0x01e00000); // apparently bit 25 is unused - static final private BitField _adtl_fill_pattern = + private static final BitField _adtl_fill_pattern = BitFieldFactory.getInstance(0xfc000000); private int field_8_adtl_palette_options; // additional to avoid 2 // field_9_fill_palette_options bit map - static final private BitField _fill_foreground = BitFieldFactory.getInstance(0x007F); - static final private BitField _fill_background = BitFieldFactory.getInstance(0x3f80); + private static final BitField _fill_foreground = BitFieldFactory.getInstance(0x007F); + private static final BitField _fill_background = BitFieldFactory.getInstance(0x3f80); // apparently bits 15 and 14 are unused private short field_9_fill_palette_options; @@ -398,8 +398,7 @@ public final class ExtendedFormatRecord * Dunno. Docs just say this is for far east versions.. (I'm guessing it * justifies for right-to-left read languages) * - * - * @param justify + * @param justify use 0 for US * @see #setAlignmentOptions(short) */ @@ -907,14 +906,10 @@ public final class ExtendedFormatRecord _adtl_fill_pattern.setValue(field_8_adtl_palette_options, fill); } - // end bitfields for additional palette options - /** - * set the fill palette options bitmask (see - * - * - * @param options + * set the fill palette options bitmask (see bitfields for additional palette options) * + * @param options the palette options */ public void setFillPaletteOptions(short options) @@ -1662,6 +1657,7 @@ public final class ExtendedFormatRecord return _fill_background.getShortValue(field_9_fill_palette_options); } + @Override public String toString() { StringBuffer buffer = new StringBuffer(); @@ -1769,6 +1765,7 @@ public final class ExtendedFormatRecord return buffer.toString(); } + @Override public void serialize(LittleEndianOutput out) { out.writeShort(getFontIndex()); out.writeShort(getFormatIndex()); @@ -1781,10 +1778,12 @@ public final class ExtendedFormatRecord out.writeShort(getFillPaletteOptions()); } + @Override protected int getDataSize() { return 20; } + @Override public short getSid() { return sid; @@ -1797,7 +1796,9 @@ public final class ExtendedFormatRecord * * If The source ExtendedFormatRecord comes from * a different Workbook, you will need to sort - * out the font and format indicies yourself! + * out the font and format indices yourself! + * + * @param source the ExtendedFormatRecord to copy from */ public void cloneStyleFrom(ExtendedFormatRecord source) { field_1_font_index = source.field_1_font_index; @@ -1811,7 +1812,8 @@ public final class ExtendedFormatRecord field_9_fill_palette_options = source.field_9_fill_palette_options; } - public int hashCode() { + @Override + public int hashCode() { final int prime = 31; int result = 1; result = prime * result + field_1_font_index; @@ -1831,7 +1833,8 @@ public final class ExtendedFormatRecord * contents as equals, as the various indexes * that matter are embedded in the records */ - public boolean equals(Object obj) { + @Override + public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) diff --git a/src/java/org/apache/poi/hssf/record/ExternSheetRecord.java b/src/java/org/apache/poi/hssf/record/ExternSheetRecord.java index beee8bca6..37d8c4daa 100644 --- a/src/java/org/apache/poi/hssf/record/ExternSheetRecord.java +++ b/src/java/org/apache/poi/hssf/record/ExternSheetRecord.java @@ -186,7 +186,9 @@ public class ExternSheetRecord extends StandardRecord { } /** - * Returns the index of the SupBookRecord for this index + * @param refIndex specifies the n-th refIndex + * + * @return the index of the SupBookRecord for this index */ public int getExtbookIndexFromRefIndex(int refIndex) { RefSubRecord refRec = getRef(refIndex); diff --git a/src/java/org/apache/poi/hssf/record/ExternalNameRecord.java b/src/java/org/apache/poi/hssf/record/ExternalNameRecord.java index 33a4166cc..b6721352e 100644 --- a/src/java/org/apache/poi/hssf/record/ExternalNameRecord.java +++ b/src/java/org/apache/poi/hssf/record/ExternalNameRecord.java @@ -61,25 +61,31 @@ public final class ExternalNameRecord extends StandardRecord { private int _nRows; /** - * Convenience Function to determine if the name is a built-in name + * @return {@code true} if the name is a built-in name */ public boolean isBuiltInName() { return (field_1_option_flag & OPT_BUILTIN_NAME) != 0; } /** * For OLE and DDE, links can be either 'automatic' or 'manual' + * + * @return {@code true} if this is a automatic link */ public boolean isAutomaticLink() { return (field_1_option_flag & OPT_AUTOMATIC_LINK) != 0; } /** * only for OLE and DDE + * + * @return {@code true} if this is a picture link */ public boolean isPicureLink() { return (field_1_option_flag & OPT_PICTURE_LINK) != 0; } /** * DDE links only. If true, this denotes the 'StdDocumentName' + * + * @return {@code true} if this denotes the 'StdDocumentName' */ public boolean isStdDocumentNameIdentifier() { return (field_1_option_flag & OPT_STD_DOCUMENT_NAME) != 0; @@ -104,12 +110,15 @@ public final class ExternalNameRecord extends StandardRecord { /** * If this is a local name, then this is the (1 based) * index of the name of the Sheet this refers to, as - * defined in the preceeding {@link SupBookRecord}. + * defined in the preceding {@link SupBookRecord}. * If it isn't a local name, then it must be zero. + * + * @return the index of the name of the Sheet this refers to */ public short getIx() { return field_2_ixals; } + public void setIx(short ix) { field_2_ixals = ix; } @@ -212,8 +221,7 @@ public final class ExternalNameRecord extends StandardRecord { sb.append(" .name = ").append(field_4_name).append("\n"); if(field_5_name_definition != null) { Ptg[] ptgs = field_5_name_definition.getTokens(); - for (int i = 0; i < ptgs.length; i++) { - Ptg ptg = ptgs[i]; + for (Ptg ptg : ptgs) { sb.append(ptg.toString()).append(ptg.getRVAType()).append("\n"); } }