Merged revisions 700280,700304,700327,700356 via svnmerge from

https://svn.apache.org/repos/asf/poi/trunk

........
  r700280 | josh | 2008-09-29 15:04:20 -0700 (Mon, 29 Sep 2008) | 1 line
  
  Fix for bug 45876 - allowed BoundSheetRecord to take sheet names longer than 31 chars
........
  r700304 | josh | 2008-09-29 16:12:53 -0700 (Mon, 29 Sep 2008) | 1 line
  
  Updated formula evaluator documentation due to bugzilla 45768
........
  r700327 | josh | 2008-09-29 19:30:53 -0700 (Mon, 29 Sep 2008) | 1 line
  
  Removed validateSid method from Record classes
........
  r700356 | josh | 2008-09-29 23:18:44 -0700 (Mon, 29 Sep 2008) | 1 line
  
  Refactored fillFields() method into constructor in Record class hierarchy
........


git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@700359 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Josh Micich 2008-09-30 06:42:27 +00:00
parent fad1570e1f
commit 57e7f5f10f
213 changed files with 303 additions and 4061 deletions

View File

@ -67,6 +67,7 @@
<action dev="POI-DEVELOPERS" type="add">Created a common interface for handling Excel files, irrespective of if they are .xls or .xlsx</action>
</release>
<release version="3.2-alpha1" date="2008-??-??">
<action dev="POI-DEVELOPERS" type="fix">45876 - fixed BoundSheetRecord to allow sheet names longer than 31 chars</action>
<action dev="POI-DEVELOPERS" type="add">45890 - fixed HSSFSheet.shiftRows to also update conditional formats</action>
<action dev="POI-DEVELOPERS" type="add">45865 modified Formula Parser/Evaluator to handle cross-worksheet formulas</action>
<action dev="POI-DEVELOPERS" type="add">Optimised the FormulaEvaluator to take cell dependencies into account</action>

View File

@ -64,6 +64,7 @@
<action dev="POI-DEVELOPERS" type="add">Created a common interface for handling Excel files, irrespective of if they are .xls or .xlsx</action>
</release>
<release version="3.2-alpha1" date="2008-??-??">
<action dev="POI-DEVELOPERS" type="fix">45876 - fixed BoundSheetRecord to allow sheet names longer than 31 chars</action>
<action dev="POI-DEVELOPERS" type="add">45890 - fixed HSSFSheet.shiftRows to also update conditional formats</action>
<action dev="POI-DEVELOPERS" type="add">45865 modified Formula Parser/Evaluator to handle cross-worksheet formulas</action>
<action dev="POI-DEVELOPERS" type="add">Optimised the FormulaEvaluator to take cell dependencies into account</action>

View File

@ -18,7 +18,6 @@
package org.apache.poi.hssf.eventusermodel.dummyrecord;
import org.apache.poi.hssf.record.Record;
import org.apache.poi.hssf.record.RecordInputStream;
/**
* A dummy record to indicate that we've now had the last
@ -47,15 +46,10 @@ public class LastCellOfRowDummyRecord extends Record {
*/
public int getLastColumnNumber() { return lastColumnNumber; }
protected void fillFields(RecordInputStream in) {
}
public short getSid() {
return -1;
}
public int serialize(int offset, byte[] data) {
return -1;
}
protected void validateSid(short id) {
}
}

View File

