You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2021/05/22 20:56:49 UTC

svn commit: r1890120 [6/43] - in /poi/trunk/poi/src: main/java/org/apache/poi/ main/java/org/apache/poi/ddf/ main/java/org/apache/poi/extractor/ main/java/org/apache/poi/hpsf/ main/java/org/apache/poi/hssf/ main/java/org/apache/poi/hssf/dev/ main/java/...

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/FontRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/FontRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/FontRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/FontRecord.java Sat May 22 20:56:44 2021
@@ -29,489 +29,489 @@ import org.apache.poi.util.StringUtil;
 
 /** Describes a font in the workbook */
 public final class FontRecord extends StandardRecord {
-	// docs are wrong (0x231 Microsoft Support site article Q184647)
-	public static final short sid                = 0x0031;
-	public static final short SS_NONE            = 0;
-	public static final short SS_SUPER           = 1;
-	public static final short SS_SUB             = 2;
-	public static final byte U_NONE              = 0;
-	public static final byte U_SINGLE            = 1;
-	public static final byte U_DOUBLE            = 2;
-	public static final byte U_SINGLE_ACCOUNTING = 0x21;
-	public static final byte U_DOUBLE_ACCOUNTING = 0x22;
-
-	// 0 0x01 - Reserved bit must be 0
-	// is this font in italics
-	private static final BitField italic     = BitFieldFactory.getInstance(0x02);
-
-	// 2 0x04 - reserved bit must be 0
-	// is this font has a line through the center
-	private static final BitField strikeout  = BitFieldFactory.getInstance(0x08);
-	// some weird macintosh thing....but who understands those mac people anyhow
-	private static final BitField macoutline = BitFieldFactory.getInstance(0x10);
-	private static final BitField macshadow  = BitFieldFactory.getInstance(0x20);
-
-	// in units of .05 of a point
-	private short field_1_font_height;
-	private short field_2_attributes;
-
-	// 7-6 - reserved bits must be 0
-	// the rest is unused
-	private short field_3_color_palette_index;
-	private short field_4_bold_weight;
-	// 00none/01super/02sub
-	private short field_5_super_sub_script;
-	// 00none/01single/02double/21singleaccounting/22doubleaccounting
-	private byte field_6_underline;
-	// ?? defined by windows api logfont structure?
-	private byte field_7_family;
-	// ?? defined by windows api logfont structure?
-	private byte field_8_charset;
-	// must be 0
-	private byte field_9_zero;
-	/** possibly empty string never <code>null</code> */
-	private String field_11_font_name;
-
-	public FontRecord() {
-	}
-
-	public FontRecord(FontRecord other) {
-		super(other);
-		field_1_font_height = other.field_1_font_height;
-		field_2_attributes = other.field_2_attributes;
-		field_3_color_palette_index = other.field_3_color_palette_index;
-		field_4_bold_weight = other.field_4_bold_weight;
-		field_5_super_sub_script = other.field_5_super_sub_script;
-		field_6_underline = other.field_6_underline;
-		field_7_family = other.field_7_family;
-		field_8_charset = other.field_8_charset;
-		field_9_zero = other.field_9_zero;
-		field_11_font_name = other.field_11_font_name;
-	}
-
-	public FontRecord(RecordInputStream in) {
-		field_1_font_height         = in.readShort();
-		field_2_attributes          = in.readShort();
-		field_3_color_palette_index = in.readShort();
-		field_4_bold_weight         = in.readShort();
-		field_5_super_sub_script    = in.readShort();
-		field_6_underline           = in.readByte();
-		field_7_family              = in.readByte();
-		field_8_charset             = in.readByte();
-		field_9_zero                = in.readByte();
-		int field_10_font_name_len  = in.readUByte();
-		int unicodeFlags            = in.readUByte(); // options byte present always (even if no character data)
-
-		if (field_10_font_name_len > 0) {
-			if (unicodeFlags == 0) {   // is compressed unicode
-				field_11_font_name = in.readCompressedUnicode(field_10_font_name_len);
-			} else {   // is not compressed unicode
-				field_11_font_name = in.readUnicodeLEString(field_10_font_name_len);
-			}
-		} else {
-			field_11_font_name = "";
-		}
-	}
-
-	/**
-	 * sets the height of the font in 1/20th point units
-	 *
-	 * @param height  fontheight (in points/20)
-	 */
-	public void setFontHeight(short height) {
-		field_1_font_height = height;
-	}
-
-	/**
-	 * set the font attributes (see individual bit setters that reference this method)
-	 *
-	 * @param attributes    the bitmask to set
-	 */
-	public void setAttributes(short attributes) {
-		field_2_attributes = attributes;
-	}
-
-	// attributes bitfields
-
-	/**
-	 * set the font to be italics or not
-	 *
-	 * @param italics - whether the font is italics or not
-	 * @see #setAttributes(short)
-	 */
-	public void setItalic(boolean italics) {
-		field_2_attributes = italic.setShortBoolean(field_2_attributes, italics);
-	}
-
-	/**
-	 * set the font to be stricken out or not
-	 *
-	 * @param strike - whether the font is stricken out or not
-	 * @see #setAttributes(short)
-	 */
-	public void setStrikeout(boolean strike) {
-		field_2_attributes = strikeout.setShortBoolean(field_2_attributes, strike);
-	}
-
-	/**
-	 * whether to use the mac outline font style thing (mac only) - Some mac person
-	 * should comment this instead of me doing it (since I have no idea)
-	 *
-	 * @param mac - whether to do that mac font outline thing or not
-	 * @see #setAttributes(short)
-	 */
-	public void setMacoutline(boolean mac) {
-		field_2_attributes = macoutline.setShortBoolean(field_2_attributes, mac);
-	}
-
-	/**
-	 * whether to use the mac shado font style thing (mac only) - Some mac person
-	 * should comment this instead of me doing it (since I have no idea)
-	 *
-	 * @param mac - whether to do that mac font shadow thing or not
-	 * @see #setAttributes(short)
-	 */
-	public void setMacshadow(boolean mac) {
-		field_2_attributes = macshadow.setShortBoolean(field_2_attributes, mac);
-	}
-
-	/**
-	 * set the font's color palette index
-	 *
-	 * @param cpi - font color index
-	 */
-	public void setColorPaletteIndex(short cpi) {
-		field_3_color_palette_index = cpi;
-	}
-
-	/**
-	 * set the bold weight for this font (100-1000dec or 0x64-0x3e8).  Default is
-	 * 0x190 for normal and 0x2bc for bold
-	 *
-	 * @param bw - a number between 100-1000 for the fonts "boldness"
-	 */
-	public void setBoldWeight(short bw) {
-		field_4_bold_weight = bw;
-	}
-
-	/**
-	 * set the type of super or subscript for the font
-	 *
-	 * @param sss  super or subscript option
-	 * @see #SS_NONE
-	 * @see #SS_SUPER
-	 * @see #SS_SUB
-	 */
-	public void setSuperSubScript(short sss) {
-		field_5_super_sub_script = sss;
-	}
-
-	/**
-	 * set the type of underlining for the font
-	 *
-	 * @param u  super or subscript option
-	 *
-	 * @see #U_NONE
-	 * @see #U_SINGLE
-	 * @see #U_DOUBLE
-	 * @see #U_SINGLE_ACCOUNTING
-	 * @see #U_DOUBLE_ACCOUNTING
-	 */
-	public void setUnderline(byte u) {
-		field_6_underline = u;
-	}
-
-	/**
-	 * set the font family (TODO)
-	 *
-	 * @param f family
-	 */
-	public void setFamily(byte f) {
-		field_7_family = f;
-	}
-
-	/**
-	 * set the character set
-	 *
-	 * @param charset - character set
-	 */
-	public void setCharset(byte charset) {
-		field_8_charset = charset;
-	}
-
-
-	/**
-	 * set the name of the font
-	 *
-	 * @param fn - name of the font (i.e. "Arial")
-	 */
-	public void setFontName(String fn) {
-		field_11_font_name = fn;
-	}
-
-	/**
-	 * gets the height of the font in 1/20th point units
-	 *
-	 * @return fontheight (in points/20)
-	 */
-	public short getFontHeight() {
-		return field_1_font_height;
-	}
-
-	/**
-	 * get the font attributes (see individual bit getters that reference this method)
-	 *
-	 * @return attribute - the bitmask
-	 */
-	public short getAttributes() {
-		return field_2_attributes;
-	}
-
-	/**
-	 * get whether the font is to be italics or not
-	 *
-	 * @return italics - whether the font is italics or not
-	 * @see #getAttributes()
-	 */
-	public boolean isItalic() {
-		return italic.isSet(field_2_attributes);
-	}
-
-	/**
-	 * get whether the font is to be stricken out or not
-	 *
-	 * @return strike - whether the font is stricken out or not
-	 * @see #getAttributes()
-	 */
-	public boolean isStruckout(){
-		return strikeout.isSet(field_2_attributes);
-	}
-
-	/**
-	 * whether to use the mac outline font style thing (mac only) - Some mac person
-	 * should comment this instead of me doing it (since I have no idea)
-	 *
-	 * @return mac - whether to do that mac font outline thing or not
-	 * @see #getAttributes()
-	 */
-	public boolean isMacoutlined(){
-		return macoutline.isSet(field_2_attributes);
-	}
-
-	/**
-	 * whether to use the mac shado font style thing (mac only) - Some mac person
-	 * should comment this instead of me doing it (since I have no idea)
-	 *
-	 * @return mac - whether to do that mac font shadow thing or not
-	 * @see #getAttributes()
-	 */
-	public boolean isMacshadowed(){
-		return macshadow.isSet(field_2_attributes);
-	}
-
-	/**
-	 * get the font's color palette index
-	 *
-	 * @return cpi - font color index
-	 */
-	public short getColorPaletteIndex(){
-		return field_3_color_palette_index;
-	}
-
-	/**
-	 * get the bold weight for this font (100-1000dec or 0x64-0x3e8).  Default is
-	 * 0x190 for normal and 0x2bc for bold
-	 *
-	 * @return bw - a number between 100-1000 for the fonts "boldness"
-	 */
-	public short getBoldWeight(){
-		return field_4_bold_weight;
-	}
-
-	/**
-	 * get the type of super or subscript for the font
-	 *
-	 * @return super or subscript option
-	 * @see #SS_NONE
-	 * @see #SS_SUPER
-	 * @see #SS_SUB
-	 */
-	public short getSuperSubScript(){
-		return field_5_super_sub_script;
-	}
-
-	/**
-	 * get the type of underlining for the font
-	 *
-	 * @return super or subscript option
-	 *
-	 * @see #U_NONE
-	 * @see #U_SINGLE
-	 * @see #U_DOUBLE
-	 * @see #U_SINGLE_ACCOUNTING
-	 * @see #U_DOUBLE_ACCOUNTING
-	 */
-	public byte getUnderline() {
-		return field_6_underline;
-	}
-
-	/**
-	 * get the font family (TODO)
-	 *
-	 * @return family
-	 */
-	public byte getFamily() {
-		return field_7_family;
-	}
-
-	/**
-	 * get the character set
-	 *
-	 * @return charset - character set
-	 */
-	public byte getCharset() {
-		return field_8_charset;
-	}
-
-	/**
-	 * get the name of the font
-	 *
-	 * @return fn - name of the font (i.e. "Arial")
-	 */
-	public String getFontName() {
-		return field_11_font_name;
-	}
-
-	public void serialize(LittleEndianOutput out) {
-
-		out.writeShort(getFontHeight());
-		out.writeShort(getAttributes());
-		out.writeShort(getColorPaletteIndex());
-		out.writeShort(getBoldWeight());
-		out.writeShort(getSuperSubScript());
-		out.writeByte(getUnderline());
-		out.writeByte(getFamily());
-		out.writeByte(getCharset());
-		out.writeByte(field_9_zero);
-		int fontNameLen = field_11_font_name.length();
-		out.writeByte(fontNameLen);
-		boolean hasMultibyte = StringUtil.hasMultibyte(field_11_font_name);
-		out.writeByte(hasMultibyte ? 0x01 : 0x00);
-		if (fontNameLen > 0) {
-			if (hasMultibyte) {
-			   StringUtil.putUnicodeLE(field_11_font_name, out);
-			} else {
-				StringUtil.putCompressedUnicode(field_11_font_name, out);
-			}
-		}
-	}
-	protected int getDataSize() {
-		int size = 16; // 5 shorts + 6 bytes
-		int fontNameLen = field_11_font_name.length();
-		if (fontNameLen < 1) {
-			return size;
-		}
-
-		boolean hasMultibyte = StringUtil.hasMultibyte(field_11_font_name);
-		return size + fontNameLen * (hasMultibyte ? 2 : 1);
-	}
-
-	public short getSid() {
-		return sid;
-	}
-
-	/**
-	 * Clones all the font style information from another
-	 *  FontRecord, onto this one. This
-	 *  will then hold all the same font style options.
-	 *
-	 * @param source the record to clone the properties from
-	 */
-	public void cloneStyleFrom(FontRecord source) {
-		field_1_font_height         = source.field_1_font_height;
-		field_2_attributes          = source.field_2_attributes;
-		field_3_color_palette_index = source.field_3_color_palette_index;
-		field_4_bold_weight         = source.field_4_bold_weight;
-		field_5_super_sub_script    = source.field_5_super_sub_script;
-		field_6_underline           = source.field_6_underline;
-		field_7_family              = source.field_7_family;
-		field_8_charset             = source.field_8_charset;
-		field_9_zero                = source.field_9_zero;
-		field_11_font_name          = source.field_11_font_name;
-	}
-
-	public int hashCode() {
-		return Objects.hash(
-			field_1_font_height
-			, field_2_attributes
-			, field_3_color_palette_index
-			, field_4_bold_weight
-			, field_5_super_sub_script
-			, field_6_underline
-			, field_7_family
-			, field_8_charset
-			, field_9_zero
-			, field_11_font_name
-		);
-	}
-
-	/**
-	 * Does this FontRecord have all the same font
-	 *  properties as the supplied FontRecord?
-	 * Note that {@link #equals(Object)} will check
-	 *  for exact objects, while this will check
-	 *  for exact contents, because normally the
-	 *  font record's position makes a big
-	 *  difference too.
-	 *
-	 *  @param other the record to compare with
-	 *
-	 *  @return true, if the properties match
-	 */
-	public boolean sameProperties(FontRecord other) {
-
-		return
-		field_1_font_height         == other.field_1_font_height &&
-		field_2_attributes          == other.field_2_attributes &&
-		field_3_color_palette_index == other.field_3_color_palette_index &&
-		field_4_bold_weight         == other.field_4_bold_weight &&
-		field_5_super_sub_script    == other.field_5_super_sub_script &&
-		field_6_underline           == other.field_6_underline &&
-		field_7_family              == other.field_7_family &&
-		field_8_charset             == other.field_8_charset &&
-		field_9_zero                == other.field_9_zero &&
-		Objects.equals(this.field_11_font_name, other.field_11_font_name)
-		;
-	}
+    // docs are wrong (0x231 Microsoft Support site article Q184647)
+    public static final short sid                = 0x0031;
+    public static final short SS_NONE            = 0;
+    public static final short SS_SUPER           = 1;
+    public static final short SS_SUB             = 2;
+    public static final byte U_NONE              = 0;
+    public static final byte U_SINGLE            = 1;
+    public static final byte U_DOUBLE            = 2;
+    public static final byte U_SINGLE_ACCOUNTING = 0x21;
+    public static final byte U_DOUBLE_ACCOUNTING = 0x22;
+
+    // 0 0x01 - Reserved bit must be 0
+    // is this font in italics
+    private static final BitField italic     = BitFieldFactory.getInstance(0x02);
+
+    // 2 0x04 - reserved bit must be 0
+    // is this font has a line through the center
+    private static final BitField strikeout  = BitFieldFactory.getInstance(0x08);
+    // some weird macintosh thing....but who understands those mac people anyhow
+    private static final BitField macoutline = BitFieldFactory.getInstance(0x10);
+    private static final BitField macshadow  = BitFieldFactory.getInstance(0x20);
+
+    // in units of .05 of a point
+    private short field_1_font_height;
+    private short field_2_attributes;
+
+    // 7-6 - reserved bits must be 0
+    // the rest is unused
+    private short field_3_color_palette_index;
+    private short field_4_bold_weight;
+    // 00none/01super/02sub
+    private short field_5_super_sub_script;
+    // 00none/01single/02double/21singleaccounting/22doubleaccounting
+    private byte field_6_underline;
+    // ?? defined by windows api logfont structure?
+    private byte field_7_family;
+    // ?? defined by windows api logfont structure?
+    private byte field_8_charset;
+    // must be 0
+    private byte field_9_zero;
+    /** possibly empty string never <code>null</code> */
+    private String field_11_font_name;
+
+    public FontRecord() {
+    }
+
+    public FontRecord(FontRecord other) {
+        super(other);
+        field_1_font_height = other.field_1_font_height;
+        field_2_attributes = other.field_2_attributes;
+        field_3_color_palette_index = other.field_3_color_palette_index;
+        field_4_bold_weight = other.field_4_bold_weight;
+        field_5_super_sub_script = other.field_5_super_sub_script;
+        field_6_underline = other.field_6_underline;
+        field_7_family = other.field_7_family;
+        field_8_charset = other.field_8_charset;
+        field_9_zero = other.field_9_zero;
+        field_11_font_name = other.field_11_font_name;
+    }
+
+    public FontRecord(RecordInputStream in) {
+        field_1_font_height         = in.readShort();
+        field_2_attributes          = in.readShort();
+        field_3_color_palette_index = in.readShort();
+        field_4_bold_weight         = in.readShort();
+        field_5_super_sub_script    = in.readShort();
+        field_6_underline           = in.readByte();
+        field_7_family              = in.readByte();
+        field_8_charset             = in.readByte();
+        field_9_zero                = in.readByte();
+        int field_10_font_name_len  = in.readUByte();
+        int unicodeFlags            = in.readUByte(); // options byte present always (even if no character data)
+
+        if (field_10_font_name_len > 0) {
+            if (unicodeFlags == 0) {   // is compressed unicode
+                field_11_font_name = in.readCompressedUnicode(field_10_font_name_len);
+            } else {   // is not compressed unicode
+                field_11_font_name = in.readUnicodeLEString(field_10_font_name_len);
+            }
+        } else {
+            field_11_font_name = "";
+        }
+    }
+
+    /**
+     * sets the height of the font in 1/20th point units
+     *
+     * @param height  fontheight (in points/20)
+     */
+    public void setFontHeight(short height) {
+        field_1_font_height = height;
+    }
+
+    /**
+     * set the font attributes (see individual bit setters that reference this method)
+     *
+     * @param attributes    the bitmask to set
+     */
+    public void setAttributes(short attributes) {
+        field_2_attributes = attributes;
+    }
+
+    // attributes bitfields
+
+    /**
+     * set the font to be italics or not
+     *
+     * @param italics - whether the font is italics or not
+     * @see #setAttributes(short)
+     */
+    public void setItalic(boolean italics) {
+        field_2_attributes = italic.setShortBoolean(field_2_attributes, italics);
+    }
+
+    /**
+     * set the font to be stricken out or not
+     *
+     * @param strike - whether the font is stricken out or not
+     * @see #setAttributes(short)
+     */
+    public void setStrikeout(boolean strike) {
+        field_2_attributes = strikeout.setShortBoolean(field_2_attributes, strike);
+    }
+
+    /**
+     * whether to use the mac outline font style thing (mac only) - Some mac person
+     * should comment this instead of me doing it (since I have no idea)
+     *
+     * @param mac - whether to do that mac font outline thing or not
+     * @see #setAttributes(short)
+     */
+    public void setMacoutline(boolean mac) {
+        field_2_attributes = macoutline.setShortBoolean(field_2_attributes, mac);
+    }
+
+    /**
+     * whether to use the mac shado font style thing (mac only) - Some mac person
+     * should comment this instead of me doing it (since I have no idea)
+     *
+     * @param mac - whether to do that mac font shadow thing or not
+     * @see #setAttributes(short)
+     */
+    public void setMacshadow(boolean mac) {
+        field_2_attributes = macshadow.setShortBoolean(field_2_attributes, mac);
+    }
+
+    /**
+     * set the font's color palette index
+     *
+     * @param cpi - font color index
+     */
+    public void setColorPaletteIndex(short cpi) {
+        field_3_color_palette_index = cpi;
+    }
+
+    /**
+     * set the bold weight for this font (100-1000dec or 0x64-0x3e8).  Default is
+     * 0x190 for normal and 0x2bc for bold
+     *
+     * @param bw - a number between 100-1000 for the fonts "boldness"
+     */
+    public void setBoldWeight(short bw) {
+        field_4_bold_weight = bw;
+    }
+
+    /**
+     * set the type of super or subscript for the font
+     *
+     * @param sss  super or subscript option
+     * @see #SS_NONE
+     * @see #SS_SUPER
+     * @see #SS_SUB
+     */
+    public void setSuperSubScript(short sss) {
+        field_5_super_sub_script = sss;
+    }
+
+    /**
+     * set the type of underlining for the font
+     *
+     * @param u  super or subscript option
+     *
+     * @see #U_NONE
+     * @see #U_SINGLE
+     * @see #U_DOUBLE
+     * @see #U_SINGLE_ACCOUNTING
+     * @see #U_DOUBLE_ACCOUNTING
+     */
+    public void setUnderline(byte u) {
+        field_6_underline = u;
+    }
+
+    /**
+     * set the font family (TODO)
+     *
+     * @param f family
+     */
+    public void setFamily(byte f) {
+        field_7_family = f;
+    }
+
+    /**
+     * set the character set
+     *
+     * @param charset - character set
+     */
+    public void setCharset(byte charset) {
+        field_8_charset = charset;
+    }
+
+
+    /**
+     * set the name of the font
+     *
+     * @param fn - name of the font (i.e. "Arial")
+     */
+    public void setFontName(String fn) {
+        field_11_font_name = fn;
+    }
+
+    /**
+     * gets the height of the font in 1/20th point units
+     *
+     * @return fontheight (in points/20)
+     */
+    public short getFontHeight() {
+        return field_1_font_height;
+    }
+
+    /**
+     * get the font attributes (see individual bit getters that reference this method)
+     *
+     * @return attribute - the bitmask
+     */
+    public short getAttributes() {
+        return field_2_attributes;
+    }
+
+    /**
+     * get whether the font is to be italics or not
+     *
+     * @return italics - whether the font is italics or not
+     * @see #getAttributes()
+     */
+    public boolean isItalic() {
+        return italic.isSet(field_2_attributes);
+    }
+
+    /**
+     * get whether the font is to be stricken out or not
+     *
+     * @return strike - whether the font is stricken out or not
+     * @see #getAttributes()
+     */
+    public boolean isStruckout(){
+        return strikeout.isSet(field_2_attributes);
+    }
+
+    /**
+     * whether to use the mac outline font style thing (mac only) - Some mac person
+     * should comment this instead of me doing it (since I have no idea)
+     *
+     * @return mac - whether to do that mac font outline thing or not
+     * @see #getAttributes()
+     */
+    public boolean isMacoutlined(){
+        return macoutline.isSet(field_2_attributes);
+    }
+
+    /**
+     * whether to use the mac shado font style thing (mac only) - Some mac person
+     * should comment this instead of me doing it (since I have no idea)
+     *
+     * @return mac - whether to do that mac font shadow thing or not
+     * @see #getAttributes()
+     */
+    public boolean isMacshadowed(){
+        return macshadow.isSet(field_2_attributes);
+    }
+
+    /**
+     * get the font's color palette index
+     *
+     * @return cpi - font color index
+     */
+    public short getColorPaletteIndex(){
+        return field_3_color_palette_index;
+    }
+
+    /**
+     * get the bold weight for this font (100-1000dec or 0x64-0x3e8).  Default is
+     * 0x190 for normal and 0x2bc for bold
+     *
+     * @return bw - a number between 100-1000 for the fonts "boldness"
+     */
+    public short getBoldWeight(){
+        return field_4_bold_weight;
+    }
+
+    /**
+     * get the type of super or subscript for the font
+     *
+     * @return super or subscript option
+     * @see #SS_NONE
+     * @see #SS_SUPER
+     * @see #SS_SUB
+     */
+    public short getSuperSubScript(){
+        return field_5_super_sub_script;
+    }
+
+    /**
+     * get the type of underlining for the font
+     *
+     * @return super or subscript option
+     *
+     * @see #U_NONE
+     * @see #U_SINGLE
+     * @see #U_DOUBLE
+     * @see #U_SINGLE_ACCOUNTING
+     * @see #U_DOUBLE_ACCOUNTING
+     */
+    public byte getUnderline() {
+        return field_6_underline;
+    }
+
+    /**
+     * get the font family (TODO)
+     *
+     * @return family
+     */
+    public byte getFamily() {
+        return field_7_family;
+    }
+
+    /**
+     * get the character set
+     *
+     * @return charset - character set
+     */
+    public byte getCharset() {
+        return field_8_charset;
+    }
+
+    /**
+     * get the name of the font
+     *
+     * @return fn - name of the font (i.e. "Arial")
+     */
+    public String getFontName() {
+        return field_11_font_name;
+    }
+
+    public void serialize(LittleEndianOutput out) {
+
+        out.writeShort(getFontHeight());
+        out.writeShort(getAttributes());
+        out.writeShort(getColorPaletteIndex());
+        out.writeShort(getBoldWeight());
+        out.writeShort(getSuperSubScript());
+        out.writeByte(getUnderline());
+        out.writeByte(getFamily());
+        out.writeByte(getCharset());
+        out.writeByte(field_9_zero);
+        int fontNameLen = field_11_font_name.length();
+        out.writeByte(fontNameLen);
+        boolean hasMultibyte = StringUtil.hasMultibyte(field_11_font_name);
+        out.writeByte(hasMultibyte ? 0x01 : 0x00);
+        if (fontNameLen > 0) {
+            if (hasMultibyte) {
+               StringUtil.putUnicodeLE(field_11_font_name, out);
+            } else {
+                StringUtil.putCompressedUnicode(field_11_font_name, out);
+            }
+        }
+    }
+    protected int getDataSize() {
+        int size = 16; // 5 shorts + 6 bytes
+        int fontNameLen = field_11_font_name.length();
+        if (fontNameLen < 1) {
+            return size;
+        }
+
+        boolean hasMultibyte = StringUtil.hasMultibyte(field_11_font_name);
+        return size + fontNameLen * (hasMultibyte ? 2 : 1);
+    }
+
+    public short getSid() {
+        return sid;
+    }
+
+    /**
+     * Clones all the font style information from another
+     *  FontRecord, onto this one. This
+     *  will then hold all the same font style options.
+     *
+     * @param source the record to clone the properties from
+     */
+    public void cloneStyleFrom(FontRecord source) {
+        field_1_font_height         = source.field_1_font_height;
+        field_2_attributes          = source.field_2_attributes;
+        field_3_color_palette_index = source.field_3_color_palette_index;
+        field_4_bold_weight         = source.field_4_bold_weight;
+        field_5_super_sub_script    = source.field_5_super_sub_script;
+        field_6_underline           = source.field_6_underline;
+        field_7_family              = source.field_7_family;
+        field_8_charset             = source.field_8_charset;
+        field_9_zero                = source.field_9_zero;
+        field_11_font_name          = source.field_11_font_name;
+    }
+
+    public int hashCode() {
+        return Objects.hash(
+            field_1_font_height
+            , field_2_attributes
+            , field_3_color_palette_index
+            , field_4_bold_weight
+            , field_5_super_sub_script
+            , field_6_underline
+            , field_7_family
+            , field_8_charset
+            , field_9_zero
+            , field_11_font_name
+        );
+    }
+
+    /**
+     * Does this FontRecord have all the same font
+     *  properties as the supplied FontRecord?
+     * Note that {@link #equals(Object)} will check
+     *  for exact objects, while this will check
+     *  for exact contents, because normally the
+     *  font record's position makes a big
+     *  difference too.
+     *
+     *  @param other the record to compare with
+     *
+     *  @return true, if the properties match
+     */
+    public boolean sameProperties(FontRecord other) {
+
+        return
+        field_1_font_height         == other.field_1_font_height &&
+        field_2_attributes          == other.field_2_attributes &&
+        field_3_color_palette_index == other.field_3_color_palette_index &&
+        field_4_bold_weight         == other.field_4_bold_weight &&
+        field_5_super_sub_script    == other.field_5_super_sub_script &&
+        field_6_underline           == other.field_6_underline &&
+        field_7_family              == other.field_7_family &&
+        field_8_charset             == other.field_8_charset &&
+        field_9_zero                == other.field_9_zero &&
+        Objects.equals(this.field_11_font_name, other.field_11_font_name)
+        ;
+    }
 
     public boolean equals(Object o) {
         return (o instanceof FontRecord) && sameProperties((FontRecord) o);
     }
 
-	@Override
-	public FontRecord copy() {
-		return new FontRecord(this);
-	}
-
-	@Override
-	public HSSFRecordTypes getGenericRecordType() {
-		return HSSFRecordTypes.FONT;
-	}
-
-	@Override
-	public Map<String, Supplier<?>> getGenericProperties() {
-		return GenericRecordUtil.getGenericProperties(
-			"fontHeight", this::getFontHeight,
-			"attributes", GenericRecordUtil.getBitsAsString(this::getAttributes,
-					new BitField[]{italic,strikeout,macoutline,macshadow},
-					new String[]{"ITALIC","STRIKEOUT","MACOUTLINE","MACSHADOW"}),
-			"colorPalette", this::getColorPaletteIndex,
-			"boldWeight", this::getBoldWeight,
-			"superSubScript", this::getSuperSubScript,
-			"underline", this::getUnderline,
-			"family", this::getFamily,
-			"charset", this::getCharset,
-			"fontName", this::getFontName
-		);
-	}
+    @Override
+    public FontRecord copy() {
+        return new FontRecord(this);
+    }
+
+    @Override
+    public HSSFRecordTypes getGenericRecordType() {
+        return HSSFRecordTypes.FONT;
+    }
+
+    @Override
+    public Map<String, Supplier<?>> getGenericProperties() {
+        return GenericRecordUtil.getGenericProperties(
+            "fontHeight", this::getFontHeight,
+            "attributes", GenericRecordUtil.getBitsAsString(this::getAttributes,
+                    new BitField[]{italic,strikeout,macoutline,macshadow},
+                    new String[]{"ITALIC","STRIKEOUT","MACOUTLINE","MACSHADOW"}),
+            "colorPalette", this::getColorPaletteIndex,
+            "boldWeight", this::getBoldWeight,
+            "superSubScript", this::getSuperSubScript,
+            "underline", this::getUnderline,
+            "family", this::getFamily,
+            "charset", this::getCharset,
+            "fontName", this::getFontName
+        );
+    }
 }

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/FooterRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/FooterRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/FooterRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/FooterRecord.java Sat May 22 20:56:44 2021
@@ -21,31 +21,31 @@ package org.apache.poi.hssf.record;
  * Specifies the footer for a sheet
  */
 public final class FooterRecord extends HeaderFooterBase {
-	public static final short sid = 0x0015;
+    public static final short sid = 0x0015;
 
-	public FooterRecord(String text) {
-		super(text);
-	}
-
-	public FooterRecord(FooterRecord other) {
-		super(other);
-	}
-
-	public FooterRecord(RecordInputStream in) {
-		super(in);
-	}
-
-	public short getSid() {
-		return sid;
-	}
-
-	@Override
-	public FooterRecord copy() {
-		return new FooterRecord(this);
-	}
-
-	@Override
-	public HSSFRecordTypes getGenericRecordType() {
-		return HSSFRecordTypes.FOOTER;
-	}
+    public FooterRecord(String text) {
+        super(text);
+    }
+
+    public FooterRecord(FooterRecord other) {
+        super(other);
+    }
+
+    public FooterRecord(RecordInputStream in) {
+        super(in);
+    }
+
+    public short getSid() {
+        return sid;
+    }
+
+    @Override
+    public FooterRecord copy() {
+        return new FooterRecord(this);
+    }
+
+    @Override
+    public HSSFRecordTypes getGenericRecordType() {
+        return HSSFRecordTypes.FOOTER;
+    }
 }

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/FormulaRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/FormulaRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/FormulaRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/FormulaRecord.java Sat May 22 20:56:44 2021
@@ -34,241 +34,241 @@ import org.apache.poi.util.Removal;
  */
 public final class FormulaRecord extends CellRecord {
 
-	// docs say 406...because of a bug Microsoft support site article #Q184647)
-	public static final short sid = 0x0006;
-	// double + short + int
-	private static final int FIXED_SIZE = 14;
-
-	private static final BitField alwaysCalc = BitFieldFactory.getInstance(0x0001);
-	private static final BitField calcOnLoad = BitFieldFactory.getInstance(0x0002);
-	private static final BitField sharedFormula = BitFieldFactory.getInstance(0x0008);
-
-	private double field_4_value;
-	private short  field_5_options;
-	/**
-	 * Unused field.  As it turns out this field is often not zero..
-	 * According to Microsoft Excel Developer's Kit Page 318:
-	 * when writing the chn field (offset 20), it's supposed to be 0 but ignored on read
-	 */
-	private int field_6_zero;
-	private Formula field_8_parsed_expr;
-
-	/**
-	 * Since the NaN support seems sketchy (different constants) we'll store and spit it out directly
-	 */
-	private FormulaSpecialCachedValue specialCachedValue;
-
-	/** Creates new FormulaRecord */
-	public FormulaRecord() {
-		field_8_parsed_expr = Formula.create(Ptg.EMPTY_PTG_ARRAY);
-	}
-
-	public FormulaRecord(FormulaRecord other) {
-		super(other);
-		field_4_value = other.field_4_value;
-		field_5_options = other.field_5_options;
-		field_6_zero = other.field_6_zero;
-		field_8_parsed_expr = (other.field_8_parsed_expr == null) ? null : new Formula(other.field_8_parsed_expr);
-		specialCachedValue = (other.specialCachedValue == null) ? null : new FormulaSpecialCachedValue(other.specialCachedValue);
-	}
-
-	public FormulaRecord(RecordInputStream ris) {
-		super(ris);
-		long valueLongBits  = ris.readLong();
-		field_5_options = ris.readShort();
-		specialCachedValue = FormulaSpecialCachedValue.create(valueLongBits);
-		if (specialCachedValue == null) {
-			field_4_value = Double.longBitsToDouble(valueLongBits);
-		}
-
-		field_6_zero = ris.readInt();
-
-		int field_7_expression_len = ris.readShort(); // this length does not include any extra array data
-		int nBytesAvailable = ris.available();
-		field_8_parsed_expr = Formula.read(field_7_expression_len, ris, nBytesAvailable);
-	}
-
-	/**
-	 * set the calculated value of the formula
-	 *
-	 * @param value  calculated value
-	 */
-	public void setValue(double value) {
-		field_4_value = value;
-		specialCachedValue = null;
-	}
-
-	public void setCachedResultTypeEmptyString() {
-		specialCachedValue = FormulaSpecialCachedValue.createCachedEmptyValue();
-	}
-	public void setCachedResultTypeString() {
-		specialCachedValue = FormulaSpecialCachedValue.createForString();
-	}
-	public void setCachedResultErrorCode(int errorCode) {
-		specialCachedValue = FormulaSpecialCachedValue.createCachedErrorCode(errorCode);
-	}
-	public void setCachedResultBoolean(boolean value) {
-		specialCachedValue = FormulaSpecialCachedValue.createCachedBoolean(value);
-	}
-	/**
-	 * @return <code>true</code> if this {@link FormulaRecord} is followed by a
-	 *  {@link StringRecord} representing the cached text result of the formula
-	 *  evaluation.
-	 */
-	public boolean hasCachedResultString() {
-		return specialCachedValue != null &&
-				specialCachedValue.getTypeCode() == FormulaSpecialCachedValue.STRING;
-	}
-
-	/**
-	 * @deprecated POI 5.0.0, will be removed in 6.0, use getCachedResultTypeEnum until switch to enum is fully done
-	 */
-	@Deprecated
-	@Removal(version = "6.0.0")
-	public int getCachedResultType() {
-		if (specialCachedValue == null) {
-			return CellType.NUMERIC.getCode();
-		}
-		return specialCachedValue.getValueType();
-	}
-
-	/**
-	 * Returns the type of the cached result
-	 * @return A CellType
-	 * @since POI 5.0.0
-	 */
-	public CellType getCachedResultTypeEnum() {
-		if (specialCachedValue == null) {
-			return CellType.NUMERIC;
-		}
-		return specialCachedValue.getValueTypeEnum();
-	}
-
-	public boolean getCachedBooleanValue() {
-		return specialCachedValue.getBooleanValue();
-	}
-	public int getCachedErrorValue() {
-		return specialCachedValue.getErrorValue();
-	}
-
-
-	/**
-	 * set the option flags
-	 *
-	 * @param options  bitmask
-	 */
-	public void setOptions(short options) {
-		field_5_options = options;
-	}
-
-	/**
-	 * get the calculated value of the formula
-	 *
-	 * @return calculated value
-	 */
-	public double getValue() {
-		return field_4_value;
-	}
-
-	/**
-	 * get the option flags
-	 *
-	 * @return bitmask
-	 */
-	public short getOptions() {
-		return field_5_options;
-	}
-
-	public boolean isSharedFormula() {
-		return sharedFormula.isSet(field_5_options);
-	}
-	public void setSharedFormula(boolean flag) {
-		field_5_options =
-			sharedFormula.setShortBoolean(field_5_options, flag);
-	}
-
-	public boolean isAlwaysCalc() {
-		return alwaysCalc.isSet(field_5_options);
-	}
-	public void setAlwaysCalc(boolean flag) {
-		field_5_options =
-			alwaysCalc.setShortBoolean(field_5_options, flag);
-	}
-
-	public boolean isCalcOnLoad() {
-		return calcOnLoad.isSet(field_5_options);
-	}
-	public void setCalcOnLoad(boolean flag) {
-		field_5_options =
-			calcOnLoad.setShortBoolean(field_5_options, flag);
-	}
-
-	/**
-	 * @return the formula tokens. never <code>null</code>
-	 */
-	public Ptg[] getParsedExpression() {
-		return field_8_parsed_expr.getTokens();
-	}
-
-	public Formula getFormula() {
-		return field_8_parsed_expr;
-	}
-
-	public void setParsedExpression(Ptg[] ptgs) {
-		field_8_parsed_expr = Formula.create(ptgs);
-	}
+    // docs say 406...because of a bug Microsoft support site article #Q184647)
+    public static final short sid = 0x0006;
+    // double + short + int
+    private static final int FIXED_SIZE = 14;
+
+    private static final BitField alwaysCalc = BitFieldFactory.getInstance(0x0001);
+    private static final BitField calcOnLoad = BitFieldFactory.getInstance(0x0002);
+    private static final BitField sharedFormula = BitFieldFactory.getInstance(0x0008);
+
+    private double field_4_value;
+    private short  field_5_options;
+    /**
+     * Unused field.  As it turns out this field is often not zero..
+     * According to Microsoft Excel Developer's Kit Page 318:
+     * when writing the chn field (offset 20), it's supposed to be 0 but ignored on read
+     */
+    private int field_6_zero;
+    private Formula field_8_parsed_expr;
+
+    /**
+     * Since the NaN support seems sketchy (different constants) we'll store and spit it out directly
+     */
+    private FormulaSpecialCachedValue specialCachedValue;
+
+    /** Creates new FormulaRecord */
+    public FormulaRecord() {
+        field_8_parsed_expr = Formula.create(Ptg.EMPTY_PTG_ARRAY);
+    }
+
+    public FormulaRecord(FormulaRecord other) {
+        super(other);
+        field_4_value = other.field_4_value;
+        field_5_options = other.field_5_options;
+        field_6_zero = other.field_6_zero;
+        field_8_parsed_expr = (other.field_8_parsed_expr == null) ? null : new Formula(other.field_8_parsed_expr);
+        specialCachedValue = (other.specialCachedValue == null) ? null : new FormulaSpecialCachedValue(other.specialCachedValue);
+    }
+
+    public FormulaRecord(RecordInputStream ris) {
+        super(ris);
+        long valueLongBits  = ris.readLong();
+        field_5_options = ris.readShort();
+        specialCachedValue = FormulaSpecialCachedValue.create(valueLongBits);
+        if (specialCachedValue == null) {
+            field_4_value = Double.longBitsToDouble(valueLongBits);
+        }
+
+        field_6_zero = ris.readInt();
+
+        int field_7_expression_len = ris.readShort(); // this length does not include any extra array data
+        int nBytesAvailable = ris.available();
+        field_8_parsed_expr = Formula.read(field_7_expression_len, ris, nBytesAvailable);
+    }
+
+    /**
+     * set the calculated value of the formula
+     *
+     * @param value  calculated value
+     */
+    public void setValue(double value) {
+        field_4_value = value;
+        specialCachedValue = null;
+    }
+
+    public void setCachedResultTypeEmptyString() {
+        specialCachedValue = FormulaSpecialCachedValue.createCachedEmptyValue();
+    }
+    public void setCachedResultTypeString() {
+        specialCachedValue = FormulaSpecialCachedValue.createForString();
+    }
+    public void setCachedResultErrorCode(int errorCode) {
+        specialCachedValue = FormulaSpecialCachedValue.createCachedErrorCode(errorCode);
+    }
+    public void setCachedResultBoolean(boolean value) {
+        specialCachedValue = FormulaSpecialCachedValue.createCachedBoolean(value);
+    }
+    /**
+     * @return <code>true</code> if this {@link FormulaRecord} is followed by a
+     *  {@link StringRecord} representing the cached text result of the formula
+     *  evaluation.
+     */
+    public boolean hasCachedResultString() {
+        return specialCachedValue != null &&
+                specialCachedValue.getTypeCode() == FormulaSpecialCachedValue.STRING;
+    }
+
+    /**
+     * @deprecated POI 5.0.0, will be removed in 6.0, use getCachedResultTypeEnum until switch to enum is fully done
+     */
+    @Deprecated
+    @Removal(version = "6.0.0")
+    public int getCachedResultType() {
+        if (specialCachedValue == null) {
+            return CellType.NUMERIC.getCode();
+        }
+        return specialCachedValue.getValueType();
+    }
+
+    /**
+     * Returns the type of the cached result
+     * @return A CellType
+     * @since POI 5.0.0
+     */
+    public CellType getCachedResultTypeEnum() {
+        if (specialCachedValue == null) {
+            return CellType.NUMERIC;
+        }
+        return specialCachedValue.getValueTypeEnum();
+    }
+
+    public boolean getCachedBooleanValue() {
+        return specialCachedValue.getBooleanValue();
+    }
+    public int getCachedErrorValue() {
+        return specialCachedValue.getErrorValue();
+    }
+
+
+    /**
+     * set the option flags
+     *
+     * @param options  bitmask
+     */
+    public void setOptions(short options) {
+        field_5_options = options;
+    }
+
+    /**
+     * get the calculated value of the formula
+     *
+     * @return calculated value
+     */
+    public double getValue() {
+        return field_4_value;
+    }
+
+    /**
+     * get the option flags
+     *
+     * @return bitmask
+     */
+    public short getOptions() {
+        return field_5_options;
+    }
+
+    public boolean isSharedFormula() {
+        return sharedFormula.isSet(field_5_options);
+    }
+    public void setSharedFormula(boolean flag) {
+        field_5_options =
+            sharedFormula.setShortBoolean(field_5_options, flag);
+    }
+
+    public boolean isAlwaysCalc() {
+        return alwaysCalc.isSet(field_5_options);
+    }
+    public void setAlwaysCalc(boolean flag) {
+        field_5_options =
+            alwaysCalc.setShortBoolean(field_5_options, flag);
+    }
+
+    public boolean isCalcOnLoad() {
+        return calcOnLoad.isSet(field_5_options);
+    }
+    public void setCalcOnLoad(boolean flag) {
+        field_5_options =
+            calcOnLoad.setShortBoolean(field_5_options, flag);
+    }
+
+    /**
+     * @return the formula tokens. never <code>null</code>
+     */
+    public Ptg[] getParsedExpression() {
+        return field_8_parsed_expr.getTokens();
+    }
+
+    public Formula getFormula() {
+        return field_8_parsed_expr;
+    }
+
+    public void setParsedExpression(Ptg[] ptgs) {
+        field_8_parsed_expr = Formula.create(ptgs);
+    }
 
-	@Override
+    @Override
     public short getSid() {
-		return sid;
-	}
+        return sid;
+    }
 
