From bug #44254 - avoid some unread bytes warnings, and process the contents of DVALRecord

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@614909 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2008-01-24 16:05:27 +00:00
parent dee42e72c1
commit 7c0d830822
5 changed files with 92 additions and 37 deletions

View File

@ -36,6 +36,7 @@
<!-- Don't forget to update status.xml too! --> <!-- Don't forget to update status.xml too! -->
<release version="3.0.2-FINAL" date="2008-??-??"> <release version="3.0.2-FINAL" date="2008-??-??">
<action dev="POI-DEVELOPERS" type="fix">44254 - Avoid some unread byte warnings, and properly understand DVALRecord</action>
<action dev="POI-DEVELOPERS" type="add">Add another formula evaluation method, evaluateFormulaCell(cell), which will re-calculate the value for a formula, without affecting the formula itself.</action> <action dev="POI-DEVELOPERS" type="add">Add another formula evaluation method, evaluateFormulaCell(cell), which will re-calculate the value for a formula, without affecting the formula itself.</action>
<action dev="POI-DEVELOPERS" type="fix">41726 - Fix how we handle signed cell offsets in relative areas and references</action> <action dev="POI-DEVELOPERS" type="fix">41726 - Fix how we handle signed cell offsets in relative areas and references</action>
<action dev="POI-DEVELOPERS" type="add">44233 - Support for getting and setting a flag on the sheet, which tells excel to re-calculate all formulas on it at next reload</action> <action dev="POI-DEVELOPERS" type="add">44233 - Support for getting and setting a flag on the sheet, which tells excel to re-calculate all formulas on it at next reload</action>

View File

@ -33,6 +33,7 @@
<!-- Don't forget to update changes.xml too! --> <!-- Don't forget to update changes.xml too! -->
<changes> <changes>
<release version="3.0.2-FINAL" date="2008-??-??"> <release version="3.0.2-FINAL" date="2008-??-??">
<action dev="POI-DEVELOPERS" type="fix">44254 - Avoid some unread byte warnings, and properly understand DVALRecord</action>
<action dev="POI-DEVELOPERS" type="add">Add another formula evaluation method, evaluateFormulaCell(cell), which will re-calculate the value for a formula, without affecting the formula itself.</action> <action dev="POI-DEVELOPERS" type="add">Add another formula evaluation method, evaluateFormulaCell(cell), which will re-calculate the value for a formula, without affecting the formula itself.</action>
<action dev="POI-DEVELOPERS" type="fix">41726 - Fix how we handle signed cell offsets in relative areas and references</action> <action dev="POI-DEVELOPERS" type="fix">41726 - Fix how we handle signed cell offsets in relative areas and references</action>
<action dev="POI-DEVELOPERS" type="add">44233 - Support for getting and setting a flag on the sheet, which tells excel to re-calculate all formulas on it at next reload</action> <action dev="POI-DEVELOPERS" type="add">44233 - Support for getting and setting a flag on the sheet, which tells excel to re-calculate all formulas on it at next reload</action>

View File

