record sid clean-up

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@719031 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Josh Micich 2008-11-19 19:09:05 +00:00
parent 2a7fa85dd9
commit 3673b6a984
16 changed files with 294 additions and 516 deletions

View File

@ -801,20 +801,14 @@ public final class Sheet implements Model {
* creates the Iteration record and sets it to false (don't iteratively calculate formulas) * creates the Iteration record and sets it to false (don't iteratively calculate formulas)
*/ */
private static IterationRecord createIteration() { private static IterationRecord createIteration() {
IterationRecord retval = new IterationRecord(); return new IterationRecord(false);
retval.setIteration(false);
return retval;
} }
/** /**
* creates the Delta record and sets it to 0.0010 (default accuracy) * creates the Delta record and sets it to 0.0010 (default accuracy)
*/ */
private static DeltaRecord createDelta() { private static DeltaRecord createDelta() {
DeltaRecord retval = new DeltaRecord(); return new DeltaRecord(DeltaRecord.DEFAULT_VALUE);
retval.setMaxChange(0.0010);
return retval;
} }
/** /**
@ -1412,18 +1406,6 @@ public final class Sheet implements Model {
this.selection = selection; this.selection = selection;
} }
/**
* creates a Protect record with protect set to false.
*/
private static ProtectRecord createProtect() {
if (log.check( POILogger.DEBUG )) {
log.log(POILogger.DEBUG, "create protect record with protection disabled");
}
ProtectRecord retval = new ProtectRecord();
retval.setProtect(false); // TODO - supply param to constructor
return retval;
}
/** /**
* creates an ObjectProtect record with protect set to false. * creates an ObjectProtect record with protect set to false.
*/ */
@ -1454,7 +1436,7 @@ public final class Sheet implements Model {
public ProtectRecord getProtect() public ProtectRecord getProtect()
{ {
if (protect == null) { if (protect == null) {
protect = createProtect(); protect = new ProtectRecord(false);
// Insert the newly created protect record just before DefaultColWidthRecord // Insert the newly created protect record just before DefaultColWidthRecord
int loc = findFirstRecordLocBySid(DefaultColWidthRecord.sid); int loc = findFirstRecordLocBySid(DefaultColWidthRecord.sid);
records.add(loc, protect); records.add(loc, protect);
@ -1477,16 +1459,10 @@ public final class Sheet implements Model {
} }
/** /**
* creates a Password record with password set to 00. * creates a Password record with password set to 0x0000.
*/ */
private static PasswordRecord createPassword() { private static PasswordRecord createPassword() {
if (log.check( POILogger.DEBUG )) { return new PasswordRecord(0x0000);
log.log(POILogger.DEBUG, "create password record with 00 password");
}
PasswordRecord retval = new PasswordRecord();
retval.setPassword((short)00);
return retval;
} }
/** /**

View File

@ -1092,11 +1092,7 @@ public final class Workbook implements Model {
*/ */
protected Record createDSF() { protected Record createDSF() {
DSFRecord retval = new DSFRecord(); return new DSFRecord(false); // we don't even support double stream files
retval.setDsf(
( short ) 0); // we don't even support double stream files
return retval;
} }
/** /**
@ -1125,75 +1121,42 @@ public final class Workbook implements Model {
} }
/** /**
* creates the WindowProtect record with protect set to false. * @return a new WindowProtect record with protect set to false.
* @see org.apache.poi.hssf.record.WindowProtectRecord
* @see org.apache.poi.hssf.record.Record
* @return record containing a WindowProtectRecord
*/ */
private static WindowProtectRecord createWindowProtect() {
protected Record createWindowProtect() { // by default even when we support it we won't
WindowProtectRecord retval = new WindowProtectRecord(); // want it to be protected
return new WindowProtectRecord(false);
retval.setProtect(
false); // by default even when we support it we won't
return retval; // want it to be protected
} }
/** /**
* creates the Protect record with protect set to false. * @return a new Protect record with protect set to false.
* @see org.apache.poi.hssf.record.ProtectRecord
* @see org.apache.poi.hssf.record.Record
* @return record containing a ProtectRecord
*/ */
private static ProtectRecord createProtect() {
protected Record createProtect() { // by default even when we support it we won't
ProtectRecord retval = new ProtectRecord(); // want it to be protected
return new ProtectRecord(false);
retval.setProtect(
false); // by default even when we support it we won't
return retval; // want it to be protected
} }
/** /**
* creates the Password record with password set to 0. * @return a new Password record with password set to 0x0000 (no password).
* @see org.apache.poi.hssf.record.PasswordRecord
* @see org.apache.poi.hssf.record.Record
* @return record containing a PasswordRecord
*/ */
private static PasswordRecord createPassword() {
protected Record createPassword() { return new PasswordRecord(0x0000); // no password by default!
PasswordRecord retval = new PasswordRecord();
retval.setPassword(( short ) 0); // no password by default!
return retval;
} }
/** /**
* creates the ProtectionRev4 record with protect set to false. * @return a new ProtectionRev4 record with protect set to false.
* @see org.apache.poi.hssf.record.ProtectionRev4Record
* @see org.apache.poi.hssf.record.Record
* @return record containing a ProtectionRev4Record
*/ */
private static ProtectionRev4Record createProtectionRev4() {
protected Record createProtectionRev4() { return new ProtectionRev4Record(false);
ProtectionRev4Record retval = new ProtectionRev4Record();
retval.setProtect(false);
return retval;
} }
/** /**
* creates the PasswordRev4 record with password set to 0. * @return a new PasswordRev4 record with password set to 0.
* @see org.apache.poi.hssf.record.PasswordRev4Record
* @see org.apache.poi.hssf.record.Record
* @return record containing a PasswordRev4Record
*/ */
private static PasswordRev4Record createPasswordRev4() {
protected Record createPasswordRev4() { return new PasswordRev4Record(0x0000);
PasswordRev4Record retval = new PasswordRev4Record();
retval.setPassword(( short ) 0); // no password by default!
return retval;
} }
/** /**
@ -1287,17 +1250,10 @@ public final class Workbook implements Model {
} }
/** /**
* creates the RefreshAll record with refreshAll set to true. (refresh all calcs) * @return a new RefreshAll record with refreshAll set to false. (do not refresh all calcs)
* @see org.apache.poi.hssf.record.RefreshAllRecord
* @see org.apache.poi.hssf.record.Record
* @return record containing a RefreshAllRecord
*/ */
private static RefreshAllRecord createRefreshAll() {
protected Record createRefreshAll() { return new RefreshAllRecord(false);
RefreshAllRecord retval = new RefreshAllRecord();
retval.setRefreshAll(false);
return retval;
} }
/** /**
@ -1783,17 +1739,10 @@ public final class Workbook implements Model {
} }
/** /**
* Creates the UseSelFS object with the use natural language flag set to 0 (false) * @return a new UseSelFS object with the use natural language flag set to 0 (false)
* @return record containing a UseSelFSRecord
* @see org.apache.poi.hssf.record.UseSelFSRecord
* @see org.apache.poi.hssf.record.Record
*/ */
private static UseSelFSRecord createUseSelFS() {
protected Record createUseSelFS() { return new UseSelFSRecord(false);
UseSelFSRecord retval = new UseSelFSRecord();
retval.setFlag(( short ) 0);
return retval;
} }
/** /**

View File

@ -1,4 +1,3 @@
/* ==================================================================== /* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with contributor license agreements. See the NOTICE file distributed with
@ -15,77 +14,62 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
==================================================================== */ ==================================================================== */
package org.apache.poi.hssf.record; package org.apache.poi.hssf.record;
import org.apache.poi.util.BitField;
import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.HexDump;
import org.apache.poi.util.LittleEndianOutput; import org.apache.poi.util.LittleEndianOutput;
/** /**
* Title: Double Stream Flag Record<P> * Title: Double Stream Flag Record (0x0161)<p/>
* Description: tells if this is a double stream file. (always no for HSSF generated files)<P> * Description: tells if this is a double stream file. (always no for HSSF generated files)<p/>
* Double Stream files contain both BIFF8 and BIFF7 workbooks.<P> * Double Stream files contain both BIFF8 and BIFF7 workbooks.<p/>
* REFERENCE: PG 305 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P> * REFERENCE: PG 305 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<p/>
* @author Andrew C. Oliver (acoliver at apache dot org) * @author Andrew C. Oliver (acoliver at apache dot org)
* @version 2.0-pre
*/ */
public final class DSFRecord extends StandardRecord {
public final static short sid = 0x0161;
public final class DSFRecord private static final BitField biff5BookStreamFlag = BitFieldFactory.getInstance(0x0001);
extends StandardRecord
{
public final static short sid = 0x161;
private short field_1_dsf;
public DSFRecord() private int _options;
{
private DSFRecord(int options) {
_options = options;
}
public DSFRecord(boolean isBiff5BookStreamPresent) {
this(0);
_options = biff5BookStreamFlag.setBoolean(0, isBiff5BookStreamPresent);
} }
public DSFRecord(RecordInputStream in) public DSFRecord(RecordInputStream in) {
{ this(in.readShort());
field_1_dsf = in.readShort();
} }
/** public boolean isBiff5BookStreamPresent() {
* set the DSF flag return biff5BookStreamFlag.isSet(_options);
* @param dsfflag (0-off,1-on)
*/
public void setDsf(short dsfflag)
{
field_1_dsf = dsfflag;
} }
/** public String toString() {
* get the DSF flag
* @return dsfflag (0-off,1-on)
*/
public short getDsf()
{
return field_1_dsf;
}
public String toString()
{
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append("[DSF]\n"); buffer.append("[DSF]\n");
buffer.append(" .isDSF = ") buffer.append(" .options = ").append(HexDump.shortToHex(_options)).append("\n");
.append(Integer.toHexString(getDsf())).append("\n");
buffer.append("[/DSF]\n"); buffer.append("[/DSF]\n");
return buffer.toString(); return buffer.toString();
} }
public void serialize(LittleEndianOutput out) { public void serialize(LittleEndianOutput out) {
out.writeShort(getDsf()); out.writeShort(_options);
} }
protected int getDataSize() { protected int getDataSize() {
return 2; return 2;
} }
public short getSid() public short getSid() {
{
return sid; return sid;
} }
} }

View File

@ -1,4 +1,3 @@
/* ==================================================================== /* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with contributor license agreements. See the NOTICE file distributed with
@ -15,67 +14,47 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
==================================================================== */ ==================================================================== */
package org.apache.poi.hssf.record; package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndianOutput; import org.apache.poi.util.LittleEndianOutput;
/** /**
* Title: Delta Record<P> * Title: Delta Record (0x0010)<p/>
* Description: controls the accuracy of the calculations<P> * Description: controls the accuracy of the calculations<p/>
* REFERENCE: PG 303 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P> * REFERENCE: PG 303 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<p/>
* @author Andrew C. Oliver (acoliver at apache dot org) * @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au) * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/ */
public final class DeltaRecord extends StandardRecord {
public final class DeltaRecord public final static short sid = 0x0010;
extends StandardRecord
{
public final static short sid = 0x10;
public final static double DEFAULT_VALUE = 0.0010; // should be .001 public final static double DEFAULT_VALUE = 0.0010; // should be .001
// a double is an IEEE 8-byte float...damn IEEE and their goofy standards an // a double is an IEEE 8-byte float...damn IEEE and their goofy standards an
// ambiguous numeric identifiers // ambiguous numeric identifiers
private double field_1_max_change; private double field_1_max_change;
public DeltaRecord() public DeltaRecord(double maxChange) {
{
}
public DeltaRecord(RecordInputStream in)
{
field_1_max_change = in.readDouble();
}
/**
* set the maximum change
* @param maxChange - maximum rounding error
*/
public void setMaxChange(double maxChange)
{
field_1_max_change = maxChange; field_1_max_change = maxChange;
} }
public DeltaRecord(RecordInputStream in) {
field_1_max_change = in.readDouble();
}
/** /**
* get the maximum change * get the maximum change
* @return maxChange - maximum rounding error * @return maxChange - maximum rounding error
*/ */
public double getMaxChange() {
public double getMaxChange()
{
return field_1_max_change; return field_1_max_change;
} }
public String toString() public String toString() {
{
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append("[DELTA]\n"); buffer.append("[DELTA]\n");
buffer.append(" .maxchange = ").append(getMaxChange()) buffer.append(" .maxchange = ").append(getMaxChange()).append("\n");
.append("\n");
buffer.append("[/DELTA]\n"); buffer.append("[/DELTA]\n");
return buffer.toString(); return buffer.toString();
} }
@ -88,14 +67,12 @@ public final class DeltaRecord
return 8; return 8;
} }
public short getSid() public short getSid() {
{
return sid; return sid;
} }
public Object clone() { public Object clone() {
DeltaRecord rec = new DeltaRecord(); // immutable
rec.field_1_max_change = field_1_max_change; return this;
return rec;
} }
} }

View File

@ -24,14 +24,16 @@ import org.apache.poi.util.StringUtil;
import org.apache.poi.util.HexDump; import org.apache.poi.util.HexDump;
/** /**
* The <code>HyperlinkRecord</code> wraps an HLINK-record * The <code>HyperlinkRecord</code> (0x01B8) wraps an HLINK-record
* from the Excel-97 format. * from the Excel-97 format.
* Supports only external links for now (eg http://) * Supports only external links for now (eg http://)
* *
* @author Mark Hissink Muller <a href="mailto:mark@hissinkmuller.nl >mark&064;hissinkmuller.nl</a> * @author Mark Hissink Muller <a href="mailto:mark@hissinkmuller.nl >mark&064;hissinkmuller.nl</a>
* @author Yegor Kozlov (yegor at apache dot org) * @author Yegor Kozlov (yegor at apache dot org)
*/ */
public final class HyperlinkRecord extends Record { public final class HyperlinkRecord extends Record {
public final static short sid = 0x01B8;
/** /**
* Link flags * Link flags
*/ */
@ -60,7 +62,6 @@ public final class HyperlinkRecord extends Record {
protected final static byte[] FILE_TAIL = {(byte)0xFF, (byte)0xFF, (byte)0xAD, (byte)0xDE, 0x00, 0x00, 0x00, 0x00, protected final static byte[] FILE_TAIL = {(byte)0xFF, (byte)0xFF, (byte)0xAD, (byte)0xDE, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
public final static short sid = 0x1b8;
/** /**
* First row of the hyperlink * First row of the hyperlink
@ -238,8 +239,8 @@ public final class HyperlinkRecord extends Record {
*/ */
public String getLabel() public String getLabel()
{ {
if(label == null) return null; if(label == null) return null;
int idx = label.indexOf('\u0000'); int idx = label.indexOf('\u0000');
return idx == -1 ? label : label.substring(0, idx); return idx == -1 ? label : label.substring(0, idx);
} }
@ -261,8 +262,8 @@ public final class HyperlinkRecord extends Record {
*/ */
public String getAddress() public String getAddress()
{ {
if(address == null) return null; if(address == null) return null;
int idx = address.indexOf('\u0000'); int idx = address.indexOf('\u0000');
return idx == -1 ? address : address.substring(0, idx); return idx == -1 ? address : address.substring(0, idx);
} }
@ -402,7 +403,7 @@ public final class HyperlinkRecord extends Record {
LittleEndian.putInt(data, pos, address.length()); pos += 4; LittleEndian.putInt(data, pos, address.length()); pos += 4;
StringUtil.putUnicodeLE(address, data, pos); pos += address.length()*2; StringUtil.putUnicodeLE(address, data, pos); pos += address.length()*2;
} }
return getRecordSize(); return getRecordSize();
} }
protected int getDataSize() { protected int getDataSize() {

View File

@ -1,4 +1,3 @@
/* ==================================================================== /* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with contributor license agreements. See the NOTICE file distributed with
@ -15,54 +14,46 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
==================================================================== */ ==================================================================== */
package org.apache.poi.hssf.record; package org.apache.poi.hssf.record;
import org.apache.poi.util.BitField;
import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.HexDump;
import org.apache.poi.util.LittleEndianOutput; import org.apache.poi.util.LittleEndianOutput;
/** /**
* Title: Iteration Record<P> * Title: Iteration Record (0x0011) <p/>
* Description: Tells whether to iterate over forumla calculations or not * Description: Tells whether to iterate over forumla calculations or not
* (if a formula is dependant upon another formula's result) * (if a formula is dependant upon another formula's result)
* (odd feature for something that can only have 32 elements in * (odd feature for something that can only have 32 elements in
* a formula!)<P> * a formula!)<P>
* REFERENCE: PG 325 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P> * REFERENCE: PG 325 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<p/>
* @author Andrew C. Oliver (acoliver at apache dot org) * @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au) * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/ */
public final class IterationRecord extends StandardRecord {
public final static short sid = 0x0011;
public final class IterationRecord private static final BitField iterationOn = BitFieldFactory.getInstance(0x0001);
extends StandardRecord
{
public final static short sid = 0x11;
private short field_1_iteration;
public IterationRecord() private int _flags;
{
public IterationRecord(boolean iterateOn) {
_flags = iterationOn.setBoolean(0, iterateOn);
} }
public IterationRecord(RecordInputStream in) public IterationRecord(RecordInputStream in)
{ {
field_1_iteration = in.readShort(); _flags = in.readShort();
} }
/** /**
* set whether or not to iterate for calculations * set whether or not to iterate for calculations
* @param iterate or not * @param iterate or not
*/ */
public void setIteration(boolean iterate) {
public void setIteration(boolean iterate) _flags = iterationOn.setBoolean(_flags, iterate);
{
if (iterate)
{
field_1_iteration = 1;
}
else
{
field_1_iteration = 0;
}
} }
/** /**
@ -70,39 +61,32 @@ public final class IterationRecord
* *
* @return whether iterative calculations are turned off or on * @return whether iterative calculations are turned off or on
*/ */
public boolean getIteration() {
public boolean getIteration() return iterationOn.isSet(_flags);
{
return (field_1_iteration == 1);
} }
public String toString() public String toString() {
{
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append("[ITERATION]\n"); buffer.append("[ITERATION]\n");
buffer.append(" .iteration = ").append(getIteration()) buffer.append(" .flags = ").append(HexDump.shortToHex(_flags)).append("\n");
.append("\n");
buffer.append("[/ITERATION]\n"); buffer.append("[/ITERATION]\n");
return buffer.toString(); return buffer.toString();
} }
public void serialize(LittleEndianOutput out) { public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_iteration); out.writeShort(_flags);
} }
protected int getDataSize() { protected int getDataSize() {
return 2; return 2;
} }
public short getSid() public short getSid() {
{
return sid; return sid;
} }
public Object clone() { public Object clone() {
IterationRecord rec = new IterationRecord(); return new IterationRecord(getIteration());
rec.field_1_iteration = field_1_iteration;
return rec;
} }
} }

View File

@ -1,4 +1,3 @@
/* ==================================================================== /* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with contributor license agreements. See the NOTICE file distributed with
@ -15,25 +14,25 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
==================================================================== */ ==================================================================== */
package org.apache.poi.hssf.record; package org.apache.poi.hssf.record;
import org.apache.poi.util.HexDump;
import org.apache.poi.util.LittleEndianOutput; import org.apache.poi.util.LittleEndianOutput;
/** /**
* Title: Password Record<P> * Title: Password Record (0x0013)<p/>
* Description: stores the encrypted password for a sheet or workbook (HSSF doesn't support encryption) * Description: stores the encrypted password for a sheet or workbook (HSSF doesn't support encryption)
* REFERENCE: PG 371 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P> * REFERENCE: PG 371 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<p/>
* @author Andrew C. Oliver (acoliver at apache dot org) * @author Andrew C. Oliver (acoliver at apache dot org)
* @version 2.0-pre *
*/ */
public final class PasswordRecord extends StandardRecord { public final class PasswordRecord extends StandardRecord {
public final static short sid = 0x13; public final static short sid = 0x0013;
private short field_1_password; // not sure why this is only 2 bytes, but it is... go figure private int field_1_password; // not sure why this is only 2 bytes, but it is... go figure
public PasswordRecord() { public PasswordRecord(int password) {
field_1_password = password;
} }
public PasswordRecord(RecordInputStream in) { public PasswordRecord(RecordInputStream in) {
@ -57,7 +56,7 @@ public final class PasswordRecord extends StandardRecord {
hash ^= (0x8000 | ('N' << 8) | 'K'); hash ^= (0x8000 | ('N' << 8) | 'K');
} }
return (short)hash; return (short)hash;
} }
/** /**
* set the password * set the password
@ -65,7 +64,7 @@ public final class PasswordRecord extends StandardRecord {
* @param password representing the password * @param password representing the password
*/ */
public void setPassword(short password) { public void setPassword(int password) {
field_1_password = password; field_1_password = password;
} }
@ -74,7 +73,7 @@ public final class PasswordRecord extends StandardRecord {
* *
* @return short representing the password * @return short representing the password
*/ */
public short getPassword() { public int getPassword() {
return field_1_password; return field_1_password;
} }
@ -82,14 +81,13 @@ public final class PasswordRecord extends StandardRecord {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append("[PASSWORD]\n"); buffer.append("[PASSWORD]\n");
buffer.append(" .password = ") buffer.append(" .password = ").append(HexDump.shortToHex(field_1_password)).append("\n");
.append(Integer.toHexString(getPassword())).append("\n");
buffer.append("[/PASSWORD]\n"); buffer.append("[/PASSWORD]\n");
return buffer.toString(); return buffer.toString();
} }
public void serialize(LittleEndianOutput out) { public void serialize(LittleEndianOutput out) {
out.writeShort(getPassword()); out.writeShort(field_1_password);
} }
protected int getDataSize() { protected int getDataSize() {
@ -104,9 +102,6 @@ public final class PasswordRecord extends StandardRecord {
* Clone this record. * Clone this record.
*/ */
public Object clone() { public Object clone() {
PasswordRecord clone = new PasswordRecord(); return new PasswordRecord(field_1_password);
clone.setPassword(field_1_password);
return clone;
} }
} }

View File

@ -1,4 +1,3 @@
/* ==================================================================== /* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with contributor license agreements. See the NOTICE file distributed with
@ -15,33 +14,27 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
==================================================================== */ ==================================================================== */
package org.apache.poi.hssf.record; package org.apache.poi.hssf.record;
import org.apache.poi.util.HexDump;
import org.apache.poi.util.LittleEndianOutput; import org.apache.poi.util.LittleEndianOutput;
/** /**
* Title: Protection Revision 4 password Record<P> * Title: Protection Revision 4 password Record (0x01BC) <p/>
* Description: Stores the (2 byte??!!) encrypted password for a shared * Description: Stores the (2 byte??!!) encrypted password for a shared workbook<p/>
* workbook<P> * REFERENCE: PG 374 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<p/>
* REFERENCE: PG 374 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org) * @author Andrew C. Oliver (acoliver at apache dot org)
* @version 2.0-pre
*/ */
public final class PasswordRev4Record extends StandardRecord {
public final static short sid = 0x01BC;
private int field_1_password;
public final class PasswordRev4Record public PasswordRev4Record(int pw) {
extends StandardRecord field_1_password = pw;
{
public final static short sid = 0x1BC;
private short field_1_password;
public PasswordRev4Record()
{
} }
public PasswordRev4Record(RecordInputStream in) public PasswordRev4Record(RecordInputStream in) {
{
field_1_password = in.readShort(); field_1_password = in.readShort();
} }
@ -50,44 +43,28 @@ public final class PasswordRev4Record
* *
* @param pw representing the password * @param pw representing the password
*/ */
public void setPassword(short pw) {
public void setPassword(short pw)
{
field_1_password = pw; field_1_password = pw;
} }
/** public String toString() {
* get the password
*
* @return short representing the password
*/
public short getPassword()
{
return field_1_password;
}
public String toString()
{
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append("[PROT4REVPASSWORD]\n"); buffer.append("[PROT4REVPASSWORD]\n");
buffer.append(" .password = ") buffer.append(" .password = ").append(HexDump.shortToHex(field_1_password)).append("\n");
.append(Integer.toHexString(getPassword())).append("\n");
buffer.append("[/PROT4REVPASSWORD]\n"); buffer.append("[/PROT4REVPASSWORD]\n");
return buffer.toString(); return buffer.toString();
} }
public void serialize(LittleEndianOutput out) { public void serialize(LittleEndianOutput out) {
out.writeShort(getPassword()); out.writeShort(field_1_password);
} }
protected int getDataSize() { protected int getDataSize() {
return 2; return 2;
} }
public short getSid() public short getSid() {
{
return sid; return sid;
} }
} }

View File

@ -1,4 +1,3 @@
/* ==================================================================== /* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with contributor license agreements. See the NOTICE file distributed with
@ -15,92 +14,80 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
==================================================================== */ ==================================================================== */
package org.apache.poi.hssf.record; package org.apache.poi.hssf.record;
import org.apache.poi.util.BitField;
import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.HexDump;
import org.apache.poi.util.LittleEndianOutput; import org.apache.poi.util.LittleEndianOutput;
/** /**
* Title: Protect Record<P> * Title: Protect Record (0x0012) <p/>
* Description: defines whether a sheet or workbook is protected (HSSF DOES NOT SUPPORT ENCRYPTION)<P> * Description: defines whether a sheet or workbook is protected (HSSF DOES NOT SUPPORT ENCRYPTION)<p/>
* (kindly ask the US government to stop having arcane stupid encryption laws and we'll support it) <P>
* (after all terrorists will all use US-legal encrypton right??)<P>
* HSSF now supports the simple "protected" sheets (where they are not encrypted and open office et al * HSSF now supports the simple "protected" sheets (where they are not encrypted and open office et al
* ignore the password record entirely). * ignore the password record entirely).
* REFERENCE: PG 373 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P> * REFERENCE: PG 373 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<p/>
* @author Andrew C. Oliver (acoliver at apache dot org) * @author Andrew C. Oliver (acoliver at apache dot org)
*/ */
public final class ProtectRecord extends StandardRecord {
public final static short sid = 0x0012;
public final class ProtectRecord private static final BitField protectFlag = BitFieldFactory.getInstance(0x0001);
extends StandardRecord
{
public final static short sid = 0x12;
private short field_1_protect;
public ProtectRecord() private int _options;
{
private ProtectRecord(int options) {
_options = options;
} }
public ProtectRecord(RecordInputStream in) public ProtectRecord(boolean isProtected) {
{ this(0);
field_1_protect = in.readShort(); setProtect(isProtected);
}
public ProtectRecord(RecordInputStream in) {
this(in.readShort());
} }
/** /**
* set whether the sheet is protected or not * set whether the sheet is protected or not
* @param protect whether to protect the sheet or not * @param protect whether to protect the sheet or not
*/ */
public void setProtect(boolean protect) {
public void setProtect(boolean protect) _options = protectFlag.setBoolean(_options, protect);
{
if (protect)
{
field_1_protect = 1;
}
else
{
field_1_protect = 0;
}
} }
/** /**
* get whether the sheet is protected or not * get whether the sheet is protected or not
* @return whether to protect the sheet or not * @return whether to protect the sheet or not
*/ */
public boolean getProtect() {
public boolean getProtect() return protectFlag.isSet(_options);
{
return (field_1_protect == 1);
} }
public String toString() public String toString() {
{
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append("[PROTECT]\n"); buffer.append("[PROTECT]\n");
buffer.append(" .protect = ").append(getProtect()) buffer.append(" .options = ").append(HexDump.shortToHex(_options)).append("\n");
.append("\n");
buffer.append("[/PROTECT]\n"); buffer.append("[/PROTECT]\n");
return buffer.toString(); return buffer.toString();
} }
public void serialize(LittleEndianOutput out) { public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_protect); out.writeShort(_options);
} }
protected int getDataSize() { protected int getDataSize() {
return 2; return 2;
} }
public short getSid() public short getSid() {
{
return sid; return sid;
} }
public Object clone() { public Object clone() {
ProtectRecord rec = new ProtectRecord(); return new ProtectRecord(_options);
rec.field_1_protect = field_1_protect;
return rec;
} }
} }

View File

@ -1,4 +1,3 @@
/* ==================================================================== /* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with contributor license agreements. See the NOTICE file distributed with
@ -15,84 +14,74 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
==================================================================== */ ==================================================================== */
package org.apache.poi.hssf.record; package org.apache.poi.hssf.record;
import org.apache.poi.util.BitField;
import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.HexDump;
import org.apache.poi.util.LittleEndianOutput; import org.apache.poi.util.LittleEndianOutput;
/** /**
* Title: Protection Revision 4 Record<P> * Title: Protection Revision 4 Record (0x01AF) <p/>
* Description: describes whether this is a protected shared/tracked workbook<P> * Description: describes whether this is a protected shared/tracked workbook<p/>
* ( HSSF does not support encryption because we don't feel like going to jail ) <P> * REFERENCE: PG 373 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<p/>
* REFERENCE: PG 373 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org) * @author Andrew C. Oliver (acoliver at apache dot org)
* @version 2.0-pre
*/ */
public final class ProtectionRev4Record extends StandardRecord {
public final static short sid = 0x01AF;
public final class ProtectionRev4Record private static final BitField protectedFlag = BitFieldFactory.getInstance(0x0001);
extends StandardRecord
{
public final static short sid = 0x1af;
private short field_1_protect;
public ProtectionRev4Record() private int _options;
{
private ProtectionRev4Record(int options) {
_options = options;
} }
public ProtectionRev4Record(RecordInputStream in) public ProtectionRev4Record(boolean protect) {
{ this(0);
field_1_protect = in.readShort(); setProtect(protect);
}
public ProtectionRev4Record(RecordInputStream in) {
this(in.readUShort());
} }
/** /**
* set whether the this is protected shared/tracked workbook or not * set whether the this is protected shared/tracked workbook or not
* @param protect whether to protect the workbook or not * @param protect whether to protect the workbook or not
*/ */
public void setProtect(boolean protect) {
public void setProtect(boolean protect) _options = protectedFlag.setBoolean(_options, protect);
{
if (protect)
{
field_1_protect = 1;
}
else
{
field_1_protect = 0;
}
} }
/** /**
* get whether the this is protected shared/tracked workbook or not * get whether the this is protected shared/tracked workbook or not
* @return whether to protect the workbook or not * @return whether to protect the workbook or not
*/ */
public boolean getProtect() {
return protectedFlag.isSet(_options);
}
public boolean getProtect() public String toString() {
{
return (field_1_protect == 1);
}
public String toString()
{
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append("[PROT4REV]\n"); buffer.append("[PROT4REV]\n");
buffer.append(" .protect = ").append(getProtect()) buffer.append(" .options = ").append(HexDump.shortToHex(_options)).append("\n");
.append("\n");
buffer.append("[/PROT4REV]\n"); buffer.append("[/PROT4REV]\n");
return buffer.toString(); return buffer.toString();
} }
public void serialize(LittleEndianOutput out) { public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_protect); out.writeShort(_options);
} }
protected int getDataSize() { protected int getDataSize() {
return 2; return 2;
} }
public short getSid() public short getSid() {
{
return sid; return sid;
} }
} }

View File

@ -1,4 +1,3 @@
/* ==================================================================== /* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with contributor license agreements. See the NOTICE file distributed with
@ -15,84 +14,79 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
==================================================================== */ ==================================================================== */
package org.apache.poi.hssf.record; package org.apache.poi.hssf.record;
import org.apache.poi.util.BitField;
import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.HexDump;
import org.apache.poi.util.LittleEndianOutput; import org.apache.poi.util.LittleEndianOutput;
/** /**
* Title: Refresh All Record <P> * Title: Refresh All Record (0x01B7) <p/>
* Description: Flag whether to refresh all external data when loading a sheet. * Description: Flag whether to refresh all external data when loading a sheet.
* (which hssf doesn't support anyhow so who really cares?)<P> * (which hssf doesn't support anyhow so who really cares?)<P>
* REFERENCE: PG 376 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P> * REFERENCE: PG 376 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org) * @author Andrew C. Oliver (acoliver at apache dot org)
* @version 2.0-pre
*/ */
public final class RefreshAllRecord extends StandardRecord {
public final static short sid = 0x01B7;
public final class RefreshAllRecord private static final BitField refreshFlag = BitFieldFactory.getInstance(0x0001);
extends StandardRecord
{
public final static short sid = 0x1B7;
private short field_1_refreshall;
public RefreshAllRecord() private int _options;
{
private RefreshAllRecord(int options) {
_options = options;
} }
public RefreshAllRecord(RecordInputStream in) public RefreshAllRecord(RecordInputStream in) {
{ this(in.readUShort());
field_1_refreshall = in.readShort(); }
public RefreshAllRecord(boolean refreshAll) {
this(0);
setRefreshAll(refreshAll);
} }
/** /**
* set whether to refresh all external data when loading a sheet * set whether to refresh all external data when loading a sheet
* @param refreshall or not * @param refreshAll or not
*/ */
public void setRefreshAll(boolean refreshAll) {
public void setRefreshAll(boolean refreshall) _options = refreshFlag.setBoolean(_options, refreshAll);
{
if (refreshall)
{
field_1_refreshall = 1;
}
else
{
field_1_refreshall = 0;
}
} }
/** /**
* get whether to refresh all external data when loading a sheet * get whether to refresh all external data when loading a sheet
* @return refreshall or not * @return refreshall or not
*/ */
public boolean getRefreshAll() {
public boolean getRefreshAll() return refreshFlag.isSet(_options);
{
return (field_1_refreshall == 1);
} }
public String toString() public String toString() {
{
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append("[REFRESHALL]\n"); buffer.append("[REFRESHALL]\n");
buffer.append(" .refreshall = ").append(getRefreshAll()) buffer.append(" .options = ").append(HexDump.shortToHex(_options)).append("\n");
.append("\n");
buffer.append("[/REFRESHALL]\n"); buffer.append("[/REFRESHALL]\n");
return buffer.toString(); return buffer.toString();
} }
public void serialize(LittleEndianOutput out) { public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_refreshall); out.writeShort(_options);
} }
protected int getDataSize() { protected int getDataSize() {
return 2; return 2;
} }
public short getSid() public short getSid() {
{
return sid; return sid;
} }
@Override
public Object clone() {
return new RefreshAllRecord(_options);
}
} }