-	@Override
-	protected int getValueDataSize() {
-		return FIXED_SIZE + field_8_parsed_expr.getEncodedSize();
-	}
-	@Override
-	protected void serializeValue(LittleEndianOutput out) {
-
-		if (specialCachedValue == null) {
-			out.writeDouble(field_4_value);
-		} else {
-			specialCachedValue.serialize(out);
-		}
-
-		out.writeShort(getOptions());
-
-		out.writeInt(field_6_zero); // may as well write original data back so as to minimise differences from original
-		field_8_parsed_expr.serialize(out);
-	}
-
-	@Override
-	protected String getRecordName() {
-		return "FORMULA";
-	}
-
-	@Override
-	public FormulaRecord copy() {
-		return new FormulaRecord(this);
-	}
-
-	@Override
-	public HSSFRecordTypes getGenericRecordType() {
-		return HSSFRecordTypes.FORMULA;
-	}
-
-	@Override
-	public Map<String, Supplier<?>> getGenericProperties() {
-		return GenericRecordUtil.getGenericProperties(
-			"base", super::getGenericProperties,
-			"options", this::getOptions,
-			"alwaysCalc", this::isAlwaysCalc,
-			"calcOnLoad", this::isCalcOnLoad,
-			"shared", this::isSharedFormula,
-			"zero", () -> field_6_zero,
-			"value", () -> specialCachedValue == null ? field_4_value : specialCachedValue,
-			"formula", this::getFormula
-		);
-	}
+    @Override
+    protected int getValueDataSize() {
+        return FIXED_SIZE + field_8_parsed_expr.getEncodedSize();
+    }
+    @Override
+    protected void serializeValue(LittleEndianOutput out) {
+
+        if (specialCachedValue == null) {
+            out.writeDouble(field_4_value);
+        } else {
+            specialCachedValue.serialize(out);
+        }
+
+        out.writeShort(getOptions());
+
+        out.writeInt(field_6_zero); // may as well write original data back so as to minimise differences from original
+        field_8_parsed_expr.serialize(out);
+    }
+
+    @Override
+    protected String getRecordName() {
+        return "FORMULA";
+    }
+
+    @Override
+    public FormulaRecord copy() {
+        return new FormulaRecord(this);
+    }
+
+    @Override
+    public HSSFRecordTypes getGenericRecordType() {
+        return HSSFRecordTypes.FORMULA;
+    }
+
+    @Override
+    public Map<String, Supplier<?>> getGenericProperties() {
+        return GenericRecordUtil.getGenericProperties(
+            "base", super::getGenericProperties,
+            "options", this::getOptions,
+            "alwaysCalc", this::isAlwaysCalc,
+            "calcOnLoad", this::isCalcOnLoad,
+            "shared", this::isSharedFormula,
+            "zero", () -> field_6_zero,
+            "value", () -> specialCachedValue == null ? field_4_value : specialCachedValue,
+            "formula", this::getFormula
+        );
+    }
 }
 

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/FtCblsSubRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/FtCblsSubRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/FtCblsSubRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/FtCblsSubRecord.java Sat May 22 20:56:44 2021
@@ -73,7 +73,7 @@ public final class FtCblsSubRecord exten
         out.write(reserved);
     }
 