@ -18,7 +18,6 @@
package org.apache.poi.hssf.eventusermodel.dummyrecord;
import org.apache.poi.hssf.record.Record;
import org.apache.poi.hssf.record.RecordInputStream;
/**
* A dummy record for when we're missing a cell in a row,
@ -33,16 +32,12 @@ public class MissingCellDummyRecord extends Record {
this.column = column;
}
protected void fillFields(RecordInputStream in) {
}
public short getSid() {
return -1;
}
public int serialize(int offset, byte[] data) {
return -1;
}
protected void validateSid(short id) {
}
public int getRow() { return row; }
public int getColumn() { return column; }

View File

@ -31,16 +31,12 @@ public class MissingRowDummyRecord extends Record {
this.rowNumber = rowNumber;
}
protected void fillFields(RecordInputStream in) {
}
public short getSid() {
return -1;
}
public int serialize(int offset, byte[] data) {
return -1;
}
protected void validateSid(short id) {
}
public int getRowNumber() {
return rowNumber;

View File

@ -55,6 +55,12 @@ import org.apache.poi.util.POILogger;
* @version 1.0-pre
*/
public final class Workbook implements Model {
/**
* Excel silently truncates long sheet names to 31 chars.
* This constant is used to ensure uniqueness in the first 31 chars
*/
private static final int MAX_SENSITIVE_SHEET_NAME_LEN = 31;
private static final int DEBUG = POILogger.DEBUG;
/**
@ -488,32 +494,43 @@ public final class Workbook implements Model {
/**
* sets the name for a given sheet. If the boundsheet record doesn't exist and
* its only one more than we have, go ahead and create it. If its > 1 more than
* its only one more than we have, go ahead and create it. If it's > 1 more than
* we have, except
*
* @param sheetnum the sheet number (0 based)
* @param sheetname the name for the sheet
*/
public void setSheetName(int sheetnum, String sheetname ) {
public void setSheetName(int sheetnum, String sheetname) {
checkSheets(sheetnum);
BoundSheetRecord sheet = (BoundSheetRecord)boundsheets.get( sheetnum );
sheet.setSheetname(sheetname);
}
/**
* Determines whether a workbook contains the provided sheet name.
* Determines whether a workbook contains the provided sheet name. For the purpose of
* comparison, long names are truncated to 31 chars.
*
* @param name the name to test (case insensitive match)
* @param excludeSheetIdx the sheet to exclude from the check or -1 to include all sheets in the check.
* @return true if the sheet contains the name, false otherwise.
*/
public boolean doesContainsSheetName( String name, int excludeSheetIdx )
{
for ( int i = 0; i < boundsheets.size(); i++ )
{
public boolean doesContainsSheetName(String name, int excludeSheetIdx) {
String aName = name;
if (aName.length() > MAX_SENSITIVE_SHEET_NAME_LEN) {
aName = aName.substring(0, MAX_SENSITIVE_SHEET_NAME_LEN);
}
for (int i = 0; i < boundsheets.size(); i++) {
BoundSheetRecord boundSheetRecord = getBoundSheetRec(i);
if (excludeSheetIdx != i && name.equalsIgnoreCase(boundSheetRecord.getSheetname()))
if (excludeSheetIdx == i) {
continue;
}
String bName = boundSheetRecord.getSheetname();
if (bName.length() > MAX_SENSITIVE_SHEET_NAME_LEN) {
bName = bName.substring(0, MAX_SENSITIVE_SHEET_NAME_LEN);
}
if (aName.equalsIgnoreCase(bName)) {
return true;
}
}
return false;
}
@ -1954,9 +1971,9 @@ public final class Workbook implements Model {
return (short)getOrCreateLinkTable().checkExternSheet(sheetNumber);
}
public int getExternalSheetIndex(String workbookName, String sheetName) {
return getOrCreateLinkTable().getExternalSheetIndex(workbookName, sheetName);
}
public int getExternalSheetIndex(String workbookName, String sheetName) {
return getOrCreateLinkTable().getExternalSheetIndex(workbookName, sheetName);
}
/** gets the total number of names

View File

@ -57,31 +57,7 @@ public abstract class AbstractEscherHolderRecord
escherRecords = new ArrayList();
}
/**
* Constructs a Bar record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public AbstractEscherHolderRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != getSid())
{
throw new RecordFormatException("Not an escher record! (sid was " + id + ", expecting " + getSid() + ")");
}
}
protected void fillFields(RecordInputStream in)
{
escherRecords = new ArrayList();
if (! DESERIALISE )

View File

@ -48,32 +48,7 @@ public final class AreaFormatRecord extends Record {
}
/**
* Constructs a AreaFormat record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public AreaFormatRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a AreaFormat record");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_foregroundColor = in.readInt();
field_2_backgroundColor = in.readInt();

View File

@ -42,32 +42,7 @@ public final class AreaRecord extends Record {
}
/**
* Constructs a Area record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public AreaRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a Area record");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_formatFlags = in.readShort();

View File

@ -46,32 +46,7 @@ public class AxisLineFormatRecord
}
/**
* Constructs a AxisLineFormat record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public AxisLineFormatRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a AxisLineFormat record");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_axisType = in.readShort();
}

View File

@ -57,32 +57,7 @@ public final class AxisOptionsRecord extends Record {
}
/**
* Constructs a AxisOptions record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public AxisOptionsRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a AxisOptions record");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_minimumCategory = in.readShort();
field_2_maximumCategory = in.readShort();

View File

@ -48,32 +48,7 @@ public class AxisParentRecord
}
/**
* Constructs a AxisParent record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public AxisParentRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a AxisParent record");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_axisType = in.readShort();
field_2_x = in.readInt();

View File

@ -49,32 +49,7 @@ public class AxisRecord
}
/**
* Constructs a Axis record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public AxisRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a Axis record");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_axisType = in.readShort();
field_2_reserved1 = in.readInt();

View File

@ -42,32 +42,7 @@ public class AxisUsedRecord
}
/**
* Constructs a AxisUsed record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public AxisUsedRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a AxisUsed record");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_numAxis = in.readShort();
}

View File

@ -86,27 +86,7 @@ public class BOFRecord
{
}
/**
* Constructs a BOFRecord and sets its fields appropriately
* @param in the RecordInputstream to read the record from
*/
public BOFRecord(RecordInputStream in)
{
super(in);
// fillFields(data,size);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A BOF RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_version = in.readShort();
field_2_type = in.readShort();

View File

@ -40,25 +40,7 @@ public class BackupRecord
{
}
/**
* Constructs a BackupRecord and sets its fields appropriately
* @param in the RecordInputstream to read the record from
*/
public BackupRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A BACKUP RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_backup = in.readShort();
}

View File

@ -47,32 +47,7 @@ public final class BarRecord extends Record {
}
/**
* Constructs a Bar record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public BarRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a Bar record");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_barSpace = in.readShort();
field_2_categorySpace = in.readShort();

View File

@ -1,4 +1,3 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@ -15,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.record;
@ -29,10 +27,7 @@ import org.apache.poi.util.LittleEndian;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public class BeginRecord
extends Record
{
public class BeginRecord extends Record {
public static final short sid = 0x1033;
public BeginRecord()
@ -40,24 +35,9 @@ public class BeginRecord
}
/**
* Constructs a BeginRecord record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
* @param in unused (since this record has no data)
*/
public BeginRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A BEGIN RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
}
@ -72,9 +52,8 @@ public class BeginRecord
public int serialize(int offset, byte [] data)
{
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset,
(( short ) 0)); // no record info
LittleEndian.putUShort(data, 0 + offset, sid);
LittleEndian.putUShort(data, 2 + offset, 0); // no record info
return getRecordSize();
}

View File

@ -39,36 +39,13 @@ public final class BlankRecord extends Record implements CellValueRecordInterfac
{
}
/**
* Constructs a BlankRecord and sets its fields appropriately
* @param in the RecordInputstream to read the record from
*/
public BlankRecord(RecordInputStream in)
{
super(in);
}
protected void fillFields(RecordInputStream in)
{
field_1_row = in.readUShort();
field_2_col = in.readShort();
field_3_xf = in.readShort();
}
/**
* called by constructor, should throw runtime exception in the event of a
* record passed with a differing ID.
*
* @param id alleged id for this record
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A BLANKRECORD!");
}
}
/**
* set the row this cell occurs on
* @param row the row this cell occurs within

View File

@ -40,25 +40,7 @@ public class BookBoolRecord
{
}
/**
* Constructs a BookBoolRecord and sets its fields appropriately
* @param in the RecordInputstream to read the record from
*/
public BookBoolRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A BOOKBOOL RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_save_link_values = in.readShort();
}

View File

@ -41,19 +41,9 @@ public final class BoolErrRecord extends Record implements CellValueRecordInterf
}
/**
* Constructs a BoolErr record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public BoolErrRecord(RecordInputStream in)
{
super(in);
}
/**
* @param in the RecordInputstream to read the record from
*/
protected void fillFields(RecordInputStream in)
{
//field_1_row = LittleEndian.getShort(data, 0 + offset);
field_1_row = in.readUShort();
@ -221,20 +211,6 @@ public final class BoolErrRecord extends Record implements CellValueRecordInterf
return 12;
}
/**
* called by constructor, should throw runtime exception in the event of a
* record passed with a differing ID.
*
* @param id alleged id for this record
*/
protected void validateSid(short id)
{
if (id != BoolErrRecord.sid)
{
throw new RecordFormatException("Not a valid BoolErrRecord");
}
}
public short getSid()
{
return sid;

View File

@ -39,30 +39,7 @@ public class BottomMarginRecord
}
/**
* Constructs a BottomMargin record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public BottomMarginRecord( RecordInputStream in )
{
super( in );
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid( short id )
{
if ( id != sid )
{
throw new RecordFormatException( "Not a BottomMargin record" );
}
}
protected void fillFields( RecordInputStream in )
{
field_1_margin = in.readDouble();
}
@ -121,4 +98,4 @@ public class BottomMarginRecord
return rec;
}
} // END OF CLASS
} // END OF CLAS

View File

@ -52,21 +52,6 @@ public final class BoundSheetRecord extends Record {
setSheetname(sheetname);
}
/**
* Constructs a BoundSheetRecord and sets its fields appropriately
*
* @param in the RecordInputstream to read the record from
*/
public BoundSheetRecord(RecordInputStream in) {
super(in);
}
protected void validateSid(short id) {
if (id != sid) {
throw new RecordFormatException("NOT A Bound Sheet RECORD");
}
}
/**
* UTF8: sid + len + bof + flags + len(str) + unicode + str 2 + 2 + 4 + 2 +
* 1 + 1 + len(str)
@ -75,7 +60,7 @@ public final class BoundSheetRecord extends Record {
* 1 + 1 + 2 * len(str)
*
*/
protected void fillFields(RecordInputStream in) {
public BoundSheetRecord(RecordInputStream in) {
field_1_position_of_BOF = in.readInt();
field_2_option_flags = in.readUShort();
int field_3_sheetname_length = in.readUByte();
@ -116,9 +101,8 @@ public final class BoundSheetRecord extends Record {
throw new IllegalArgumentException("sheetName must not be null");
}
int len = sheetName.length();
if (len < 1 || len > 31) {
throw new IllegalArgumentException("sheetName '" + sheetName
+ "' is invalid - must be 1-30 characters long");
if (len < 1) {
throw new IllegalArgumentException("sheetName must not be empty string");
}
for (int i=0; i<len; i++) {
char ch = sheetName.charAt(i);

View File

@ -48,11 +48,6 @@ public final class CFHeaderRecord extends Record {
}
public CFHeaderRecord(RecordInputStream in)
{
super(in);
}
protected void fillFields(RecordInputStream in)
{
field_1_numcf = in.readShort();
field_2_need_recalculation = in.readShort();
@ -160,22 +155,6 @@ public final class CFHeaderRecord extends Record {
return 4 + getDataSize();
}
/**
* called by constructor, should throw runtime exception in the event of a
* record passed with a differing ID.
*
* @param id alleged id for this record
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException(
"NOT A ConditionalFormattingHeaderRecord RECORD");
}
}
public short getSid()
{
return sid;

View File

@ -159,10 +159,6 @@ public final class CFRuleRecord extends Record {
}
public CFRuleRecord(RecordInputStream in) {
super(in);
}
protected void fillFields(RecordInputStream in) {
field_1_condition_type = in.readByte();
field_2_comparison_operator = in.readByte();
int field_3_formula1_len = in.readUShort();
@ -446,21 +442,6 @@ public final class CFRuleRecord extends Record {
public void setParsedExpression2(Ptg[] ptgs) {
field_18_formula2 = safeClone(ptgs);
}
/**
* called by constructor, should throw runtime exception in the event of a
* record passed with a differing ID.
*
* @param id alleged id for this record
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A CFRULE RECORD");
}
}
public short getSid()
{

View File

@ -38,22 +38,12 @@ public final class CRNCountRecord extends Record {
throw new RuntimeException("incomplete code");
}
public CRNCountRecord(RecordInputStream in) {
super(in);
}
protected void validateSid(short id) {
if (id != sid) {
throw new RecordFormatException("NOT An XCT RECORD");
}
}
public int getNumberOfCRNs() {
return field_1_number_crn_records;
}
protected void fillFields(RecordInputStream in) {
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

View File

@ -39,22 +39,12 @@ public final class CRNRecord extends Record {
throw new RuntimeException("incomplete code");
}
public CRNRecord(RecordInputStream in) {
super(in);
}
protected void validateSid(short id) {
if (id != sid) {
throw new RecordFormatException("NOT An XCT RECORD");
}
}
public int getNumberOfCRNs() {
return field_1_last_column_index;
}
protected void fillFields(RecordInputStream in) {
public CRNRecord(RecordInputStream in) {
field_1_last_column_index = in.readByte() & 0x00FF;
field_2_first_column_index = in.readByte() & 0x00FF;
field_3_row_index = in.readShort();

View File

@ -45,26 +45,7 @@ public class CalcCountRecord
{
}
/**
* Constructs a CalcCountRecord and sets its fields appropriately
* @param in the RecordInputstream to read the record from
*
*/
public CalcCountRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT An Calc Count RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_iterations = in.readShort();
}

View File

@ -61,25 +61,7 @@ public class CalcModeRecord
{
}
/**
* Constructs a CalcModeRecord and sets its fields appropriately
* @param in the RecordInputstream to read the record from
*/
public CalcModeRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT An Calc Mode RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_calcmode = in.readShort();
}

View File

@ -47,32 +47,7 @@ public final class CategorySeriesAxisRecord extends Record {
}
/**
* Constructs a CategorySeriesAxis record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public CategorySeriesAxisRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a CategorySeriesAxis record");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_crossingPoint = in.readShort();
field_2_labelFrequency = in.readShort();

View File

@ -44,25 +44,7 @@ public final class ChartFormatRecord extends Record {
{
}
/**
* Constructs a ChartFormatRecord record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public ChartFormatRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A CHARTFORMAT RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field1_x_position = in.readInt();
field2_y_position = in.readInt();

View File

@ -45,32 +45,7 @@ public class ChartRecord
}
/**
* Constructs a Chart record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public ChartRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a Chart record");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_x = in.readInt();
field_2_y = in.readInt();

View File

@ -59,17 +59,6 @@ public class ChartTitleFormatRecord extends Record {
}
public ChartTitleFormatRecord(RecordInputStream in) {
super(in);
}
protected void validateSid(short id) {
if (id != sid)
{
throw new RecordFormatException("NOT A CHARTTITLEFORMAT RECORD");
}
}
protected void fillFields(RecordInputStream in) {
m_recs = in.readUShort();
int idx;
CTFormat ctf;

View File

@ -47,25 +47,7 @@ public class CodepageRecord
{
}
/**
* Constructs a CodepageRecord and sets its fields appropriately
* @param in the RecordInputstream to read the record from
*/
public CodepageRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A CODEPAGE RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_codepage = in.readShort();
}

View File

@ -52,17 +52,7 @@ public final class ColumnInfoRecord extends Record {
field_6_reserved = 2; // seems to be the most common value
}
/**
* Constructs a ColumnInfo record and sets its fields appropriately
* @param in the RecordInputstream to read the record from
*/
public ColumnInfoRecord(RecordInputStream in)
{
super(in);
}
protected void fillFields(RecordInputStream in)
{
field_1_first_col = in.readUShort();
field_2_last_col = in.readUShort();
@ -83,14 +73,6 @@ public final class ColumnInfoRecord extends Record {
}
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A COLINFO RECORD!!");
}
}
/**
* set the first column this record defines formatting info for
* @param fc - the first column index (0-based)

View File

@ -82,31 +82,7 @@ public final class CommonObjectDataSubRecord extends SubRecord {
}
/**
* Constructs a CommonObjectData record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public CommonObjectDataSubRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a CommonObjectData record");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_objectType = in.readShort();
field_2_objectId = in.readShort();

View File

@ -45,17 +45,6 @@ public class ContinueRecord
{
}
/**
* Main constructor -- kinda dummy because we don't validate or fill fields
*
* @param in the RecordInputstream to read the record from
*/
public ContinueRecord(RecordInputStream in)
{
super(in);
}
/**
* USE ONLY within "processContinue"
*/
@ -97,20 +86,6 @@ public class ContinueRecord
return field_1_data;
}
/**
* Make sure we have a good id
*
* @param id the alleged id
*/
protected void validateSid(short id)
{
if (id != ContinueRecord.sid)
{
throw new RecordFormatException("Not a Continue Record");
}
}
/**
* Debugging toString
*
@ -139,7 +114,7 @@ public class ContinueRecord
* @param in the RecordInputstream to read the record from
*/
protected void fillFields(RecordInputStream in)
public ContinueRecord(RecordInputStream in)
{
field_1_data = in.readRemainder();
}

