Update FtrHeader and CFHeader clone/create

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1690500 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2015-07-12 18:16:13 +00:00
parent 13144e3301
commit 7359be141e
3 changed files with 13 additions and 14 deletions

View File

@ -38,6 +38,7 @@ public class CFHeaderRecord extends StandardRecord {
/** Creates new CFHeaderRecord */
public CFHeaderRecord() {
field_3_enclosing_cell_range = new CellRangeAddress(0, 0, 0, 0);
field_4_cell_ranges = new CellRangeAddressList();
}
public CFHeaderRecord(CellRangeAddress[] regions, int nRules) {
@ -158,7 +159,7 @@ public class CFHeaderRecord extends StandardRecord {
CFHeaderRecord result = new CFHeaderRecord();
result.field_1_numcf = field_1_numcf;
result.field_2_need_recalculation_and_id = field_2_need_recalculation_and_id;
result.field_3_enclosing_cell_range = field_3_enclosing_cell_range;
result.field_3_enclosing_cell_range = field_3_enclosing_cell_range.copy();
result.field_4_cell_ranges = field_4_cell_ranges.copy();
return result;
}

View File

@ -18,6 +18,7 @@
package org.apache.poi.hssf.record.common;
import org.apache.poi.hssf.record.RecordInputStream;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.util.LittleEndianOutput;
/**
@ -32,19 +33,18 @@ public final class FtrHeader {
private short recordType;
/** This is a FrtFlags */
private short grbitFrt;
/** MUST be 8 bytes and all zero TODO Correct this! */
private byte[] reserved;
/** The range of cells the parent record applies to, or 0 if N/A */
private CellRangeAddress associatedRange;
public FtrHeader() {
reserved = new byte[8];
associatedRange = new CellRangeAddress(0, 0, 0, 0);
}
public FtrHeader(RecordInputStream in) {
recordType = in.readShort();
grbitFrt = in.readShort();
reserved = new byte[8];
in.read(reserved, 0, 8);
associatedRange = new CellRangeAddress(in);
}
public String toString() {
@ -59,7 +59,7 @@ public final class FtrHeader {
public void serialize(LittleEndianOutput out) {
out.writeShort(recordType);
out.writeShort(grbitFrt);
out.write(reserved);
associatedRange.serialize(out);
}
public static int getDataSize() {
@ -80,18 +80,18 @@ public final class FtrHeader {
this.grbitFrt = grbitFrt;
}
public byte[] getReserved() {
return reserved;
public CellRangeAddress getAssociatedRange() {
return associatedRange;
}
public void setReserved(byte[] reserved) {
this.reserved = reserved;
public void setAssociatedRange(CellRangeAddress associatedRange) {
this.associatedRange = associatedRange;
}
public Object clone() {
FtrHeader result = new FtrHeader();
result.recordType = recordType;
result.grbitFrt = grbitFrt;
result.reserved = reserved;
result.associatedRange = associatedRange.copy();
return result;
}
}

View File

@ -24,8 +24,6 @@ import org.apache.poi.ss.SpreadsheetVersion;
* See OOO documentation: excelfileformat.pdf sec 2.5.14 - 'Cell Range Address'<p/>
*
* Common subclass of 8-bit and 16-bit versions
*
* @author Josh Micich
*/
public abstract class CellRangeAddressBase {