-	protected int getDataSize() {
+    protected int getDataSize() {
         return reserved.length;
     }
 

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/GroupMarkerSubRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/GroupMarkerSubRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/GroupMarkerSubRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/GroupMarkerSubRecord.java Sat May 22 20:56:44 2021
@@ -65,7 +65,7 @@ public final class GroupMarkerSubRecord
         out.write(reserved);
     }
 
-	protected int getDataSize() {
+    protected int getDataSize() {
         return reserved.length;
     }
 

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/HeaderFooterBase.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/HeaderFooterBase.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/HeaderFooterBase.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/HeaderFooterBase.java Sat May 22 20:56:44 2021
@@ -28,99 +28,99 @@ import org.apache.poi.util.StringUtil;
  * Common header/footer base class
  */
 public abstract class HeaderFooterBase extends StandardRecord {
-	private boolean field_2_hasMultibyte;
-	private String field_3_text;
+    private boolean field_2_hasMultibyte;
+    private String field_3_text;
 
-	protected HeaderFooterBase(String text) {
-		setText(text);
-	}
-
-	protected HeaderFooterBase(HeaderFooterBase other) {
-		super(other);
-		field_2_hasMultibyte = other.field_2_hasMultibyte;
-		field_3_text = other.field_3_text;
-	}
-
-	protected HeaderFooterBase(RecordInputStream in) {
-		if (in.remaining() > 0) {
-			int field_1_footer_len = in.readShort();
-			//61287 -- if the footer_len == 0, there may not be a multibyte flag
-			if (field_1_footer_len == 0) {
-				field_3_text = "";
-				if (in.remaining() == 0) {
-					return;
-				}
-			}
-			field_2_hasMultibyte = in.readByte() != 0x00;
-
-			if (field_2_hasMultibyte) {
-				field_3_text = in.readUnicodeLEString(field_1_footer_len);
-			} else {
-				field_3_text = in.readCompressedUnicode(field_1_footer_len);
-			}
-		} else {
-			// Note - this is unusual for BIFF records in general, but normal for header / footer records:
-			// when the text is empty string, the whole record is empty (just the 4 byte BIFF header)
-			field_3_text = "";
-		}
-	}
-
-	/**
-	 * set the footer string
-	 *
-	 * @param text string to display
-	 */
-	public final void setText(String text) {
-		if (text == null) {
-			throw new IllegalArgumentException("text must not be null");
-		}
-		field_2_hasMultibyte = StringUtil.hasMultibyte(text);
-		field_3_text = text;
-
-		// Check it'll fit into the space in the record
-		if (getDataSize() > RecordInputStream.MAX_RECORD_DATA_SIZE) {
-			throw new IllegalArgumentException("Header/Footer string too long (limit is "
-					+ RecordInputStream.MAX_RECORD_DATA_SIZE + " bytes)");
-		}
-	}
-
-	/**
-	 * get the length of the footer string
-	 *
-	 * @return length of the footer string
-	 */
-	private int getTextLength() {
-		return field_3_text.length();
-	}
-
-	public final String getText() {
-		return field_3_text;
-	}
-
-	public final void serialize(LittleEndianOutput out) {
-		if (getTextLength() > 0) {
-			out.writeShort(getTextLength());
-			out.writeByte(field_2_hasMultibyte ? 0x01 : 0x00);
-			if (field_2_hasMultibyte) {
-				StringUtil.putUnicodeLE(field_3_text, out);
-			} else {
-				StringUtil.putCompressedUnicode(field_3_text, out);
-			}
-		}
-	}
-
-	protected final int getDataSize() {
-		if (getTextLength() < 1) {
-			return 0;
-		}
-		return 3 + getTextLength() * (field_2_hasMultibyte ? 2 : 1);
-	}
-
-	@Override
-	public abstract HeaderFooterBase copy();
-
-	@Override
-	public Map<String, Supplier<?>> getGenericProperties() {
-		return GenericRecordUtil.getGenericProperties("text", this::getText);
-	}
+    protected HeaderFooterBase(String text) {
+        setText(text);
+    }
+
+    protected HeaderFooterBase(HeaderFooterBase other) {
+        super(other);
+        field_2_hasMultibyte = other.field_2_hasMultibyte;
+        field_3_text = other.field_3_text;
+    }
+
+    protected HeaderFooterBase(RecordInputStream in) {
+        if (in.remaining() > 0) {
+            int field_1_footer_len = in.readShort();
+            //61287 -- if the footer_len == 0, there may not be a multibyte flag
+            if (field_1_footer_len == 0) {
+                field_3_text = "";
+                if (in.remaining() == 0) {
+                    return;
+                }
+            }
+            field_2_hasMultibyte = in.readByte() != 0x00;
+
+            if (field_2_hasMultibyte) {
+                field_3_text = in.readUnicodeLEString(field_1_footer_len);
+            } else {
+                field_3_text = in.readCompressedUnicode(field_1_footer_len);
+            }
+        } else {
+            // Note - this is unusual for BIFF records in general, but normal for header / footer records:
+            // when the text is empty string, the whole record is empty (just the 4 byte BIFF header)
+            field_3_text = "";
+        }
+    }
+
+    /**
+     * set the footer string
+     *
+     * @param text string to display
+     */
+    public final void setText(String text) {
+        if (text == null) {
+            throw new IllegalArgumentException("text must not be null");
+        }
+        field_2_hasMultibyte = StringUtil.hasMultibyte(text);
+        field_3_text = text;
+
+        // Check it'll fit into the space in the record
+        if (getDataSize() > RecordInputStream.MAX_RECORD_DATA_SIZE) {
+            throw new IllegalArgumentException("Header/Footer string too long (limit is "
+                    + RecordInputStream.MAX_RECORD_DATA_SIZE + " bytes)");
+        }
+    }
+
+    /**
+     * get the length of the footer string
+     *
+     * @return length of the footer string
+     */
+    private int getTextLength() {
+        return field_3_text.length();
+    }
+
+    public final String getText() {
+        return field_3_text;
+    }
+
+    public final void serialize(LittleEndianOutput out) {
+        if (getTextLength() > 0) {
+            out.writeShort(getTextLength());
+            out.writeByte(field_2_hasMultibyte ? 0x01 : 0x00);
+            if (field_2_hasMultibyte) {
+                StringUtil.putUnicodeLE(field_3_text, out);
+            } else {
+                StringUtil.putCompressedUnicode(field_3_text, out);
+            }
+        }
+    }
+
+    protected final int getDataSize() {
+        if (getTextLength() < 1) {
+            return 0;
+        }
+        return 3 + getTextLength() * (field_2_hasMultibyte ? 2 : 1);
+    }
+
+    @Override
+    public abstract HeaderFooterBase copy();
+
+    @Override
+    public Map<String, Supplier<?>> getGenericProperties() {
+        return GenericRecordUtil.getGenericProperties("text", this::getText);
+    }
 }

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/HeaderFooterRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/HeaderFooterRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/HeaderFooterRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/HeaderFooterRecord.java Sat May 22 20:56:44 2021
@@ -32,7 +32,7 @@ public final class HeaderFooterRecord ex
     @SuppressWarnings("MismatchedReadAndWriteOfArray")
     private static final byte[] BLANK_GUID = new byte[16];
 
-	private byte[] _rawData;
+    private byte[] _rawData;
 
     public HeaderFooterRecord(byte[] data) {
         _rawData = data;
@@ -43,25 +43,25 @@ public final class HeaderFooterRecord ex
         _rawData = (other._rawData == null) ? null : other._rawData.clone();
     }
 
-	/**
-	 * construct a HeaderFooterRecord record.  No fields are interpreted and the record will
-	 * be serialized in its original form more or less
-	 * @param in the RecordInputstream to read the record from
-	 */
-	public HeaderFooterRecord(RecordInputStream in) {
-		_rawData = in.readRemainder();
-	}
-
-	/**
-	 * spit the record out AS IS. no interpretation or identification
-	 */
-	public void serialize(LittleEndianOutput out) {
-		out.write(_rawData);
-	}
-
-	protected int getDataSize() {
-		return _rawData.length;
-	}
+    /**
+     * construct a HeaderFooterRecord record.  No fields are interpreted and the record will
+     * be serialized in its original form more or less
+     * @param in the RecordInputstream to read the record from
+     */
+    public HeaderFooterRecord(RecordInputStream in) {
+        _rawData = in.readRemainder();
+    }
+
+    /**
+     * spit the record out AS IS. no interpretation or identification
+     */
+    public void serialize(LittleEndianOutput out) {
+        out.write(_rawData);
+    }
+
+    protected int getDataSize() {
+        return _rawData.length;
+    }
 
     public short getSid()
     {

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/HeaderRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/HeaderRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/HeaderRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/HeaderRecord.java Sat May 22 20:56:44 2021
@@ -21,31 +21,31 @@ package org.apache.poi.hssf.record;
  * Specifies a header for a sheet
  */
 public final class HeaderRecord extends HeaderFooterBase {
-	public static final short sid = 0x0014;
+    public static final short sid = 0x0014;
 
-	public HeaderRecord(String text) {
-		super(text);
-	}
-
-	public HeaderRecord(HeaderRecord other) {
-		super(other);
-	}
-
-	public HeaderRecord(RecordInputStream in) {
-		super(in);
-	}
-
-	public short getSid() {
-		return sid;
-	}
-
-	@Override
-	public HeaderRecord copy() {
-		return new HeaderRecord(this);
-	}
-
-	@Override
-	public HSSFRecordTypes getGenericRecordType() {
-		return HSSFRecordTypes.HEADER;
-	}
+    public HeaderRecord(String text) {
+        super(text);
+    }
+
+    public HeaderRecord(HeaderRecord other) {
+        super(other);
+    }
+
+    public HeaderRecord(RecordInputStream in) {
+        super(in);
+    }
+
+    public short getSid() {
+        return sid;
+    }
+
+    @Override
+    public HeaderRecord copy() {
+        return new HeaderRecord(this);
+    }
+
+    @Override
+    public HSSFRecordTypes getGenericRecordType() {
+        return HSSFRecordTypes.HEADER;
+    }
 }

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/HorizontalPageBreakRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/HorizontalPageBreakRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/HorizontalPageBreakRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/HorizontalPageBreakRecord.java Sat May 22 20:56:44 2021
@@ -24,35 +24,35 @@ package org.apache.poi.hssf.record;
  */
 public final class HorizontalPageBreakRecord extends PageBreakRecord {
 
-	public static final short sid = 0x001B;
+    public static final short sid = 0x001B;
 
-	/**
-	 * Creates an empty horizontal page break record
-	 */
-	public HorizontalPageBreakRecord() {}
-
-	public HorizontalPageBreakRecord(HorizontalPageBreakRecord other) {
-		super(other);
-	}
-
-	/**
-	 * @param in the RecordInputstream to read the record from
-	 */
-	public HorizontalPageBreakRecord(RecordInputStream in) {
-		super(in);
-	}
-
-	public short getSid() {
-		return sid;
-	}
-
-	@Override
-	public HorizontalPageBreakRecord copy() {
-		return new HorizontalPageBreakRecord(this);
-	}
-
-	@Override
-	public HSSFRecordTypes getGenericRecordType() {
-		return HSSFRecordTypes.HORIZONTAL_PAGE_BREAK;
-	}
+    /**
+     * Creates an empty horizontal page break record
+     */
+    public HorizontalPageBreakRecord() {}
+
+    public HorizontalPageBreakRecord(HorizontalPageBreakRecord other) {
+        super(other);
+    }
+
+    /**
+     * @param in the RecordInputstream to read the record from
+     */
+    public HorizontalPageBreakRecord(RecordInputStream in) {
+        super(in);
+    }
+
+    public short getSid() {
+        return sid;
+    }
+
+    @Override
+    public HorizontalPageBreakRecord copy() {
+        return new HorizontalPageBreakRecord(this);
+    }
+
+    @Override
+    public HSSFRecordTypes getGenericRecordType() {
+        return HSSFRecordTypes.HORIZONTAL_PAGE_BREAK;
+    }
 }

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/IndexRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/IndexRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/IndexRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/IndexRecord.java Sat May 22 20:56:44 2021
@@ -48,7 +48,7 @@ public final class IndexRecord extends S
     public IndexRecord(RecordInputStream in) {
         int field_1_zero          = in.readInt();
         if (field_1_zero != 0) {
-        	throw new RecordFormatException("Expected zero for field 1 but got " + field_1_zero);
+            throw new RecordFormatException("Expected zero for field 1 but got " + field_1_zero);
         }
         field_2_first_row     = in.readInt();
         field_3_last_row_add1 = in.readInt();
@@ -117,14 +117,14 @@ public final class IndexRecord extends S
         out.writeInt(getLastRowAdd1());
         out.writeInt(field_4_zero);
         for (int k = 0; k < getNumDbcells(); k++) {
-        	out.writeInt(getDbcellAt(k));
+            out.writeInt(getDbcellAt(k));
         }
     }
 
     @Override
     protected int getDataSize() {
         return 16 // 4 ints
-        	+ getNumDbcells() * 4;
+            + getNumDbcells() * 4;
     }
 
     /**

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/LabelRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/LabelRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/LabelRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/LabelRecord.java Sat May 22 20:56:44 2021
@@ -152,8 +152,8 @@ public final class LabelRecord extends R
     }
 
     /**
-	 * NO-OP!
-	 */
+     * NO-OP!
+     */
     @Override
     public void setColumn(short col)
     {

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/LabelSSTRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/LabelSSTRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/LabelSSTRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/LabelSSTRecord.java Sat May 22 20:56:44 2021
@@ -65,7 +65,7 @@ public final class LabelSSTRecord extend
 
     @Override
     protected String getRecordName() {
-    	return "LABELSST";
+        return "LABELSST";
     }
 
     @Override

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/Margin.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/Margin.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/Margin.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/Margin.java Sat May 22 20:56:44 2021
@@ -22,18 +22,18 @@ package org.apache.poi.hssf.record;
  * This allows much of the code to be generic when it comes to handling margins.
  */
 public interface Margin {
-	// TODO - introduce MarginBaseRecord
-	/**
-	 * Get the margin field for the Margin.
-	 *
-	 * @return the margin
-	 */
-	double getMargin();
+    // TODO - introduce MarginBaseRecord
+    /**
+     * Get the margin field for the Margin.
+     *
+     * @return the margin
+     */
+    double getMargin();
 
-	/**
-	 * Set the margin field for the Margin.
-	 *
-	 * @param field_1_margin the margin
-	 */
-	void setMargin(double field_1_margin);
+    /**
+     * Set the margin field for the Margin.
+     *
+     * @param field_1_margin the margin
+     */
+    void setMargin(double field_1_margin);
 }

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/MergeCellsRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/MergeCellsRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/MergeCellsRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/MergeCellsRecord.java Sat May 22 20:56:44 2021
@@ -48,23 +48,23 @@ public final class MergeCellsRecord exte
 
 
     public MergeCellsRecord(CellRangeAddress[] regions, int startIndex, int numberOfRegions) {
-		_regions = regions;
-		_startIndex = startIndex;
-		_numberOfRegions = numberOfRegions;
+        _regions = regions;
+        _startIndex = startIndex;
+        _numberOfRegions = numberOfRegions;
     }
     /**
      * Constructs a MergedCellsRecord and sets its fields appropriately
      * @param in the RecordInputstream to read the record from
      */
     public MergeCellsRecord(RecordInputStream in) {
-     	int nRegions = in.readUShort();
-    	CellRangeAddress[] cras = new CellRangeAddress[nRegions];
-    	for (int i = 0; i < nRegions; i++) {
-			cras[i] = new CellRangeAddress(in);
-		}
-    	_numberOfRegions = nRegions;
-    	_startIndex = 0;
-    	_regions = cras;
+        int nRegions = in.readUShort();
+        CellRangeAddress[] cras = new CellRangeAddress[nRegions];
+        for (int i = 0; i < nRegions; i++) {
+            cras[i] = new CellRangeAddress(in);
+        }
+        _numberOfRegions = nRegions;
+        _startIndex = 0;
+        _regions = cras;
     }
     /**
      * get the number of merged areas.  If this drops down to 0 you should just go
@@ -86,8 +86,8 @@ public final class MergeCellsRecord exte
 
     @Override
     protected int getDataSize() {
-		return CellRangeAddressList.getEncodedSize(_numberOfRegions);
-	}
+        return CellRangeAddressList.getEncodedSize(_numberOfRegions);
+    }
 
     @Override
     public short getSid() {
@@ -98,8 +98,8 @@ public final class MergeCellsRecord exte
     public void serialize(LittleEndianOutput out) {
         out.writeShort(_numberOfRegions);
         for (int i = 0; i < _numberOfRegions; i++) {
-			_regions[_startIndex + i].serialize(out);
-		}
+            _regions[_startIndex + i].serialize(out);
+        }
     }
 
     @Override

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/MulBlankRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/MulBlankRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/MulBlankRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/MulBlankRecord.java Sat May 22 20:56:44 2021
@@ -29,113 +29,113 @@ import org.apache.poi.util.LittleEndianO
  * @see BlankRecord
  */
 public final class MulBlankRecord extends StandardRecord {
-	public static final short sid = 0x00BE;
+    public static final short sid = 0x00BE;
 
-	private final int _row;
-	private final int _firstCol;
-	private final short[] _xfs;
-	private final int _lastCol;
-
-	public MulBlankRecord(int row, int firstCol, short[] xfs) {
-		_row = row;
-		_firstCol = firstCol;
-		_xfs = xfs;
-		_lastCol = firstCol + xfs.length - 1;
-	}
-
-	/**
-	 * @return the row number of the cells this represents
-	 */
-	public int getRow() {
-		return _row;
-	}
-
-	/**
-	 * @return starting column (first cell this holds in the row). Zero based
-	 */
-	public int getFirstColumn() {
-		return _firstCol;
-	}
-
-	/**
-	 * @return ending column (last cell this holds in the row). Zero based
-	 */
-	public int getLastColumn() {
-		return _lastCol;
-	}
-
-	/**
-	 * get the number of columns this contains (last-first +1)
-	 * @return number of columns (last - first +1)
-	 */
-	public int getNumColumns() {
-		return _lastCol - _firstCol + 1;
-	}
-
-	/**
-	 * returns the xf index for column (coffset = column - field_2_first_col)
-	 * @param coffset  the column (coffset = column - field_2_first_col)
-	 * @return the XF index for the column
-	 */
-	public short getXFAt(int coffset) {
-		return _xfs[coffset];
-	}
-
-	/**
-	 * @param in the RecordInputstream to read the record from
-	 */
-	public MulBlankRecord(RecordInputStream in) {
-		_row	   = in.readUShort();
-		_firstCol = in.readShort();
-		_xfs	   = parseXFs(in);
-		_lastCol  = in.readShort();
-	}
-
-	private static short [] parseXFs(RecordInputStream in) {
-		short[] retval = new short[(in.remaining() - 2) / 2];
-
-		for (int idx = 0; idx < retval.length;idx++) {
-		  retval[idx] = in.readShort();
-		}
-		return retval;
-	}
-
-	public short getSid() {
-		return sid;
-	}
-
-	public void serialize(LittleEndianOutput out) {
-		out.writeShort(_row);
-		out.writeShort(_firstCol);
-		for (short xf : _xfs) {
-			out.writeShort(xf);
-		}
-		out.writeShort(_lastCol);
-	}
-
-	protected int getDataSize() {
-		// 3 short fields + array of shorts
-		return 6 + _xfs.length * 2;
-	}
-
-	@Override
-	public MulBlankRecord copy() {
-		// immutable - so OK to return this
-		return this;
-	}
-
-	@Override
-	public HSSFRecordTypes getGenericRecordType() {
-		return HSSFRecordTypes.MUL_BLANK;
-	}
-
-	@Override
-	public Map<String, Supplier<?>> getGenericProperties() {
-		return GenericRecordUtil.getGenericProperties(
-			"row", this::getRow,
-			"firstColumn", this::getFirstColumn,
-			"lastColumn", this::getLastColumn,
-			"xf", () -> _xfs
-		);
-	}
+    private final int _row;
+    private final int _firstCol;
+    private final short[] _xfs;
+    private final int _lastCol;
+
+    public MulBlankRecord(int row, int firstCol, short[] xfs) {
+        _row = row;
+        _firstCol = firstCol;
+        _xfs = xfs;
+        _lastCol = firstCol + xfs.length - 1;
+    }
+
+    /**
+     * @return the row number of the cells this represents
+     */
+    public int getRow() {
+        return _row;
+    }
+
+    /**
+     * @return starting column (first cell this holds in the row). Zero based
+     */
+    public int getFirstColumn() {
+        return _firstCol;
+    }
+
+    /**
+     * @return ending column (last cell this holds in the row). Zero based
+     */
+    public int getLastColumn() {
+        return _lastCol;
+    }
+
+    /**
+     * get the number of columns this contains (last-first +1)
+     * @return number of columns (last - first +1)
+     */
+    public int getNumColumns() {
+        return _lastCol - _firstCol + 1;
+    }
+
+    /**
+     * returns the xf index for column (coffset = column - field_2_first_col)
+     * @param coffset  the column (coffset = column - field_2_first_col)
+     * @return the XF index for the column
+     */
+    public short getXFAt(int coffset) {
+        return _xfs[coffset];
+    }
+
+    /**
+     * @param in the RecordInputstream to read the record from
+     */
+    public MulBlankRecord(RecordInputStream in) {
+        _row       = in.readUShort();
+        _firstCol = in.readShort();
+        _xfs       = parseXFs(in);
+        _lastCol  = in.readShort();
+    }
+
+    private static short [] parseXFs(RecordInputStream in) {
+        short[] retval = new short[(in.remaining() - 2) / 2];
+
+        for (int idx = 0; idx < retval.length;idx++) {
+          retval[idx] = in.readShort();
+        }
+        return retval;
+    }
+
+    public short getSid() {
+        return sid;
+    }
+
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(_row);
+        out.writeShort(_firstCol);
+        for (short xf : _xfs) {
+            out.writeShort(xf);
+        }
+        out.writeShort(_lastCol);
+    }
+
+    protected int getDataSize() {
+        // 3 short fields + array of shorts
+        return 6 + _xfs.length * 2;
+    }
+
+    @Override
+    public MulBlankRecord copy() {
+        // immutable - so OK to return this
+        return this;
+    }
+
+    @Override
+    public HSSFRecordTypes getGenericRecordType() {
+        return HSSFRecordTypes.MUL_BLANK;
+    }
+
+    @Override
+    public Map<String, Supplier<?>> getGenericProperties() {
+        return GenericRecordUtil.getGenericProperties(
+            "row", this::getRow,
+            "firstColumn", this::getFirstColumn,
+            "lastColumn", this::getLastColumn,
+            "xf", () -> _xfs
+        );
+    }
 }

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/MulRKRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/MulRKRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/MulRKRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/MulRKRecord.java Sat May 22 20:56:44 2021
@@ -33,134 +33,134 @@ import org.apache.poi.util.RecordFormatE
  * @since 2.0-pre
  */
 public final class MulRKRecord extends StandardRecord {
-	public static final short sid = 0x00BD;
+    public static final short sid = 0x00BD;
 
-	private final int	  field_1_row;
-	private final short   field_2_first_col;
-	private final RkRec[] field_3_rks;
-	private final short   field_4_last_col;
-
-	public int getRow() {
-		return field_1_row;
-	}
-
-	/**
-	 * starting column (first cell this holds in the row)
-	 * @return first column number
-	 */
-	public short getFirstColumn() {
-		return field_2_first_col;
-	}
-
-	/**
-	 * ending column (last cell this holds in the row)
-	 * @return first column number
-	 */
-	public short getLastColumn() {
-		return field_4_last_col;
-	}
-
-	/**
-	 * get the number of columns this contains (last-first +1)
-	 * @return number of columns (last - first +1)
-	 */
-	public int getNumColumns() {
-		return field_4_last_col - field_2_first_col + 1;
-	}
-
-	/**
-	 * returns the xf index for column (coffset = column - field_2_first_col)
-	 *
+    private final int     field_1_row;
+    private final short   field_2_first_col;
+    private final RkRec[] field_3_rks;
+    private final short   field_4_last_col;
+
+    public int getRow() {
+        return field_1_row;
+    }
+
+    /**
+     * starting column (first cell this holds in the row)
+     * @return first column number
+     */
+    public short getFirstColumn() {
+        return field_2_first_col;
+    }
+
+    /**
+     * ending column (last cell this holds in the row)
+     * @return first column number
+     */
+    public short getLastColumn() {
+        return field_4_last_col;
+    }
+
+    /**
+     * get the number of columns this contains (last-first +1)
+     * @return number of columns (last - first +1)
+     */
+    public int getNumColumns() {
+        return field_4_last_col - field_2_first_col + 1;
+    }
+
+    /**
+     * returns the xf index for column (coffset = column - field_2_first_col)
+     *
+     * @param coffset the coffset = column - field_2_first_col
+     *
+     * @return the XF index for the column
+     */
+    public short getXFAt(int coffset) {
+        return field_3_rks[coffset].xf;
+    }
+
+    /**
+     * returns the rk number for column (coffset = column - field_2_first_col)
+     *
      * @param coffset the coffset = column - field_2_first_col
      *
-	 * @return the XF index for the column
-	 */
-	public short getXFAt(int coffset) {
-		return field_3_rks[coffset].xf;
-	}
-
-	/**
-	 * returns the rk number for column (coffset = column - field_2_first_col)
-	 *
-	 * @param coffset the coffset = column - field_2_first_col
-	 *
-	 * @return the value (decoded into a double)
-	 */
-	public double getRKNumberAt(int coffset) {
-		return RKUtil.decodeNumber(field_3_rks[coffset].rk);
-	}
-
-	/**
-	 * @param in the RecordInputstream to read the record from
-	 */
-	public MulRKRecord(RecordInputStream in) {
-		field_1_row = in.readUShort();
-		field_2_first_col = in.readShort();
-		field_3_rks = RkRec.parseRKs(in);
-		field_4_last_col = in.readShort();
-	}
+     * @return the value (decoded into a double)
+     */
+    public double getRKNumberAt(int coffset) {
+        return RKUtil.decodeNumber(field_3_rks[coffset].rk);
+    }
+
+    /**
+     * @param in the RecordInputstream to read the record from
+     */
+    public MulRKRecord(RecordInputStream in) {
+        field_1_row = in.readUShort();
+        field_2_first_col = in.readShort();
+        field_3_rks = RkRec.parseRKs(in);
+        field_4_last_col = in.readShort();
+    }
 
-	@Override
+    @Override
     public short getSid()
-	{
-		return sid;
-	}
+    {
+        return sid;
+    }
 
-	@Override
+    @Override
     public void serialize(LittleEndianOutput out) {
-		throw new RecordFormatException( "Sorry, you can't serialize MulRK in this release");
-	}
-	@Override
+        throw new RecordFormatException( "Sorry, you can't serialize MulRK in this release");
+    }
+    @Override
     protected int getDataSize() {
-		throw new RecordFormatException( "Sorry, you can't serialize MulRK in this release");
-	}
+        throw new RecordFormatException( "Sorry, you can't serialize MulRK in this release");
+    }
 
-	private static final class RkRec implements GenericRecord {
-		public static final int ENCODED_SIZE = 6;
-		public final short xf;
-		public final int   rk;
-
-		private RkRec(RecordInputStream in) {
-			xf = in.readShort();
-			rk = in.readInt();
-		}
-
-		public static RkRec[] parseRKs(RecordInputStream in) {
-			int nItems = (in.remaining()-2) / ENCODED_SIZE;
-			RkRec[] retval = new RkRec[nItems];
-			for (int i=0; i<nItems; i++) {
-				retval[i] = new RkRec(in);
-			}
-			return retval;
-		}
-
-		@Override
-		public Map<String, Supplier<?>> getGenericProperties() {
-			return GenericRecordUtil.getGenericProperties(
-				"xf", () -> xf,
-				"rk", () -> rk
-			);
-		}
-	}
-
-	@Override
-	public MulRKRecord copy() {
-		// immutable - so OK to return this
-		return this;
-	}
-
-	@Override
-	public HSSFRecordTypes getGenericRecordType() {
-		return HSSFRecordTypes.MUL_RK;
-	}
-
-	@Override
-	public Map<String, Supplier<?>> getGenericProperties() {
-		return GenericRecordUtil.getGenericProperties(
-			"row", this::getRow,
-			"firstColumn", this::getFirstColumn,
-			"lastColumn", this::getLastColumn,
-			"rk", () -> field_3_rks
-		);
-	}
+    private static final class RkRec implements GenericRecord {
+        public static final int ENCODED_SIZE = 6;
+        public final short xf;
+        public final int   rk;
+
+        private RkRec(RecordInputStream in) {
+            xf = in.readShort();
+            rk = in.readInt();
+        }
+
+        public static RkRec[] parseRKs(RecordInputStream in) {
+            int nItems = (in.remaining()-2) / ENCODED_SIZE;
+            RkRec[] retval = new RkRec[nItems];
+            for (int i=0; i<nItems; i++) {
+                retval[i] = new RkRec(in);
+            }
+            return retval;
+        }
+
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties(
+                "xf", () -> xf,
+                "rk", () -> rk
+            );
+        }
+    }
+
+    @Override
+    public MulRKRecord copy() {
+        // immutable - so OK to return this
+        return this;
+    }
+
+    @Override
+    public HSSFRecordTypes getGenericRecordType() {
+        return HSSFRecordTypes.MUL_RK;
+    }
+
+    @Override
+    public Map<String, Supplier<?>> getGenericProperties() {
+        return GenericRecordUtil.getGenericProperties(
+            "row", this::getRow,
+            "firstColumn", this::getFirstColumn,
+            "lastColumn", this::getLastColumn,
+            "rk", () -> field_3_rks
+        );
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org