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 [4/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/BoolErrRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/BoolErrRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/BoolErrRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/BoolErrRecord.java Sat May 22 20:56:44 2021
@@ -29,173 +29,173 @@ import org.apache.poi.util.RecordFormatE
  * Creates new BoolErrRecord. (0x0205)
  */
 public final class BoolErrRecord extends CellRecord {
-	public static final short sid = 0x0205;
-	private int _value;
-	/**
-	 * If <code>true</code>, this record represents an error cell value,
-	 * otherwise this record represents a boolean cell value
-	 */
-	private boolean _isError;
-
-	/** Creates new BoolErrRecord */
-	public BoolErrRecord() {}
-
-	public BoolErrRecord(BoolErrRecord other) {
-		super(other);
-		_value = other._value;
-		_isError = other._isError;
-	}
-
-	/**
-	 * @param in the RecordInputstream to read the record from
-	 */
-	public BoolErrRecord(RecordInputStream in) {
-		super(in);
-		switch (in.remaining()) {
-			case 2:
-				_value = in.readByte();
-				break;
-			case 3:
-				_value = in.readUShort();
-				break;
-			default:
-				throw new RecordFormatException("Unexpected size ("
-						+ in.remaining() + ") for BOOLERR record.");
-		}
-		int flag = in.readUByte();
-		switch (flag) {
-			case 0:
-				_isError = false;
-				break;
-			case 1:
-				_isError = true;
-				break;
-			default:
-				throw new RecordFormatException("Unexpected isError flag ("
-						+ flag + ") for BOOLERR record.");
-		}
-	}
-
-	/**
-	 * set the boolean value for the cell
-	 *
-	 * @param value   representing the boolean value
-	 */
-	public void setValue(boolean value) {
-		_value = value ? 1 : 0;
-		_isError = false;
-	}
-
-	/**
-	 * set the error value for the cell. See {@link FormulaError} for valid codes.
-	 *
-	 * @param value     error representing the error value
-	 *                  this value can only be 0,7,15,23,29,36 or 42
-	 *                  see bugzilla bug 16560 for an explanation
-	 */
-	public void setValue(byte value) {
-		setValue(FormulaError.forInt(value));
-	}
-
-	/**
-	 * set the error value for the cell
-	 *
-	 * @param value     error representing the error value
-	 *                  this value can only be 0,7,15,23,29,36 or 42
-	 *                  see bugzilla bug 16560 for an explanation
-	 */
-	public void setValue(FormulaError value) {
-		switch(value) {
-			case NULL:
-			case DIV0:
-			case VALUE:
-			case REF:
-			case NAME:
-			case NUM:
-			case NA:
-				_value = value.getCode();
-				_isError = true;
-				return;
-			default:
-		        throw new IllegalArgumentException("Error Value can only be 0,7,15,23,29,36 or 42. It cannot be "+value.getCode()+" ("+value+")");
-		}
-	}
-
-	/**
-	 * get the value for the cell
-	 *
-	 * @return boolean representing the boolean value
-	 */
-	public boolean getBooleanValue() {
-		return _value != 0;
-	}
-
-	/**
-	 * get the error value for the cell
-	 *
-	 * @return byte representing the error value
-	 */
-	public byte getErrorValue() {
-		return (byte)_value;
-	}
-
-	/**
-	 * Indicates whether the call holds a boolean value
-	 *
-	 * @return boolean true if the cell holds a boolean value
-	 */
-	public boolean isBoolean() {
-		return !_isError;
-	}
-
-	/**
-	 * Indicates whether the call holds an error value
-	 *
-	 * @return boolean true if the cell holds an error value
-	 */
-	public boolean isError() {
-		return _isError;
-	}
-
-	@Override
-	protected String getRecordName() {
-		return "BOOLERR";
-	}
-
-	@Override
-	protected void serializeValue(LittleEndianOutput out) {
-		out.writeByte(_value);
-		out.writeByte(_isError ? 1 : 0);
-	}
-
-	@Override
-	protected int getValueDataSize() {
-		return 2;
-	}
-
-	public short getSid() {
-		return sid;
-	}
-
-	@Override
-	public BoolErrRecord copy() {
-		return new BoolErrRecord(this);
-	}
-
-	@Override
-	public HSSFRecordTypes getGenericRecordType() {
-		return HSSFRecordTypes.BOOL_ERR;
-	}
-
-	@Override
-	public Map<String, Supplier<?>> getGenericProperties() {
-		return GenericRecordUtil.getGenericProperties(
-			"base", super::getGenericProperties,
-			"isBoolean", this::isBoolean,
-			"booleanVal", this::getBooleanValue,
-			"isError", this::isError,
-			"errorVal", this::getErrorValue,
-			"errorTxt", () -> isError() ? FormulaError.forInt(getErrorValue()).getString() : null
-		);
-	}
+    public static final short sid = 0x0205;
+    private int _value;
+    /**
+     * If <code>true</code>, this record represents an error cell value,
+     * otherwise this record represents a boolean cell value
+     */
+    private boolean _isError;
+
+    /** Creates new BoolErrRecord */
+    public BoolErrRecord() {}
+
+    public BoolErrRecord(BoolErrRecord other) {
+        super(other);
+        _value = other._value;
+        _isError = other._isError;
+    }
+
+    /**
+     * @param in the RecordInputstream to read the record from
+     */
+    public BoolErrRecord(RecordInputStream in) {
+        super(in);
+        switch (in.remaining()) {
+            case 2:
+                _value = in.readByte();
+                break;
+            case 3:
+                _value = in.readUShort();
+                break;
+            default:
+                throw new RecordFormatException("Unexpected size ("
+                        + in.remaining() + ") for BOOLERR record.");
+        }
+        int flag = in.readUByte();
+        switch (flag) {
+            case 0:
+                _isError = false;
+                break;
+            case 1:
+                _isError = true;
+                break;
+            default:
+                throw new RecordFormatException("Unexpected isError flag ("
+                        + flag + ") for BOOLERR record.");
+        }
+    }
+
+    /**
+     * set the boolean value for the cell
+     *
+     * @param value   representing the boolean value
+     */
+    public void setValue(boolean value) {
+        _value = value ? 1 : 0;
+        _isError = false;
+    }
+
+    /**
+     * set the error value for the cell. See {@link FormulaError} for valid codes.
+     *
+     * @param value     error representing the error value
+     *                  this value can only be 0,7,15,23,29,36 or 42
+     *                  see bugzilla bug 16560 for an explanation
+     */
+    public void setValue(byte value) {
+        setValue(FormulaError.forInt(value));
+    }
+
+    /**
+     * set the error value for the cell
+     *
+     * @param value     error representing the error value
+     *                  this value can only be 0,7,15,23,29,36 or 42
+     *                  see bugzilla bug 16560 for an explanation
+     */
+    public void setValue(FormulaError value) {
+        switch(value) {
+            case NULL:
+            case DIV0:
+            case VALUE:
+            case REF:
+            case NAME:
+            case NUM:
+            case NA:
+                _value = value.getCode();
+                _isError = true;
+                return;
+            default:
+                throw new IllegalArgumentException("Error Value can only be 0,7,15,23,29,36 or 42. It cannot be "+value.getCode()+" ("+value+")");
+        }
+    }
+
+    /**
+     * get the value for the cell
+     *
+     * @return boolean representing the boolean value
+     */
+    public boolean getBooleanValue() {
+        return _value != 0;
+    }
+
+    /**
+     * get the error value for the cell
+     *
+     * @return byte representing the error value
+     */
+    public byte getErrorValue() {
+        return (byte)_value;
+    }
+
+    /**
+     * Indicates whether the call holds a boolean value
+     *
+     * @return boolean true if the cell holds a boolean value
+     */
+    public boolean isBoolean() {
+        return !_isError;
+    }
+
+    /**
+     * Indicates whether the call holds an error value
+     *
+     * @return boolean true if the cell holds an error value
+     */
+    public boolean isError() {
+        return _isError;
+    }
+
+    @Override
+    protected String getRecordName() {
+        return "BOOLERR";
+    }
+
+    @Override
+    protected void serializeValue(LittleEndianOutput out) {
+        out.writeByte(_value);
+        out.writeByte(_isError ? 1 : 0);
+    }
+
+    @Override
+    protected int getValueDataSize() {
+        return 2;
+    }
+
+    public short getSid() {
+        return sid;
+    }
+
+    @Override
+    public BoolErrRecord copy() {
+        return new BoolErrRecord(this);
+    }
+
+    @Override
+    public HSSFRecordTypes getGenericRecordType() {
+        return HSSFRecordTypes.BOOL_ERR;
+    }
+
+    @Override
+    public Map<String, Supplier<?>> getGenericProperties() {
+        return GenericRecordUtil.getGenericProperties(
+            "base", super::getGenericProperties,
+            "isBoolean", this::isBoolean,
+            "booleanVal", this::getBooleanValue,
+            "isError", this::isError,
+            "errorVal", this::getErrorValue,
+            "errorTxt", () -> isError() ? FormulaError.forInt(getErrorValue()).getString() : null
+        );
+    }
 }

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/BoundSheetRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/BoundSheetRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/BoundSheetRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/BoundSheetRecord.java Sat May 22 20:56:44 2021
@@ -36,194 +36,194 @@ import org.apache.poi.util.StringUtil;
  * tells where the Beginning of file record is within the HSSF file.
  */
 public final class BoundSheetRecord extends StandardRecord {
-	public static final short sid = 0x0085;
-	private static final BitField hiddenFlag = BitFieldFactory.getInstance(0x01);
-	private static final BitField veryHiddenFlag = BitFieldFactory.getInstance(0x02);
-
-	private int field_1_position_of_BOF;
-	private int field_2_option_flags;
-	private int field_4_isMultibyteUnicode;
-	private String field_5_sheetname;
-
-	public BoundSheetRecord(String sheetname) {
-		field_2_option_flags = 0;
-		setSheetname(sheetname);
-	}
-
-	public BoundSheetRecord(BoundSheetRecord other) {
-		super(other);
-		field_1_position_of_BOF = other.field_1_position_of_BOF;
-		field_2_option_flags = other.field_2_option_flags;
-		field_4_isMultibyteUnicode = other.field_4_isMultibyteUnicode;
-		field_5_sheetname = other.field_5_sheetname;
-	}
-
-	/**
-	 * UTF8: sid + len + bof + flags + len(str) + unicode + str 2 + 2 + 4 + 2 +
-	 * 1 + 1 + len(str)
-	 *
-	 * UNICODE: sid + len + bof + flags + len(str) + unicode + str 2 + 2 + 4 + 2 +
-	 * 1 + 1 + 2 * len(str)
-	 *
-	 * @param in the record stream to read from
-	 */
-	public BoundSheetRecord(RecordInputStream in) {
+    public static final short sid = 0x0085;
+    private static final BitField hiddenFlag = BitFieldFactory.getInstance(0x01);
+    private static final BitField veryHiddenFlag = BitFieldFactory.getInstance(0x02);
+
+    private int field_1_position_of_BOF;
+    private int field_2_option_flags;
+    private int field_4_isMultibyteUnicode;
+    private String field_5_sheetname;
+
+    public BoundSheetRecord(String sheetname) {
+        field_2_option_flags = 0;
+        setSheetname(sheetname);
+    }
+
+    public BoundSheetRecord(BoundSheetRecord other) {
+        super(other);
+        field_1_position_of_BOF = other.field_1_position_of_BOF;
+        field_2_option_flags = other.field_2_option_flags;
+        field_4_isMultibyteUnicode = other.field_4_isMultibyteUnicode;
+        field_5_sheetname = other.field_5_sheetname;
+    }
+
+    /**
+     * UTF8: sid + len + bof + flags + len(str) + unicode + str 2 + 2 + 4 + 2 +
+     * 1 + 1 + len(str)
+     *
+     * UNICODE: sid + len + bof + flags + len(str) + unicode + str 2 + 2 + 4 + 2 +
+     * 1 + 1 + 2 * len(str)
+     *
+     * @param in the record stream to read from
+     */
+    public BoundSheetRecord(RecordInputStream in) {
         byte[] buf = new byte[LittleEndianConsts.INT_SIZE];
-	    in.readPlain(buf, 0, buf.length);
-		field_1_position_of_BOF = LittleEndian.getInt(buf);
-		field_2_option_flags = in.readUShort();
-		int field_3_sheetname_length = in.readUByte();
-		field_4_isMultibyteUnicode = in.readByte();
-
-		if (isMultibyte()) {
-			field_5_sheetname = in.readUnicodeLEString(field_3_sheetname_length);
-		} else {
-			field_5_sheetname = in.readCompressedUnicode(field_3_sheetname_length);
-		}
-	}
-
-	/**
-	 * set the offset in bytes of the Beginning of File Marker within the HSSF
-	 * Stream part of the POIFS file
-	 *
-	 * @param pos offset in bytes
-	 */
-	public void setPositionOfBof(int pos) {
-		field_1_position_of_BOF = pos;
-	}
-
-	/**
-	 * Set the sheetname for this sheet.  (this appears in the tabs at the bottom)
-	 * @param sheetName the name of the sheet
-	 * @see org.apache.poi.ss.util.WorkbookUtil#createSafeSheetName(String nameProposal)
-	 *      for a safe way to create valid names
-	 * @throws IllegalArgumentException if sheet name will cause excel to crash.
-	 */
-	public void setSheetname(String sheetName) {
-
-		WorkbookUtil.validateSheetName(sheetName);
-		field_5_sheetname = sheetName;
-		field_4_isMultibyteUnicode = StringUtil.hasMultibyte(sheetName) ?  1 : 0;
-	}
-
-	/**
-	 * get the offset in bytes of the Beginning of File Marker within the HSSF Stream part of the POIFS file
-	 *
-	 * @return offset in bytes
-	 */
-	public int getPositionOfBof() {
-		return field_1_position_of_BOF;
-	}
-
-	private boolean isMultibyte() {
-		return (field_4_isMultibyteUnicode & 0x01) != 0;
-	}
-
-	/**
-	 * get the sheetname for this sheet.  (this appears in the tabs at the bottom)
-	 * @return sheetname the name of the sheet
-	 */
-	public String getSheetname() {
-		return field_5_sheetname;
-	}
-
-	protected int getDataSize() {
-		return 8 + field_5_sheetname.length() * (isMultibyte() ? 2 : 1);
-	}
-
-	public void serialize(LittleEndianOutput out) {
-		out.writeInt(getPositionOfBof());
-		out.writeShort(field_2_option_flags);
-
-		String name = field_5_sheetname;
-		out.writeByte(name.length());
-		out.writeByte(field_4_isMultibyteUnicode);
-
-		if (isMultibyte()) {
-			StringUtil.putUnicodeLE(name, out);
-		} else {
-			StringUtil.putCompressedUnicode(name, out);
-		}
-	}
-
-	public short getSid() {
-		return sid;
-	}
-
-	/**
-	 * Is the sheet hidden? Different from very hidden
-	 *
-	 * @return {@code true} if hidden
-	 */
-	public boolean isHidden() {
-		return hiddenFlag.isSet(field_2_option_flags);
-	}
-
-	/**
-	 * Is the sheet hidden? Different from very hidden
-	 *
-	 * @param hidden {@code true} if hidden
-	 */
-	public void setHidden(boolean hidden) {
-		field_2_option_flags = hiddenFlag.setBoolean(field_2_option_flags, hidden);
-	}
-
-	/**
-	 * Is the sheet very hidden? Different from (normal) hidden
-	 *
-	 * @return {@code true} if very hidden
-	 */
-	public boolean isVeryHidden() {
-		return veryHiddenFlag.isSet(field_2_option_flags);
-	}
-
-	/**
-	 * Is the sheet very hidden? Different from (normal) hidden
-	 *
-	 * @param veryHidden {@code true} if very hidden
-	 */
-	public void setVeryHidden(boolean veryHidden) {
-		field_2_option_flags = veryHiddenFlag.setBoolean(field_2_option_flags, veryHidden);
-	}
-
-	/**
-	 * Converts a List of {@link BoundSheetRecord}s to an array and sorts by the position of their
-	 * BOFs.
-	 *
-	 * @param boundSheetRecords the boundSheetRecord list to arrayify
-	 *
-	 * @return the sorted boundSheetRecords
-	 */
-	public static BoundSheetRecord[] orderByBofPosition(List<BoundSheetRecord> boundSheetRecords) {
-		BoundSheetRecord[] bsrs = new BoundSheetRecord[boundSheetRecords.size()];
-		boundSheetRecords.toArray(bsrs);
-		Arrays.sort(bsrs, BoundSheetRecord::compareRecords);
-	 	return bsrs;
-	}
-
-	private static int compareRecords(BoundSheetRecord bsr1, BoundSheetRecord bsr2) {
-		return bsr1.getPositionOfBof() - bsr2.getPositionOfBof();
-	}
-
-	@Override
-	public BoundSheetRecord copy() {
-		return new BoundSheetRecord(this);
-	}
-
-	@Override
-	public HSSFRecordTypes getGenericRecordType() {
-		return HSSFRecordTypes.BOUND_SHEET;
-	}
-
-	@Override
-	public Map<String, Supplier<?>> getGenericProperties() {
-		return GenericRecordUtil.getGenericProperties(
-			"bof", this::getPositionOfBof,
-			"optionFlags", () -> field_2_option_flags,
-			"multiByte", this::isMultibyte,
-			"sheetName", this::getSheetname,
-			"hidden", this::isHidden,
-			"veryHidden", this::isVeryHidden
-		);
-	}
+        in.readPlain(buf, 0, buf.length);
+        field_1_position_of_BOF = LittleEndian.getInt(buf);
+        field_2_option_flags = in.readUShort();
+        int field_3_sheetname_length = in.readUByte();
+        field_4_isMultibyteUnicode = in.readByte();
+
+        if (isMultibyte()) {
+            field_5_sheetname = in.readUnicodeLEString(field_3_sheetname_length);
+        } else {
+            field_5_sheetname = in.readCompressedUnicode(field_3_sheetname_length);
+        }
+    }
+
+    /**
+     * set the offset in bytes of the Beginning of File Marker within the HSSF
+     * Stream part of the POIFS file
+     *
+     * @param pos offset in bytes
+     */
+    public void setPositionOfBof(int pos) {
+        field_1_position_of_BOF = pos;
+    }
+
+    /**
+     * Set the sheetname for this sheet.  (this appears in the tabs at the bottom)
+     * @param sheetName the name of the sheet
+     * @see org.apache.poi.ss.util.WorkbookUtil#createSafeSheetName(String nameProposal)
+     *      for a safe way to create valid names
+     * @throws IllegalArgumentException if sheet name will cause excel to crash.
+     */
+    public void setSheetname(String sheetName) {
+
+        WorkbookUtil.validateSheetName(sheetName);
+        field_5_sheetname = sheetName;
+        field_4_isMultibyteUnicode = StringUtil.hasMultibyte(sheetName) ?  1 : 0;
+    }
+
+    /**
+     * get the offset in bytes of the Beginning of File Marker within the HSSF Stream part of the POIFS file
+     *
+     * @return offset in bytes
+     */
+    public int getPositionOfBof() {
+        return field_1_position_of_BOF;
+    }
+
+    private boolean isMultibyte() {
+        return (field_4_isMultibyteUnicode & 0x01) != 0;
+    }
+
+    /**
+     * get the sheetname for this sheet.  (this appears in the tabs at the bottom)
+     * @return sheetname the name of the sheet
+     */
+    public String getSheetname() {
+        return field_5_sheetname;
+    }
+
+    protected int getDataSize() {
+        return 8 + field_5_sheetname.length() * (isMultibyte() ? 2 : 1);
+    }
+
+    public void serialize(LittleEndianOutput out) {
+        out.writeInt(getPositionOfBof());
+        out.writeShort(field_2_option_flags);
+
+        String name = field_5_sheetname;
+        out.writeByte(name.length());
+        out.writeByte(field_4_isMultibyteUnicode);
+
+        if (isMultibyte()) {
+            StringUtil.putUnicodeLE(name, out);
+        } else {
+            StringUtil.putCompressedUnicode(name, out);
+        }
+    }
+
+    public short getSid() {
+        return sid;
+    }
+
+    /**
+     * Is the sheet hidden? Different from very hidden
+     *
+     * @return {@code true} if hidden
+     */
+    public boolean isHidden() {
+        return hiddenFlag.isSet(field_2_option_flags);
+    }
+
+    /**
+     * Is the sheet hidden? Different from very hidden
+     *
+     * @param hidden {@code true} if hidden
+     */
+    public void setHidden(boolean hidden) {
+        field_2_option_flags = hiddenFlag.setBoolean(field_2_option_flags, hidden);
+    }
+
+    /**
+     * Is the sheet very hidden? Different from (normal) hidden
+     *
+     * @return {@code true} if very hidden
+     */
+    public boolean isVeryHidden() {
+        return veryHiddenFlag.isSet(field_2_option_flags);
+    }
+
+    /**
+     * Is the sheet very hidden? Different from (normal) hidden
+     *
+     * @param veryHidden {@code true} if very hidden
+     */
+    public void setVeryHidden(boolean veryHidden) {
+        field_2_option_flags = veryHiddenFlag.setBoolean(field_2_option_flags, veryHidden);
+    }
+
+    /**
+     * Converts a List of {@link BoundSheetRecord}s to an array and sorts by the position of their
+     * BOFs.
+     *
+     * @param boundSheetRecords the boundSheetRecord list to arrayify
+     *
+     * @return the sorted boundSheetRecords
+     */
+    public static BoundSheetRecord[] orderByBofPosition(List<BoundSheetRecord> boundSheetRecords) {
+        BoundSheetRecord[] bsrs = new BoundSheetRecord[boundSheetRecords.size()];
+        boundSheetRecords.toArray(bsrs);
+        Arrays.sort(bsrs, BoundSheetRecord::compareRecords);
+        return bsrs;
+    }
+
+    private static int compareRecords(BoundSheetRecord bsr1, BoundSheetRecord bsr2) {
+        return bsr1.getPositionOfBof() - bsr2.getPositionOfBof();
+    }
+
+    @Override
+    public BoundSheetRecord copy() {
+        return new BoundSheetRecord(this);
+    }
+
+    @Override
+    public HSSFRecordTypes getGenericRecordType() {
+        return HSSFRecordTypes.BOUND_SHEET;
+    }
+
+    @Override
+    public Map<String, Supplier<?>> getGenericProperties() {
+        return GenericRecordUtil.getGenericProperties(
+            "bof", this::getPositionOfBof,
+            "optionFlags", () -> field_2_option_flags,
+            "multiByte", this::isMultibyte,
+            "sheetName", this::getSheetname,
+            "hidden", this::isHidden,
+            "veryHidden", this::isVeryHidden
+        );
+    }
 }

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/CFRule12Record.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/CFRule12Record.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/CFRule12Record.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/CFRule12Record.java Sat May 22 20:56:44 2021
@@ -352,7 +352,7 @@ public final class CFRule12Record extend
      *
      * @return list of tokens (casts stack to a list and returns it!)
      * this method can return null is we are unable to create Ptgs from
-     *	 existing excel file
+     *   existing excel file
      * callers should check for null!
      */
     public Ptg[] getParsedExpressionScale() {

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/CFRuleBase.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/CFRuleBase.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/CFRuleBase.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/CFRuleBase.java Sat May 22 20:56:44 2021
@@ -401,7 +401,7 @@ public abstract class CFRuleBase extends
      *
      * @return list of tokens (casts stack to a list and returns it!)
      * this method can return null is we are unable to create Ptgs from
-     *	 existing excel file
+     *   existing excel file
      * callers should check for null!
      */
     public Ptg[] getParsedExpression1() {

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/CRNCountRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/CRNCountRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/CRNCountRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/CRNCountRecord.java Sat May 22 20:56:44 2021
@@ -26,63 +26,63 @@ import org.apache.poi.util.LittleEndianO
  * XCT - CRN Count
  */
 public final class CRNCountRecord extends StandardRecord {
-	public static final short sid = 0x59;
+    public static final short sid = 0x59;
 
-	private static final short DATA_SIZE = 4;
+    private static final short DATA_SIZE = 4;
 
-	private int field_1_number_crn_records;
-	private int field_2_sheet_table_index;
+    private int field_1_number_crn_records;
+    private int field_2_sheet_table_index;
 
-	public CRNCountRecord(CRNCountRecord other) {
-		super(other);
-		field_1_number_crn_records = other.field_1_number_crn_records;
-		field_2_sheet_table_index = other.field_2_sheet_table_index;
-	}
-
-	public CRNCountRecord(RecordInputStream in) {
-		field_1_number_crn_records = in.readShort();
-		if(field_1_number_crn_records < 0) {
-			// TODO - seems like the sign bit of this field might be used for some other purpose
-			// see example file for test case "TestBugs.test19599()"
-			field_1_number_crn_records = (short)-field_1_number_crn_records;
-		}
-		field_2_sheet_table_index = in.readShort();
-	 }
-
-	public int getNumberOfCRNs() {
-		return field_1_number_crn_records;
-	}
-
-	public void serialize(LittleEndianOutput out) {
-		out.writeShort((short)field_1_number_crn_records);
-		out.writeShort((short)field_2_sheet_table_index);
-	}
-	protected int getDataSize() {
-		return DATA_SIZE;
-	}
-
-	/**
-	 * return the non static version of the id for this record.
-	 */
-	public short getSid() {
-		return sid;
-	}
-
-	@Override
-	public CRNCountRecord copy() {
-		return new CRNCountRecord(this);
-	}
-
-	@Override
-	public HSSFRecordTypes getGenericRecordType() {
-		return HSSFRecordTypes.CRN_COUNT;
-	}
-
-	@Override
-	public Map<String, Supplier<?>> getGenericProperties() {
-		return GenericRecordUtil.getGenericProperties(
-			"numberOfCRNs", this::getNumberOfCRNs,
-			"sheetTableIndex", () -> field_2_sheet_table_index
-		);
-	}
+    public CRNCountRecord(CRNCountRecord other) {
+        super(other);
+        field_1_number_crn_records = other.field_1_number_crn_records;
+        field_2_sheet_table_index = other.field_2_sheet_table_index;
+    }
+
+    public CRNCountRecord(RecordInputStream in) {
+        field_1_number_crn_records = in.readShort();
+        if(field_1_number_crn_records < 0) {
+            // TODO - seems like the sign bit of this field might be used for some other purpose
+            // see example file for test case "TestBugs.test19599()"
+            field_1_number_crn_records = (short)-field_1_number_crn_records;
+        }
+        field_2_sheet_table_index = in.readShort();
+     }
+
+    public int getNumberOfCRNs() {
+        return field_1_number_crn_records;
+    }
+
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort((short)field_1_number_crn_records);
+        out.writeShort((short)field_2_sheet_table_index);
+    }
+    protected int getDataSize() {
+        return DATA_SIZE;
+    }
+
+    /**
+     * return the non static version of the id for this record.
+     */
+    public short getSid() {
+        return sid;
+    }
+
+    @Override
+    public CRNCountRecord copy() {
+        return new CRNCountRecord(this);
+    }
+
+    @Override
+    public HSSFRecordTypes getGenericRecordType() {
+        return HSSFRecordTypes.CRN_COUNT;
+    }
+
+    @Override
+    public Map<String, Supplier<?>> getGenericProperties() {
+        return GenericRecordUtil.getGenericProperties(
+            "numberOfCRNs", this::getNumberOfCRNs,
+            "sheetTableIndex", () -> field_2_sheet_table_index
+        );
+    }
 }

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/CRNRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/CRNRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/CRNRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/CRNRecord.java Sat May 22 20:56:44 2021
@@ -28,70 +28,70 @@ import org.apache.poi.util.LittleEndianO
  * This record stores the contents of an external cell or cell range
  */
 public final class CRNRecord extends StandardRecord {
-	public static final short sid = 0x005A;
+    public static final short sid = 0x005A;
 
-	private int	field_1_last_column_index;
-	private int	field_2_first_column_index;
-	private int	field_3_row_index;
-	private Object[] field_4_constant_values;
-
-	public CRNRecord(CRNRecord other) {
-		super(other);
-		field_1_last_column_index = other.field_1_last_column_index;
-		field_2_first_column_index = other.field_2_first_column_index;
-		field_3_row_index = other.field_3_row_index;
-		// field_4_constant_values are instances of Double, Boolean, String, ErrorCode,
-		// i.e. they are immutable and can their references can be simply cloned
-		field_4_constant_values = (other.field_4_constant_values == null) ? null : other.field_4_constant_values.clone();
-	}
-
-	public CRNRecord(RecordInputStream in) {
-		field_1_last_column_index = in.readUByte();
-		field_2_first_column_index = in.readUByte();
-		field_3_row_index = in.readShort();
-		int nValues = field_1_last_column_index - field_2_first_column_index + 1;
-		field_4_constant_values = ConstantValueParser.parse(in, nValues);
-	}
-
-	public int getNumberOfCRNs() {
-		return field_1_last_column_index;
-	}
-
-	protected int getDataSize() {
-		return 4 + ConstantValueParser.getEncodedSize(field_4_constant_values);
-	}
-
-	public void serialize(LittleEndianOutput out) {
-		out.writeByte(field_1_last_column_index);
-		out.writeByte(field_2_first_column_index);
-		out.writeShort(field_3_row_index);
-		ConstantValueParser.encode(out, field_4_constant_values);
-	}
-
-	/**
-	 * return the non static version of the id for this record.
-	 */
-	public short getSid() {
-		return sid;
-	}
-
-	@Override
-	public CRNRecord copy() {
-		return new CRNRecord(this);
-	}
-
-	@Override
-	public HSSFRecordTypes getGenericRecordType() {
-		return HSSFRecordTypes.CRN;
-	}
-
-	@Override
-	public Map<String, Supplier<?>> getGenericProperties() {
-		return GenericRecordUtil.getGenericProperties(
-			"row", () -> field_3_row_index,
-			"firstColumn", () -> field_2_first_column_index,
-			"lastColumn", () -> field_1_last_column_index,
-			"constantValues", () -> field_4_constant_values
-		);
-	}
+    private int field_1_last_column_index;
+    private int field_2_first_column_index;
+    private int field_3_row_index;
+    private Object[] field_4_constant_values;
+
+    public CRNRecord(CRNRecord other) {
+        super(other);
+        field_1_last_column_index = other.field_1_last_column_index;
+        field_2_first_column_index = other.field_2_first_column_index;
+        field_3_row_index = other.field_3_row_index;
+        // field_4_constant_values are instances of Double, Boolean, String, ErrorCode,
+        // i.e. they are immutable and can their references can be simply cloned
+        field_4_constant_values = (other.field_4_constant_values == null) ? null : other.field_4_constant_values.clone();
+    }
+
+    public CRNRecord(RecordInputStream in) {
+        field_1_last_column_index = in.readUByte();
+        field_2_first_column_index = in.readUByte();
+        field_3_row_index = in.readShort();
+        int nValues = field_1_last_column_index - field_2_first_column_index + 1;
+        field_4_constant_values = ConstantValueParser.parse(in, nValues);
+    }
+
+    public int getNumberOfCRNs() {
+        return field_1_last_column_index;
+    }
+
+    protected int getDataSize() {
+        return 4 + ConstantValueParser.getEncodedSize(field_4_constant_values);
+    }
+
+    public void serialize(LittleEndianOutput out) {
+        out.writeByte(field_1_last_column_index);
+        out.writeByte(field_2_first_column_index);
+        out.writeShort(field_3_row_index);
+        ConstantValueParser.encode(out, field_4_constant_values);
+    }
+
+    /**
+     * return the non static version of the id for this record.
+     */
+    public short getSid() {
+        return sid;
+    }
+
+    @Override
+    public CRNRecord copy() {
+        return new CRNRecord(this);
+    }
+
+    @Override
+    public HSSFRecordTypes getGenericRecordType() {
+        return HSSFRecordTypes.CRN;
+    }
+
+    @Override
+    public Map<String, Supplier<?>> getGenericProperties() {
+        return GenericRecordUtil.getGenericProperties(
+            "row", () -> field_3_row_index,
+            "firstColumn", () -> field_2_first_column_index,
+            "lastColumn", () -> field_1_last_column_index,
+            "constantValues", () -> field_4_constant_values
+        );
+    }
 }

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/CommonObjectDataSubRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/CommonObjectDataSubRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/CommonObjectDataSubRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/CommonObjectDataSubRecord.java Sat May 22 20:56:44 2021
@@ -122,14 +122,14 @@ public final class CommonObjectDataSubRe
         out.writeInt(field_6_reserved3);
     }
 
-	@Override
+    @Override
     protected int getDataSize() {
         return 2 + 2 + 2 + 4 + 4 + 4;
     }
 
-	/**
-	 * @return the record sid
-	 */
+    /**
+     * @return the record sid
+     */
     public short getSid()
     {
         return sid;

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/DVALRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/DVALRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/DVALRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/DVALRecord.java Sat May 22 20:56:44 2021
@@ -27,67 +27,67 @@ import org.apache.poi.util.LittleEndianO
  * This record is the list header of all data validation records (0x01BE) in the current sheet.
  */
 public final class DVALRecord extends StandardRecord {
-	public static final short sid = 0x01B2;
+    public static final short sid = 0x01B2;
 
-	/** Options of the DVAL */
-	private short field_1_options;
-	/** Horizontal position of the dialog */
-	private int field_2_horiz_pos;
-	/** Vertical position of the dialog */
-	private int field_3_vert_pos;
-
-	/** Object ID of the drop down arrow object for list boxes ;
-	 * in our case this will be always FFFF , until
-	 * MSODrawingGroup and MSODrawing records are implemented */
-	private int  field_cbo_id;
+    /** Options of the DVAL */
+    private short field_1_options;
+    /** Horizontal position of the dialog */
+    private int field_2_horiz_pos;
+    /** Vertical position of the dialog */
+    private int field_3_vert_pos;
+
+    /** Object ID of the drop down arrow object for list boxes ;
+     * in our case this will be always FFFF , until
+     * MSODrawingGroup and MSODrawing records are implemented */
+    private int  field_cbo_id;
 
-	/** Number of following DV Records */
-	private int  field_5_dv_no;
+    /** Number of following DV Records */
+    private int  field_5_dv_no;
 
     public DVALRecord() {
         field_cbo_id = 0xFFFFFFFF;
         field_5_dv_no = 0x00000000;
     }
 
-	public DVALRecord(DVALRecord other) {
-		super(other);
-		field_1_options = other.field_1_options;
-		field_2_horiz_pos = other.field_2_horiz_pos;
-		field_3_vert_pos = other.field_3_vert_pos;
-		field_cbo_id = other.field_cbo_id;
-		field_5_dv_no = other.field_5_dv_no;
-	}
-
-	public DVALRecord(RecordInputStream in) {
-		field_1_options = in.readShort();
-		field_2_horiz_pos = in.readInt();
-		field_3_vert_pos = in.readInt();
+    public DVALRecord(DVALRecord other) {
+        super(other);
+        field_1_options = other.field_1_options;
+        field_2_horiz_pos = other.field_2_horiz_pos;
+        field_3_vert_pos = other.field_3_vert_pos;
+        field_cbo_id = other.field_cbo_id;
+        field_5_dv_no = other.field_5_dv_no;
+    }
+
+    public DVALRecord(RecordInputStream in) {
+        field_1_options = in.readShort();
+        field_2_horiz_pos = in.readInt();
+        field_3_vert_pos = in.readInt();
         field_cbo_id = in.readInt();
         field_5_dv_no = in.readInt();
-	}
+    }
+
+    /**
+     * @param options the options of the dialog
+     */
+    public void setOptions(short options) {
+        field_1_options = options;
+    }
 
     /**
-	 * @param options the options of the dialog
-	 */
-	public void setOptions(short options) {
-		field_1_options = options;
-	}
-
-	/**
-	 * @param horiz_pos the Horizontal position of the dialog
-	 */
-	public void setHorizontalPos(int horiz_pos) {
-		field_2_horiz_pos = horiz_pos;
-	}
-
-	/**
-	 * @param vert_pos the Vertical position of the dialog
-	 */
-	public void setVerticalPos(int vert_pos) {
-		field_3_vert_pos = vert_pos;
-	}
+     * @param horiz_pos the Horizontal position of the dialog
+     */
+    public void setHorizontalPos(int horiz_pos) {
+        field_2_horiz_pos = horiz_pos;
+    }
 
-	/**
+    /**
+     * @param vert_pos the Vertical position of the dialog
+     */
+    public void setVerticalPos(int vert_pos) {
+        field_3_vert_pos = vert_pos;
+    }
+
+    /**
      * set the object ID of the drop down arrow object for list boxes
      * @param cboID - Object ID
      */
@@ -104,27 +104,27 @@ public final class DVALRecord extends St
     }
 
     /**
-	 * @return the field_1_options
-	 */
-	public short getOptions() {
-		return field_1_options;
-	}
-
-	/**
-	 * @return the Horizontal position of the dialog
-	 */
-	public int getHorizontalPos() {
-		return field_2_horiz_pos;
-	}
-
-	/**
-	 * @return the the Vertical position of the dialog
-	 */
-	public int getVerticalPos() {
-		return field_3_vert_pos;
-	}
+     * @return the field_1_options
+     */
+    public short getOptions() {
+        return field_1_options;
+    }
+
+    /**
+     * @return the Horizontal position of the dialog
+     */
+    public int getHorizontalPos() {
+        return field_2_horiz_pos;
+    }
+
+    /**
+     * @return the the Vertical position of the dialog
+     */
+    public int getVerticalPos() {
+        return field_3_vert_pos;
+    }
 
-	/**
+    /**
      * @return the Object ID of the drop down arrow object for list boxes
      */
     public int getObjectID() {
@@ -139,11 +139,11 @@ public final class DVALRecord extends St
     }
 
     public void serialize(LittleEndianOutput out) {
-		out.writeShort(getOptions());
-		out.writeInt(getHorizontalPos());
-		out.writeInt(getVerticalPos());
-		out.writeInt(getObjectID());
-		out.writeInt(getDVRecNo());
+        out.writeShort(getOptions());
+        out.writeInt(getHorizontalPos());
+        out.writeInt(getVerticalPos());
+        out.writeInt(getObjectID());
+        out.writeInt(getDVRecNo());
     }
 
     protected int getDataSize() {
@@ -154,24 +154,24 @@ public final class DVALRecord extends St
         return sid;
     }
 
-	@Override
+    @Override
     public DVALRecord copy() {
       return new DVALRecord(this);
     }
 
-	@Override
-	public HSSFRecordTypes getGenericRecordType() {
-		return HSSFRecordTypes.DVAL;
-	}
-
-	@Override
-	public Map<String, Supplier<?>> getGenericProperties() {
-		return GenericRecordUtil.getGenericProperties(
-			"options", this::getOptions,
-			"horizPos", this::getHorizontalPos,
-			"vertPos", this::getVerticalPos,
-			"comboObjectID", this::getObjectID,
-			"dvRecordsNumber", this::getDVRecNo
-		);
-	}
+    @Override
+    public HSSFRecordTypes getGenericRecordType() {
+        return HSSFRecordTypes.DVAL;
+    }
+
+    @Override
+    public Map<String, Supplier<?>> getGenericProperties() {
+        return GenericRecordUtil.getGenericProperties(
+            "options", this::getOptions,
+            "horizPos", this::getHorizontalPos,
+            "vertPos", this::getVerticalPos,
+            "comboObjectID", this::getObjectID,
+            "dvRecordsNumber", this::getDVRecNo
+        );
+    }
 }

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/DVRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/DVRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/DVRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/DVRecord.java Sat May 22 20:56:44 2021
@@ -38,201 +38,201 @@ import org.apache.poi.util.StringUtil;
  * This list is followed by DVAL record(s)
  */
 public final class DVRecord extends StandardRecord {
-	public static final short sid = 0x01BE;
+    public static final short sid = 0x01BE;
 
-	/** the unicode string used for error/prompt title/text when not present */
-	private static final UnicodeString NULL_TEXT_STRING = new UnicodeString("\0");
+    /** the unicode string used for error/prompt title/text when not present */
+    private static final UnicodeString NULL_TEXT_STRING = new UnicodeString("\0");
 
-	/**
-	 * Option flags field
-	 *
-	 * @see HSSFDataValidation utility class
-	 */
-	private static final BitField opt_data_type                    = new BitField(0x0000000F);
-	private static final BitField opt_error_style                  = new BitField(0x00000070);
-	private static final BitField opt_string_list_formula          = new BitField(0x00000080);
-	private static final BitField opt_empty_cell_allowed           = new BitField(0x00000100);
-	private static final BitField opt_suppress_dropdown_arrow      = new BitField(0x00000200);
-	private static final BitField opt_show_prompt_on_cell_selected = new BitField(0x00040000);
-	private static final BitField opt_show_error_on_invalid_value  = new BitField(0x00080000);
-	private static final BitField opt_condition_operator           = new BitField(0x00700000);
-
-	private static final int[] FLAG_MASKS = { 0x0000000F,0x00000070,0x00000080,0x00000100,
-			0x00000200,0x00040000,0x00080000,0x00700000 };
-
-	private static final String[] FLAG_NAMES = { "DATA_TYPE", "ERROR_STYLE", "STRING_LIST_FORMULA",
-		"EMPTY_CELL_ALLOWED", "SUPPRESS_DROPDOWN_ARROW", "SHOW_PROMPT_ON_CELL_SELECTED",
-		"SHOW_ERROR_ON_INVALID_VALUE", "CONDITION_OPERATOR" };
-
-
-
-	/** Option flags */
-	private int _option_flags;
-	/** Title of the prompt box, cannot be longer than 32 chars */
-	private final UnicodeString _promptTitle;
-	/** Title of the error box, cannot be longer than 32 chars */
-	private final UnicodeString _errorTitle;
-	/** Text of the prompt box, cannot be longer than 255 chars */
-	private final UnicodeString _promptText;
-	/** Text of the error box, cannot be longer than 255 chars */
-	private final UnicodeString _errorText;
-	/** Not used - Excel seems to always write 0x3FE0 */
-	private short _not_used_1 = 0x3FE0;
-	/** Formula data for first condition (RPN token array without size field) */
-	private final Formula _formula1;
-	/** Not used - Excel seems to always write 0x0000 */
-	@SuppressWarnings("RedundantFieldInitialization")
-	private short _not_used_2 = 0x0000;
-	/** Formula data for second condition (RPN token array without size field) */
-	private final Formula _formula2;
-	/** Cell range address list with all affected ranges */
-	private final CellRangeAddressList _regions;
-
-	public DVRecord(DVRecord other) {
-		super(other);
-		_option_flags = other._option_flags;
-		_promptTitle = other._promptTitle.copy();
-		_errorTitle = other._errorTitle.copy();
-		_promptText = other._promptText.copy();
-		_errorText = other._errorText.copy();
-		_not_used_1 = other._not_used_1;
-		_formula1 = (other._formula1 == null) ? null : other._formula1.copy();
-		_not_used_2 = other._not_used_2;
-		_formula2 = (other._formula2 == null) ? null : other._formula2.copy();
-		_regions = (other._regions == null) ? null : other._regions.copy();
-	}
-
-	public DVRecord(int validationType, int operator, int errorStyle, boolean emptyCellAllowed,
-			boolean suppressDropDownArrow, boolean isExplicitList,
-			boolean showPromptBox, String promptTitle, String promptText,
-			boolean showErrorBox, String errorTitle, String errorText,
-			Ptg[] formula1, Ptg[] formula2,
-			CellRangeAddressList regions) {
-
-		// check length-limits
-		if(promptTitle != null && promptTitle.length() > 32) {
-			throw new IllegalStateException("Prompt-title cannot be longer than 32 characters, but had: " + promptTitle);
-		}
-		if(promptText != null && promptText.length() > 255) {
-			throw new IllegalStateException("Prompt-text cannot be longer than 255 characters, but had: " + promptText);
-		}
-
-		if(errorTitle != null && errorTitle.length() > 32) {
-			throw new IllegalStateException("Error-title cannot be longer than 32 characters, but had: " + errorTitle);
-		}
-		if(errorText != null && errorText.length() > 255) {
-			throw new IllegalStateException("Error-text cannot be longer than 255 characters, but had: " + errorText);
-		}
-
-		int flags = 0;
-		flags = opt_data_type.setValue(flags, validationType);
-		flags = opt_condition_operator.setValue(flags, operator);
-		flags = opt_error_style.setValue(flags, errorStyle);
-		flags = opt_empty_cell_allowed.setBoolean(flags, emptyCellAllowed);
-		flags = opt_suppress_dropdown_arrow.setBoolean(flags, suppressDropDownArrow);
-		flags = opt_string_list_formula.setBoolean(flags, isExplicitList);
-		flags = opt_show_prompt_on_cell_selected.setBoolean(flags, showPromptBox);
-		flags = opt_show_error_on_invalid_value.setBoolean(flags, showErrorBox);
-		_option_flags = flags;
-		_promptTitle = resolveTitleText(promptTitle);
-		_promptText = resolveTitleText(promptText);
-		_errorTitle = resolveTitleText(errorTitle);
-		_errorText = resolveTitleText(errorText);
-		_formula1 = Formula.create(formula1);
-		_formula2 = Formula.create(formula2);
-		_regions = regions;
-	}
-
-	public DVRecord(RecordInputStream in) {
-		_option_flags = in.readInt();
-
-		_promptTitle = readUnicodeString(in);
-		_errorTitle = readUnicodeString(in);
-		_promptText = readUnicodeString(in);
-		_errorText = readUnicodeString(in);
-
-		int field_size_first_formula = in.readUShort();
-		_not_used_1 = in.readShort();
-
-		// "You may not use unions, intersections or array constants in Data Validation criteria"
-
-		// read first formula data condition
-		_formula1 = Formula.read(field_size_first_formula, in);
-
-		int field_size_sec_formula = in.readUShort();
-		_not_used_2 = in.readShort();
-
-		// read sec formula data condition
-		_formula2 = Formula.read(field_size_sec_formula, in);
-
-		// read cell range address list with all affected ranges
-		_regions = new CellRangeAddressList(in);
-	}
-
-	/**
-	 * @return the condition data type
-	 * @see org.apache.poi.ss.usermodel.DataValidationConstraint.ValidationType
-	 */
-	public int getDataType() {
-	   return opt_data_type.getValue(_option_flags);
-	}
-
-	/**
-	 * @return the condition error style
-	 * @see org.apache.poi.ss.usermodel.DataValidation.ErrorStyle
-	 */
-	public int getErrorStyle() {
-	   return opt_error_style.getValue(_option_flags);
-	}
-
-	/**
-	 * @return <code>true</code> if in list validations the string list is explicitly given in the
-	 *  formula, <code>false</code> otherwise
-	  */
-	public boolean getListExplicitFormula() {
-	   return (opt_string_list_formula.isSet(_option_flags));
-	}
-
-	/**
-	 * @return <code>true</code> if empty values are allowed in cells, <code>false</code> otherwise
-	 */
-	public boolean getEmptyCellAllowed() {
-	   return (opt_empty_cell_allowed.isSet(_option_flags));
-	}
-
-
-	/**
-	  * @return <code>true</code> if drop down arrow should be suppressed when list validation is
-	  * used, <code>false</code> otherwise
-	 */
-	public boolean getSuppressDropdownArrow() {
-	   return (opt_suppress_dropdown_arrow.isSet(_option_flags));
-	}
-
-	/**
-	 * @return <code>true</code> if a prompt window should appear when cell is selected, <code>false</code> otherwise
-	 */
-	public boolean getShowPromptOnCellSelected() {
-	   return (opt_show_prompt_on_cell_selected.isSet(_option_flags));
-	}
-
-	/**
-	 * @return <code>true</code> if an error window should appear when an invalid value is entered
-	 *  in the cell, <code>false</code> otherwise
-	 */
-	public boolean getShowErrorOnInvalidValue() {
-	   return (opt_show_error_on_invalid_value.isSet(_option_flags));
-	}
-
-	/**
-	 * get the condition operator
-	 * @return the condition operator
-	 * @see HSSFDataValidation utility class
-	 */
-	public int getConditionOperator() {
-	   return opt_condition_operator.getValue(_option_flags);
-	}
-	// <-- end option flags
+    /**
+     * Option flags field
+     *
+     * @see HSSFDataValidation utility class
+     */
+    private static final BitField opt_data_type                    = new BitField(0x0000000F);
+    private static final BitField opt_error_style                  = new BitField(0x00000070);
+    private static final BitField opt_string_list_formula          = new BitField(0x00000080);
+    private static final BitField opt_empty_cell_allowed           = new BitField(0x00000100);
+    private static final BitField opt_suppress_dropdown_arrow      = new BitField(0x00000200);
+    private static final BitField opt_show_prompt_on_cell_selected = new BitField(0x00040000);
+    private static final BitField opt_show_error_on_invalid_value  = new BitField(0x00080000);
+    private static final BitField opt_condition_operator           = new BitField(0x00700000);
+
+    private static final int[] FLAG_MASKS = { 0x0000000F,0x00000070,0x00000080,0x00000100,
+            0x00000200,0x00040000,0x00080000,0x00700000 };
+
+    private static final String[] FLAG_NAMES = { "DATA_TYPE", "ERROR_STYLE", "STRING_LIST_FORMULA",
+        "EMPTY_CELL_ALLOWED", "SUPPRESS_DROPDOWN_ARROW", "SHOW_PROMPT_ON_CELL_SELECTED",
+        "SHOW_ERROR_ON_INVALID_VALUE", "CONDITION_OPERATOR" };
+
+
+
+    /** Option flags */
+    private int _option_flags;
+    /** Title of the prompt box, cannot be longer than 32 chars */
+    private final UnicodeString _promptTitle;
+    /** Title of the error box, cannot be longer than 32 chars */
+    private final UnicodeString _errorTitle;
+    /** Text of the prompt box, cannot be longer than 255 chars */
+    private final UnicodeString _promptText;
+    /** Text of the error box, cannot be longer than 255 chars */
+    private final UnicodeString _errorText;
+    /** Not used - Excel seems to always write 0x3FE0 */
+    private short _not_used_1 = 0x3FE0;
+    /** Formula data for first condition (RPN token array without size field) */
+    private final Formula _formula1;
+    /** Not used - Excel seems to always write 0x0000 */
+    @SuppressWarnings("RedundantFieldInitialization")
+    private short _not_used_2 = 0x0000;
+    /** Formula data for second condition (RPN token array without size field) */
+    private final Formula _formula2;
+    /** Cell range address list with all affected ranges */
+    private final CellRangeAddressList _regions;
+
+    public DVRecord(DVRecord other) {
+        super(other);
+        _option_flags = other._option_flags;
+        _promptTitle = other._promptTitle.copy();
+        _errorTitle = other._errorTitle.copy();
+        _promptText = other._promptText.copy();
+        _errorText = other._errorText.copy();
+        _not_used_1 = other._not_used_1;
+        _formula1 = (other._formula1 == null) ? null : other._formula1.copy();
+        _not_used_2 = other._not_used_2;
+        _formula2 = (other._formula2 == null) ? null : other._formula2.copy();
+        _regions = (other._regions == null) ? null : other._regions.copy();
+    }
+
+    public DVRecord(int validationType, int operator, int errorStyle, boolean emptyCellAllowed,
+            boolean suppressDropDownArrow, boolean isExplicitList,
+            boolean showPromptBox, String promptTitle, String promptText,
+            boolean showErrorBox, String errorTitle, String errorText,
+            Ptg[] formula1, Ptg[] formula2,
+            CellRangeAddressList regions) {
+
+        // check length-limits
+        if(promptTitle != null && promptTitle.length() > 32) {
+            throw new IllegalStateException("Prompt-title cannot be longer than 32 characters, but had: " + promptTitle);
+        }
+        if(promptText != null && promptText.length() > 255) {
+            throw new IllegalStateException("Prompt-text cannot be longer than 255 characters, but had: " + promptText);
+        }
+
+        if(errorTitle != null && errorTitle.length() > 32) {
+            throw new IllegalStateException("Error-title cannot be longer than 32 characters, but had: " + errorTitle);
+        }
+        if(errorText != null && errorText.length() > 255) {
+            throw new IllegalStateException("Error-text cannot be longer than 255 characters, but had: " + errorText);
+        }
+
+        int flags = 0;
+        flags = opt_data_type.setValue(flags, validationType);
+        flags = opt_condition_operator.setValue(flags, operator);
+        flags = opt_error_style.setValue(flags, errorStyle);
+        flags = opt_empty_cell_allowed.setBoolean(flags, emptyCellAllowed);
+        flags = opt_suppress_dropdown_arrow.setBoolean(flags, suppressDropDownArrow);
+        flags = opt_string_list_formula.setBoolean(flags, isExplicitList);
+        flags = opt_show_prompt_on_cell_selected.setBoolean(flags, showPromptBox);
+        flags = opt_show_error_on_invalid_value.setBoolean(flags, showErrorBox);
+        _option_flags = flags;
+        _promptTitle = resolveTitleText(promptTitle);
+        _promptText = resolveTitleText(promptText);
+        _errorTitle = resolveTitleText(errorTitle);
+        _errorText = resolveTitleText(errorText);
+        _formula1 = Formula.create(formula1);
+        _formula2 = Formula.create(formula2);
+        _regions = regions;
+    }
+
+    public DVRecord(RecordInputStream in) {
+        _option_flags = in.readInt();
+
+        _promptTitle = readUnicodeString(in);
+        _errorTitle = readUnicodeString(in);
+        _promptText = readUnicodeString(in);
+        _errorText = readUnicodeString(in);
+
+        int field_size_first_formula = in.readUShort();
+        _not_used_1 = in.readShort();
+
+        // "You may not use unions, intersections or array constants in Data Validation criteria"
+
+        // read first formula data condition
+        _formula1 = Formula.read(field_size_first_formula, in);
+
+        int field_size_sec_formula = in.readUShort();
+        _not_used_2 = in.readShort();
+
+        // read sec formula data condition
+        _formula2 = Formula.read(field_size_sec_formula, in);
+
+        // read cell range address list with all affected ranges
+        _regions = new CellRangeAddressList(in);
+    }
+
+    /**
+     * @return the condition data type
+     * @see org.apache.poi.ss.usermodel.DataValidationConstraint.ValidationType
+     */
+    public int getDataType() {
+       return opt_data_type.getValue(_option_flags);
+    }
+
+    /**
+     * @return the condition error style
+     * @see org.apache.poi.ss.usermodel.DataValidation.ErrorStyle
+     */
+    public int getErrorStyle() {
+       return opt_error_style.getValue(_option_flags);
+    }
+
+    /**
+     * @return <code>true</code> if in list validations the string list is explicitly given in the
+     *  formula, <code>false</code> otherwise
+      */
+    public boolean getListExplicitFormula() {
+       return (opt_string_list_formula.isSet(_option_flags));
+    }
+
+    /**
+     * @return <code>true</code> if empty values are allowed in cells, <code>false</code> otherwise
+     */
+    public boolean getEmptyCellAllowed() {
+       return (opt_empty_cell_allowed.isSet(_option_flags));
+    }
+
+
+    /**
+      * @return <code>true</code> if drop down arrow should be suppressed when list validation is
+      * used, <code>false</code> otherwise
+     */
+    public boolean getSuppressDropdownArrow() {
+       return (opt_suppress_dropdown_arrow.isSet(_option_flags));
+    }
+
+    /**
+     * @return <code>true</code> if a prompt window should appear when cell is selected, <code>false</code> otherwise
+     */
+    public boolean getShowPromptOnCellSelected() {
+       return (opt_show_prompt_on_cell_selected.isSet(_option_flags));
+    }
+
+    /**
+     * @return <code>true</code> if an error window should appear when an invalid value is entered
+     *  in the cell, <code>false</code> otherwise
+     */
+    public boolean getShowErrorOnInvalidValue() {
+       return (opt_show_error_on_invalid_value.isSet(_option_flags));
+    }
+
+    /**
+     * get the condition operator
+     * @return the condition operator
+     * @see HSSFDataValidation utility class
+     */
+    public int getConditionOperator() {
+       return opt_condition_operator.getValue(_option_flags);
+    }
+    // <-- end option flags
 
     public String getPromptTitle() {
         return resolveTitleString(_promptTitle);
@@ -258,42 +258,42 @@ public final class DVRecord extends Stan
         return Formula.getTokens(_formula2);
     }
 
-	public CellRangeAddressList getCellRangeAddress() {
-		return this._regions;
-	}
-
-
-	public void serialize(LittleEndianOutput out) {
-
-		out.writeInt(_option_flags);
-
-		serializeUnicodeString(_promptTitle, out);
-		serializeUnicodeString(_errorTitle, out);
-		serializeUnicodeString(_promptText, out);
-		serializeUnicodeString(_errorText, out);
-		out.writeShort(_formula1.getEncodedTokenSize());
-		out.writeShort(_not_used_1);
-		_formula1.serializeTokens(out);
-
-		out.writeShort(_formula2.getEncodedTokenSize());
-		out.writeShort(_not_used_2);
-		_formula2.serializeTokens(out);
-
-		_regions.serialize(out);
-	}
-
-	/**
-	 * When entered via the UI, Excel translates empty string into "\0"
-	 * While it is possible to encode the title/text as empty string (Excel doesn't exactly crash),
-	 * the resulting tool-tip text / message box looks wrong.  It is best to do the same as the
-	 * Excel UI and encode 'not present' as "\0".
-	 */
-	private static UnicodeString resolveTitleText(String str) {
-		if (str == null || str.length() < 1) {
-			return NULL_TEXT_STRING;
-		}
-		return new UnicodeString(str);
-	}
+    public CellRangeAddressList getCellRangeAddress() {
+        return this._regions;
+    }
+
+
+    public void serialize(LittleEndianOutput out) {
+
+        out.writeInt(_option_flags);
+
+        serializeUnicodeString(_promptTitle, out);
+        serializeUnicodeString(_errorTitle, out);
+        serializeUnicodeString(_promptText, out);
+        serializeUnicodeString(_errorText, out);
+        out.writeShort(_formula1.getEncodedTokenSize());
+        out.writeShort(_not_used_1);
+        _formula1.serializeTokens(out);
+
+        out.writeShort(_formula2.getEncodedTokenSize());
+        out.writeShort(_not_used_2);
+        _formula2.serializeTokens(out);
+
+        _regions.serialize(out);
+    }
+
+    /**
+     * When entered via the UI, Excel translates empty string into "\0"
+     * While it is possible to encode the title/text as empty string (Excel doesn't exactly crash),
+     * the resulting tool-tip text / message box looks wrong.  It is best to do the same as the
+     * Excel UI and encode 'not present' as "\0".
+     */
+    private static UnicodeString resolveTitleText(String str) {
+        if (str == null || str.length() < 1) {
+            return NULL_TEXT_STRING;
+        }
+        return new UnicodeString(str);
+    }
 
     private static String resolveTitleString(UnicodeString us) {
         if (us == null || us.equals(NULL_TEXT_STRING)) {
@@ -302,56 +302,56 @@ public final class DVRecord extends Stan
         return us.getString();
     }
 
-	private static UnicodeString readUnicodeString(RecordInputStream in) {
-		return new UnicodeString(in);
-	}
-
-	private static void serializeUnicodeString(UnicodeString us, LittleEndianOutput out) {
-		StringUtil.writeUnicodeString(out, us.getString());
-	}
-	private static int getUnicodeStringSize(UnicodeString us) {
-		String str = us.getString();
-		return 3 + str.length() * (StringUtil.hasMultibyte(str) ? 2 : 1);
-	}
-
-	protected int getDataSize() {
-		int size = 4+2+2+2+2;//options_field+first_formula_size+first_unused+sec_formula_size+sec+unused;
-		size += getUnicodeStringSize(_promptTitle);
-		size += getUnicodeStringSize(_errorTitle);
-		size += getUnicodeStringSize(_promptText);
-		size += getUnicodeStringSize(_errorText);
-		size += _formula1.getEncodedTokenSize();
-		size += _formula2.getEncodedTokenSize();
-		size += _regions.getSize();
-		return size;
-	}
-
-	public short getSid() {
-		return sid;
-	}
-
-	/** Clones the object. */
-	@Override
-	public DVRecord copy() {
-		return new DVRecord(this);
-	}
-
-	@Override
-	public HSSFRecordTypes getGenericRecordType() {
-		return HSSFRecordTypes.DV;
-	}
-
-	@Override
-	public Map<String, Supplier<?>> getGenericProperties() {
-		return GenericRecordUtil.getGenericProperties(
-			"optionFlags", getBitsAsString(() -> _option_flags, FLAG_MASKS, FLAG_NAMES),
-			"promptTitle", this::getPromptTitle,
-			"errorTitle", this::getErrorTitle,
-			"promptText", this::getPromptText,
-			"errorText", this::getErrorText,
-			"formula1", this::getFormula1,
-			"formula2", this::getFormula2,
-			"regions", () -> _regions
-		);
-	}
+    private static UnicodeString readUnicodeString(RecordInputStream in) {
+        return new UnicodeString(in);
+    }
+
+    private static void serializeUnicodeString(UnicodeString us, LittleEndianOutput out) {
+        StringUtil.writeUnicodeString(out, us.getString());
+    }
+    private static int getUnicodeStringSize(UnicodeString us) {
+        String str = us.getString();
+        return 3 + str.length() * (StringUtil.hasMultibyte(str) ? 2 : 1);
+    }
+
+    protected int getDataSize() {
+        int size = 4+2+2+2+2;//options_field+first_formula_size+first_unused+sec_formula_size+sec+unused;
+        size += getUnicodeStringSize(_promptTitle);
+        size += getUnicodeStringSize(_errorTitle);
+        size += getUnicodeStringSize(_promptText);
+        size += getUnicodeStringSize(_errorText);
+        size += _formula1.getEncodedTokenSize();
+        size += _formula2.getEncodedTokenSize();
+        size += _regions.getSize();
+        return size;
+    }
+
+    public short getSid() {
+        return sid;
+    }
+
+    /** Clones the object. */
+    @Override
+    public DVRecord copy() {
+        return new DVRecord(this);
+    }
+
+    @Override
+    public HSSFRecordTypes getGenericRecordType() {
+        return HSSFRecordTypes.DV;
+    }
+
+    @Override
+    public Map<String, Supplier<?>> getGenericProperties() {
+        return GenericRecordUtil.getGenericProperties(
+            "optionFlags", getBitsAsString(() -> _option_flags, FLAG_MASKS, FLAG_NAMES),
+            "promptTitle", this::getPromptTitle,
+            "errorTitle", this::getErrorTitle,
+            "promptText", this::getPromptText,
+            "errorText", this::getErrorText,
+            "formula1", this::getFormula1,
+            "formula2", this::getFormula2,
+            "regions", () -> _regions
+        );
+    }
 }

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/DrawingRecordForBiffViewer.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/DrawingRecordForBiffViewer.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/DrawingRecordForBiffViewer.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/DrawingRecordForBiffViewer.java Sat May 22 20:56:44 2021
@@ -41,17 +41,17 @@ public final class DrawingRecordForBiffV
 
     public DrawingRecordForBiffViewer(DrawingRecord r)
     {
-    	super(convertToInputStream(r));
-    	decode();
+        super(convertToInputStream(r));
+        decode();
     }
     private static RecordInputStream convertToInputStream(DrawingRecord r)
     {
-    	byte[] data = r.serialize();
-    	RecordInputStream rinp = new RecordInputStream(
-    			new ByteArrayInputStream(data)
-    	);
-    	rinp.nextRecord();
-    	return rinp;
+        byte[] data = r.serialize();
+        RecordInputStream rinp = new RecordInputStream(
+                new ByteArrayInputStream(data)
+        );
+        rinp.nextRecord();
+        return rinp;
     }
 
     protected String getRecordName()

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/DrawingSelectionRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/DrawingSelectionRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/DrawingSelectionRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/DrawingSelectionRecord.java Sat May 22 20:56:44 2021
@@ -31,107 +31,107 @@ import org.apache.poi.util.LittleEndianO
  * [MS-OGRAPH].pdf sec 2.4.69
  */
 public final class DrawingSelectionRecord extends StandardRecord {
-	public static final short sid = 0x00ED;
+    public static final short sid = 0x00ED;
 
-	/**
-	 * From [MS-ODRAW].pdf sec 2.2.1<p>
-	 * TODO - make EscherRecordHeader {@link LittleEndianInput} aware and refactor with this
-	 */
-	private static final class OfficeArtRecordHeader implements GenericRecord {
-		public static final int ENCODED_SIZE = 8;
-		/**
-		 * lower 4 bits is 'version' usually 0x01 or 0x0F (for containers)
-		 * upper 12 bits is 'instance'
-		 */
-		private final int _verAndInstance;
-		/** value should be between 0xF000 and 0xFFFF */
-		private final int _type;
-		private final int _length;
-
-		public OfficeArtRecordHeader(LittleEndianInput in) {
-			_verAndInstance = in.readUShort();
-			_type = in.readUShort();
-			_length = in.readInt();
-		}
-
-		public void serialize(LittleEndianOutput out) {
-			out.writeShort(_verAndInstance);
-			out.writeShort(_type);
-			out.writeInt(_length);
-		}
-
-		@Override
-		public Map<String, Supplier<?>> getGenericProperties() {
-			return GenericRecordUtil.getGenericProperties(
-				"verAndInstance", () -> _verAndInstance,
-				"type", () -> _type,
-				"length", () -> _length
-			);
-		}
-	}
-
-	// [MS-OGRAPH].pdf says that the data of this record is an OfficeArtFDGSL structure
-	// as described in[MS-ODRAW].pdf sec 2.2.33
-	private OfficeArtRecordHeader _header;
-	private int _cpsp;
-	/** a MSODGSLK enum value for the current selection mode */
-	private int _dgslk;
-	private int _spidFocus;
-	/** selected shape IDs (e.g. from EscherSpRecord.ShapeId) */
-	private int[] _shapeIds;
-
-	public DrawingSelectionRecord(RecordInputStream in) {
-		_header = new OfficeArtRecordHeader(in);
-		_cpsp = in.readInt();
-		_dgslk = in.readInt();
-		_spidFocus = in.readInt();
-		int nShapes = in.available() / 4;
-		int[] shapeIds = new int[nShapes];
-		for (int i = 0; i < nShapes; i++) {
-			shapeIds[i] = in.readInt();
-		}
-		_shapeIds = shapeIds;
-	}
-
-	public short getSid() {
-		return sid;
-	}
-
-	protected int getDataSize() {
-		return OfficeArtRecordHeader.ENCODED_SIZE
-			+ 12 // 3 int fields
-			+ _shapeIds.length * 4;
-	}
-
-	public void serialize(LittleEndianOutput out) {
-		_header.serialize(out);
-		out.writeInt(_cpsp);
-		out.writeInt(_dgslk);
-		out.writeInt(_spidFocus);
-		for (int shapeId : _shapeIds) {
-			out.writeInt(shapeId);
-		}
-	}
-
-	@Override
-	public DrawingSelectionRecord copy() {
-		// currently immutable
-		return this;
-	}
-
-	@Override
-	public HSSFRecordTypes getGenericRecordType() {
-		return HSSFRecordTypes.DRAWING_SELECTION;
-	}
-
-	@Override
-	public Map<String, Supplier<?>> getGenericProperties() {
-		return GenericRecordUtil.getGenericProperties(
-			"rh", () -> _header,
-			"cpsp", () -> _cpsp,
-			"dgslk", () -> _dgslk,
-			"spidFocus", () -> _spidFocus,
-			"shapeIds", () -> _shapeIds
-		);
-	}
+    /**
+     * From [MS-ODRAW].pdf sec 2.2.1<p>
+     * TODO - make EscherRecordHeader {@link LittleEndianInput} aware and refactor with this
+     */
+    private static final class OfficeArtRecordHeader implements GenericRecord {
+        public static final int ENCODED_SIZE = 8;
+        /**
+         * lower 4 bits is 'version' usually 0x01 or 0x0F (for containers)
+         * upper 12 bits is 'instance'
+         */
+        private final int _verAndInstance;
+        /** value should be between 0xF000 and 0xFFFF */
+        private final int _type;
+        private final int _length;
+
+        public OfficeArtRecordHeader(LittleEndianInput in) {
+            _verAndInstance = in.readUShort();
+            _type = in.readUShort();
+            _length = in.readInt();
+        }
+
+        public void serialize(LittleEndianOutput out) {
+            out.writeShort(_verAndInstance);
+            out.writeShort(_type);
+            out.writeInt(_length);
+        }
+
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties(
+                "verAndInstance", () -> _verAndInstance,
+                "type", () -> _type,
+                "length", () -> _length
+            );
+        }
+    }
+
+    // [MS-OGRAPH].pdf says that the data of this record is an OfficeArtFDGSL structure
+    // as described in[MS-ODRAW].pdf sec 2.2.33
+    private OfficeArtRecordHeader _header;
+    private int _cpsp;
+    /** a MSODGSLK enum value for the current selection mode */
+    private int _dgslk;
+    private int _spidFocus;
+    /** selected shape IDs (e.g. from EscherSpRecord.ShapeId) */
+    private int[] _shapeIds;
+
+    public DrawingSelectionRecord(RecordInputStream in) {
+        _header = new OfficeArtRecordHeader(in);
+        _cpsp = in.readInt();
+        _dgslk = in.readInt();
+        _spidFocus = in.readInt();
+        int nShapes = in.available() / 4;
+        int[] shapeIds = new int[nShapes];
+        for (int i = 0; i < nShapes; i++) {
+            shapeIds[i] = in.readInt();
+        }
+        _shapeIds = shapeIds;
+    }
+
+    public short getSid() {
+        return sid;
+    }
+
+    protected int getDataSize() {
+        return OfficeArtRecordHeader.ENCODED_SIZE
+            + 12 // 3 int fields
+            + _shapeIds.length * 4;
+    }
+
+    public void serialize(LittleEndianOutput out) {
+        _header.serialize(out);
+        out.writeInt(_cpsp);
+        out.writeInt(_dgslk);
+        out.writeInt(_spidFocus);
+        for (int shapeId : _shapeIds) {
+            out.writeInt(shapeId);
+        }
+    }
+
+    @Override
+    public DrawingSelectionRecord copy() {
+        // currently immutable
+        return this;
+    }
+
+    @Override
+    public HSSFRecordTypes getGenericRecordType() {
+        return HSSFRecordTypes.DRAWING_SELECTION;
+    }
+
+    @Override
+    public Map<String, Supplier<?>> getGenericProperties() {
+        return GenericRecordUtil.getGenericProperties(
+            "rh", () -> _header,
+            "cpsp", () -> _cpsp,
+            "dgslk", () -> _dgslk,
+            "spidFocus", () -> _spidFocus,
+            "shapeIds", () -> _shapeIds
+        );
+    }
 }

Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/EOFRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/EOFRecord.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/EOFRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/EOFRecord.java Sat May 22 20:56:44 2021
@@ -29,9 +29,9 @@ import org.apache.poi.util.LittleEndianO
  */
 public final class EOFRecord extends StandardRecord {
     public static final short sid = 0x0A;
-	public static final int ENCODED_SIZE = 4;
+    public static final int ENCODED_SIZE = 4;
 
-	public static final EOFRecord instance = new EOFRecord();
+    public static final EOFRecord instance = new EOFRecord();
 
     private EOFRecord() {}
 



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