]> source.dussan.org Git - poi.git/commitdiff
replace getInstance() / getOptions() with getShapeType for EscherSpRecord
authorSergey Vladimirov <sergey@apache.org>
Wed, 31 Aug 2011 13:14:09 +0000 (13:14 +0000)
committerSergey Vladimirov <sergey@apache.org>
Wed, 31 Aug 2011 13:14:09 +0000 (13:14 +0000)
replace getOptions() with getInstance() for other cases

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1163615 13f79535-47bb-0310-9956-ffa450edef68

21 files changed:
src/java/org/apache/poi/ddf/AbstractEscherOptRecord.java
src/java/org/apache/poi/ddf/EscherBSERecord.java
src/java/org/apache/poi/ddf/EscherBitmapBlip.java
src/java/org/apache/poi/ddf/EscherBlipRecord.java
src/java/org/apache/poi/ddf/EscherBlipWMFRecord.java
src/java/org/apache/poi/ddf/EscherChildAnchorRecord.java
src/java/org/apache/poi/ddf/EscherClientAnchorRecord.java
src/java/org/apache/poi/ddf/EscherClientDataRecord.java
src/java/org/apache/poi/ddf/EscherContainerRecord.java
src/java/org/apache/poi/ddf/EscherDgRecord.java
src/java/org/apache/poi/ddf/EscherDggRecord.java
src/java/org/apache/poi/ddf/EscherMetafileBlip.java
src/java/org/apache/poi/ddf/EscherPictBlip.java
src/java/org/apache/poi/ddf/EscherSpRecord.java
src/java/org/apache/poi/ddf/EscherSpgrRecord.java
src/java/org/apache/poi/ddf/EscherSplitMenuColorsRecord.java
src/java/org/apache/poi/ddf/EscherTextboxRecord.java
src/java/org/apache/poi/ddf/UnknownEscherRecord.java
src/java/org/apache/poi/hssf/record/EscherAggregate.java
src/scratchpad/src/org/apache/poi/hslf/model/Shape.java
src/scratchpad/src/org/apache/poi/hslf/model/ShapeFactory.java

index 840ccc9a10c20c71a8b6695c65bf6a2789aad064..2b97b2885f98ca6b4f84e7574216b425a08da819 100644 (file)
@@ -152,8 +152,11 @@ public abstract class AbstractEscherOptRecord extends EscherRecord
         stringBuilder.append( "  isContainer: " );
         stringBuilder.append( isContainerRecord() );
         stringBuilder.append( nl );
-        stringBuilder.append( "  options: 0x" );
-        stringBuilder.append( HexDump.toHex( getOptions() ) );
+        stringBuilder.append( "  version: 0x" );
+        stringBuilder.append( HexDump.toHex( getVersion() ) );
+        stringBuilder.append( nl );
+        stringBuilder.append( "  instance: 0x" );
+        stringBuilder.append( HexDump.toHex( getInstance() ) );
         stringBuilder.append( nl );
         stringBuilder.append( "  recordId: 0x" );
         stringBuilder.append( HexDump.toHex( getRecordId() ) );
