Formula changes. . Disable for 1.5...alow compile in if desired.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352431 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
310413425e
commit
29911b8674
@ -631,6 +631,11 @@ public class BiffViewer
|
|||||||
retval = new LinkedDataRecord(rectype, size, data);
|
retval = new LinkedDataRecord(rectype, size, data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case FormulaRecord.sid:
|
||||||
|
retval = new FormulaRecord(rectype, size, data);
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
default :
|
default :
|
||||||
retval = new UnknownRecord(rectype, size, data);
|
retval = new UnknownRecord(rectype, size, data);
|
||||||
}
|
}
|
||||||
|
@ -77,8 +77,12 @@ public class FormulaRecord
|
|||||||
extends Record
|
extends Record
|
||||||
implements CellValueRecordInterface, Comparable
|
implements CellValueRecordInterface, Comparable
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public static final boolean EXPERIMENTAL_FORMULA_SUPPORT_ENABLED=false;
|
||||||
|
|
||||||
public static final short sid =
|
public static final short sid =
|
||||||
0x06; // docs say 406...because of a bug Microsoft support site article #Q184647)
|
0x06; // docs say 406...because of a bug Microsoft support site article #Q184647)
|
||||||
|
|
||||||
private short field_1_row;
|
private short field_1_row;
|
||||||
private short field_2_column;
|
private short field_2_column;
|
||||||
private short field_3_xf;
|
private short field_3_xf;
|
||||||
@ -88,6 +92,9 @@ public class FormulaRecord
|
|||||||
private short field_7_expression_len;
|
private short field_7_expression_len;
|
||||||
private Stack field_8_parsed_expr;
|
private Stack field_8_parsed_expr;
|
||||||
|
|
||||||
|
private byte[] all_data; //if formula support is not enabled then
|
||||||
|
//we'll just store/reserialize
|
||||||
|
|
||||||
/** Creates new FormulaRecord */
|
/** Creates new FormulaRecord */
|
||||||
|
|
||||||
public FormulaRecord()
|
public FormulaRecord()
|
||||||
@ -126,6 +133,7 @@ public class FormulaRecord
|
|||||||
|
|
||||||
protected void fillFields(byte [] data, short size, int offset)
|
protected void fillFields(byte [] data, short size, int offset)
|
||||||
{
|
{
|
||||||
|
if (EXPERIMENTAL_FORMULA_SUPPORT_ENABLED) {
|
||||||
field_1_row = LittleEndian.getShort(data, 0 + offset);
|
field_1_row = LittleEndian.getShort(data, 0 + offset);
|
||||||
field_2_column = LittleEndian.getShort(data, 2 + offset);
|
field_2_column = LittleEndian.getShort(data, 2 + offset);
|
||||||
field_3_xf = LittleEndian.getShort(data, 4 + offset);
|
field_3_xf = LittleEndian.getShort(data, 4 + offset);
|
||||||
@ -133,9 +141,16 @@ public class FormulaRecord
|
|||||||
field_5_options = LittleEndian.getShort(data, 14 + offset);
|
field_5_options = LittleEndian.getShort(data, 14 + offset);
|
||||||
field_6_zero = LittleEndian.getInt(data, 16 + offset);
|
field_6_zero = LittleEndian.getInt(data, 16 + offset);
|
||||||
field_7_expression_len = LittleEndian.getShort(data, 20 + offset);
|
field_7_expression_len = LittleEndian.getShort(data, 20 + offset);
|
||||||
|
field_8_parsed_expr = getParsedExpressionTokens(data, size,
|
||||||
|
offset);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
all_data = new byte[size+4];
|
||||||
|
LittleEndian.putShort(all_data,0,sid);
|
||||||
|
LittleEndian.putShort(all_data,2,size);
|
||||||
|
System.arraycopy(data,offset,all_data,4,size);
|
||||||
|
}
|
||||||
|
|
||||||
// field_8_parsed_expr = getParsedExpressionTokens(data, size,
|
|
||||||
// offset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Stack getParsedExpressionTokens(byte [] data, short size,
|
private Stack getParsedExpressionTokens(byte [] data, short size,
|
||||||
@ -332,6 +347,7 @@ public class FormulaRecord
|
|||||||
|
|
||||||
public int serialize(int offset, byte [] data)
|
public int serialize(int offset, byte [] data)
|
||||||
{
|
{
|
||||||
|
if (EXPERIMENTAL_FORMULA_SUPPORT_ENABLED) {
|
||||||
int ptgSize = getTotalPtgSize();
|
int ptgSize = getTotalPtgSize();
|
||||||
|
|
||||||
LittleEndian.putShort(data, 0 + offset, sid);
|
LittleEndian.putShort(data, 0 + offset, sid);
|
||||||
@ -343,6 +359,9 @@ public class FormulaRecord
|
|||||||
LittleEndian.putShort(data, 18 + offset, getOptions());
|
LittleEndian.putShort(data, 18 + offset, getOptions());
|
||||||
LittleEndian.putInt(data, 20 + offset, field_6_zero);
|
LittleEndian.putInt(data, 20 + offset, field_6_zero);
|
||||||
LittleEndian.putShort(data, 24 + offset, getExpressionLength());
|
LittleEndian.putShort(data, 24 + offset, getExpressionLength());
|
||||||
|
} else {
|
||||||
|
System.arraycopy(all_data,0,data,offset,all_data.length);
|
||||||
|
}
|
||||||
|
|
||||||
// serializePtgs(data, 26+offset);
|
// serializePtgs(data, 26+offset);
|
||||||
return getRecordSize();
|
return getRecordSize();
|
||||||
@ -350,7 +369,14 @@ public class FormulaRecord
|
|||||||
|
|
||||||
public int getRecordSize()
|
public int getRecordSize()
|
||||||
{
|
{
|
||||||
return 0;
|
int retval =0;
|
||||||
|
|
||||||
|
if (EXPERIMENTAL_FORMULA_SUPPORT_ENABLED) {
|
||||||
|
retval = getTotalPtgSize() + 28;
|
||||||
|
} else {
|
||||||
|
retval =all_data.length;
|
||||||
|
}
|
||||||
|
return retval;
|
||||||
|
|
||||||
// return getTotalPtgSize() + 28;
|
// return getTotalPtgSize() + 28;
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,11 @@ import org.apache.poi.util.LittleEndian;
|
|||||||
public class RecordFactory
|
public class RecordFactory
|
||||||
{
|
{
|
||||||
private static int NUM_RECORDS = 10000;
|
private static int NUM_RECORDS = 10000;
|
||||||
private static final Class[] records = new Class[]
|
private static final Class[] records;
|
||||||
|
|
||||||
|
static {
|
||||||
|
if (FormulaRecord.EXPERIMENTAL_FORMULA_SUPPORT_ENABLED) {
|
||||||
|
records = new Class[]
|
||||||
{
|
{
|
||||||
BOFRecord.class, InterfaceHdrRecord.class, MMSRecord.class,
|
BOFRecord.class, InterfaceHdrRecord.class, MMSRecord.class,
|
||||||
InterfaceEndRecord.class, WriteAccessRecord.class,
|
InterfaceEndRecord.class, WriteAccessRecord.class,
|
||||||
@ -104,6 +108,37 @@ public class RecordFactory
|
|||||||
MulRKRecord.class, MulBlankRecord.class, MergeCellsRecord.class,
|
MulRKRecord.class, MulBlankRecord.class, MergeCellsRecord.class,
|
||||||
FormulaRecord.class, BoolErrRecord.class
|
FormulaRecord.class, BoolErrRecord.class
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
records = new Class[]
|
||||||
|
{
|
||||||
|
BOFRecord.class, InterfaceHdrRecord.class, MMSRecord.class,
|
||||||
|
InterfaceEndRecord.class, WriteAccessRecord.class,
|
||||||
|
CodepageRecord.class, DSFRecord.class, TabIdRecord.class,
|
||||||
|
FnGroupCountRecord.class, WindowProtectRecord.class,
|
||||||
|
ProtectRecord.class, PasswordRecord.class, ProtectionRev4Record.class,
|
||||||
|
PasswordRev4Record.class, WindowOneRecord.class, BackupRecord.class,
|
||||||
|
HideObjRecord.class, DateWindow1904Record.class,
|
||||||
|
PrecisionRecord.class, RefreshAllRecord.class, BookBoolRecord.class,
|
||||||
|
FontRecord.class, FormatRecord.class, ExtendedFormatRecord.class,
|
||||||
|
StyleRecord.class, UseSelFSRecord.class, BoundSheetRecord.class,
|
||||||
|
CountryRecord.class, SSTRecord.class, ExtSSTRecord.class,
|
||||||
|
EOFRecord.class, IndexRecord.class, CalcModeRecord.class,
|
||||||
|
CalcCountRecord.class, RefModeRecord.class, IterationRecord.class,
|
||||||
|
DeltaRecord.class, SaveRecalcRecord.class, PrintHeadersRecord.class,
|
||||||
|
PrintGridlinesRecord.class, GridsetRecord.class, GutsRecord.class,
|
||||||
|
DefaultRowHeightRecord.class, WSBoolRecord.class, HeaderRecord.class,
|
||||||
|
FooterRecord.class, HCenterRecord.class, VCenterRecord.class,
|
||||||
|
PrintSetupRecord.class, DefaultColWidthRecord.class,
|
||||||
|
DimensionsRecord.class, RowRecord.class, LabelSSTRecord.class,
|
||||||
|
RKRecord.class, NumberRecord.class, DBCellRecord.class,
|
||||||
|
WindowTwoRecord.class, SelectionRecord.class, ContinueRecord.class,
|
||||||
|
LabelRecord.class, BlankRecord.class, ColumnInfoRecord.class,
|
||||||
|
MulRKRecord.class, MulBlankRecord.class, MergeCellsRecord.class,
|
||||||
|
BoolErrRecord.class
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
private static Map recordsMap = recordsToMap(records);
|
private static Map recordsMap = recordsToMap(records);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user