aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi/ddf
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2015-06-10 22:23:47 +0000
committerAndreas Beeker <kiwiwings@apache.org>2015-06-10 22:23:47 +0000
commitb00e544e9b28a8c0a1c1ad5eddc473a6fa0285cf (patch)
tree72375de997bc5865c56887c47a8c1250dd7fa52b /src/java/org/apache/poi/ddf
parent16ac6b107e8f5deae70c391be3fbc5d02d751fd0 (diff)
downloadpoi-b00e544e9b28a8c0a1c1ad5eddc473a6fa0285cf.tar.gz
poi-b00e544e9b28a8c0a1c1ad5eddc473a6fa0285cf.zip
Fixed TextRun handling and various junit tests
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/common_sl@1684773 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/ddf')
-rw-r--r--src/java/org/apache/poi/ddf/EscherChildAnchorRecord.java27
-rw-r--r--src/java/org/apache/poi/ddf/EscherProperties.java2
-rw-r--r--src/java/org/apache/poi/ddf/EscherTextboxRecord.java3
3 files changed, 23 insertions, 9 deletions
diff --git a/src/java/org/apache/poi/ddf/EscherChildAnchorRecord.java b/src/java/org/apache/poi/ddf/EscherChildAnchorRecord.java
index b6193cea4e..bbb84bae8c 100644
--- a/src/java/org/apache/poi/ddf/EscherChildAnchorRecord.java
+++ b/src/java/org/apache/poi/ddf/EscherChildAnchorRecord.java
@@ -40,13 +40,26 @@ public class EscherChildAnchorRecord
private int field_4_dy2;
public int fillFields(byte[] data, int offset, EscherRecordFactory recordFactory) {
- /*int bytesRemaining =*/ readHeader( data, offset );
+ int bytesRemaining = readHeader( data, offset );
int pos = offset + 8;
int size = 0;
- field_1_dx1 = LittleEndian.getInt( data, pos + size );size+=4;
- field_2_dy1 = LittleEndian.getInt( data, pos + size );size+=4;
- field_3_dx2 = LittleEndian.getInt( data, pos + size );size+=4;
- field_4_dy2 = LittleEndian.getInt( data, pos + size );size+=4;
+ switch (bytesRemaining) {
+ case 16: // RectStruct
+ field_1_dx1 = LittleEndian.getInt( data, pos + size );size+=4;
+ field_2_dy1 = LittleEndian.getInt( data, pos + size );size+=4;
+ field_3_dx2 = LittleEndian.getInt( data, pos + size );size+=4;
+ field_4_dy2 = LittleEndian.getInt( data, pos + size );size+=4;
+ break;
+ case 8: // SmallRectStruct
+ field_1_dx1 = LittleEndian.getShort( data, pos + size );size+=2;
+ field_2_dy1 = LittleEndian.getShort( data, pos + size );size+=2;
+ field_3_dx2 = LittleEndian.getShort( data, pos + size );size+=2;
+ field_4_dy2 = LittleEndian.getShort( data, pos + size );size+=2;
+ break;
+ default:
+ throw new RuntimeException("Invalid EscherChildAnchorRecord - neither 8 nor 16 bytes.");
+ }
+
return 8 + size;
}
@@ -58,8 +71,8 @@ public class EscherChildAnchorRecord
LittleEndian.putInt( data, pos, getRecordSize()-8 ); pos += 4;
LittleEndian.putInt( data, pos, field_1_dx1 ); pos += 4;
LittleEndian.putInt( data, pos, field_2_dy1 ); pos += 4;
- LittleEndian.putInt( data, pos, field_3_dx2 ); pos += 4;
- LittleEndian.putInt( data, pos, field_4_dy2 ); pos += 4;
+ LittleEndian.putInt( data, pos, field_3_dx2 ); pos += 4;
+ LittleEndian.putInt( data, pos, field_4_dy2 ); pos += 4;
listener.afterRecordSerialize( pos, getRecordId(), pos - offset, this );
return pos - offset;
diff --git a/src/java/org/apache/poi/ddf/EscherProperties.java b/src/java/org/apache/poi/ddf/EscherProperties.java
index 7ec219006b..2bee6b92e5 100644
--- a/src/java/org/apache/poi/ddf/EscherProperties.java
+++ b/src/java/org/apache/poi/ddf/EscherProperties.java
@@ -507,7 +507,7 @@ public final class EscherProperties {
addProp(m, SHADOWSTYLE__ORIGINX, "shadowstyle.originx");
addProp(m, SHADOWSTYLE__ORIGINY, "shadowstyle.originy");
addProp(m, SHADOWSTYLE__SHADOW, "shadowstyle.shadow");
- addProp(m, SHADOWSTYLE__SHADOWOBSURED, "shadowstyle.shadowobsured");
+ addProp(m, SHADOWSTYLE__SHADOWOBSURED, "shadowstyle.shadowobscured");
addProp(m, PERSPECTIVE__TYPE, "perspective.type");
addProp(m, PERSPECTIVE__OFFSETX, "perspective.offsetx");
addProp(m, PERSPECTIVE__OFFSETY, "perspective.offsety");
diff --git a/src/java/org/apache/poi/ddf/EscherTextboxRecord.java b/src/java/org/apache/poi/ddf/EscherTextboxRecord.java
index c21c227968..dbf28531fe 100644
--- a/src/java/org/apache/poi/ddf/EscherTextboxRecord.java
+++ b/src/java/org/apache/poi/ddf/EscherTextboxRecord.java
@@ -17,6 +17,7 @@
package org.apache.poi.ddf;
+import org.apache.poi.hslf.record.RecordTypes;
import org.apache.poi.util.HexDump;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.RecordFormatException;
@@ -32,7 +33,7 @@ import org.apache.poi.util.RecordFormatException;
*/
public class EscherTextboxRecord extends EscherRecord
{
- public static final short RECORD_ID = (short)0xF00D;
+ public static final short RECORD_ID = (short)RecordTypes.EscherClientTextbox;
public static final String RECORD_DESCRIPTION = "msofbtClientTextbox";
private static final byte[] NO_BYTES = new byte[0];