@ -31,17 +31,20 @@ public class DVALRecord extends Record
{ {
public final static short sid = 0x01B2; public final static short sid = 0x01B2;
//unknown field ; it's size should be 10 /** Options of the DVAL */
private short field_unknown = 0x0000; private short field_1_options;
/** Horizontal position of the dialog */
private int field_2_horiz_pos;
/** Vertical position of the dialog */
private int field_3_vert_pos;
//Object ID of the drop down arrow object for list boxes ; /** Object ID of the drop down arrow object for list boxes ;
//in our case this will be always FFFF , until * in our case this will be always FFFF , until
//MSODrawingGroup and MSODrawing records are implemented * MSODrawingGroup and MSODrawing records are implemented */
private int field_cbo_id = 0xFFFFFFFF; private int field_cbo_id = 0xFFFFFFFF;
//Number of following DV records /** Number of following DV Records */
//Default value is 1 private int field_5_dv_no = 0x00000000;
private int field_3_dv_no = 0x00000000;
public DVALRecord() public DVALRecord()
{ {
@ -68,12 +71,33 @@ public class DVALRecord extends Record
protected void fillFields(RecordInputStream in) protected void fillFields(RecordInputStream in)
{ {
for ( int i=0; i<5; i++) this.field_1_options = in.readShort();
{ this.field_2_horiz_pos = in.readInt();
this.field_unknown = in.readShort(); this.field_3_vert_pos = in.readInt();
}
this.field_cbo_id = in.readInt(); this.field_cbo_id = in.readInt();
this.field_3_dv_no = in.readInt(); this.field_5_dv_no = in.readInt();
}
/**
* @param field_1_options the options of the dialog
*/
public void setOptions(short field_1_options) {
this.field_1_options = field_1_options;
}
/**
* @param field_2_horiz_pos the Horizontal position of the dialog
*/
public void setHorizontalPos(int field_2_horiz_pos) {
this.field_2_horiz_pos = field_2_horiz_pos;
}
/**
* @param field_3_vert_pos the Vertical position of the dialog
*/
public void setVerticalPos(int field_3_vert_pos) {
this.field_3_vert_pos = field_3_vert_pos;
} }
/** /**
@ -91,7 +115,30 @@ public class DVALRecord extends Record
*/ */
public void setDVRecNo(int dvNo) public void setDVRecNo(int dvNo)
{ {
this.field_3_dv_no = dvNo; this.field_5_dv_no = dvNo;
}
/**
* @return the field_1_options
*/
public short getOptions() {
return field_1_options;
}
/**
* @return the Horizontal position of the dialog
*/
public int getHorizontalPos() {
return field_2_horiz_pos;
}
/**
* @return the the Vertical position of the dialog
*/
public int getVerticalPos() {
return field_3_vert_pos;
} }
/** /**
@ -107,7 +154,7 @@ public class DVALRecord extends Record
*/ */
public int getDVRecNo( ) public int getDVRecNo( )
{ {
return this.field_3_dv_no; return this.field_5_dv_no;
} }
@ -116,6 +163,9 @@ public class DVALRecord extends Record
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append("[DVAL]\n"); buffer.append("[DVAL]\n");
buffer.append(" .options = ").append(this.getOptions()).append('\n');
buffer.append(" .horizPos = ").append(this.getHorizontalPos()).append('\n');
buffer.append(" .vertPos = ").append(this.getVerticalPos()).append('\n');
buffer.append(" .comboObjectID = ").append(Integer.toHexString(this.getObjectID())).append("\n"); buffer.append(" .comboObjectID = ").append(Integer.toHexString(this.getObjectID())).append("\n");
buffer.append(" .DVRecordsNumber = ").append(Integer.toHexString(this.getDVRecNo())).append("\n"); buffer.append(" .DVRecordsNumber = ").append(Integer.toHexString(this.getDVRecNo())).append("\n");
buffer.append("[/DVAL]\n"); buffer.append("[/DVAL]\n");
@ -126,10 +176,10 @@ public class DVALRecord extends Record
{ {
LittleEndian.putShort(data, 0 + offset, this.sid); LittleEndian.putShort(data, 0 + offset, this.sid);
LittleEndian.putShort(data, 2 + offset, ( short)(this.getRecordSize()-4)); LittleEndian.putShort(data, 2 + offset, ( short)(this.getRecordSize()-4));
for ( int i=0; i<5; i++)
{ LittleEndian.putShort(data, 4 + offset, this.getOptions());
LittleEndian.putShort(data, 4 + i*2 + offset, (short)this.field_unknown); LittleEndian.putInt(data, 6 + offset, this.getHorizontalPos());
} LittleEndian.putInt(data, 10 + offset, this.getVerticalPos());
LittleEndian.putInt(data, 14 + offset, this.getObjectID()); LittleEndian.putInt(data, 14 + offset, this.getObjectID());
LittleEndian.putInt(data, 18 + offset, this.getDVRecNo()); LittleEndian.putInt(data, 18 + offset, this.getDVRecNo());
return getRecordSize(); return getRecordSize();
@ -149,9 +199,11 @@ public class DVALRecord extends Record
public Object clone() public Object clone()
{ {
DVALRecord rec = new DVALRecord(); DVALRecord rec = new DVALRecord();
rec.field_unknown = this.field_unknown; rec.field_1_options = field_1_options;
rec.field_2_horiz_pos = field_2_horiz_pos;
rec.field_3_vert_pos = field_3_vert_pos;
rec.field_cbo_id = this.field_cbo_id; rec.field_cbo_id = this.field_cbo_id;
rec.field_3_dv_no = this.field_3_dv_no; rec.field_5_dv_no = this.field_5_dv_no;
return rec; return rec;
} }
} }

View File

@ -55,6 +55,7 @@ public class UncalcedRecord extends Record
} }
protected void fillFields(RecordInputStream in) { protected void fillFields(RecordInputStream in) {
short unused = in.readShort();
} }
public String toString() { public String toString() {

View File

@ -29,7 +29,7 @@ import org.apache.poi.hssf.usermodel.HSSFErrorConstants;
public class ErrPtg extends Ptg public class ErrPtg extends Ptg
{ {
public static final short sid = 0x1c; public static final short sid = 0x1c;
private static final int SIZE = 7; private static final int SIZE = 2;
private byte field_1_error_code; private byte field_1_error_code;
/** Creates new ErrPtg */ /** Creates new ErrPtg */