View File

@ -44,25 +44,7 @@ public class CountryRecord
{
}
/**
* Constructs a CountryRecord and sets its fields appropriately
* @param in the RecordInputstream to read the record from
*/
public CountryRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A Country RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_default_country = in.readShort();
field_2_current_country = in.readShort();

View File

@ -38,24 +38,7 @@ public final class DBCellRecord extends Record {
field_2_cell_offsets = new short[0];
}
/**
* Constructs a DBCellRecord and sets its fields appropriately
* @param in the RecordInputstream to read the record from
*/
public DBCellRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A valid DBCell RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_row_offset = in.readUShort();
int size = in.remaining();

View File

@ -40,25 +40,7 @@ public class DSFRecord
{
}
/**
* Constructs a DBCellRecord and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public DSFRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A DSF RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_dsf = in.readShort();
}

View File

@ -48,26 +48,7 @@ public class DVALRecord extends Record
field_5_dv_no = 0x00000000;
}
/**
* Constructs a DVAL record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public DVALRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A valid DVAL RECORD");
}
}
protected void fillFields(RecordInputStream in)
public DVALRecord(RecordInputStream in)
{
this.field_1_options = in.readShort();
this.field_2_horiz_pos = in.readInt();

View File

@ -75,15 +75,6 @@ public final class DVRecord extends Record {
private static final BitField opt_show_error_on_invalid_value = new BitField(0x00080000);
private static final BitField opt_condition_operator = new BitField(0x00700000);
/**
* Constructs a DV record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public DVRecord(RecordInputStream in) {
super(in);
}
public DVRecord(int validationType, int operator, int errorStyle, boolean emptyCellAllowed,
boolean suppressDropDownArrow, boolean isExplicitList,
boolean showPromptBox, String promptTitle, String promptText,
@ -110,13 +101,7 @@ public final class DVRecord extends Record {
_regions = regions;
}
protected void validateSid(short id) {
if (id != sid) {
throw new RecordFormatException("NOT a valid DV RECORD");
}
}
protected void fillFields(RecordInputStream in) {
public DVRecord(RecordInputStream in) {
_option_flags = in.readInt();

View File

@ -45,32 +45,7 @@ public final class DatRecord extends Record {
}
/**
* Constructs a Dat record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public DatRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a Dat record");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_options = in.readShort();
}

View File

@ -45,32 +45,7 @@ public final class DataFormatRecord extends Record {
}
/**
* Constructs a DataFormat record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public DataFormatRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a DataFormat record");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_pointNumber = in.readShort();
field_2_seriesIndex = in.readShort();

View File

@ -40,25 +40,7 @@ public class DateWindow1904Record
{
}
/**
* Constructs a DateWindow1904 record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public DateWindow1904Record(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A 1904 RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_window = in.readShort();
}

View File

@ -36,25 +36,7 @@ public final class DefaultColWidthRecord extends Record {
{
}
/**
* Constructs a DefaultColumnWidth record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public DefaultColWidthRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A DefaultColWidth RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_col_width = in.readUShort();
}

View File

@ -45,32 +45,7 @@ public class DefaultDataLabelTextPropertiesRecord
}
/**
* Constructs a DefaultDataLabelTextProperties record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public DefaultDataLabelTextPropertiesRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a DefaultDataLabelTextProperties record");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_categoryDataType = in.readShort();
}

View File

@ -42,25 +42,7 @@ public class DefaultRowHeightRecord
{
}
/**
* Constructs a DefaultRowHeight record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public DefaultRowHeightRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A DefaultRowHeight RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_option_flags = in.readShort();
field_2_row_height = in.readShort();

View File

@ -44,25 +44,7 @@ public class DeltaRecord
{
}
/**
* Constructs a Delta record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public DeltaRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A DELTA RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_max_change = in.readDouble();
}

View File

@ -45,25 +45,7 @@ public class DimensionsRecord
{
}
/**
* Constructs a Dimensions record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public DimensionsRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A valid DIMENSIONS RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_first_row = in.readInt();
field_2_last_row = in.readInt();

View File

@ -30,24 +30,6 @@ public class DrawingRecord extends Record
}
public DrawingRecord( RecordInputStream in )
{
super( in );
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a MSODRAWING record");
}
}
protected void fillFields( RecordInputStream in )
{
recordData = in.readRemainder();
}

View File

@ -40,24 +40,9 @@ public final class EOFRecord extends Record {
}
/**
* Constructs a EOFRecord record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
* @param in unused (since this record has no data)
*/
public EOFRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT An EOF RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
}