View File

@ -28,20 +28,20 @@ import org.apache.poi.util.LittleEndianOutput;
* *
*/ */
public final class TabIdRecord extends StandardRecord { public final class TabIdRecord extends StandardRecord {
public final static short sid = 0x13d; public final static short sid = 0x013D;
private static final short[] EMPTY_SHORT_ARRAY = { }; private static final short[] EMPTY_SHORT_ARRAY = { };
public short[] _tabids; public short[] _tabids;
public TabIdRecord() { public TabIdRecord() {
_tabids = EMPTY_SHORT_ARRAY; _tabids = EMPTY_SHORT_ARRAY;
} }
public TabIdRecord(RecordInputStream in) { public TabIdRecord(RecordInputStream in) {
int nTabs = in.remaining() / 2; int nTabs = in.remaining() / 2;
_tabids = new short[nTabs]; _tabids = new short[nTabs];
for (int k = 0; k < _tabids.length; k++) { for (int i = 0; i < _tabids.length; i++) {
_tabids[ k ] = in.readShort(); _tabids[i] = in.readShort();
} }
} }
@ -58,9 +58,8 @@ public final class TabIdRecord extends StandardRecord {
buffer.append("[TABID]\n"); buffer.append("[TABID]\n");
buffer.append(" .elements = ").append(_tabids.length).append("\n"); buffer.append(" .elements = ").append(_tabids.length).append("\n");
for (int k = 0; k < _tabids.length; k++) for (int i = 0; i < _tabids.length; i++) {
{ buffer.append(" .element_").append(i).append(" = ").append(_tabids[i]).append("\n");
buffer.append(" .element_").append(k).append(" = ").append(_tabids[ k ]).append("\n");
} }
buffer.append("[/TABID]\n"); buffer.append("[/TABID]\n");
return buffer.toString(); return buffer.toString();
@ -69,8 +68,8 @@ public final class TabIdRecord extends StandardRecord {
public void serialize(LittleEndianOutput out) { public void serialize(LittleEndianOutput out) {
short[] tabids = _tabids; short[] tabids = _tabids;
for (int k = 0; k < tabids.length; k++) { for (int i = 0; i < tabids.length; i++) {
out.writeShort(tabids[ k ]); out.writeShort(tabids[i]);
} }
} }

View File

@ -1,4 +1,3 @@
/* ==================================================================== /* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with contributor license agreements. See the NOTICE file distributed with
@ -15,85 +14,64 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
==================================================================== */ ==================================================================== */
package org.apache.poi.hssf.record; package org.apache.poi.hssf.record;
import org.apache.poi.util.BitField;
import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.HexDump;
import org.apache.poi.util.LittleEndianOutput; import org.apache.poi.util.LittleEndianOutput;
/** /**
* Title: Use Natural Language Formulas Flag<P> * Title: USESELFS (0x0160) - Use Natural Language Formulas Flag <p/>
* Description: Tells the GUI if this was written by something that can use * Description: Tells the GUI if this was written by something that can use
* "natural language" formulas. HSSF can't.<P> * "natural language" formulas. HSSF can't.<p/>
* REFERENCE: PG 420 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P> * REFERENCE: PG 420 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<p/>
* @author Andrew C. Oliver (acoliver at apache dot org) * @author Andrew C. Oliver (acoliver at apache dot org)
* @version 2.0-pre
*/ */
public final class UseSelFSRecord extends StandardRecord {
public final static short sid = 0x0160;
public final class UseSelFSRecord private static final BitField useNaturalLanguageFormulasFlag = BitFieldFactory.getInstance(0x0001);
extends StandardRecord
{
public final static short sid = 0x160;
public final static short TRUE = 1;
public final static short FALSE = 0;
private short field_1_flag;
public UseSelFSRecord() private int _options;
{
private UseSelFSRecord(int options) {
_options = options;
} }
public UseSelFSRecord(RecordInputStream in) public UseSelFSRecord(RecordInputStream in) {
{ this(in.readUShort());
field_1_flag = in.readShort();
} }
/** public UseSelFSRecord(boolean b) {
* turn the flag on or off this(0);
* _options = useNaturalLanguageFormulasFlag.setBoolean(_options, b);
* @param flag whether to use natural language formulas or not
* @see #TRUE
* @see #FALSE
*/
public void setFlag(short flag)
{
field_1_flag = flag;
} }
/** public String toString() {
* returns whether we use natural language formulas or not
*
* @return whether to use natural language formulas or not
* @see #TRUE
* @see #FALSE
*/
public short getFlag()
{
return field_1_flag;
}
public String toString()
{
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append("[USESELFS]\n"); buffer.append("[USESELFS]\n");
buffer.append(" .flag = ") buffer.append(" .options = ").append(HexDump.shortToHex(_options)).append("\n");
.append(Integer.toHexString(getFlag())).append("\n");
buffer.append("[/USESELFS]\n"); buffer.append("[/USESELFS]\n");
return buffer.toString(); return buffer.toString();
} }
public void serialize(LittleEndianOutput out) { public void serialize(LittleEndianOutput out) {
out.writeShort(getFlag()); out.writeShort(_options);
} }
protected int getDataSize() { protected int getDataSize() {
return 2; return 2;
} }
public short getSid() public short getSid() {
{
return sid; return sid;
} }
@Override
public Object clone() {
return new UseSelFSRecord(_options);
}
} }

View File

@ -1,4 +1,3 @@
/* ==================================================================== /* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with contributor license agreements. See the NOTICE file distributed with
@ -15,50 +14,46 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
==================================================================== */ ==================================================================== */
package org.apache.poi.hssf.record; package org.apache.poi.hssf.record;
import org.apache.poi.util.BitField;
import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.HexDump;
import org.apache.poi.util.LittleEndianOutput; import org.apache.poi.util.LittleEndianOutput;
/** /**
* Title: Window Protect Record<P> * Title: Window Protect Record (0x0019) <p/>
* Description: flags whether workbook windows are protected<P> * Description: flags whether workbook windows are protected<p/>
* REFERENCE: PG 424 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P> * REFERENCE: PG 424 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<p/>
* @author Andrew C. Oliver (acoliver at apache dot org) * @author Andrew C. Oliver (acoliver at apache dot org)
* @version 2.0-pre
*/ */
public final class WindowProtectRecord extends StandardRecord {
public final static short sid = 0x0019;
public final class WindowProtectRecord private static final BitField settingsProtectedFlag = BitFieldFactory.getInstance(0x0001);
extends StandardRecord
{
public final static short sid = 0x19;
private short field_1_protect;
public WindowProtectRecord() private int _options;
{
public WindowProtectRecord(int options) {
_options = options;
} }
public WindowProtectRecord(RecordInputStream in) public WindowProtectRecord(RecordInputStream in) {
{ this(in.readUShort());
field_1_protect = in.readShort(); }
public WindowProtectRecord(boolean protect) {
this(0);
setProtect(protect);
} }
/** /**
* set whether this window should be protected or not * set whether this window should be protected or not
* @param protect or not * @param protect or not
*/ */
public void setProtect(boolean protect) {
public void setProtect(boolean protect) _options = settingsProtectedFlag.setBoolean(_options, protect);
{
if (protect == true)
{
field_1_protect = 1;
}
else
{
field_1_protect = 0;
}
} }
/** /**
@ -66,25 +61,21 @@ public final class WindowProtectRecord
* *
* @return protected or not * @return protected or not
*/ */
public boolean getProtect() {
public boolean getProtect() return settingsProtectedFlag.isSet(_options);
{
return (field_1_protect == 1);
} }
public String toString() public String toString() {
{
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append("[WINDOWPROTECT]\n"); buffer.append("[WINDOWPROTECT]\n");
buffer.append(" .protect = ").append(getProtect()) buffer.append(" .options = ").append(HexDump.shortToHex(_options)).append("\n");
.append("\n");
buffer.append("[/WINDOWPROTECT]\n"); buffer.append("[/WINDOWPROTECT]\n");
return buffer.toString(); return buffer.toString();
} }
public void serialize(LittleEndianOutput out) { public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_protect); out.writeShort(_options);
} }
protected int getDataSize() { protected int getDataSize() {
@ -95,4 +86,8 @@ public final class WindowProtectRecord
{ {
return sid; return sid;
} }
@Override
public Object clone() {
return new WindowProtectRecord(_options);
}
} }

View File

@ -1004,7 +1004,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* @return hashed password * @return hashed password
*/ */
public short getPassword() { public short getPassword() {
return getSheet().getPassword().getPassword(); return (short)getSheet().getPassword().getPassword();
} }
/** /**

View File

@ -108,7 +108,7 @@ public final class HSSFChart {
// unknown 33 // unknown 33
records.add( createFontBasisRecord1() ); records.add( createFontBasisRecord1() );
records.add( createFontBasisRecord2() ); records.add( createFontBasisRecord2() );
records.add( createProtectRecord() ); records.add(new ProtectRecord(false));
records.add( createUnitsRecord() ); records.add( createUnitsRecord() );
records.add( createChartRecord( 0, 0, 30434904, 19031616 ) ); records.add( createChartRecord( 0, 0, 30434904, 19031616 ) );
records.add( createBeginRecord() ); records.add( createBeginRecord() );
@ -333,13 +333,6 @@ public final class HSSFChart {
return r; return r;
} }
private ProtectRecord createProtectRecord()
{
ProtectRecord r = new ProtectRecord();
r.setProtect(false);
return r;
}
private BOFRecord createBOFRecord() private BOFRecord createBOFRecord()
{ {
BOFRecord r = new BOFRecord(); BOFRecord r = new BOFRecord();