Bug 45312: Add unit-test and javadoc, also convert file to proper line-ending and make poi.deserialize.escher=true behave for full reading of files outside of BiffViewer

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1621586 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2014-08-31 11:40:22 +00:00
parent 0cbbbfe5d5
commit 809ec00a7d
6 changed files with 836 additions and 673 deletions

View File

@ -145,7 +145,7 @@ public final class BiffViewer {
case DatRecord.sid: return new DatRecord(in); case DatRecord.sid: return new DatRecord(in);
case DataFormatRecord.sid: return new DataFormatRecord(in); case DataFormatRecord.sid: return new DataFormatRecord(in);
case DateWindow1904Record.sid: return new DateWindow1904Record(in); case DateWindow1904Record.sid: return new DateWindow1904Record(in);
case DConRefRecord.sid: return new DConRefRecord(in); case DConRefRecord.sid: return new DConRefRecord(in);
case DefaultColWidthRecord.sid:return new DefaultColWidthRecord(in); case DefaultColWidthRecord.sid:return new DefaultColWidthRecord(in);
case DefaultDataLabelTextPropertiesRecord.sid: return new DefaultDataLabelTextPropertiesRecord(in); case DefaultDataLabelTextPropertiesRecord.sid: return new DefaultDataLabelTextPropertiesRecord(in);
case DefaultRowHeightRecord.sid: return new DefaultRowHeightRecord(in); case DefaultRowHeightRecord.sid: return new DefaultRowHeightRecord(in);

View File

@ -57,20 +57,19 @@ public abstract class AbstractEscherHolderRecord extends Record {
public AbstractEscherHolderRecord(RecordInputStream in) public AbstractEscherHolderRecord(RecordInputStream in)
{ {
escherRecords = new ArrayList<EscherRecord>(); escherRecords = new ArrayList<EscherRecord>();
if (! DESERIALISE ) if (! DESERIALISE ) {
{
rawDataContainer.concatenate(in.readRemainder()); rawDataContainer.concatenate(in.readRemainder());
} } else {
else
{
byte[] data = in.readAllContinuedRemainder(); byte[] data = in.readAllContinuedRemainder();
convertToEscherRecords( 0, data.length, data ); convertToEscherRecords( 0, data.length, data );
} }
} }
protected void convertRawBytesToEscherRecords() { protected void convertRawBytesToEscherRecords() {
byte[] rawData = getRawData(); if (! DESERIALISE ) {
convertToEscherRecords(0, rawData.length, rawData); byte[] rawData = getRawData();
convertToEscherRecords(0, rawData.length, rawData);
}
} }
private void convertToEscherRecords( int offset, int size, byte[] data ) private void convertToEscherRecords( int offset, int size, byte[] data )
{ {
@ -224,7 +223,7 @@ public abstract class AbstractEscherHolderRecord extends Record {
public EscherRecord getEscherRecord(int index) public EscherRecord getEscherRecord(int index)
{ {
return (EscherRecord) escherRecords.get(index); return escherRecords.get(index);
} }
/** /**

View File

@ -42,6 +42,10 @@ public final class HSSFClientAnchor extends HSSFAnchor implements ClientAnchor {
/** /**
* Creates a new client anchor and sets the top-left and bottom-right * Creates a new client anchor and sets the top-left and bottom-right
* coordinates of the anchor. * coordinates of the anchor.
*
* Note: Microsoft Excel seems to sometimes disallow
* higher y1 than y2 or higher x1 than x2, you might need to
* reverse them and draw shapes vertically or horizontally flipped!
* *
* @param dx1 the x coordinate within the first cell. * @param dx1 the x coordinate within the first cell.
* @param dy1 the y coordinate within the first cell. * @param dy1 the y coordinate within the first cell.
@ -186,8 +190,12 @@ public final class HSSFClientAnchor extends HSSFAnchor implements ClientAnchor {
} }
/** /**
* Dets the top-left and bottom-right * Sets the top-left and bottom-right coordinates of
* coordinates of the anchor. * the anchor.
*
* Note: Microsoft Excel seems to sometimes disallow
* higher y1 than y2 or higher x1 than x2, you might need to
* reverse them and draw shapes vertically or horizontally flipped!
* *
* @param x1 the x coordinate within the first cell. * @param x1 the x coordinate within the first cell.
* @param y1 the y coordinate within the first cell. * @param y1 the y coordinate within the first cell.

View File

@ -171,6 +171,10 @@ public final class HSSFPatriarch implements HSSFShapeContainer, Drawing {
/** /**
* Creates a simple shape. This includes such shapes as lines, rectangles, * Creates a simple shape. This includes such shapes as lines, rectangles,
* and ovals. * and ovals.
*
* Note: Microsoft Excel seems to sometimes disallow
* higher y1 than y2 or higher x1 than x2 in the anchor, you might need to
* reverse them and draw shapes vertically or horizontally flipped!
* *
* @param anchor the client anchor describes how this group is attached * @param anchor the client anchor describes how this group is attached
* to the sheet. * to the sheet.

View File

@ -27,6 +27,11 @@ import java.io.IOException;
/** /**
* An abstract shape. * An abstract shape.
*
* Note: Microsoft Excel seems to sometimes disallow
* higher y1 than y2 or higher x1 than x2 in the anchor, you might need to
* reverse them and draw shapes vertically or horizontally flipped via
* setFlipVertical() or setFlipHorizontally().
*/ */
public abstract class HSSFShape { public abstract class HSSFShape {
public static final int LINEWIDTH_ONE_PT = 12700; public static final int LINEWIDTH_ONE_PT = 12700;

File diff suppressed because it is too large Load Diff