index a99c11fd5aeb8eaf8e7e83c042a7b0de133ee6c5..78420683a2d7690573adf5a504db3dffabd874f7 100644 (file)
@@ -313,7 +313,8 @@ public final class EscherBSERecord extends EscherRecord {
         String extraData = _remainingData == null ? null : HexDump.toHex(_remainingData, 32);
         return getClass().getName() + ":" + '\n' +
                 "  RecordId: 0x" + HexDump.toHex( RECORD_ID ) + '\n' +
-                "  Options: 0x" + HexDump.toHex( getOptions() ) + '\n' +
+                "  Version: 0x" + HexDump.toHex( getVersion() ) + '\n' +
+                "  Instance: 0x" + HexDump.toHex( getInstance() ) + '\n' +
                 "  BlipTypeWin32: " + field_1_blipTypeWin32 + '\n' +
                 "  BlipTypeMacOS: " + field_2_blipTypeMacOS + '\n' +
                 "  SUID: " + (field_3_uid == null ? "" : HexDump.toHex(field_3_uid)) + '\n' +
index 57cdb3023afc35413567ad2a9c97d7c7c9e7156e..bec7635ebff674cca3c61284ae6f4363daf74b1f 100644 (file)
@@ -108,7 +108,8 @@ public class EscherBitmapBlip extends EscherBlipRecord {
         }
         return getClass().getName() + ":" + nl +
                 "  RecordId: 0x" + HexDump.toHex( getRecordId() ) + nl +
-                "  Options: 0x" + HexDump.toHex( getOptions() ) + nl +
+                "  Version: 0x" + HexDump.toHex( getVersion() ) + nl +
+                "  Instance: 0x" + HexDump.toHex( getInstance() ) + nl +
                 "  UID: 0x" + HexDump.toHex( field_1_UID ) + nl +
                 "  Marker: 0x" + HexDump.toHex( field_2_marker ) + nl +
                 "  Extra Data:" + nl + extraData;
index 48c0c2b2925fb993a3f7f77729447a805952d147..f10781f602e57be0dafa5ba0c8a11da066cd024a 100644 (file)
@@ -77,7 +77,8 @@ public class EscherBlipRecord extends EscherRecord { // TODO - instantiable supe
         String extraData = HexDump.toHex(field_pictureData, 32);
         return getClass().getName() + ":" + '\n' +
                 "  RecordId: 0x" + HexDump.toHex( getRecordId() ) + '\n' +
-                "  Options: 0x" + HexDump.toHex( getOptions() ) + '\n' +
+                "  Version: 0x" + HexDump.toHex( getVersion() ) + '\n' +
+                "  Instance: 0x" + HexDump.toHex( getInstance() ) + '\n' +
                 "  Extra Data:" + '\n' + extraData;
     }
 }
index f544dbe90c83a85e70d259464105562287a5a235..7881754af53e64aea710f5dc962989b51df1e6ce 100644 (file)
@@ -334,7 +334,8 @@ public class EscherBlipWMFRecord
         }
         return getClass().getName() + ":" + nl +
                 "  RecordId: 0x" + HexDump.toHex( getRecordId() ) + nl +
-                "  Options: 0x" + HexDump.toHex( getOptions() ) + nl +
+                "  Version: 0x" + HexDump.toHex( getVersion() ) + nl +
+                "  Instance: 0x" + HexDump.toHex( getInstance() ) + nl +
                 "  Secondary UID: " + HexDump.toHex( field_1_secondaryUID ) + nl +
                 "  CacheOfSize: " + field_2_cacheOfSize + nl +
                 "  BoundaryTop: " + field_3_boundaryTop + nl +
index 15f729298e2ba0f107453d06ea719dfc4f9f4fc5..00c61c6e8e44b3022b833d50b6b520528de4126f 100644 (file)
@@ -88,7 +88,8 @@ public class EscherChildAnchorRecord
 
         return getClass().getName() + ":" + nl +
                 "  RecordId: 0x" + HexDump.toHex(RECORD_ID) + nl +
-                "  Options: 0x" + HexDump.toHex(getOptions()) + nl +
+                "  Version: 0x" + HexDump.toHex(getVersion()) + nl +
+                "  Instance: 0x" + HexDump.toHex(getInstance()) + nl +
                 "  X1: " + field_1_dx1 + nl +
                 "  Y1: " + field_2_dy1 + nl +
                 "  X2: " + field_3_dx2 + nl +
index 4f96247329960841148fd38ba4421bb5018c496a..f79569ac6c531ccab8002ae645e934dc2bfd589d 100644 (file)
@@ -145,7 +145,8 @@ public class EscherClientAnchorRecord
         }
         return getClass().getName() + ":" + nl +
                 "  RecordId: 0x" + HexDump.toHex(RECORD_ID) + nl +
-                "  Options: 0x" + HexDump.toHex(getOptions()) + nl +
+                "  Version: 0x" + HexDump.toHex(getVersion()) + nl +
+                "  Instance: 0x" + HexDump.toHex(getInstance()) + nl +
                 "  Flag: " + field_1_flag + nl +
                 "  Col1: " + field_2_col1 + nl +
                 "  DX1: " + field_3_dx1 + nl +