View File

@ -54,35 +54,12 @@ public class EmbeddedObjectRefSubRecord
field_5_ole_classname = "";
}
/**
* Constructs an EmbeddedObjectRef record and sets its fields appropriately.
*
* @param in the record input stream.
*/
public EmbeddedObjectRefSubRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a EmbeddedObjectRef record");
}
}
public short getSid()
{
return sid;
}
protected void fillFields(RecordInputStream in)
public EmbeddedObjectRefSubRecord(RecordInputStream in)
{
field_1_stream_id_offset = in.readShort();
field_2_unknown = in.readShortArray();

View File

@ -1,4 +1,3 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@ -15,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.record;
@ -30,9 +28,7 @@ import org.apache.poi.util.LittleEndian;
* @author Glen Stampoultzis (glens at apache.org)
*/
public class EndRecord
extends Record
{
public final class EndRecord extends Record {
public static final short sid = 0x1034;
public EndRecord()
@ -40,25 +36,9 @@ public class EndRecord
}
/**
* Constructs a EndRecord record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
* @param in unused (since this record has no data)
*/
public EndRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT An END RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
}
@ -73,9 +53,8 @@ public class EndRecord
public int serialize(int offset, byte [] data)
{
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset,
(( short ) 0)); // no record info
LittleEndian.putUShort(data, 0 + offset, sid);
LittleEndian.putUShort(data, 2 + offset, 0); // no record info
return getRecordSize();
}