index 7dc9627122396a901c7549102b0a11ddb19cb6e9..a94a022f0aa3e77a907ebe8deac1f1dbfe5d675c 100644 (file)
@@ -92,7 +92,8 @@ public class EscherClientDataRecord
         }
         return getClass().getName() + ":" + nl +
                 "  RecordId: 0x" + HexDump.toHex(RECORD_ID) + nl +
-                "  Options: 0x" + HexDump.toHex(getOptions()) + nl +
+                "  Version: 0x" + HexDump.toHex(getVersion()) + nl +
+                "  Instance: 0x" + HexDump.toHex(getInstance()) + nl +
                 "  Extra Data:" + nl +
                 extraData;
 
index 4aa9567a2a347e4141f9bf89b358dcc0e98f65c9..70232eb1d80da692b15c97de3df7338e28e0e1a1 100644 (file)
@@ -248,7 +248,8 @@ public final class EscherContainerRecord extends EscherRecord {
 
         return getClass().getName() + " (" + getRecordName() + "):" + nl
                 + "  isContainer: " + isContainerRecord() + nl
-                + "  options: 0x" + HexDump.toHex( getOptions() ) + nl
+                + "  version: 0x" + HexDump.toHex( getVersion() ) + nl
+                + "  instance: 0x" + HexDump.toHex( getInstance() ) + nl
                 + "  recordId: 0x" + HexDump.toHex( getRecordId() ) + nl
                 + "  numchildren: " + _childRecords.size() + nl
                 + children.toString();
index a96bffa861052da982ec72a36f5b4faa095c57a8..2f251f17d10c1f9faadfa001a49e1c2d45733521 100644 (file)
@@ -88,7 +88,8 @@ public class EscherDgRecord
     public String toString() {
         return getClass().getName() + ":" + '\n' +
                 "  RecordId: 0x" + HexDump.toHex(RECORD_ID) + '\n' +
-                "  Options: 0x" + HexDump.toHex(getOptions()) + '\n' +
+                "  Version: 0x" + HexDump.toHex(getVersion()) + '\n' +
+                "  Instance: 0x" + HexDump.toHex(getInstance()) + '\n' +
                 "  NumShapes: " + field_1_numShapes + '\n' +
                 "  LastMSOSPID: " + field_2_lastMSOSPID + '\n';
 
index bdcf5ad0683edd34527dd7a6c8ce5ae445c016a6..c5e4551d4dd6c5c584657c68db4754d96d71e5c7 100644 (file)
@@ -132,7 +132,8 @@ public final class EscherDggRecord extends EscherRecord {
         }
         return getClass().getName() + ":" + '\n' +
                 "  RecordId: 0x" + HexDump.toHex(RECORD_ID) + '\n' +
-                "  Options: 0x" + HexDump.toHex(getOptions()) + '\n' +
+                "  Version: 0x" + HexDump.toHex(getVersion()) + '\n' +
+                "  Instance: 0x" + HexDump.toHex(getInstance()) + '\n' +
                 "  ShapeIdMax: " + field_1_shapeIdMax + '\n' +
                 "  NumIdClusters: " + getNumIdClusters() + '\n' +
                 "  NumShapesSaved: " + field_3_numShapesSaved + '\n' +
index 9989951f8287036b4fcb7bc7acb0a9d30115c6ef..d9a13476151f8bc331fab5ea60334f2179a5989f 100644 (file)
@@ -247,7 +247,8 @@ public final class EscherMetafileBlip extends EscherBlipRecord {
         String extraData = "";//HexDump.toHex(field_pictureData, 32);
         return getClass().getName() + ":" + '\n' +
                 "  RecordId: 0x" + HexDump.toHex( getRecordId() ) + '\n' +
-                "  Options: 0x" + HexDump.toHex( getOptions() ) + '\n' +
+                "  Version: 0x" + HexDump.toHex( getVersion() ) + '\n' +
+                "  Instance: 0x" + HexDump.toHex( getInstance() ) + '\n' +
                 "  UID: 0x" + HexDump.toHex( field_1_UID ) + '\n' +
                 (field_2_UID == null ? "" : ("  UID2: 0x" + HexDump.toHex( field_2_UID ) + '\n')) +
                 "  Uncompressed Size: " + HexDump.toHex( field_2_cb ) + '\n' +
index 31f36c3ebcdafbb7b26e2fbaab91446564ca8941..978ff777e4575675e763a846a13e8c45bd337caf 100644 (file)
@@ -202,7 +202,8 @@ public final class EscherPictBlip extends EscherBlipRecord {
         String extraData = HexDump.toHex(field_pictureData, 32);
         return getClass().getName() + ":" + '\n' +
                 "  RecordId: 0x" + HexDump.toHex( getRecordId() ) + '\n' +
-                "  Options: 0x" + HexDump.toHex( getOptions() ) + '\n' +
+                "  Version: 0x" + HexDump.toHex( getVersion() ) + '\n' +
+                "  Instance: 0x" + HexDump.toHex( getInstance() ) + '\n' +
                 "  UID: 0x" + HexDump.toHex( field_1_UID ) + '\n' +
                 "  Uncompressed Size: " + HexDump.toHex( field_2_cb ) + '\n' +
                 "  Bounds: " + getBounds() + '\n' +
index 69bde52c15009cafff65fca20a42fb3f9fc3dfea..cd51c91929dfd3a2b67f121de1f2394fddb46263 100644 (file)
@@ -108,7 +108,8 @@ public class EscherSpRecord
 
         return getClass().getName() + ":" + nl +
                 "  RecordId: 0x" + HexDump.toHex(RECORD_ID) + nl +
-                "  Options: 0x" + HexDump.toHex(getOptions()) + nl +
+                "  Version: 0x" + HexDump.toHex(getVersion()) + nl +
+                "  ShapeType: 0x" + HexDump.toHex(getShapeType()) + nl +
                 "  ShapeId: " + field_1_shapeId + nl +
                 "  Flags: " + decodeFlags(field_2_flags) + " (0x" + HexDump.toHex(field_2_flags) + ")" + nl;
 
@@ -197,4 +198,27 @@ public class EscherSpRecord
     {
         this.field_2_flags = field_2_flags;
     }
+
+    /**
+     * Returns shape type. Must be one of MSOSPT values (see [MS-ODRAW] for
+     * details).
+     * 
+     * @return shape type
+     */
+    public short getShapeType()
+    {
+        return getInstance();
+    }
+
+    /**
+     * Sets shape type. Must be one of MSOSPT values (see [MS-ODRAW] for
+     * details).
+     * 
+     * @param value
+     *            new shape type
+     */
+    public void setShapeType( short value )
+    {
+        setInstance( value );
+    }
 }
index 80594af5e004e1b5e08537d1a7f2b89c0ed107ca..43197322df0a54dbfec8c12ffc8165ede7770404 100644 (file)
@@ -89,7 +89,8 @@ public class EscherSpgrRecord
     public String toString() {
         return getClass().getName() + ":" + '\n' +
                 "  RecordId: 0x" + HexDump.toHex(RECORD_ID) + '\n' +
-                "  Options: 0x" + HexDump.toHex(getOptions()) + '\n' +
+                "  Version: 0x" + HexDump.toHex(getVersion()) + '\n' +
+                "  Instance: 0x" + HexDump.toHex(getInstance()) + '\n' +
                 "  RectX: " + field_1_rectX1 + '\n' +
                 "  RectY: " + field_2_rectY1 + '\n' +
                 "  RectWidth: " + field_3_rectX2 + '\n' +
index f11c2251bf6132773c2f5d71a42aeace5d58d422..2f85ef24add90473a6316573812c026aa37adbff 100644 (file)
@@ -90,7 +90,8 @@ public class EscherSplitMenuColorsRecord
     public String toString() {
         return getClass().getName() + ":" + '\n' +
                 "  RecordId: 0x" + HexDump.toHex(RECORD_ID) + '\n' +
-                "  Options: 0x" + HexDump.toHex(getOptions()) + '\n' +
+                "  Version: 0x" + HexDump.toHex(getVersion()) + '\n' +
+                "  Instance: 0x" + HexDump.toHex(getInstance()) + '\n' +
                 "  Color1: 0x" + HexDump.toHex(field_1_color1) + '\n' +
                 "  Color2: 0x" + HexDump.toHex(field_2_color2) + '\n' +
                 "  Color3: 0x" + HexDump.toHex(field_3_color3) + '\n' +
index ab1ab0bfc3b9829f53c6d0914549236a9a0dfc63..5e726d523ee2bbadbf9c9966f3fdff9b7190ad58 100644 (file)
@@ -132,7 +132,8 @@ public class EscherTextboxRecord extends EscherRecord
 
         return getClass().getName() + ":" + nl +
                 "  isContainer: " + isContainerRecord() + nl +
-                "  options: 0x" + HexDump.toHex( getOptions() ) + nl +
+                "  version: 0x" + HexDump.toHex( getVersion() ) + nl +
+                "  instance: 0x" + HexDump.toHex( getInstance() ) + nl +
                 "  recordId: 0x" + HexDump.toHex( getRecordId() ) + nl +
                 "  numchildren: " + getChildRecords().size() + nl +
                 theDumpHex;
index e5296123b148715e3605e0af0a86a3d831ad21ac..563ef6d6e45acf62909dd2d2b5287dab54600c77 100644 (file)
@@ -135,7 +135,8 @@ public final class UnknownEscherRecord extends EscherRecord {
 
         return getClass().getName() + ":" + '\n' +
                 "  isContainer: " + isContainerRecord() + '\n' +
-                "  options: 0x" + HexDump.toHex( getOptions() ) + '\n' +
+                "  version: 0x" + HexDump.toHex( getVersion() ) + '\n' +
+                "  instance: 0x" + HexDump.toHex( getInstance() ) + '\n' +
                 "  recordId: 0x" + HexDump.toHex( getRecordId() ) + '\n' +
                 "  numchildren: " + getChildRecords().size() + '\n' +
                 theDumpHex +
index 50d5e5d3f3a34ab88d91796c4bfd7cfcdbf865bb..bc893b4c3b2c4d8ffeb5cff2a019805bdc50a68f 100644 (file)
@@ -616,7 +616,7 @@ public final class EscherAggregate extends AbstractEscherHolderRecord {
                        {
                                EscherSpRecord spRecord = shapeContainer
                                                .getChildById( EscherSpRecord.RECORD_ID );
-                               int type = spRecord.getOptions() >> 4;
+                               int type = spRecord.getShapeType();
 
                                switch (type)
                                {
index 49cc01f64123f1963d5f0bf1d6e3aaa938bf042b..3fca27c449f2dcf7c1c6629b49e9241f5fb8e781 100644 (file)
@@ -130,7 +130,7 @@ public abstract class Shape {
      */
     public int getShapeType(){
         EscherSpRecord spRecord = _escherContainer.getChildById(EscherSpRecord.RECORD_ID);
-        return spRecord.getOptions() >> 4;
+        return spRecord.getShapeType();
     }
 
     /**
@@ -139,7 +139,8 @@ public abstract class Shape {
      */
     public void setShapeType(int type){
         EscherSpRecord spRecord = _escherContainer.getChildById(EscherSpRecord.RECORD_ID);
-        spRecord.setOptions((short)(type << 4 | 0x2));
+        spRecord.setShapeType( (short) type );
+        spRecord.setVersion( (short) 0x2 );
     }
 
     /**
index 05e8733b5a27103a3c0de1d7f6edd906d76621a4..464c842348163da49b10b931747b045d34550d90 100644 (file)
@@ -72,7 +72,7 @@ public final class ShapeFactory {
         Shape shape = null;
         EscherSpRecord spRecord = spContainer.getChildById(EscherSpRecord.RECORD_ID);
 
-        int type = spRecord.getOptions() >> 4;
+        int type = spRecord.getShapeType();
         switch (type){
             case ShapeTypes.TextBox:
                 shape = new TextBox(spContainer, parent);