View File

@ -1,4 +1,3 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@ -16,12 +15,9 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.record;
import org.apache.poi.util.*;
import org.apache.poi.util.LittleEndian;
/**
* The end data record is used to denote the end of the subrecords.
@ -30,10 +26,8 @@ import org.apache.poi.util.*;
* @author Glen Stampoultzis (glens at apache.org)
*/
public class EndSubRecord
extends SubRecord
{
public final static short sid = 0x00;
public final class EndSubRecord extends SubRecord {
public final static short sid = 0x00;
public EndSubRecord()
@ -42,31 +36,9 @@ public class EndSubRecord
}
/**
* Constructs a End record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
* @param in unused (since this record has no data)
*/
public EndSubRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a End record");
}
}
protected void fillFields(RecordInputStream in)
{
}

View File

@ -17,18 +17,41 @@
package org.apache.poi.hssf.record;
import org.apache.poi.ddf.*;
import org.apache.poi.hssf.usermodel.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.poi.ddf.DefaultEscherRecordFactory;
import org.apache.poi.ddf.EscherBoolProperty;
import org.apache.poi.ddf.EscherClientAnchorRecord;
import org.apache.poi.ddf.EscherClientDataRecord;
import org.apache.poi.ddf.EscherContainerRecord;
import org.apache.poi.ddf.EscherDgRecord;
import org.apache.poi.ddf.EscherDggRecord;
import org.apache.poi.ddf.EscherOptRecord;
import org.apache.poi.ddf.EscherProperties;
import org.apache.poi.ddf.EscherRecord;
import org.apache.poi.ddf.EscherRecordFactory;
import org.apache.poi.ddf.EscherSerializationListener;
import org.apache.poi.ddf.EscherSpRecord;
import org.apache.poi.ddf.EscherSpgrRecord;
import org.apache.poi.ddf.EscherTextboxRecord;
import org.apache.poi.hssf.model.AbstractShape;
import org.apache.poi.hssf.model.TextboxShape;
import org.apache.poi.hssf.model.DrawingManager2;
import org.apache.poi.hssf.model.ConvertAnchor;
import org.apache.poi.hssf.model.CommentShape;
import org.apache.poi.hssf.model.ConvertAnchor;
import org.apache.poi.hssf.model.DrawingManager2;
import org.apache.poi.hssf.model.TextboxShape;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFPatriarch;
import org.apache.poi.hssf.usermodel.HSSFShape;
import org.apache.poi.hssf.usermodel.HSSFShapeContainer;
import org.apache.poi.hssf.usermodel.HSSFShapeGroup;
import org.apache.poi.hssf.usermodel.HSSFTextbox;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
import java.util.*;
/**
* This class is used to aggregate the MSODRAWING and OBJ record
* combinations. This is necessary due to the bizare way in which
@ -282,16 +305,6 @@ public class EscherAggregate extends AbstractEscherHolderRecord
return sid;
}
/**
* Unused since this is an aggregate record. Use createAggregate().
*
* @see #createAggregate
*/
protected void fillFields( byte[] data, short size, int offset )
{
throw new IllegalStateException( "Should not reach here" );
}
/**
* Calculates the string representation of this record. This is
* simply a dump of all the records.
@ -539,8 +552,7 @@ public class EscherAggregate extends AbstractEscherHolderRecord
// The top level container ought to have
// the DgRecord and the container of one container
// per shape group (patriach overall first)
EscherContainerRecord topContainer =
(EscherContainerRecord)getEscherContainer();
EscherContainerRecord topContainer = getEscherContainer();
if(topContainer == null) {
return;
}

View File

@ -51,17 +51,6 @@ public class ExtSSTInfoSubRecord
}
public ExtSSTInfoSubRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
// do nothing
}
protected void fillFields(RecordInputStream in)
{
field_1_stream_pos = in.readInt();
field_2_bucket_sst_offset = in.readShort();

View File

@ -53,25 +53,7 @@ public class ExtSSTRecord
field_2_sst_info = new ArrayList();
}
/**
* Constructs a EOFRecord record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public ExtSSTRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT An EXTSST RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_2_sst_info = new ArrayList();
field_1_strings_per_bucket = in.readShort();

View File

@ -195,25 +195,7 @@ public class ExtendedFormatRecord
{
}
/**
* Constructs an ExtendedFormat record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public ExtendedFormatRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A EXTENDED FORMAT RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_font_index = in.readShort();
field_2_format_index = in.readShort();

View File

@ -95,34 +95,13 @@ public class ExternSheetRecord extends Record {
_list = new ArrayList();
}
/**
* Constructs a Extern Sheet record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public ExternSheetRecord(RecordInputStream in) {
super(in);
}
/**
* called by constructor, should throw runtime exception in the event of a
* record passed with a differing ID.
*
* @param id alleged id for this record
*/
protected void validateSid(short id) {
if (id != sid) {
throw new RecordFormatException("NOT An ExternSheet RECORD");
}
}
/**
* called by the constructor, should set class level fields. Should throw
* runtime exception for bad/icomplete data.
*
* @param in the RecordInputstream to read the record from
*/
protected void fillFields(RecordInputStream in) {
public ExternSheetRecord(RecordInputStream in) {
_list = new ArrayList();
int nItems = in.readShort();

View File

@ -47,11 +47,7 @@ public final class ExternalNameRecord extends Record {
private short field_2_index;
private short field_3_not_used;
private String field_4_name;
private Ptg[] field_5_name_definition; // TODO - junits for name definition field
public ExternalNameRecord(RecordInputStream in) {
super(in);
}
private Ptg[] field_5_name_definition;
/**
* Convenience Function to determine if the name is a built-in name
@ -90,19 +86,6 @@ public final class ExternalNameRecord extends Record {
return field_4_name;
}
/**
* called by constructor, should throw runtime exception in the event of a
* record passed with a differing ID.
*
* @param id alleged id for this record
*/
protected void validateSid(short id) {
if (id != sid) {
throw new RecordFormatException("NOT A valid ExternalName RECORD");
}
}
private int getDataSize(){
int result = 3 * 2 // 3 short fields
+ 2 + field_4_name.length(); // nameLen and name
@ -129,13 +112,13 @@ public final class ExternalNameRecord extends Record {
LittleEndian.putShort( data, 4 + offset, field_1_option_flag );
LittleEndian.putShort( data, 6 + offset, field_2_index );
LittleEndian.putShort( data, 8 + offset, field_3_not_used );
short nameLen = (short) field_4_name.length();
LittleEndian.putShort( data, 10 + offset, nameLen );
int nameLen = field_4_name.length();
LittleEndian.putUShort( data, 10 + offset, nameLen );
StringUtil.putCompressedUnicode( field_4_name, data, 12 + offset );
if(hasFormula()) {
short defLen = (short) getNameDefinitionSize();
LittleEndian.putShort( data, 12 + nameLen + offset, defLen );
Ptg.serializePtgStack(toStack(field_5_name_definition), data, 14 + nameLen + offset );
int defLen = getNameDefinitionSize();
LittleEndian.putUShort( data, 12 + nameLen + offset, defLen );
Ptg.serializePtgs(field_5_name_definition, data, 14 + nameLen + offset );
}
return dataSize + 4;
}
@ -154,7 +137,7 @@ public final class ExternalNameRecord extends Record {
}
protected void fillFields(RecordInputStream in) {
public ExternalNameRecord(RecordInputStream in) {
field_1_option_flag = in.readShort();
field_2_index = in.readShort();
field_3_not_used = in.readShort();
@ -171,7 +154,7 @@ public final class ExternalNameRecord extends Record {
throw readFail("Ran out of record data trying to read formula.");
}
short formulaLen = in.readShort();
field_5_name_definition = toPtgArray(Ptg.createParsedExpressionTokens(formulaLen, in));
field_5_name_definition = Ptg.readTokens(formulaLen, in);
}
/*
* Makes better error messages (while hasFormula() is not reliable)
@ -209,19 +192,6 @@ public final class ExternalNameRecord extends Record {
return true;
}
private static Ptg[] toPtgArray(Stack s) {
Ptg[] result = new Ptg[s.size()];
s.toArray(result);
return result;
}
private static Stack toStack(Ptg[] ptgs) {
Stack result = new Stack();
for (int i = 0; i < ptgs.length; i++) {
result.push(ptgs[i]);
}
return result;
}
public short getSid() {
return sid;
}

View File

@ -40,25 +40,7 @@ public class FilePassRecord
{
}
/**
* Constructs a FILEPASS record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public FilePassRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A FILEPASS RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_encryptedpassword = in.readInt();

View File

@ -36,24 +36,8 @@ public final class FileSharingRecord extends Record {
private String field_3_username_value;
public FileSharingRecord() {}
/**
* Constructs a FileSharing record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public FileSharingRecord(RecordInputStream in) {
super(in);
}
protected void validateSid(short id) {
if (id != sid) {
throw new RecordFormatException("NOT A FILESHARING RECORD");
}
}
protected void fillFields(RecordInputStream in) {
field_1_readonly = in.readShort();
field_2_password = in.readShort();

View File

@ -46,25 +46,7 @@ public class FnGroupCountRecord
{
}
/**
* Constructs a FnGroupCount record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public FnGroupCountRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A FNGROUPCOUNT RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_count = in.readShort();
}

View File

@ -46,32 +46,7 @@ public class FontBasisRecord
}
/**
* Constructs a FontBasis record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public FontBasisRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a FontBasis record");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_xBasis = in.readShort();
field_2_yBasis = in.readShort();

View File

@ -42,32 +42,7 @@ public class FontIndexRecord
}
/**
* Constructs a FontIndex record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public FontIndexRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a FontIndex record");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_fontIndex = in.readShort();
}

View File

@ -76,26 +76,7 @@ public class FontRecord
{
}
/**
* Constructs a Font record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public FontRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A FONT RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_font_height = in.readShort();
field_2_attributes = in.readShort();

View File

@ -45,25 +45,7 @@ public class FooterRecord
{
}
/**
* Constructs a FooterRecord record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public FooterRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A FooterRECORD");
}
}
protected void fillFields(RecordInputStream in)
{
if (in.remaining() > 0)
{

View File

@ -46,25 +46,7 @@ public class FormatRecord
{
}
/**
* Constructs a Format record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public FormatRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A FORMAT RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_index_code = in.readShort();
field_3_unicode_len = in.readShort();

View File

@ -186,20 +186,7 @@ public final class FormulaRecord extends Record implements CellValueRecordInterf
field_8_parsed_expr = Ptg.EMPTY_PTG_ARRAY;
}
/**
* Constructs a Formula record and sets its fields appropriately.
* Note - id must be 0x06 (NOT 0x406 see MSKB #Q184647 for an
* "explanation of this bug in the documentation) or an exception
* will be throw upon validation
*
* @param in the RecordInputstream to read the record from
*/
public FormulaRecord(RecordInputStream in) {
super(in);
}
protected void fillFields(RecordInputStream in) {
field_1_row = in.readUShort();
field_2_column = in.readShort();
field_3_xf = in.readShort();
@ -356,18 +343,6 @@ public final class FormulaRecord extends Record implements CellValueRecordInterf
field_8_parsed_expr = ptgs;
}
/**
* called by constructor, should throw runtime exception in the event of a
* record passed with a differing ID.
*
* @param id alleged id for this record
*/
protected void validateSid(short id) {
if (id != sid) {
throw new RecordFormatException("NOT A FORMULA RECORD");
}
}
public short getSid() {
return sid;
}

View File

@ -46,32 +46,7 @@ public final class FrameRecord extends Record {
}
/**
* Constructs a Frame record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public FrameRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a Frame record");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_borderType = in.readShort();
field_2_options = in.readShort();

View File

@ -44,25 +44,7 @@ public class GridsetRecord
{
}
/**
* Constructs a GridSet record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public GridsetRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A Gridset RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_gridset_flag = in.readShort();
}

View File

@ -41,32 +41,7 @@ public class GroupMarkerSubRecord
}
/**
* Constructs a group marker record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public GroupMarkerSubRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a Group Marker record");
}
}
protected void fillFields(RecordInputStream in)
{
// int pos = 0;
reserved = in.readRemainder();

View File

@ -43,25 +43,7 @@ public class GutsRecord
{
}
/**
* Constructs a Guts record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public GutsRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A Guts RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_left_row_gutter = in.readShort();
field_2_top_col_gutter = in.readShort();

View File

@ -1,4 +1,3 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@ -15,50 +14,28 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
/**
* Title: HCenter record<P>
* Title: HCenter record (0x0083)<P>
* Description: whether to center between horizontal margins<P>
* REFERENCE: PG 320 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
public class HCenterRecord
extends Record
{
public final static short sid = 0x83;
public final class HCenterRecord extends Record {
public final static short sid = 0x0083;
private short field_1_hcenter;
public HCenterRecord()
{
}
/**
* Constructs an HCenter record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public HCenterRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A HCenter RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_hcenter = in.readShort();
}
@ -104,8 +81,8 @@ public class HCenterRecord
public int serialize(int offset, byte [] data)
{
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, ( short ) 0x2);
LittleEndian.putShort(data, 4 + offset, ( short ) field_1_hcenter);
LittleEndian.putUShort(data, 2 + offset, 0x2);
LittleEndian.putUShort(data, 4 + offset, field_1_hcenter);
return getRecordSize();
}

View File

@ -45,25 +45,7 @@ public class HeaderRecord
{
}
/**
* Constructs an Header record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public HeaderRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A HEADERRECORD");
}
}
protected void fillFields(RecordInputStream in)
{
if (in.remaining() > 0)
{

View File

@ -42,25 +42,7 @@ public class HideObjRecord
{
}
/**
* Constructs an HideObj record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public HideObjRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A HIDEOBJ RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_hide_obj = in.readShort();
}

View File

@ -44,13 +44,6 @@ public final class HorizontalPageBreakRecord extends PageBreakRecord {
super(in);
}
protected void validateSid(short id) {
if (id != getSid()) {
throw new RecordFormatException(
"NOT A HorizontalPageBreak or VerticalPageBreak RECORD!! " + id);
}
}
public short getSid() {
return sid;
}

View File

@ -130,16 +130,6 @@ public class HyperlinkRecord extends Record {
}
/**
* Read hyperlink from input stream
*
* @param in the stream to read from
*/
public HyperlinkRecord(RecordInputStream in)
{
super(in);
}
/**
* Return the column of the first cell that contains the hyperlink
*
@ -315,7 +305,7 @@ public class HyperlinkRecord extends Record {
/**
* @param in the RecordInputstream to read the record from
*/
protected void fillFields(RecordInputStream in)
public HyperlinkRecord(RecordInputStream in)
{
try {
rwFirst = in.readShort();
@ -372,14 +362,6 @@ public class HyperlinkRecord extends Record {
return HyperlinkRecord.sid;
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A HYPERLINKRECORD!");
}
}
public int serialize(int offset, byte[] data)
{
int pos = offset;

View File

@ -48,25 +48,7 @@ public class IndexRecord
{
}
/**
* Constructs an Index record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public IndexRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT An Index RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_5_dbcells =
new IntList(DBCELL_CAPACITY); // initial capacity of 30

View File

@ -1,4 +1,3 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@ -15,49 +14,30 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
/**
* Title: Interface End Record<P>
* Title: Interface End Record (0x00E2)<P>
* Description: Shows where the Interface Records end (MMS)
* (has no fields)<P>
* REFERENCE: PG 324 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @version 2.0-pre
*/
public class InterfaceEndRecord
extends Record
{
public final static short sid = 0xe2;
public final class InterfaceEndRecord extends Record {
public final static short sid = 0x00E2;
public InterfaceEndRecord()
{
}
/**
* Constructs an InterfaceEnd record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
* @param in unused (since this record has no data)
*/
public InterfaceEndRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A INTERFACEEND RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
}

View File

@ -45,25 +45,7 @@ public class InterfaceHdrRecord
{
}
/**
* Constructs an Codepage record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public InterfaceHdrRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A INTERFACEHDR RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_codepage = in.readShort();
}

View File

@ -43,25 +43,7 @@ public class IterationRecord
{
}
/**
* Constructs an Iteration record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public IterationRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT An ITERATION RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_iteration = in.readShort();
}

View File

@ -44,33 +44,9 @@ public final class LabelRecord extends Record implements CellValueRecordInterfac
}
/**
* Constructs an Label record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public LabelRecord(RecordInputStream in)
{
super(in);
}
/**
* called by constructor, should throw runtime exception in the event of a
* record passed with a differing ID.
*
* @param id alleged id for this record
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a valid LabelRecord");
}
}
/**
* @param in the RecordInputstream to read the record from
*/
protected void fillFields(RecordInputStream in)
{
field_1_row = in.readUShort();
field_2_column = in.readShort();

View File

@ -40,25 +40,7 @@ public final class LabelSSTRecord extends Record implements CellValueRecordInter
{
}
/**
* Constructs an LabelSST record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public LabelSSTRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A valid LabelSST RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_row = in.readUShort();
field_2_column = in.readUShort();

View File

@ -31,28 +31,7 @@ public class LeftMarginRecord extends Record implements Margin
public LeftMarginRecord() { }
/**
* Constructs a LeftMargin record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public LeftMarginRecord(RecordInputStream in)
{ super(in); }
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid( short id )
{
if ( id != sid )
{
throw new RecordFormatException( "Not a LeftMargin record" );
}
}
protected void fillFields(RecordInputStream in)
{
field_1_margin = in.readDouble();
}
@ -106,4 +85,4 @@ public class LeftMarginRecord extends Record implements Margin
rec.field_1_margin = this.field_1_margin;
return rec;
}
} // END OF CLASS
} // END OF CLAS

View File

@ -62,32 +62,7 @@ public final class LegendRecord extends Record {
}
/**
* Constructs a Legend record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public LegendRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a Legend record");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_xAxisUpperLeft = in.readInt();
field_2_yAxisUpperLeft = in.readInt();

View File

@ -61,32 +61,7 @@ public final class LineFormatRecord extends Record {
}
/**
* Constructs a LineFormat record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public LineFormatRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a LineFormat record");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_lineColor = in.readInt();
field_2_linePattern = in.readShort();

View File

@ -1,4 +1,3 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@ -15,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.record;
@ -31,9 +29,7 @@ import java.util.Iterator;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public class LinkedDataFormulaField
implements CustomField
{
public final class LinkedDataFormulaField implements CustomField {
Stack formulaTokens = new Stack();
public int getSize()

View File

@ -54,32 +54,7 @@ public final class LinkedDataRecord extends Record {
}
/**
* Constructs a LinkedData record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public LinkedDataRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a LinkedData record");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_linkType = in.readByte();
field_2_referenceType = in.readByte();
@ -155,7 +130,7 @@ public final class LinkedDataRecord extends Record {
rec.field_2_referenceType = field_2_referenceType;
rec.field_3_options = field_3_options;
rec.field_4_indexNumberFmtRecord = field_4_indexNumberFmtRecord;
rec.field_5_formulaOfLink = ((LinkedDataFormulaField)field_5_formulaOfLink.clone());;
rec.field_5_formulaOfLink = ((LinkedDataFormulaField)field_5_formulaOfLink.clone());
return rec;
}

View File

@ -41,25 +41,7 @@ public class MMSRecord
{
}
/**
* Constructs a MMS record and sets its fields appropriately.
* @param in the RecordInputstream to read the record from
*/
public MMSRecord(RecordInputStream in)
{
super(in);
}
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A MMS RECORD");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_addMenuCount = in.readByte();
field_2_delMenuCount = in.readByte();

View File

@ -56,9 +56,6 @@ public final class MergeCellsRecord extends Record {
_startIndex = 0;
_regions = cras;
}
protected void fillFields(RecordInputStream in) {
throw new RuntimeException("obsolete");
}
/**
* get the number of merged areas. If this drops down to 0 you should just go
* ahead and delete the record.
@ -119,13 +116,6 @@ public final class MergeCellsRecord extends Record {
return retval.toString();
}
protected void validateSid(short id) {
if (id != sid) {
throw new RecordFormatException("NOT A MERGEDCELLS RECORD!! "
+ id);
}
}
public Object clone() {
int nRegions = _numberOfRegions;
CellRangeAddress[] clonedRegions = new CellRangeAddress[nRegions];

View File

@ -52,17 +52,6 @@ public class MulBlankRecord
{
}
/**
* Constructs a MulBlank record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public MulBlankRecord(RecordInputStream in)
{
super(in);
}
/**
* get the row number of the cells this represents
*
@ -119,7 +108,7 @@ public class MulBlankRecord
/**
* @param in the RecordInputstream to read the record from
*/
protected void fillFields(RecordInputStream in)
public MulBlankRecord(RecordInputStream in)
{
//field_1_row = LittleEndian.getShort(data, 0 + offset);
field_1_row = in.readUShort();
@ -159,21 +148,6 @@ public class MulBlankRecord
return buffer.toString();
}
/**
* called by constructor, should throw runtime exception in the event of a
* record passed with a differing ID.
*
* @param id alleged id for this record
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a MulBlankRecord!");
}
}
public short getSid()
{
return sid;

View File

@ -37,15 +37,6 @@ public final class MulRKRecord extends Record {
private RkRec[] field_3_rks;
private short field_4_last_col;
/**
* Constructs a MulRK record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public MulRKRecord(RecordInputStream in) {
super(in);
}
public int getRow() {
return field_1_row;
}
@ -93,7 +84,7 @@ public final class MulRKRecord extends Record {
/**
* @param in the RecordInputstream to read the record from
*/
protected void fillFields(RecordInputStream in) {
public MulRKRecord(RecordInputStream in) {
field_1_row = in.readUShort();
field_2_first_col = in.readShort();
field_3_rks = RkRec.parseRKs(in);
@ -117,21 +108,6 @@ public final class MulRKRecord extends Record {
return buffer.toString();
}
/**
* called by constructor, should throw runtime exception in the event of a
* record passed with a differing ID.
*
* @param id alleged id for this record
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a MulRKRecord!");
}
}
public short getSid()
{
return sid;

View File

@ -107,15 +107,6 @@ public final class NameRecord extends Record {
field_17_status_bar_text = "";
}
/**
* Constructs a Name record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public NameRecord(RecordInputStream in) {
super(in);
}
/**
* Constructor to create a built-in named region
* @param builtin Built-in byte representation for the name record, use the public constants
@ -340,18 +331,6 @@ public final class NameRecord extends Record {
return field_17_status_bar_text;
}
/**
* called by constructor, should throw runtime exception in the event of a
* record passed with a differing ID.
*
* @param id alleged id for this record
*/
protected void validateSid(short id) {
if (id != sid) {
throw new RecordFormatException("NOT A valid Name RECORD");
}
}
/**
* called by the class that is responsible for writing this sucker.
@ -551,7 +530,7 @@ public final class NameRecord extends Record {
*
* @param in the RecordInputstream to read the record from
*/
protected void fillFields(RecordInputStream in) {
public NameRecord(RecordInputStream in) {
field_1_option_flag = in.readShort();
field_2_keyboard_shortcut = in.readByte();
int field_3_length_name_text = in.readByte();

View File

@ -53,18 +53,6 @@ public class NoteRecord extends Record {
field_3_flags = 0;
}
/**
* Constructs a <code>NoteRecord</code> and fills its fields
* from the supplied <code>RecordInputStream</code>.
*
* @param in the stream to read from
*/
public NoteRecord(RecordInputStream in)
{
super(in);
}
/**
* @return id of this record.
*/
@ -73,23 +61,10 @@ public class NoteRecord extends Record {
return sid;
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a NoteRecord record");
}
}
/**
* Read the record data from the supplied <code>RecordInputStream</code>
*/
protected void fillFields(RecordInputStream in)
public NoteRecord(RecordInputStream in)
{
field_1_row = in.readShort();
field_2_col = in.readShort();

View File

@ -45,33 +45,10 @@ public class NoteStructureSubRecord
reserved = new byte[22];
}
/**
* Constructs a NoteStructureSubRecord and sets its fields appropriately.
*
*/
public NoteStructureSubRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a Note Structure record");
}
}
/**
* Read the record data from the supplied <code>RecordInputStream</code>
*/
protected void fillFields(RecordInputStream in)
public NoteStructureSubRecord(RecordInputStream in)
{
//just grab the raw data
reserved = in.readRemainder();

View File

@ -42,32 +42,7 @@ public class NumberFormatIndexRecord
}
/**
* Constructs a NumberFormatIndex record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public NumberFormatIndexRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not a NumberFormatIndex record");
}
}
protected void fillFields(RecordInputStream in)
{
field_1_formatIndex = in.readShort();
}

View File

@ -41,19 +41,9 @@ public final class NumberRecord extends Record implements CellValueRecordInterfa
}
/**
* Constructs a Number record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public NumberRecord(RecordInputStream in)
{
super(in);
}
/**
* @param in the RecordInputstream to read the record from
*/
protected void fillFields(RecordInputStream in)
{
field_1_row = in.readUShort();
field_2_col = in.readUShort();
@ -157,21 +147,6 @@ public final class NumberRecord extends Record implements CellValueRecordInterfa
return 18;
}
/**
* called by constructor, should throw runtime exception in the event of a
* record passed with a differing ID.
*
* @param id alleged id for this record
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("NOT A Number RECORD");
}
}
public short getSid()
{
return sid;

View File

@ -43,31 +43,7 @@ public final class ObjRecord extends Record {
// TODO - ensure 2 sub-records (ftCmo 15h, and ftEnd 00h) are always created
}
/**
* Constructs a OBJ record and sets its fields appropriately.
*
* @param in the RecordInputstream to read the record from
*/
public ObjRecord(RecordInputStream in)
{
super(in);
}
/**
* Checks the sid matches the expected side for this record
*
* @param id the expected sid.
*/
protected void validateSid(short id)
{
if (id != sid)
{
throw new RecordFormatException("Not an OBJ record");
}
}
protected void fillFields(RecordInputStream in)
{
// TODO - problems with OBJ sub-records stream
// MS spec says first sub-records is always CommonObjectDataSubRecord, and last is

Some files were not shown because too many files have changed in this diff Show More