From 9982ec4e79a83491d6761586089e3f8e7898a537 Mon Sep 17 00:00:00 2001 From: Andreas Beeker Date: Sat, 12 Oct 2019 16:32:53 +0000 Subject: [PATCH] #63745 - Add traversing and debugging interface Replace EscherProperty.getAttributeMap by GenericRecord interface git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1868352 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/ddf/AbstractEscherOptRecord.java | 45 +- .../apache/poi/ddf/EscherArrayProperty.java | 184 ++-- .../org/apache/poi/ddf/EscherBSERecord.java | 63 +- .../org/apache/poi/ddf/EscherBitmapBlip.java | 21 +- .../org/apache/poi/ddf/EscherBlipRecord.java | 7 - .../apache/poi/ddf/EscherBoolProperty.java | 31 +- .../poi/ddf/EscherChildAnchorRecord.java | 10 - .../poi/ddf/EscherClientAnchorRecord.java | 16 - .../poi/ddf/EscherClientDataRecord.java | 7 - .../apache/poi/ddf/EscherComplexProperty.java | 135 ++- .../apache/poi/ddf/EscherContainerRecord.java | 17 - .../org/apache/poi/ddf/EscherDgRecord.java | 8 - .../org/apache/poi/ddf/EscherDggRecord.java | 20 - src/java/org/apache/poi/ddf/EscherDump.java | 875 ---------------- .../apache/poi/ddf/EscherMetafileBlip.java | 16 - .../org/apache/poi/ddf/EscherPictBlip.java | 14 - .../org/apache/poi/ddf/EscherProperties.java | 974 ++++++------------ .../org/apache/poi/ddf/EscherProperty.java | 91 +- .../apache/poi/ddf/EscherPropertyFactory.java | 72 +- .../apache/poi/ddf/EscherPropertyTypes.java | 376 +++++++ .../poi/ddf/EscherPropertyTypesHolder.java | 30 + .../org/apache/poi/ddf/EscherRGBProperty.java | 31 +- src/java/org/apache/poi/ddf/EscherRecord.java | 183 +--- .../poi/ddf/EscherShapePathProperty.java | 15 +- .../apache/poi/ddf/EscherSimpleProperty.java | 61 +- .../org/apache/poi/ddf/EscherSpRecord.java | 10 - .../org/apache/poi/ddf/EscherSpgrRecord.java | 10 - .../poi/ddf/EscherSplitMenuColorsRecord.java | 10 - .../apache/poi/ddf/EscherTextboxRecord.java | 20 - .../apache/poi/ddf/UnknownEscherRecord.java | 18 - .../poi/hssf/model/InternalWorkbook.java | 54 +- .../poi/hssf/usermodel/HSSFCombobox.java | 25 +- .../poi/hssf/usermodel/HSSFComment.java | 30 +- .../poi/hssf/usermodel/HSSFPicture.java | 16 +- .../poi/hssf/usermodel/HSSFPolygon.java | 64 +- .../apache/poi/hssf/usermodel/HSSFShape.java | 38 +- .../poi/hssf/usermodel/HSSFShapeFactory.java | 4 +- .../poi/hssf/usermodel/HSSFShapeGroup.java | 6 +- .../poi/hssf/usermodel/HSSFSimpleShape.java | 30 +- .../poi/hssf/usermodel/HSSFTextbox.java | 68 +- .../apache/poi/sl/usermodel/PictureData.java | 14 +- .../apache/poi/hslf/model/ActiveXShape.java | 15 +- .../apache/poi/hslf/model/HSLFMetroShape.java | 4 +- .../org/apache/poi/hslf/model/MovieShape.java | 6 +- .../org/apache/poi/hslf/model/Polygon.java | 23 +- .../poi/hslf/record/EscherPlaceholder.java | 10 - .../org/apache/poi/hslf/record/PPDrawing.java | 18 +- .../poi/hslf/usermodel/HSLFAutoShape.java | 60 +- .../apache/poi/hslf/usermodel/HSLFFill.java | 44 +- .../poi/hslf/usermodel/HSLFFreeformShape.java | 12 +- .../apache/poi/hslf/usermodel/HSLFLine.java | 14 +- .../poi/hslf/usermodel/HSLFObjectShape.java | 6 +- .../poi/hslf/usermodel/HSLFPictureShape.java | 25 +- .../apache/poi/hslf/usermodel/HSLFShape.java | 110 +- .../poi/hslf/usermodel/HSLFShapeFactory.java | 6 +- .../HSLFShapePlaceholderDetails.java | 4 +- .../poi/hslf/usermodel/HSLFSimpleShape.java | 111 +- .../apache/poi/hslf/usermodel/HSLFTable.java | 10 +- .../poi/hslf/usermodel/HSLFTableCell.java | 20 +- .../poi/hslf/usermodel/HSLFTextBox.java | 16 +- .../poi/hslf/usermodel/HSLFTextShape.java | 52 +- .../apache/poi/hwmf/record/HwmfColorRef.java | 2 +- .../hwpf/usermodel/OfficeDrawingsImpl.java | 41 +- .../apache/poi/hwpf/usermodel/Picture.java | 6 +- .../org/apache/poi/hslf/model/TestShapes.java | 6 +- .../poi/hslf/usermodel/TestBackground.java | 11 +- .../apache/poi/hslf/usermodel/TestBugs.java | 4 +- .../apache/poi/ddf/TestEscherBSERecord.java | 53 +- .../apache/poi/ddf/TestEscherBlipRecord.java | 9 +- .../poi/ddf/TestEscherBoolProperty.java | 13 +- .../poi/ddf/TestEscherChildAnchorRecord.java | 23 +- .../poi/ddf/TestEscherClientAnchorRecord.java | 35 +- .../poi/ddf/TestEscherClientDataRecord.java | 18 +- .../poi/ddf/TestEscherContainerRecord.java | 118 ++- .../apache/poi/ddf/TestEscherDgRecord.java | 19 +- .../apache/poi/ddf/TestEscherDggRecord.java | 30 +- .../org/apache/poi/ddf/TestEscherDump.java | 49 +- .../apache/poi/ddf/TestEscherOptRecord.java | 63 +- .../apache/poi/ddf/TestEscherProperty.java | 18 +- .../apache/poi/ddf/TestEscherSpRecord.java | 21 +- .../apache/poi/ddf/TestEscherSpgrRecord.java | 22 +- .../ddf/TestEscherSplitMenuColorsRecord.java | 22 +- .../poi/ddf/TestUnknownEscherRecord.java | 21 +- .../poi/hssf/model/TestDrawingShapes.java | 77 +- .../poi/hssf/usermodel/TestPolygon.java | 41 +- 85 files changed, 2032 insertions(+), 2975 deletions(-) create mode 100644 src/java/org/apache/poi/ddf/EscherPropertyTypes.java create mode 100644 src/java/org/apache/poi/ddf/EscherPropertyTypesHolder.java diff --git a/src/java/org/apache/poi/ddf/AbstractEscherOptRecord.java b/src/java/org/apache/poi/ddf/AbstractEscherOptRecord.java index b3643ff172..ac4ef54932 100644 --- a/src/java/org/apache/poi/ddf/AbstractEscherOptRecord.java +++ b/src/java/org/apache/poi/ddf/AbstractEscherOptRecord.java @@ -24,6 +24,7 @@ import java.util.function.Supplier; import org.apache.poi.util.GenericRecordUtil; import org.apache.poi.util.LittleEndian; +import org.apache.poi.util.Removal; /** * Common abstract class for {@link EscherOptRecord} and @@ -96,18 +97,13 @@ public abstract class AbstractEscherOptRecord extends EscherRecord return 8 + getPropertiesSize(); } - public T lookup( int propId ) - { - for ( EscherProperty prop : properties ) - { - if ( prop.getPropertyNumber() == propId ) - { - @SuppressWarnings( "unchecked" ) - final T result = (T) prop; - return result; - } - } - return null; + public T lookup( EscherPropertyTypes propType ) { + return lookup(propType.propNumber); + } + + @SuppressWarnings( "unchecked" ) + public T lookup( int propId ) { + return (T)properties.stream().filter(p -> p.getPropertyNumber() == propId).findFirst().orElse(null); } @Override @@ -140,8 +136,7 @@ public abstract class AbstractEscherOptRecord extends EscherRecord } /** - * Set an escher property. If a property with given propId already - exists it is replaced. + * Set an escher property. If a property with given propId already exists it is replaced. * * @param value the property to set. */ @@ -151,32 +146,22 @@ public abstract class AbstractEscherOptRecord extends EscherRecord sortProperties(); } + @Deprecated + @Removal(version = "5.0.0") public void removeEscherProperty(int num){ properties.removeIf(prop -> prop.getPropertyNumber() == num); } - @Override - protected Object[][] getAttributeMap() { - List attrList = new ArrayList<>(properties.size() * 2 + 2); - attrList.add("properties"); - attrList.add(properties.size()); - for ( EscherProperty property : properties ) { - attrList.add(property.getName()); - attrList.add(property); - } - - return new Object[][]{ - { "isContainer", isContainerRecord() }, - { "numchildren", getChildRecords().size() }, - attrList.toArray() - }; + public void removeEscherProperty(EscherPropertyTypes type){ + properties.removeIf(prop -> prop.getPropertyNumber() == type.propNumber); } @Override public Map> getGenericProperties() { return GenericRecordUtil.getGenericProperties( "base", super::getGenericProperties, - "isContainer", this::isContainerRecord + "isContainer", this::isContainerRecord, + "properties", this::getEscherProperties ); } } diff --git a/src/java/org/apache/poi/ddf/EscherArrayProperty.java b/src/java/org/apache/poi/ddf/EscherArrayProperty.java index 84026f5481..0e745cc767 100644 --- a/src/java/org/apache/poi/ddf/EscherArrayProperty.java +++ b/src/java/org/apache/poi/ddf/EscherArrayProperty.java @@ -18,11 +18,17 @@ package org.apache.poi.ddf; import java.util.Iterator; +import java.util.Map; import java.util.NoSuchElementException; +import java.util.function.Supplier; +import java.util.stream.Collectors; +import java.util.stream.StreamSupport; -import org.apache.poi.util.HexDump; +import org.apache.poi.util.GenericRecordUtil; import org.apache.poi.util.IOUtils; +import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; +import org.apache.poi.util.Removal; /** * Escher array properties are the most weird construction ever invented @@ -30,17 +36,15 @@ import org.apache.poi.util.LittleEndian; */ public final class EscherArrayProperty extends EscherComplexProperty implements Iterable { - //arbitrarily selected; may need to increase + // arbitrarily selected; may need to increase private static final int MAX_RECORD_LENGTH = 100_000; /** - * The size of the header that goes at the - * start of the array, before the data + * The size of the header that goes at the start of the array, before the data */ private static final int FIXED_SIZE = 3 * 2; /** - * Normally, the size recorded in the simple data (for the complex - * data) includes the size of the header. + * Normally, the size recorded in the simple data (for the complex data) includes the size of the header. * There are a few cases when it doesn't though... */ private boolean sizeIncludesHeaderSize = true; @@ -48,50 +52,105 @@ public final class EscherArrayProperty extends EscherComplexProperty implements /** * When reading a property from data stream remember if the complex part is empty and set this flag. */ - private boolean emptyComplexPart; + private final boolean emptyComplexPart; + /** + * Create an instance of an escher array property. + * This constructor defaults to a 6 bytes header if the complexData is null or byte[0]. + * + * @param id The id consists of the property number, a flag indicating whether this is a blip id and a flag + * indicating that this is a complex property. + * @param complexData The value of this property. + * + * @deprecated use {@link #EscherArrayProperty(EscherPropertyTypes, boolean, int)} and {@link #setComplexData(byte[])} + */ + @Deprecated + @Removal(version = "5.0.0") + @Internal public EscherArrayProperty(short id, byte[] complexData) { - super(id, checkComplexData(complexData)); - emptyComplexPart = (complexData == null || complexData.length == 0); + this(id, safeSize(complexData == null ? 0 : complexData.length)); + setComplexData(complexData); } - public EscherArrayProperty(short propertyNumber, boolean isBlipId, byte[] complexData) { - super(propertyNumber, isBlipId, checkComplexData(complexData)); + /** + * Create an instance of an escher array property. + * This constructor can be used to create emptyComplexParts with a complexSize = 0. + * Preferably use {@link #EscherArrayProperty(EscherPropertyTypes, boolean, int)} with {@link #setComplexData(byte[])}. + * + * @param id The id consists of the property number, a flag indicating whether this is a blip id and a flag + * indicating that this is a complex property. + * @param complexSize the data size + */ + @Internal + public EscherArrayProperty(short id, int complexSize) { + // this is called by EscherPropertyFactory which happens to call it with empty parts + // if a part is initial empty, don't allow it to contain something again + super(id, complexSize); + emptyComplexPart = (complexSize == 0); } - private static byte[] checkComplexData(byte[] complexData) { - if (complexData == null || complexData.length == 0) { - return new byte[6]; - } + /** + * Create an instance of an escher array property. + * This constructor defaults to a 6 bytes header if the complexData is null or byte[0]. + * + * @param propertyNumber the property number part of the property id + * @param isBlipId {@code true}, if it references a blip + * @param complexData the data + * + * @deprecated use {@link #EscherArrayProperty(EscherPropertyTypes, boolean, int)} and {@link #setComplexData(byte[])} + */ + @Deprecated + @Removal(version = "5.0.0") + public EscherArrayProperty(short propertyNumber, boolean isBlipId, byte[] complexData) { + // this is called by user code, if the complexData is empty/null, allocate a space for a valid header + // be aware, that there are complex data areas with less than 6 bytes + this((short)(propertyNumber | (isBlipId ? IS_BLIP : 0)), safeSize(complexData == null ? 0 : complexData.length)); + setComplexData(complexData); + } - return complexData; + /** + * Create an instance of an escher array property. + * This constructor defaults to a 6 bytes header if the complexSize is 0. + * + * @param type the property type of the property id + * @param isBlipId {@code true}, if it references a blip + * @param complexSize the data size + */ + public EscherArrayProperty(EscherPropertyTypes type, boolean isBlipId, int complexSize) { + this((short)(type.propNumber | (isBlipId ? IS_BLIP : 0)), safeSize(complexSize)); } + private static int safeSize(int complexSize) { + // when called by user code, fix the size to be valid for the header + return complexSize == 0 ? 6 : complexSize; + } + public int getNumberOfElementsInArray() { return (emptyComplexPart) ? 0 : LittleEndian.getUShort(getComplexData(), 0); } public void setNumberOfElementsInArray(int numberOfElements) { - int expectedArraySize = numberOfElements * getActualSizeOfElements(getSizeOfElements()) + FIXED_SIZE; - if (expectedArraySize != getComplexData().length) { - byte[] newArray = IOUtils.safelyAllocate(expectedArraySize, MAX_RECORD_LENGTH); - System.arraycopy(getComplexData(), 0, newArray, 0, getComplexData().length); - setComplexData(newArray); + if (emptyComplexPart) { + return; } + rewriteArray(numberOfElements, false); LittleEndian.putShort(getComplexData(), 0, (short) numberOfElements); } + private void rewriteArray(int numberOfElements, boolean copyToNewLen) { + int expectedArraySize = numberOfElements * getActualSizeOfElements(getSizeOfElements()) + FIXED_SIZE; + resizeComplexData(expectedArraySize, copyToNewLen ? expectedArraySize : getComplexData().length); + } + public int getNumberOfElementsInMemory() { return (emptyComplexPart) ? 0 : LittleEndian.getUShort(getComplexData(), 2); } public void setNumberOfElementsInMemory(int numberOfElements) { - int expectedArraySize = numberOfElements * getActualSizeOfElements(getSizeOfElements()) + FIXED_SIZE; - if (expectedArraySize != getComplexData().length) { - byte[] newArray = IOUtils.safelyAllocate(expectedArraySize, MAX_RECORD_LENGTH); - System.arraycopy(getComplexData(), 0, newArray, 0, expectedArraySize); - setComplexData(newArray); + if (emptyComplexPart) { + return; } + rewriteArray(numberOfElements, true); LittleEndian.putShort(getComplexData(), 2, (short) numberOfElements); } @@ -100,15 +159,14 @@ public final class EscherArrayProperty extends EscherComplexProperty implements } public void setSizeOfElements(int sizeOfElements) { + if (emptyComplexPart) { + return; + } LittleEndian.putShort( getComplexData(), 4, (short) sizeOfElements ); int expectedArraySize = getNumberOfElementsInArray() * getActualSizeOfElements(getSizeOfElements()) + FIXED_SIZE; - if (expectedArraySize != getComplexData().length) { - // Keep just the first 6 bytes. The rest is no good to us anyway. - byte[] newArray = IOUtils.safelyAllocate(expectedArraySize, MAX_RECORD_LENGTH); - System.arraycopy( getComplexData(), 0, newArray, 0, 6 ); - setComplexData(newArray); - } + // Keep just the first 6 bytes. The rest is no good to us anyway. + resizeComplexData(expectedArraySize, 6); } public byte[] getElement(int index) { @@ -119,43 +177,13 @@ public final class EscherArrayProperty extends EscherComplexProperty implements } public void setElement(int index, byte[] element) { + if (emptyComplexPart) { + return; + } int actualSize = getActualSizeOfElements(getSizeOfElements()); System.arraycopy( element, 0, getComplexData(), FIXED_SIZE + index * actualSize, actualSize); } - @Override - public String toString() { - StringBuilder results = new StringBuilder(); - results.append("propNum: ").append(getPropertyNumber()); - results.append(", propName: ").append(EscherProperties.getPropertyName( getPropertyNumber() )); - results.append(", complex: ").append(isComplex()); - results.append(", blipId: ").append(isBlipId()); - results.append(", data: \n"); - results.append(" {EscherArrayProperty:" + '\n'); - results.append(" Num Elements: ").append(getNumberOfElementsInArray()).append('\n'); - results.append(" Num Elements In Memory: ").append(getNumberOfElementsInMemory()).append('\n'); - results.append(" Size of elements: ").append(getSizeOfElements()).append('\n'); - for (int i = 0; i < getNumberOfElementsInArray(); i++) { - results.append(" Element ").append(i).append(": ").append(HexDump.toHex(getElement(i))).append('\n'); - } - results.append("}" + '\n'); - - return results.toString(); - } - - @Override - public String toXml(String tab){ - StringBuilder builder = new StringBuilder(); - builder.append(tab).append("<").append(getClass().getSimpleName()).append(" id=\"0x").append(HexDump.toHex(getId())) - .append("\" name=\"").append(getName()).append("\" blipId=\"") - .append(isBlipId()).append("\">\n"); - for (int i = 0; i < getNumberOfElementsInArray(); i++) { - builder.append("\t").append(tab).append("").append(HexDump.toHex(getElement(i))).append("\n"); - } - builder.append(tab).append(""); - return builder.toString(); - } - /** * We have this method because the way in which arrays in escher works * is screwed for seemly arbitrary reasons. While most properties are @@ -167,8 +195,8 @@ public final class EscherArrayProperty extends EscherComplexProperty implements * @return the number of bytes used by this complex property. */ public int setArrayData(byte[] data, int offset) { - if (emptyComplexPart){ - setComplexData(new byte[0]); + if (emptyComplexPart) { + resizeComplexData(0); } else { short numElements = LittleEndian.getShort(data, offset); // LittleEndian.getShort(data, offset + 2); // numReserved @@ -176,13 +204,14 @@ public final class EscherArrayProperty extends EscherComplexProperty implements // the code here seems to depend on complexData already being // sized correctly via the constructor + int cdLen = getComplexData().length; int arraySize = getActualSizeOfElements(sizeOfElements) * numElements; - if (arraySize == getComplexData().length) { + if (arraySize == cdLen) { // The stored data size in the simple block excludes the header size - setComplexData(new byte[arraySize + 6]); + resizeComplexData(arraySize + 6, 0); sizeIncludesHeaderSize = false; } - System.arraycopy(data, offset, getComplexData(), 0, getComplexData().length ); + setComplexData(data, offset); } return getComplexData().length; } @@ -197,7 +226,7 @@ public final class EscherArrayProperty extends EscherComplexProperty implements public int serializeSimplePart(byte[] data, int pos) { LittleEndian.putShort(data, pos, getId()); int recordSize = getComplexData().length; - if(!sizeIncludesHeaderSize) { + if (!sizeIncludesHeaderSize) { recordSize -= 6; } LittleEndian.putInt(data, pos + 2, recordSize); @@ -238,6 +267,15 @@ public final class EscherArrayProperty extends EscherComplexProperty implements } }; } - - + + @Override + public Map> getGenericProperties() { + return GenericRecordUtil.getGenericProperties( + "base", super::getGenericProperties, + "numElements", this::getNumberOfElementsInArray, + "numElementsInMemory", this::getNumberOfElementsInMemory, + "sizeOfElements", this::getSizeOfElements, + "elements", () -> StreamSupport.stream(spliterator(), false).collect(Collectors.toList()) + ); + } } diff --git a/src/java/org/apache/poi/ddf/EscherBSERecord.java b/src/java/org/apache/poi/ddf/EscherBSERecord.java index c00c0e2812..0eae9dc600 100644 --- a/src/java/org/apache/poi/ddf/EscherBSERecord.java +++ b/src/java/org/apache/poi/ddf/EscherBSERecord.java @@ -22,6 +22,7 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.function.Supplier; +import org.apache.poi.sl.usermodel.PictureData.PictureType; import org.apache.poi.util.IOUtils; import org.apache.poi.util.LittleEndian; @@ -39,15 +40,6 @@ public final class EscherBSERecord extends EscherRecord { public static final short RECORD_ID = EscherRecordTypes.BSE.typeID; - public static final byte BT_ERROR = 0; - public static final byte BT_UNKNOWN = 1; - public static final byte BT_EMF = 2; - public static final byte BT_WMF = 3; - public static final byte BT_PICT = 4; - public static final byte BT_JPEG = 5; - public static final byte BT_PNG = 6; - public static final byte BT_DIB = 7; - private byte field_1_blipTypeWin32; private byte field_2_blipTypeMacOS; private final byte[] field_3_uid = new byte[16]; @@ -164,6 +156,10 @@ public final class EscherBSERecord extends EscherRecord { return field_1_blipTypeWin32; } + public PictureType getPictureTypeWin32() { + return PictureType.forNativeID(field_1_blipTypeWin32); + } + /** * Set the expected win32 blip type * @@ -183,6 +179,10 @@ public final class EscherBSERecord extends EscherRecord { return field_2_blipTypeMacOS; } + public PictureType getPictureTypeMacOS() { + return PictureType.forNativeID(field_2_blipTypeMacOS); + } + /** * Set the expected MacOS blip type * @@ -363,54 +363,13 @@ public final class EscherBSERecord extends EscherRecord { _remainingData = (remainingData == null) ? new byte[0] : remainingData.clone(); } - /** - * Retrieve the string representation given a blip id. - * - * @param b the blip type byte-encoded - * - * @return the blip type as string - */ - public static String getBlipType(byte b) { - switch (b) { - case BT_ERROR: return " ERROR"; - case BT_UNKNOWN: return " UNKNOWN"; - case BT_EMF: return " EMF"; - case BT_WMF: return " WMF"; - case BT_PICT: return " PICT"; - case BT_JPEG: return " JPEG"; - case BT_PNG: return " PNG"; - case BT_DIB: return " DIB"; - } - if ( b < 32 ) { - return " NotKnown"; - } - return " Client"; - } - - @Override - protected Object[][] getAttributeMap() { - return new Object[][] { - { "BlipTypeWin32", field_1_blipTypeWin32 }, - { "BlipTypeMacOS", field_2_blipTypeMacOS }, - { "SUID", field_3_uid }, - { "Tag", field_4_tag }, - { "Size", field_5_size }, - { "Ref", field_6_ref }, - { "Offset", field_7_offset }, - { "Usage", field_8_usage }, - { "Name", field_9_name }, - { "Unused2", field_10_unused2 }, - { "Unused3", field_11_unused3 }, - { "Blip Record", field_12_blipRecord }, - { "Extra Data", _remainingData } - }; - } - @Override public Map> getGenericProperties() { final Map> m = new LinkedHashMap<>(super.getGenericProperties()); m.put("blipTypeWin32", this::getBlipTypeWin32); + m.put("pictureTypeWin32", this::getPictureTypeWin32); m.put("blipTypeMacOS", this::getBlipTypeMacOS); + m.put("pictureTypeMacOS", this::getPictureTypeMacOS); m.put("suid", this::getUid); m.put("tag", this::getTag); m.put("size", this::getSize); diff --git a/src/java/org/apache/poi/ddf/EscherBitmapBlip.java b/src/java/org/apache/poi/ddf/EscherBitmapBlip.java index 04f0843349..9521e47bdb 100644 --- a/src/java/org/apache/poi/ddf/EscherBitmapBlip.java +++ b/src/java/org/apache/poi/ddf/EscherBitmapBlip.java @@ -17,11 +17,10 @@ package org.apache.poi.ddf; -import java.util.Collections; -import java.util.LinkedHashMap; import java.util.Map; import java.util.function.Supplier; +import org.apache.poi.util.GenericRecordUtil; import org.apache.poi.util.LittleEndian; public class EscherBitmapBlip extends EscherBlipRecord { @@ -113,21 +112,13 @@ public class EscherBitmapBlip extends EscherBlipRecord { this.field_2_marker = field_2_marker; } - @Override - protected Object[][] getAttributeMap() { - return new Object[][] { - { "Marker", field_2_marker }, - { "Extra Data", getPicturedata() } - }; - } - - @Override public Map> getGenericProperties() { - final Map> m = new LinkedHashMap<>(super.getGenericProperties()); - m.put("uid", this::getUID); - m.put("marker", this::getMarker); - return Collections.unmodifiableMap(m); + return GenericRecordUtil.getGenericProperties( + "base", super::getGenericProperties, + "uid", this::getUID, + "marker", this::getMarker + ); } } diff --git a/src/java/org/apache/poi/ddf/EscherBlipRecord.java b/src/java/org/apache/poi/ddf/EscherBlipRecord.java index 41464b3c19..fa3653b944 100644 --- a/src/java/org/apache/poi/ddf/EscherBlipRecord.java +++ b/src/java/org/apache/poi/ddf/EscherBlipRecord.java @@ -107,13 +107,6 @@ public class EscherBlipRecord extends EscherRecord { System.arraycopy(pictureData, offset, field_pictureData, 0, length); } - @Override - protected Object[][] getAttributeMap() { - return new Object[][] { - { "Extra Data", getPicturedata() } - }; - } - @Override public Map> getGenericProperties() { return GenericRecordUtil.getGenericProperties( diff --git a/src/java/org/apache/poi/ddf/EscherBoolProperty.java b/src/java/org/apache/poi/ddf/EscherBoolProperty.java index ddb2ec3ea0..d4d4062c8c 100644 --- a/src/java/org/apache/poi/ddf/EscherBoolProperty.java +++ b/src/java/org/apache/poi/ddf/EscherBoolProperty.java @@ -18,8 +18,6 @@ package org.apache.poi.ddf; -import org.apache.poi.util.HexDump; - /** * Represents a boolean property. The actual utility of this property is in doubt because many * of the properties marked as boolean seem to actually contain special values. In other words @@ -42,6 +40,18 @@ public class EscherBoolProperty super(propertyNumber, value); } + + /** + * Create an instance of an escher boolean property. + * + * @param propertyType The property type + * @param value The 32 bit value of this bool property + */ + public EscherBoolProperty( EscherPropertyTypes propertyType, int value ) + { + super(propertyType.propNumber, value); + } + /** * Whether this boolean property is true * @@ -51,21 +61,4 @@ public class EscherBoolProperty { return getPropertyValue() != 0; } - -// public String toString() -// { -// return "propNum: " + getPropertyNumber() -// + ", complex: " + isComplex() -// + ", blipId: " + isBlipId() -// + ", value: " + (getValue() != 0); -// } - - @Override - public String toXml(String tab){ - StringBuilder builder = new StringBuilder(); - builder.append(tab).append("<").append(getClass().getSimpleName()).append(" id=\"0x").append(HexDump.toHex(getId())) - .append("\" name=\"").append(getName()).append("\" simpleValue=\"").append(getPropertyValue()).append("\" blipId=\"") - .append(isBlipId()).append("\" value=\"").append(isTrue()).append("\"").append("/>"); - return builder.toString(); - } } diff --git a/src/java/org/apache/poi/ddf/EscherChildAnchorRecord.java b/src/java/org/apache/poi/ddf/EscherChildAnchorRecord.java index 152ab213f7..ce7217c0a8 100644 --- a/src/java/org/apache/poi/ddf/EscherChildAnchorRecord.java +++ b/src/java/org/apache/poi/ddf/EscherChildAnchorRecord.java @@ -176,16 +176,6 @@ public class EscherChildAnchorRecord extends EscherRecord { this.field_4_dy2 = field_4_dy2; } - @Override - protected Object[][] getAttributeMap() { - return new Object[][] { - { "X1", field_1_dx1 }, - { "Y1", field_2_dy1 }, - { "X2", field_3_dx2 }, - { "Y2", field_4_dy2 } - }; - } - @Override public Map> getGenericProperties() { return GenericRecordUtil.getGenericProperties( diff --git a/src/java/org/apache/poi/ddf/EscherClientAnchorRecord.java b/src/java/org/apache/poi/ddf/EscherClientAnchorRecord.java index 3662d5bd77..0be119d4fc 100644 --- a/src/java/org/apache/poi/ddf/EscherClientAnchorRecord.java +++ b/src/java/org/apache/poi/ddf/EscherClientAnchorRecord.java @@ -348,22 +348,6 @@ public class EscherClientAnchorRecord extends EscherRecord { } } - @Override - protected Object[][] getAttributeMap() { - return new Object[][] { - { "Flag", field_1_flag }, - { "Col1", field_2_col1 }, - { "DX1", field_3_dx1 }, - { "Row1", field_4_row1 }, - { "DY1", field_5_dy1 }, - { "Col2", field_6_col2 }, - { "DX2", field_7_dx2 }, - { "Row2", field_8_row2 }, - { "DY2", field_9_dy2 }, - { "Extra Data", remainingData } - }; - } - @Override public Map> getGenericProperties() { final Map> m = new LinkedHashMap<>(super.getGenericProperties()); diff --git a/src/java/org/apache/poi/ddf/EscherClientDataRecord.java b/src/java/org/apache/poi/ddf/EscherClientDataRecord.java index 468d229972..8e859cbeb0 100644 --- a/src/java/org/apache/poi/ddf/EscherClientDataRecord.java +++ b/src/java/org/apache/poi/ddf/EscherClientDataRecord.java @@ -102,13 +102,6 @@ public class EscherClientDataRecord : remainingData.clone(); } - @Override - protected Object[][] getAttributeMap() { - return new Object[][] { - { "Extra Data", getRemainingData() } - }; - } - @Override public Map> getGenericProperties() { return GenericRecordUtil.getGenericProperties( diff --git a/src/java/org/apache/poi/ddf/EscherComplexProperty.java b/src/java/org/apache/poi/ddf/EscherComplexProperty.java index 380c9c3b09..e24610bcdc 100644 --- a/src/java/org/apache/poi/ddf/EscherComplexProperty.java +++ b/src/java/org/apache/poi/ddf/EscherComplexProperty.java @@ -18,9 +18,13 @@ package org.apache.poi.ddf; import java.util.Arrays; +import java.util.Map; +import java.util.function.Supplier; -import org.apache.poi.util.HexDump; +import org.apache.poi.util.GenericRecordUtil; +import org.apache.poi.util.IOUtils; import org.apache.poi.util.LittleEndian; +import org.apache.poi.util.Removal; /** * A complex property differs from a simple property in that the data can not fit inside a 32 bit @@ -28,7 +32,10 @@ import org.apache.poi.util.LittleEndian; * stored here. */ public class EscherComplexProperty extends EscherProperty { - private byte[] _complexData; + //arbitrarily selected; may need to increase + private static final int MAX_RECORD_LENGTH = 100_000_000; + + private byte[] complexData; /** * Create a complex property using the property id and a byte array containing the complex @@ -38,12 +45,11 @@ public class EscherComplexProperty extends EscherProperty { * indicating that this is a complex property. * @param complexData The value of this property. */ + @Deprecated + @Removal(version = "5.0.0") public EscherComplexProperty(short id, byte[] complexData) { - super(id); - if (complexData == null) { - throw new IllegalArgumentException("complexData can't be null"); - } - _complexData = complexData.clone(); + this(id, complexData == null ? 0 : complexData.length); + setComplexData(complexData); } /** @@ -54,12 +60,48 @@ public class EscherComplexProperty extends EscherProperty { * @param isBlipId Whether this is a blip id. Should be false. * @param complexData The value of this complex property. */ + @Deprecated + @Removal(version = "5.0.0") public EscherComplexProperty(short propertyNumber, boolean isBlipId, byte[] complexData) { - super(propertyNumber, true, isBlipId); - if (complexData == null) { - throw new IllegalArgumentException("complexData can't be null"); - } - _complexData = complexData.clone(); + this(propertyNumber, isBlipId, complexData == null ? 0 : complexData.length); + setComplexData(complexData); + } + + /** + * Create a complex property using the property id and a byte array containing the complex + * data value size. + * + * @param id The id consists of the property number, a flag indicating whether this is a blip id and a flag + * indicating that this is a complex property. + * @param complexSize The byte size of this property. + */ + public EscherComplexProperty(short id, int complexSize) { + super((short)(id | IS_COMPLEX)); + complexData = IOUtils.safelyAllocate(complexSize, MAX_RECORD_LENGTH); + } + + /** + * Create a complex property using the property number, a flag to indicate whether this is a + * blip reference and the complex property data size. + * + * @param propertyNumber The property number + * @param isBlipId Whether this is a blip id. Should be false. + * @param complexSize The byte size of this property. + */ + public EscherComplexProperty(short propertyNumber, boolean isBlipId, int complexSize) { + this((short)(propertyNumber | (isBlipId ? IS_BLIP : 0)), complexSize); + } + + /** + * Create a complex property using the property type, a flag to indicate whether this is a + * blip reference and the complex property data size. + * + * @param type The property type + * @param isBlipId Whether this is a blip id. Should be false. + * @param complexSize The byte size of this property. + */ + public EscherComplexProperty(EscherPropertyTypes type, boolean isBlipId, int complexSize) { + this((short)(type.propNumber | (isBlipId ? IS_BLIP : 0)), complexSize); } /** @@ -68,7 +110,7 @@ public class EscherComplexProperty extends EscherProperty { @Override public int serializeSimplePart(byte[] data, int pos) { LittleEndian.putShort(data, pos, getId()); - LittleEndian.putInt(data, pos + 2, _complexData.length); + LittleEndian.putInt(data, pos + 2, complexData.length); return 6; } @@ -81,8 +123,8 @@ public class EscherComplexProperty extends EscherProperty { */ @Override public int serializeComplexPart(byte[] data, int pos) { - System.arraycopy(_complexData, 0, data, pos, _complexData.length); - return _complexData.length; + System.arraycopy(complexData, 0, data, pos, complexData.length); + return complexData.length; } /** @@ -91,11 +133,36 @@ public class EscherComplexProperty extends EscherProperty { * @return the complex bytes */ public byte[] getComplexData() { - return _complexData; + return complexData; + } + + public int setComplexData(byte[] complexData) { + return setComplexData(complexData, 0); + } + + public int setComplexData(byte[] complexData, int offset) { + if (complexData == null) { + return 0; + } else { + int copySize = Math.max(0, Math.min(this.complexData.length, complexData.length - offset)); + System.arraycopy(complexData, offset, this.complexData, 0, copySize); + return copySize; + } + } + + + + protected void resizeComplexData(int newSize) { + resizeComplexData(newSize, Integer.MAX_VALUE); } - protected void setComplexData(byte[] _complexData) { - this._complexData = _complexData; + protected void resizeComplexData(int newSize, int copyLen) { + if (newSize == complexData.length) { + return; + } + byte[] newArray = IOUtils.safelyAllocate(newSize, MAX_RECORD_LENGTH); + System.arraycopy(complexData, 0, newArray, 0, Math.min(Math.min(complexData.length, copyLen),newSize)); + complexData = newArray; } /** @@ -109,14 +176,13 @@ public class EscherComplexProperty extends EscherProperty { if (this == o) { return true; } - if (o == null || !(o instanceof EscherComplexProperty)) { + if (!(o instanceof EscherComplexProperty)) { return false; } EscherComplexProperty escherComplexProperty = (EscherComplexProperty) o; - return Arrays.equals(_complexData, escherComplexProperty._complexData); - + return Arrays.equals(complexData, escherComplexProperty.complexData); } /** @@ -126,7 +192,7 @@ public class EscherComplexProperty extends EscherProperty { */ @Override public int getPropertySize() { - return 6 + _complexData.length; + return 6 + complexData.length; } @Override @@ -134,26 +200,11 @@ public class EscherComplexProperty extends EscherProperty { return getId() * 11; } - /** - * Retrieves the string representation for this property. - */ - @Override - public String toString() { - String dataStr = HexDump.toHex( _complexData, 32); - - return "propNum: " + getPropertyNumber() - + ", propName: " + EscherProperties.getPropertyName( getPropertyNumber() ) - + ", complex: " + isComplex() - + ", blipId: " + isBlipId() - + ", data: " + System.getProperty("line.separator") + dataStr; - } - @Override - public String toXml(String tab){ - return tab + "<" + getClass().getSimpleName() + " id=\"0x" + HexDump.toHex(getId()) + - "\" name=\"" + getName() + "\" blipId=\"" + - isBlipId() + "\">\n" + - tab + ""; - //builder.append("\t").append(tab).append(dataStr); + public Map> getGenericProperties() { + return GenericRecordUtil.getGenericProperties( + "base", super::getGenericProperties, + "data", this::getComplexData + ); } } diff --git a/src/java/org/apache/poi/ddf/EscherContainerRecord.java b/src/java/org/apache/poi/ddf/EscherContainerRecord.java index bb487a5fc8..0b0ea47fcb 100644 --- a/src/java/org/apache/poi/ddf/EscherContainerRecord.java +++ b/src/java/org/apache/poi/ddf/EscherContainerRecord.java @@ -272,23 +272,6 @@ public final class EscherContainerRecord extends EscherRecord implements Iterabl } } - @Override - protected Object[][] getAttributeMap() { - List chList = new ArrayList<>(_childRecords.size() * 2 + 2); - chList.add("children"); - chList.add(_childRecords.size()); - int count = 0; - for ( EscherRecord record : this ) { - chList.add("Child "+count); - chList.add(record); - count++; - } - return new Object[][] { - { "isContainer", isContainerRecord() }, - chList.toArray() - }; - } - @Override public Map> getGenericProperties() { return GenericRecordUtil.getGenericProperties( diff --git a/src/java/org/apache/poi/ddf/EscherDgRecord.java b/src/java/org/apache/poi/ddf/EscherDgRecord.java index 3af8c69183..2787387245 100644 --- a/src/java/org/apache/poi/ddf/EscherDgRecord.java +++ b/src/java/org/apache/poi/ddf/EscherDgRecord.java @@ -144,14 +144,6 @@ public class EscherDgRecord extends EscherRecord { this.field_1_numShapes++; } - @Override - protected Object[][] getAttributeMap() { - return new Object[][] { - { "NumShapes", field_1_numShapes }, - { "LastMSOSPID", field_2_lastMSOSPID } - }; - } - @Override public Map> getGenericProperties() { return GenericRecordUtil.getGenericProperties( diff --git a/src/java/org/apache/poi/ddf/EscherDggRecord.java b/src/java/org/apache/poi/ddf/EscherDggRecord.java index 608947e03c..188a63ee57 100644 --- a/src/java/org/apache/poi/ddf/EscherDggRecord.java +++ b/src/java/org/apache/poi/ddf/EscherDggRecord.java @@ -335,26 +335,6 @@ public final class EscherDggRecord extends EscherRecord { return shapeId; } - - - @Override - protected Object[][] getAttributeMap() { - List fldIds = new ArrayList<>(); - fldIds.add("FileId Clusters"); - fldIds.add(field_5_fileIdClusters.size()); - for (FileIdCluster fic : field_5_fileIdClusters) { - fldIds.add("Group"+fic.field_1_drawingGroupId); - fldIds.add(fic.field_2_numShapeIdsUsed); - } - - return new Object[][] { - { "ShapeIdMax", field_1_shapeIdMax }, - { "NumIdClusters", getNumIdClusters() }, - { "NumShapesSaved", field_3_numShapesSaved }, - { "DrawingsSaved", field_4_drawingsSaved }, - fldIds.toArray() - }; - } @Override public Enum getGenericRecordType() { diff --git a/src/java/org/apache/poi/ddf/EscherDump.java b/src/java/org/apache/poi/ddf/EscherDump.java index eac46a99b1..489b143eac 100644 --- a/src/java/org/apache/poi/ddf/EscherDump.java +++ b/src/java/org/apache/poi/ddf/EscherDump.java @@ -17,25 +17,13 @@ package org.apache.poi.ddf; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; import java.io.PrintStream; -import java.util.zip.InflaterInputStream; - -import org.apache.poi.util.HexDump; -import org.apache.poi.util.HexRead; -import org.apache.poi.util.LittleEndian; /** * Used to dump the contents of escher records to a PrintStream. */ public final class EscherDump { - public EscherDump() { - // - } - /** * Decodes the escher stream from a byte array and dumps the results to * a print stream. @@ -58,869 +46,6 @@ public final class EscherDump { } } - /** - * This version of dump is a translation from the open office escher dump routine. - * - * @param maxLength The number of bytes to read - * @param in An input stream to read from. - * @param out An output stream to write to. - * - * @throws IOException if the data can't be read or written - * @throws LittleEndian.BufferUnderrunException if an buffer underrun occurs - */ - public void dumpOld(long maxLength, InputStream in, PrintStream out) - throws IOException, LittleEndian.BufferUnderrunException { - long remainingBytes = maxLength; - short options; // 4 bits for the version and 12 bits for the instance - short recordId; - int recordBytesRemaining; // including enclosing records - short nDumpSize; - String recordName; - - boolean atEOF = false; - - while (!atEOF && (remainingBytes > 0)) { - options = LittleEndian.readShort( in ); - recordId = LittleEndian.readShort( in ); - recordBytesRemaining = LittleEndian.readInt( in ); - - remainingBytes -= 2 + 2 + 4; - - switch ( recordId ) - { - case (short) 0xF000: - recordName = "MsofbtDggContainer"; - break; - case (short) 0xF006: - recordName = "MsofbtDgg"; - break; - case (short) 0xF016: - recordName = "MsofbtCLSID"; - break; - case (short) 0xF00B: - recordName = "MsofbtOPT"; - break; - case (short) 0xF11A: - recordName = "MsofbtColorMRU"; - break; - case (short) 0xF11E: - recordName = "MsofbtSplitMenuColors"; - break; - case (short) 0xF001: - recordName = "MsofbtBstoreContainer"; - break; - case (short) 0xF007: - recordName = "MsofbtBSE"; - break; - case (short) 0xF002: - recordName = "MsofbtDgContainer"; - break; - case (short) 0xF008: - recordName = "MsofbtDg"; - break; - case (short) 0xF118: - recordName = "MsofbtRegroupItem"; - break; - case (short) 0xF120: - recordName = "MsofbtColorScheme"; - break; - case (short) 0xF003: - recordName = "MsofbtSpgrContainer"; - break; - case (short) 0xF004: - recordName = "MsofbtSpContainer"; - break; - case (short) 0xF009: - recordName = "MsofbtSpgr"; - break; - case (short) 0xF00A: - recordName = "MsofbtSp"; - break; - case (short) 0xF00C: - recordName = "MsofbtTextbox"; - break; - case (short) 0xF00D: - recordName = "MsofbtClientTextbox"; - break; - case (short) 0xF00E: - recordName = "MsofbtAnchor"; - break; - case (short) 0xF00F: - recordName = "MsofbtChildAnchor"; - break; - case (short) 0xF010: - recordName = "MsofbtClientAnchor"; - break; - case (short) 0xF011: - recordName = "MsofbtClientData"; - break; - case (short) 0xF11F: - recordName = "MsofbtOleObject"; - break; - case (short) 0xF11D: - recordName = "MsofbtDeletedPspl"; - break; - case (short) 0xF005: - recordName = "MsofbtSolverContainer"; - break; - case (short) 0xF012: - recordName = "MsofbtConnectorRule"; - break; - case (short) 0xF013: - recordName = "MsofbtAlignRule"; - break; - case (short) 0xF014: - recordName = "MsofbtArcRule"; - break; - case (short) 0xF015: - recordName = "MsofbtClientRule"; - break; - case (short) 0xF017: - recordName = "MsofbtCalloutRule"; - break; - case (short) 0xF119: - recordName = "MsofbtSelection"; - break; - case (short) 0xF122: - recordName = "MsofbtUDefProp"; - break; - default: - if ( recordId >= (short) 0xF018 && recordId <= (short) 0xF117 ) { - recordName = "MsofbtBLIP"; - } else if ( ( options & (short) 0x000F ) == (short) 0x000F ) { - recordName = "UNKNOWN container"; - } else { - recordName = "UNKNOWN ID"; - } - } - - StringBuilder stringBuf = new StringBuilder(); - stringBuf.append( " " ); - stringBuf.append( HexDump.toHex( recordId ) ); - stringBuf.append( " " ).append( recordName ).append( " [" ); - stringBuf.append( HexDump.toHex( options ) ); - stringBuf.append( ',' ); - stringBuf.append( HexDump.toHex( recordBytesRemaining ) ); - stringBuf.append( "] instance: " ); - stringBuf.append( HexDump.toHex( ( (short) ( options >> 4 ) ) ) ); - out.println(stringBuf); - stringBuf.setLength(0); - - - if ( recordId == (short) 0xF007 && 36 <= remainingBytes && 36 <= recordBytesRemaining ) - { // BSE, FBSE - // ULONG nP = pIn->GetRecPos(); - - byte n8; - // short n16; - // int n32; - - stringBuf = stringBuf.append( " btWin32: " ); - n8 = (byte) in.read(); - stringBuf.append( HexDump.toHex( n8 ) ); - stringBuf.append( getBlipType( n8 ) ); - stringBuf.append( " btMacOS: " ); - n8 = (byte) in.read(); - stringBuf.append( HexDump.toHex( n8 ) ); - stringBuf.append( getBlipType( n8 ) ); - out.println(stringBuf); - - out.println( " rgbUid:" ); - HexDump.dump( in, out, 0, 16 ); - - out.print( " tag: " ); - outHex( 2, in, out ); - out.println(); - out.print( " size: " ); - outHex( 4, in, out ); - out.println(); - out.print( " cRef: " ); - outHex( 4, in, out ); - out.println(); - out.print( " offs: " ); - outHex( 4, in, out ); - out.println(); - out.print( " usage: " ); - outHex( 1, in, out ); - out.println(); - out.print( " cbName: " ); - outHex( 1, in, out ); - out.println(); - out.print( " unused2: " ); - outHex( 1, in, out ); - out.println(); - out.print( " unused3: " ); - outHex( 1, in, out ); - out.println(); - - // subtract the number of bytes we've read - remainingBytes -= 36; - //n -= pIn->GetRecPos() - nP; - recordBytesRemaining = 0; // loop to MsofbtBLIP - } - else if ( recordId == (short) 0xF010 && 0x12 <= remainingBytes && 0x12 <= recordBytesRemaining ) - { // ClientAnchor - //ULONG nP = pIn->GetRecPos(); - // short n16; - - out.print( " Flag: " ); - outHex( 2, in, out ); - out.println(); - out.print( " Col1: " ); - outHex( 2, in, out ); - out.print( " dX1: " ); - outHex( 2, in, out ); - out.print( " Row1: " ); - outHex( 2, in, out ); - out.print( " dY1: " ); - outHex( 2, in, out ); - out.println(); - out.print( " Col2: " ); - outHex( 2, in, out ); - out.print( " dX2: " ); - outHex( 2, in, out ); - out.print( " Row2: " ); - outHex( 2, in, out ); - out.print( " dY2: " ); - outHex( 2, in, out ); - out.println(); - - remainingBytes -= 18; - recordBytesRemaining -= 18; - - } - else if ( recordId == (short) 0xF00B || recordId == (short) 0xF122 ) - { // OPT - int nComplex = 0; - out.println( " PROPID VALUE" ); - while ( recordBytesRemaining >= 6 + nComplex && remainingBytes >= 6 + nComplex ) - { - short n16; - int n32; - n16 = LittleEndian.readShort( in ); - n32 = LittleEndian.readInt( in ); - - recordBytesRemaining -= 6; - remainingBytes -= 6; - out.print( " " ); - out.print( HexDump.toHex( n16 ) ); - out.print( " (" ); - int propertyId = n16 & (short) 0x3FFF; - out.print( " " + propertyId ); - if ( ( n16 & (short) 0x8000 ) == 0 ) - { - if ( ( n16 & (short) 0x4000 ) != 0 ) { - out.print( ", fBlipID" ); - } - out.print( ") " ); - - out.print( HexDump.toHex( n32 ) ); - - if ( ( n16 & (short) 0x4000 ) == 0 ) - { - out.print( " (" ); - out.print( dec1616( n32 ) ); - out.print( ')' ); - out.print( " {" + propName( (short)propertyId ) + "}" ); - } - out.println(); - } - else - { - out.print( ", fComplex) " ); - out.print( HexDump.toHex( n32 ) ); - out.print( " - Complex prop len" ); - out.println( " {" + propName( (short)propertyId ) + "}" ); - - nComplex += n32; - } - - } - // complex property data - while ( ( nComplex & remainingBytes ) > 0 ) - { - nDumpSize = ( nComplex > (int) remainingBytes ) ? (short) remainingBytes : (short) nComplex; - HexDump.dump( in, out, 0, nDumpSize ); - nComplex -= nDumpSize; - recordBytesRemaining -= nDumpSize; - remainingBytes -= nDumpSize; - } - } - else if ( recordId == (short) 0xF012 ) - { - out.print( " Connector rule: " ); - out.print( LittleEndian.readInt( in ) ); - out.print( " ShapeID A: " ); - out.print( LittleEndian.readInt( in ) ); - out.print( " ShapeID B: " ); - out.print( LittleEndian.readInt( in ) ); - out.print( " ShapeID connector: " ); - out.print( LittleEndian.readInt( in ) ); - out.print( " Connect pt A: " ); - out.print( LittleEndian.readInt( in ) ); - out.print( " Connect pt B: " ); - out.println( LittleEndian.readInt( in ) ); - - recordBytesRemaining -= 24; - remainingBytes -= 24; - } - else if ( recordId >= (short) 0xF018 && recordId < (short) 0xF117 ) - { - out.println( " Secondary UID: " ); - HexDump.dump( in, out, 0, 16 ); - out.println( " Cache of size: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); - out.println( " Boundary top: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); - out.println( " Boundary left: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); - out.println( " Boundary width: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); - out.println( " Boundary height: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); - out.println( " X: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); - out.println( " Y: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); - out.println( " Cache of saved size: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); - out.println( " Compression Flag: " + HexDump.toHex( (byte) in.read() ) ); - out.println( " Filter: " + HexDump.toHex( (byte) in.read() ) ); - out.println( " Data (after decompression): " ); - - recordBytesRemaining -= 34 + 16; - remainingBytes -= 34 + 16; - - nDumpSize = ( recordBytesRemaining > (int) remainingBytes ) ? (short) remainingBytes : (short) recordBytesRemaining; - - - byte[] buf = new byte[nDumpSize]; - int read = in.read( buf ); - while ( read != -1 && read < nDumpSize ) { - read += in.read( buf, read, buf.length ); - } - ByteArrayInputStream bin = new ByteArrayInputStream( buf ); - - InputStream in1 = new InflaterInputStream( bin ); - int bytesToDump = -1; - HexDump.dump( in1, out, 0, bytesToDump ); - - recordBytesRemaining -= nDumpSize; - remainingBytes -= nDumpSize; - - } - - boolean isContainer = ( options & (short) 0x000F ) == (short) 0x000F; - if ( isContainer && remainingBytes >= 0 ) - { // Container - if ( recordBytesRemaining <= (int) remainingBytes ) { - out.println( " completed within" ); - } else { - out.println( " continued elsewhere" ); - } - } - else if ( remainingBytes >= 0 ) - // -> 0x0000 ... 0x0FFF - { - nDumpSize = ( recordBytesRemaining > (int) remainingBytes ) ? (short) remainingBytes : (short) recordBytesRemaining; - - if ( nDumpSize != 0 ) - { - HexDump.dump( in, out, 0, nDumpSize ); - remainingBytes -= nDumpSize; - } - } else { - out.println( " >> OVERRUN <<" ); - } - } - - } - - /** - * Returns a property name given a property id. This is used only by the - * old escher dump routine. - * - * @param propertyId The property number for the name - * @return A descriptive name. - */ - private String propName(short propertyId) { - final class PropName { - final int _id; - final String _name; - public PropName(int id, String name) { - _id = id; - _name = name; - } - } - - final PropName[] props = new PropName[] { - new PropName(4, "transform.rotation"), - new PropName(119, "protection.lockrotation"), - new PropName(120, "protection.lockaspectratio"), - new PropName(121, "protection.lockposition"), - new PropName(122, "protection.lockagainstselect"), - new PropName(123, "protection.lockcropping"), - new PropName(124, "protection.lockvertices"), - new PropName(125, "protection.locktext"), - new PropName(126, "protection.lockadjusthandles"), - new PropName(127, "protection.lockagainstgrouping"), - new PropName(128, "text.textid"), - new PropName(129, "text.textleft"), - new PropName(130, "text.texttop"), - new PropName(131, "text.textright"), - new PropName(132, "text.textbottom"), - new PropName(133, "text.wraptext"), - new PropName(134, "text.scaletext"), - new PropName(135, "text.anchortext"), - new PropName(136, "text.textflow"), - new PropName(137, "text.fontrotation"), - new PropName(138, "text.idofnextshape"), - new PropName(139, "text.bidir"), - new PropName(187, "text.singleclickselects"), - new PropName(188, "text.usehostmargins"), - new PropName(189, "text.rotatetextwithshape"), - new PropName(190, "text.sizeshapetofittext"), - new PropName(191, "text.sizetexttofitshape"), - new PropName(192, "geotext.unicode"), - new PropName(193, "geotext.rtftext"), - new PropName(194, "geotext.alignmentoncurve"), - new PropName(195, "geotext.defaultpointsize"), - new PropName(196, "geotext.textspacing"), - new PropName(197, "geotext.fontfamilyname"), - new PropName(240, "geotext.reverseroworder"), - new PropName(241, "geotext.hastexteffect"), - new PropName(242, "geotext.rotatecharacters"), - new PropName(243, "geotext.kerncharacters"), - new PropName(244, "geotext.tightortrack"), - new PropName(245, "geotext.stretchtofitshape"), - new PropName(246, "geotext.charboundingbox"), - new PropName(247, "geotext.scaletextonpath"), - new PropName(248, "geotext.stretchcharheight"), - new PropName(249, "geotext.nomeasurealongpath"), - new PropName(250, "geotext.boldfont"), - new PropName(251, "geotext.italicfont"), - new PropName(252, "geotext.underlinefont"), - new PropName(253, "geotext.shadowfont"), - new PropName(254, "geotext.smallcapsfont"), - new PropName(255, "geotext.strikethroughfont"), - new PropName(256, "blip.cropfromtop"), - new PropName(257, "blip.cropfrombottom"), - new PropName(258, "blip.cropfromleft"), - new PropName(259, "blip.cropfromright"), - new PropName(260, "blip.bliptodisplay"), - new PropName(261, "blip.blipfilename"), - new PropName(262, "blip.blipflags"), - new PropName(263, "blip.transparentcolor"), - new PropName(264, "blip.contrastsetting"), - new PropName(265, "blip.brightnesssetting"), - new PropName(266, "blip.gamma"), - new PropName(267, "blip.pictureid"), - new PropName(268, "blip.doublemod"), - new PropName(269, "blip.picturefillmod"), - new PropName(270, "blip.pictureline"), - new PropName(271, "blip.printblip"), - new PropName(272, "blip.printblipfilename"), - new PropName(273, "blip.printflags"), - new PropName(316, "blip.nohittestpicture"), - new PropName(317, "blip.picturegray"), - new PropName(318, "blip.picturebilevel"), - new PropName(319, "blip.pictureactive"), - new PropName(320, "geometry.left"), - new PropName(321, "geometry.top"), - new PropName(322, "geometry.right"), - new PropName(323, "geometry.bottom"), - new PropName(324, "geometry.shapepath"), - new PropName(325, "geometry.vertices"), - new PropName(326, "geometry.segmentinfo"), - new PropName(327, "geometry.adjustvalue"), - new PropName(328, "geometry.adjust2value"), - new PropName(329, "geometry.adjust3value"), - new PropName(330, "geometry.adjust4value"), - new PropName(331, "geometry.adjust5value"), - new PropName(332, "geometry.adjust6value"), - new PropName(333, "geometry.adjust7value"), - new PropName(334, "geometry.adjust8value"), - new PropName(335, "geometry.adjust9value"), - new PropName(336, "geometry.adjust10value"), - new PropName(378, "geometry.shadowOK"), - new PropName(379, "geometry.3dok"), - new PropName(380, "geometry.lineok"), - new PropName(381, "geometry.geotextok"), - new PropName(382, "geometry.fillshadeshapeok"), - new PropName(383, "geometry.fillok"), - new PropName(384, "fill.filltype"), - new PropName(385, "fill.fillcolor"), - new PropName(386, "fill.fillopacity"), - new PropName(387, "fill.fillbackcolor"), - new PropName(388, "fill.backopacity"), - new PropName(389, "fill.crmod"), - new PropName(390, "fill.patterntexture"), - new PropName(391, "fill.blipfilename"), - new PropName(392, "fill.blipflags"), - new PropName(393, "fill.width"), - new PropName(394, "fill.height"), - new PropName(395, "fill.angle"), - new PropName(396, "fill.focus"), - new PropName(397, "fill.toleft"), - new PropName(398, "fill.totop"), - new PropName(399, "fill.toright"), - new PropName(400, "fill.tobottom"), - new PropName(401, "fill.rectleft"), - new PropName(402, "fill.recttop"), - new PropName(403, "fill.rectright"), - new PropName(404, "fill.rectbottom"), - new PropName(405, "fill.dztype"), - new PropName(406, "fill.shadepreset"), - new PropName(407, "fill.shadecolors"), - new PropName(408, "fill.originx"), - new PropName(409, "fill.originy"), - new PropName(410, "fill.shapeoriginx"), - new PropName(411, "fill.shapeoriginy"), - new PropName(412, "fill.shadetype"), - new PropName(443, "fill.filled"), - new PropName(444, "fill.hittestfill"), - new PropName(445, "fill.shape"), - new PropName(446, "fill.userect"), - new PropName(447, "fill.nofillhittest"), - new PropName(448, "linestyle.color"), - new PropName(449, "linestyle.opacity"), - new PropName(450, "linestyle.backcolor"), - new PropName(451, "linestyle.crmod"), - new PropName(452, "linestyle.linetype"), - new PropName(453, "linestyle.fillblip"), - new PropName(454, "linestyle.fillblipname"), - new PropName(455, "linestyle.fillblipflags"), - new PropName(456, "linestyle.fillwidth"), - new PropName(457, "linestyle.fillheight"), - new PropName(458, "linestyle.filldztype"), - new PropName(459, "linestyle.linewidth"), - new PropName(460, "linestyle.linemiterlimit"), - new PropName(461, "linestyle.linestyle"), - new PropName(462, "linestyle.linedashing"), - new PropName(463, "linestyle.linedashstyle"), - new PropName(464, "linestyle.linestartarrowhead"), - new PropName(465, "linestyle.lineendarrowhead"), - new PropName(466, "linestyle.linestartarrowwidth"), - new PropName(467, "linestyle.lineestartarrowlength"), - new PropName(468, "linestyle.lineendarrowwidth"), - new PropName(469, "linestyle.lineendarrowlength"), - new PropName(470, "linestyle.linejoinstyle"), - new PropName(471, "linestyle.lineendcapstyle"), - new PropName(507, "linestyle.arrowheadsok"), - new PropName(508, "linestyle.anyline"), - new PropName(509, "linestyle.hitlinetest"), - new PropName(510, "linestyle.linefillshape"), - new PropName(511, "linestyle.nolinedrawdash"), - new PropName(512, "shadowstyle.type"), - new PropName(513, "shadowstyle.color"), - new PropName(514, "shadowstyle.highlight"), - new PropName(515, "shadowstyle.crmod"), - new PropName(516, "shadowstyle.opacity"), - new PropName(517, "shadowstyle.offsetx"), - new PropName(518, "shadowstyle.offsety"), - new PropName(519, "shadowstyle.secondoffsetx"), - new PropName(520, "shadowstyle.secondoffsety"), - new PropName(521, "shadowstyle.scalextox"), - new PropName(522, "shadowstyle.scaleytox"), - new PropName(523, "shadowstyle.scalextoy"), - new PropName(524, "shadowstyle.scaleytoy"), - new PropName(525, "shadowstyle.perspectivex"), - new PropName(526, "shadowstyle.perspectivey"), - new PropName(527, "shadowstyle.weight"), - new PropName(528, "shadowstyle.originx"), - new PropName(529, "shadowstyle.originy"), - new PropName(574, "shadowstyle.shadow"), - new PropName(575, "shadowstyle.shadowobsured"), - new PropName(576, "perspective.type"), - new PropName(577, "perspective.offsetx"), - new PropName(578, "perspective.offsety"), - new PropName(579, "perspective.scalextox"), - new PropName(580, "perspective.scaleytox"), - new PropName(581, "perspective.scalextoy"), - new PropName(582, "perspective.scaleytox"), - new PropName(583, "perspective.perspectivex"), - new PropName(584, "perspective.perspectivey"), - new PropName(585, "perspective.weight"), - new PropName(586, "perspective.originx"), - new PropName(587, "perspective.originy"), - new PropName(639, "perspective.perspectiveon"), - new PropName(640, "3d.specularamount"), - new PropName(661, "3d.diffuseamount"), - new PropName(662, "3d.shininess"), - new PropName(663, "3d.edgethickness"), - new PropName(664, "3d.extrudeforward"), - new PropName(665, "3d.extrudebackward"), - new PropName(666, "3d.extrudeplane"), - new PropName(667, "3d.extrusioncolor"), - new PropName(648, "3d.crmod"), - new PropName(700, "3d.3deffect"), - new PropName(701, "3d.metallic"), - new PropName(702, "3d.useextrusioncolor"), - new PropName(703, "3d.lightface"), - new PropName(704, "3dstyle.yrotationangle"), - new PropName(705, "3dstyle.xrotationangle"), - new PropName(706, "3dstyle.rotationaxisx"), - new PropName(707, "3dstyle.rotationaxisy"), - new PropName(708, "3dstyle.rotationaxisz"), - new PropName(709, "3dstyle.rotationangle"), - new PropName(710, "3dstyle.rotationcenterx"), - new PropName(711, "3dstyle.rotationcentery"), - new PropName(712, "3dstyle.rotationcenterz"), - new PropName(713, "3dstyle.rendermode"), - new PropName(714, "3dstyle.tolerance"), - new PropName(715, "3dstyle.xviewpoint"), - new PropName(716, "3dstyle.yviewpoint"), - new PropName(717, "3dstyle.zviewpoint"), - new PropName(718, "3dstyle.originx"), - new PropName(719, "3dstyle.originy"), - new PropName(720, "3dstyle.skewangle"), - new PropName(721, "3dstyle.skewamount"), - new PropName(722, "3dstyle.ambientintensity"), - new PropName(723, "3dstyle.keyx"), - new PropName(724, "3dstyle.keyy"), - new PropName(725, "3dstyle.keyz"), - new PropName(726, "3dstyle.keyintensity"), - new PropName(727, "3dstyle.fillx"), - new PropName(728, "3dstyle.filly"), - new PropName(729, "3dstyle.fillz"), - new PropName(730, "3dstyle.fillintensity"), - new PropName(763, "3dstyle.constrainrotation"), - new PropName(764, "3dstyle.rotationcenterauto"), - new PropName(765, "3dstyle.parallel"), - new PropName(766, "3dstyle.keyharsh"), - new PropName(767, "3dstyle.fillharsh"), - new PropName(769, "shape.master"), - new PropName(771, "shape.connectorstyle"), - new PropName(772, "shape.blackandwhitesettings"), - new PropName(773, "shape.wmodepurebw"), - new PropName(774, "shape.wmodebw"), - new PropName(826, "shape.oleicon"), - new PropName(827, "shape.preferrelativeresize"), - new PropName(828, "shape.lockshapetype"), - new PropName(830, "shape.deleteattachedobject"), - new PropName(831, "shape.backgroundshape"), - new PropName(832, "callout.callouttype"), - new PropName(833, "callout.xycalloutgap"), - new PropName(834, "callout.calloutangle"), - new PropName(835, "callout.calloutdroptype"), - new PropName(836, "callout.calloutdropspecified"), - new PropName(837, "callout.calloutlengthspecified"), - new PropName(889, "callout.iscallout"), - new PropName(890, "callout.calloutaccentbar"), - new PropName(891, "callout.callouttextborder"), - new PropName(892, "callout.calloutminusx"), - new PropName(893, "callout.calloutminusy"), - new PropName(894, "callout.dropauto"), - new PropName(895, "callout.lengthspecified"), - new PropName(896, "groupshape.shapename"), - new PropName(897, "groupshape.description"), - new PropName(898, "groupshape.hyperlink"), - new PropName(899, "groupshape.wrappolygonvertices"), - new PropName(900, "groupshape.wrapdistleft"), - new PropName(901, "groupshape.wrapdisttop"), - new PropName(902, "groupshape.wrapdistright"), - new PropName(903, "groupshape.wrapdistbottom"), - new PropName(904, "groupshape.regroupid"), - new PropName(953, "groupshape.editedwrap"), - new PropName(954, "groupshape.behinddocument"), - new PropName(955, "groupshape.ondblclicknotify"), - new PropName(956, "groupshape.isbutton"), - new PropName(957, "groupshape.1dadjustment"), - new PropName(958, "groupshape.hidden"), - new PropName(959, "groupshape.print"), - }; - - for (int i = 0; i < props.length; i++) { - if (props[i]._id == propertyId) { - return props[i]._name; - } - } - - return "unknown property"; - } - - /** - * Returns the blip description given a blip id. - * - * @param b blip id - * @return A description. - */ - private static String getBlipType(byte b) { - return EscherBSERecord.getBlipType(b); - } - - /** - * Straight conversion from OO. Converts a type of float. - */ - private String dec1616( int n32 ) - { - String result = ""; - result += (short) ( n32 >> 16 ); - result += '.'; - result += (short) ( n32 & 0xFFFF ); - return result; - } - - /** - * Dumps out a hex value by reading from a input stream. - * - * @param bytes How many bytes this hex value consists of. - * @param in The stream to read the hex value from. - * @param out The stream to write the nicely formatted hex value to. - */ - private void outHex( int bytes, InputStream in, PrintStream out ) throws IOException, LittleEndian.BufferUnderrunException - { - switch ( bytes ) - { - case 1: - out.print( HexDump.toHex( (byte) in.read() ) ); - break; - case 2: - out.print( HexDump.toHex( LittleEndian.readShort( in ) ) ); - break; - case 4: - out.print( HexDump.toHex( LittleEndian.readInt( in ) ) ); - break; - default: - throw new IOException( "Unable to output variable of that width" ); - } - } - - /** - * A simple test stub. - * - * @param args the args - */ - public static void main( String[] args ) { - main(args, System.out); - } - - public static void main( String[] args, PrintStream out ) { - String dump = - "0F 00 00 F0 89 07 00 00 00 00 06 F0 18 00 00 00 " + - "05 04 00 00 02 00 00 00 05 00 00 00 01 00 00 00 " + - "01 00 00 00 05 00 00 00 4F 00 01 F0 2F 07 00 00 " + - "42 00 07 F0 B7 01 00 00 03 04 3F 14 AE 6B 0F 65 " + - "B0 48 BF 5E 94 63 80 E8 91 73 FF 00 93 01 00 00 " + - "01 00 00 00 00 00 00 00 00 00 FF FF 20 54 1C F0 " + - "8B 01 00 00 3F 14 AE 6B 0F 65 B0 48 BF 5E 94 63 " + - "80 E8 91 73 92 0E 00 00 00 00 00 00 00 00 00 00 " + - "D1 07 00 00 DD 05 00 00 4A AD 6F 00 8A C5 53 00 " + - "59 01 00 00 00 FE 78 9C E3 9B C4 00 04 AC 77 D9 " + - "2F 32 08 32 FD E7 61 F8 FF 0F C8 FD 05 C5 30 19 " + - "10 90 63 90 FA 0F 06 0C 8C 0C 5C 70 19 43 30 EB " + - "0E FB 05 86 85 0C DB 18 58 80 72 8C 70 16 0B 83 " + - "05 56 51 29 88 C9 60 D9 69 0C 6C 20 26 23 03 C8 " + - "74 B0 A8 0E 03 07 FB 45 56 C7 A2 CC C4 1C 06 66 " + - "A0 0D 2C 40 39 5E 86 4C 06 3D A0 4E 10 D0 60 D9 " + - "C8 58 CC E8 CF B0 80 61 3A 8A 7E 0D C6 23 AC 4F " + - "E0 E2 98 B6 12 2B 06 73 9D 12 E3 52 56 59 F6 08 " + - "8A CC 52 66 A3 50 FF 96 2B 94 E9 DF 4C A1 FE 2D " + - "3A 03 AB 9F 81 C2 F0 A3 54 BF 0F 85 EE A7 54 FF " + - "40 FB 7F A0 E3 9F D2 F4 4F 71 FE 19 58 FF 2B 31 " + - "7F 67 36 3B 25 4F 99 1B 4E 53 A6 5F 89 25 95 E9 " + - "C4 00 C7 83 12 F3 1F 26 35 4A D3 D2 47 0E 0A C3 " + - "41 8E C9 8A 52 37 DC 15 A1 D0 0D BC 4C 06 0C 2B " + - "28 2C 13 28 D4 EF 43 61 5A A0 58 3F 85 71 E0 4B " + - "69 9E 64 65 FE 39 C0 E5 22 30 1D 30 27 0E 74 3A " + - "18 60 FD 4A CC B1 2C 13 7D 07 36 2D 2A 31 85 B2 " + - "6A 0D 74 1D 1D 22 4D 99 FE 60 0A F5 9B EC 1C 58 " + - "FD 67 06 56 3F 38 0D 84 3C A5 30 0E 28 D3 AF C4 " + - "A4 CA FA 44 7A 0D 65 6E 60 7F 4D A1 1B 24 58 F7 " + - "49 AF A5 CC 0D CC DF 19 FE 03 00 F0 B1 25 4D 42 " + - "00 07 F0 E1 01 00 00 03 04 39 50 BE 98 B0 6F 57 " + - "24 31 70 5D 23 2F 9F 10 66 FF 00 BD 01 00 00 01 " + - "00 00 00 00 00 00 00 00 00 FF FF 20 54 1C F0 B5 " + - "01 00 00 39 50 BE 98 B0 6F 57 24 31 70 5D 23 2F " + - "9F 10 66 DA 03 00 00 00 00 00 00 00 00 00 00 D1 " + - "07 00 00 DD 05 00 00 4A AD 6F 00 8A C5 53 00 83 " + - "01 00 00 00 FE 78 9C A5 52 BF 4B 42 51 14 3E F7 " + - "DC 77 7A 16 45 48 8B 3C 48 A8 16 15 0D 6C 88 D0 " + - "04 C3 40 A3 32 1C 84 96 08 21 04 A1 C5 5C A2 35 " + - "82 C0 35 6A AB 1C 6A 6B A8 24 5A 83 68 08 84 84 " + - "96 A2 86 A0 7F C2 86 5E E7 5E F5 41 E4 10 BC 03 " + - "1F E7 FB F1 CE B9 F7 F1 9E 7C 05 2E 7A 37 9B E0 " + - "45 7B 10 EC 6F 96 5F 1D 74 13 55 7E B0 6C 5D 20 " + - "60 C0 49 A2 9A BD 99 4F 50 83 1B 30 38 13 0E 33 " + - "60 A6 A7 6B B5 37 EB F4 10 FA 14 15 A0 B6 6B 37 " + - "0C 1E B3 49 73 5B A5 C2 26 48 3E C1 E0 6C 08 4A " + - "30 C9 93 AA 02 B8 20 13 62 05 4E E1 E8 D7 7C C0 " + - "B8 14 95 5E BE B8 A7 CF 1E BE 55 2C 56 B9 78 DF " + - "08 7E 88 4C 27 FF 7B DB FF 7A DD B7 1A 17 67 34 " + - "6A AE BA DA 35 D1 E7 72 BE FE EC 6E FE DA E5 7C " + - "3D EC 7A DE 03 FD 50 06 0B 23 F2 0E F3 B2 A5 11 " + - "91 0D 4C B5 B5 F3 BF 94 C1 8F 24 F7 D9 6F 60 94 " + - "3B C9 9A F3 1C 6B E7 BB F0 2E 49 B2 25 2B C6 B1 " + - "EE 69 EE 15 63 4F 71 7D CE 85 CC C8 35 B9 C3 28 " + - "28 CE D0 5C 67 79 F2 4A A2 14 23 A4 38 43 73 9D " + - "2D 69 2F C1 08 31 9F C5 5C 9B EB 7B C5 69 19 B3 " + - "B4 81 F3 DC E3 B4 8E 8B CC B3 94 53 5A E7 41 2A " + - "63 9A AA 38 C5 3D 48 BB EC 57 59 6F 2B AD 73 1F " + - "1D 60 92 AE 70 8C BB 8F CE 31 C1 3C 49 27 4A EB " + - "DC A4 5B 8C D1 0B 0E 73 37 E9 11 A7 99 C7 E8 41 " + - "69 B0 7F 00 96 F2 A7 E8 42 00 07 F0 B4 01 00 00 " + - "03 04 1A BA F9 D6 A9 B9 3A 03 08 61 E9 90 FF 7B " + - "9E E6 FF 00 90 01 00 00 01 00 00 00 00 00 00 00 " + - "00 00 FF FF 20 54 1C F0 88 01 00 00 1A BA F9 D6 " + - "A9 B9 3A 03 08 61 E9 90 FF 7B 9E E6 12 0E 00 00 " + - "00 00 00 00 00 00 00 00 D1 07 00 00 DD 05 00 00 " + - "4A AD 6F 00 8A C5 53 00 56 01 00 00 00 FE 78 9C " + - "E3 13 62 00 02 D6 BB EC 17 19 04 99 FE F3 30 FC " + - "FF 07 E4 FE 82 62 98 0C 08 C8 31 48 FD 07 03 06 " + - "46 06 2E B8 8C 21 98 75 87 FD 02 C3 42 86 6D 0C " + - "2C 40 39 46 38 8B 85 C1 02 AB A8 14 C4 64 B0 EC " + - "34 06 36 10 93 91 01 64 3A 58 54 87 81 83 FD 22 " + - "AB 63 51 66 62 0E 03 33 D0 06 16 A0 1C 2F 43 26 " + - "83 1E 50 27 08 68 B0 6C 64 2C 66 F4 67 58 C0 30 " + - "1D 45 BF 06 E3 11 D6 27 70 71 4C 5B 89 15 83 B9 " + - "4E 89 71 29 AB 2C 7B 04 45 66 29 B3 51 A8 7F CB " + - "15 CA F4 6F A6 50 FF 16 9D 81 D5 CF 40 61 F8 51 " + - "AA DF 87 42 F7 53 AA 7F A0 FD 3F D0 F1 4F 69 FA " + - "A7 38 FF 0C AC FF 95 98 BF 33 9B 9D 92 A7 CC 0D " + - "A7 29 D3 AF C4 92 CA 74 62 80 E3 41 89 F9 0F 93 " + - "1A A5 69 E9 23 07 85 E1 20 C7 64 45 A9 1B EE 8A " + - "50 E8 06 5E 26 03 86 15 14 96 09 14 EA F7 A1 30 " + - "2D 50 AC 9F C2 38 F0 A5 34 4F B2 32 FF 1C E0 72 " + - "11 98 0E 98 13 07 38 1D 28 31 C7 B2 4C F4 1D D8 " + - "B4 A0 C4 14 CA AA 35 D0 75 64 88 34 65 FA 83 29 " + - "D4 6F B2 73 60 F5 9F A1 54 FF 0E CA D3 40 C8 53 " + - "0A E3 E0 09 85 6E 50 65 7D 22 BD 86 32 37 B0 BF " + - "A6 D0 0D 12 AC FB A4 D7 52 E6 06 E6 EF 0C FF 01 " + - "97 1D 12 C7 42 00 07 F0 C3 01 00 00 03 04 BA 4C " + - "B6 23 BA 8B 27 BE C8 55 59 86 24 9F 89 D4 FF 00 " + - "9F 01 00 00 01 00 00 00 00 00 00 00 00 00 FF FF " + - "20 54 1C F0 97 01 00 00 BA 4C B6 23 BA 8B 27 BE " + - "C8 55 59 86 24 9F 89 D4 AE 0E 00 00 00 00 00 00 " + - "00 00 00 00 D1 07 00 00 DD 05 00 00 4A AD 6F 00 " + - "8A C5 53 00 65 01 00 00 00 FE 78 9C E3 5B C7 00 " + - "04 AC 77 D9 2F 32 08 32 FD E7 61 F8 FF 0F C8 FD " + - "05 C5 30 19 10 90 63 90 FA 0F 06 0C 8C 0C 5C 70 " + - "19 43 30 EB 0E FB 05 86 85 0C DB 18 58 80 72 8C " + - "70 16 0B 83 05 56 51 29 88 C9 60 D9 69 0C 6C 20 " + - "26 23 03 C8 74 B0 A8 0E 03 07 FB 45 56 C7 A2 CC " + - "C4 1C 06 66 A0 0D 2C 40 39 5E 86 4C 06 3D A0 4E " + - "10 D0 60 99 C6 B8 98 D1 9F 61 01 C3 74 14 FD 1A " + - "8C 2B D8 84 B1 88 4B A5 A5 75 03 01 50 DF 59 46 " + - "77 46 0F A8 3C A6 AB 88 15 83 B9 5E 89 B1 8B D5 " + - "97 2D 82 22 B3 94 29 D5 BF E5 CA C0 EA DF AC 43 " + - "A1 FD 14 EA 67 A0 30 FC 28 D5 EF 43 A1 FB 7D 87 " + - "B8 FF 07 3A FE 07 3A FD 53 EA 7E 0A C3 4F 89 F9 " + - "0E 73 EA 69 79 CA DC 70 8A 32 FD 4A 2C 5E 4C DF " + - "87 7A 3C BC E0 A5 30 1E 3E 31 C5 33 AC A0 30 2F " + - "52 A8 DF 87 C2 30 A4 54 3F A5 65 19 85 65 A9 12 " + - "D3 2B 16 0D 8A CB 13 4A F3 E3 27 E6 09 03 9D 0E " + - "06 58 BF 12 B3 13 CB C1 01 4E 8B 4A 4C 56 AC 91 " + - "03 5D 37 86 48 53 A6 3F 98 42 FD 26 3B 07 56 FF " + - "99 1D 14 EA A7 CC 7E 70 1A 08 79 42 61 1C 3C A5 " + - "D0 0D 9C 6C C2 32 6B 29 73 03 DB 6B CA DC C0 F8 " + - "97 F5 AD CC 1A CA DC C0 F4 83 32 37 B0 A4 30 CE " + - "FC C7 48 99 1B FE 33 32 FC 07 00 6C CC 2E 23 33 " + - "00 0B F0 12 00 00 00 BF 00 08 00 08 00 81 01 09 " + - "00 00 08 C0 01 40 00 00 08 40 00 1E F1 10 00 00 " + - "00 0D 00 00 08 0C 00 00 08 17 00 00 08 F7 00 00 " + - "10 "; - - // Decode the stream to bytes - byte[] bytes = HexRead.readFromString(dump); - // Create a new instance of the escher dumper - EscherDump dumper = new EscherDump(); - // Dump the contents of scher to screen. -// dumper.dumpOld( bytes.length, new ByteArrayInputStream( bytes ), System.out ); - dumper.dump(bytes, 0, bytes.length, out); - - } public void dump( int recordSize, byte[] data, PrintStream out ) { dump( data, 0, recordSize, out ); diff --git a/src/java/org/apache/poi/ddf/EscherMetafileBlip.java b/src/java/org/apache/poi/ddf/EscherMetafileBlip.java index fc5affac94..2be619b7cd 100644 --- a/src/java/org/apache/poi/ddf/EscherMetafileBlip.java +++ b/src/java/org/apache/poi/ddf/EscherMetafileBlip.java @@ -386,22 +386,6 @@ public final class EscherMetafileBlip extends EscherBlipRecord { setCompressed(true); } - @Override - protected Object[][] getAttributeMap() { - return new Object[][]{ - // record, version, instance are directly fetched - { "UID", field_1_UID, "UID2", field_2_UID }, - { "Uncompressed Size", field_2_cb }, - { "Bounds", getBounds().toString() }, - { "Size in EMU", getSizeEMU().toString() }, - { "Compressed Size", field_5_cbSave }, - { "Compression", field_6_fCompression }, - { "Filter", field_7_fFilter }, - { "Extra Data", "" }, - { "Remaining Data", remainingData } - }; - } - @Override public Map> getGenericProperties() { final Map> m = new LinkedHashMap<>(super.getGenericProperties()); diff --git a/src/java/org/apache/poi/ddf/EscherPictBlip.java b/src/java/org/apache/poi/ddf/EscherPictBlip.java index 44bfe1eca0..88c0438297 100644 --- a/src/java/org/apache/poi/ddf/EscherPictBlip.java +++ b/src/java/org/apache/poi/ddf/EscherPictBlip.java @@ -284,20 +284,6 @@ public final class EscherPictBlip extends EscherBlipRecord { field_7_fFilter = filter; } - @Override - protected Object[][] getAttributeMap() { - return new Object[][]{ - { "UID", field_1_UID }, - { "Uncompressed Size", field_2_cb }, - { "Bounds", getBounds().toString() }, - { "Size in EMU", getSizeEMU().toString() }, - { "Compressed Size", field_5_cbSave }, - { "Compression", field_6_fCompression }, - { "Filter", field_7_fFilter }, - { "Extra Data", getPicturedata() }, - }; - } - @Override public Map> getGenericProperties() { final Map> m = new LinkedHashMap<>(super.getGenericProperties()); diff --git a/src/java/org/apache/poi/ddf/EscherProperties.java b/src/java/org/apache/poi/ddf/EscherProperties.java index 482bce95c5..415519b453 100644 --- a/src/java/org/apache/poi/ddf/EscherProperties.java +++ b/src/java/org/apache/poi/ddf/EscherProperties.java @@ -17,666 +17,334 @@ package org.apache.poi.ddf; -import java.util.HashMap; -import java.util.Map; +import org.apache.poi.util.Removal; /** - * Provides a list of all known escher properties including the description and - * type. + * Provides a list of all known escher properties including the description and type. * - * @author Glen Stampoultzis (glens at apache.org) + * @deprecated use {@link EscherPropertyTypes} enum instead */ -@SuppressWarnings("WeakerAccess") -public final class EscherProperties { +@SuppressWarnings({"unused"}) +@Deprecated +@Removal(version = "5.0.0") +public interface EscherProperties { + short TRANSFORM__ROTATION = EscherPropertyTypes.TRANSFORM__ROTATION.propNumber; + short PROTECTION__LOCKROTATION = EscherPropertyTypes.PROTECTION__LOCKROTATION.propNumber; + short PROTECTION__LOCKASPECTRATIO = EscherPropertyTypes.PROTECTION__LOCKASPECTRATIO.propNumber; + short PROTECTION__LOCKPOSITION = EscherPropertyTypes.PROTECTION__LOCKPOSITION.propNumber; + short PROTECTION__LOCKAGAINSTSELECT = EscherPropertyTypes.PROTECTION__LOCKAGAINSTSELECT.propNumber; + short PROTECTION__LOCKCROPPING = EscherPropertyTypes.PROTECTION__LOCKCROPPING.propNumber; + short PROTECTION__LOCKVERTICES = EscherPropertyTypes.PROTECTION__LOCKVERTICES.propNumber; + short PROTECTION__LOCKTEXT = EscherPropertyTypes.PROTECTION__LOCKTEXT.propNumber; + short PROTECTION__LOCKADJUSTHANDLES = EscherPropertyTypes.PROTECTION__LOCKADJUSTHANDLES.propNumber; + short PROTECTION__LOCKAGAINSTGROUPING = EscherPropertyTypes.PROTECTION__LOCKAGAINSTGROUPING.propNumber; + short TEXT__TEXTID = EscherPropertyTypes.TEXT__TEXTID.propNumber; + short TEXT__TEXTLEFT = EscherPropertyTypes.TEXT__TEXTLEFT.propNumber; + short TEXT__TEXTTOP = EscherPropertyTypes.TEXT__TEXTTOP.propNumber; + short TEXT__TEXTRIGHT = EscherPropertyTypes.TEXT__TEXTRIGHT.propNumber; + short TEXT__TEXTBOTTOM = EscherPropertyTypes.TEXT__TEXTBOTTOM.propNumber; + short TEXT__WRAPTEXT = EscherPropertyTypes.TEXT__WRAPTEXT.propNumber; + short TEXT__SCALETEXT = EscherPropertyTypes.TEXT__SCALETEXT.propNumber; + short TEXT__ANCHORTEXT = EscherPropertyTypes.TEXT__ANCHORTEXT.propNumber; + short TEXT__TEXTFLOW = EscherPropertyTypes.TEXT__TEXTFLOW.propNumber; + short TEXT__FONTROTATION = EscherPropertyTypes.TEXT__FONTROTATION.propNumber; + short TEXT__IDOFNEXTSHAPE = EscherPropertyTypes.TEXT__IDOFNEXTSHAPE.propNumber; + short TEXT__BIDIR = EscherPropertyTypes.TEXT__BIDIR.propNumber; + short TEXT__SINGLECLICKSELECTS = EscherPropertyTypes.TEXT__SINGLECLICKSELECTS.propNumber; + short TEXT__USEHOSTMARGINS = EscherPropertyTypes.TEXT__USEHOSTMARGINS.propNumber; + short TEXT__ROTATETEXTWITHSHAPE = EscherPropertyTypes.TEXT__ROTATETEXTWITHSHAPE.propNumber; + short TEXT__SIZESHAPETOFITTEXT = EscherPropertyTypes.TEXT__SIZESHAPETOFITTEXT.propNumber; + short TEXT__SIZE_TEXT_TO_FIT_SHAPE = EscherPropertyTypes.TEXT__SIZE_TEXT_TO_FIT_SHAPE.propNumber; + short GEOTEXT__UNICODE = EscherPropertyTypes.GEOTEXT__UNICODE.propNumber; + short GEOTEXT__RTFTEXT = EscherPropertyTypes.GEOTEXT__RTFTEXT.propNumber; + short GEOTEXT__ALIGNMENTONCURVE = EscherPropertyTypes.GEOTEXT__ALIGNMENTONCURVE.propNumber; + short GEOTEXT__DEFAULTPOINTSIZE = EscherPropertyTypes.GEOTEXT__DEFAULTPOINTSIZE.propNumber; + short GEOTEXT__TEXTSPACING = EscherPropertyTypes.GEOTEXT__TEXTSPACING.propNumber; + short GEOTEXT__FONTFAMILYNAME = EscherPropertyTypes.GEOTEXT__FONTFAMILYNAME.propNumber; + short GEOTEXT__REVERSEROWORDER = EscherPropertyTypes.GEOTEXT__REVERSEROWORDER.propNumber; + short GEOTEXT__HASTEXTEFFECT = EscherPropertyTypes.GEOTEXT__HASTEXTEFFECT.propNumber; + short GEOTEXT__ROTATECHARACTERS = EscherPropertyTypes.GEOTEXT__ROTATECHARACTERS.propNumber; + short GEOTEXT__KERNCHARACTERS = EscherPropertyTypes.GEOTEXT__KERNCHARACTERS.propNumber; + short GEOTEXT__TIGHTORTRACK = EscherPropertyTypes.GEOTEXT__TIGHTORTRACK.propNumber; + short GEOTEXT__STRETCHTOFITSHAPE = EscherPropertyTypes.GEOTEXT__STRETCHTOFITSHAPE.propNumber; + short GEOTEXT__CHARBOUNDINGBOX = EscherPropertyTypes.GEOTEXT__CHARBOUNDINGBOX.propNumber; + short GEOTEXT__SCALETEXTONPATH = EscherPropertyTypes.GEOTEXT__SCALETEXTONPATH.propNumber; + short GEOTEXT__STRETCHCHARHEIGHT = EscherPropertyTypes.GEOTEXT__STRETCHCHARHEIGHT.propNumber; + short GEOTEXT__NOMEASUREALONGPATH = EscherPropertyTypes.GEOTEXT__NOMEASUREALONGPATH.propNumber; + short GEOTEXT__BOLDFONT = EscherPropertyTypes.GEOTEXT__BOLDFONT.propNumber; + short GEOTEXT__ITALICFONT = EscherPropertyTypes.GEOTEXT__ITALICFONT.propNumber; + short GEOTEXT__UNDERLINEFONT = EscherPropertyTypes.GEOTEXT__UNDERLINEFONT.propNumber; + short GEOTEXT__SHADOWFONT = EscherPropertyTypes.GEOTEXT__SHADOWFONT.propNumber; + short GEOTEXT__SMALLCAPSFONT = EscherPropertyTypes.GEOTEXT__SMALLCAPSFONT.propNumber; + short GEOTEXT__STRIKETHROUGHFONT = EscherPropertyTypes.GEOTEXT__STRIKETHROUGHFONT.propNumber; + short BLIP__CROPFROMTOP = EscherPropertyTypes.BLIP__CROPFROMTOP.propNumber; + short BLIP__CROPFROMBOTTOM = EscherPropertyTypes.BLIP__CROPFROMBOTTOM.propNumber; + short BLIP__CROPFROMLEFT = EscherPropertyTypes.BLIP__CROPFROMLEFT.propNumber; + short BLIP__CROPFROMRIGHT = EscherPropertyTypes.BLIP__CROPFROMRIGHT.propNumber; + short BLIP__BLIPTODISPLAY = EscherPropertyTypes.BLIP__BLIPTODISPLAY.propNumber; + short BLIP__BLIPFILENAME = EscherPropertyTypes.BLIP__BLIPFILENAME.propNumber; + short BLIP__BLIPFLAGS = EscherPropertyTypes.BLIP__BLIPFLAGS.propNumber; + short BLIP__TRANSPARENTCOLOR = EscherPropertyTypes.BLIP__TRANSPARENTCOLOR.propNumber; + short BLIP__CONTRASTSETTING = EscherPropertyTypes.BLIP__CONTRASTSETTING.propNumber; + short BLIP__BRIGHTNESSSETTING = EscherPropertyTypes.BLIP__BRIGHTNESSSETTING.propNumber; + short BLIP__GAMMA = EscherPropertyTypes.BLIP__GAMMA.propNumber; + short BLIP__PICTUREID = EscherPropertyTypes.BLIP__PICTUREID.propNumber; + short BLIP__DOUBLEMOD = EscherPropertyTypes.BLIP__DOUBLEMOD.propNumber; + short BLIP__PICTUREFILLMOD = EscherPropertyTypes.BLIP__PICTUREFILLMOD.propNumber; + short BLIP__PICTURELINE = EscherPropertyTypes.BLIP__PICTURELINE.propNumber; + short BLIP__PRINTBLIP = EscherPropertyTypes.BLIP__PRINTBLIP.propNumber; + short BLIP__PRINTBLIPFILENAME = EscherPropertyTypes.BLIP__PRINTBLIPFILENAME.propNumber; + short BLIP__PRINTFLAGS = EscherPropertyTypes.BLIP__PRINTFLAGS.propNumber; + short BLIP__NOHITTESTPICTURE = EscherPropertyTypes.BLIP__NOHITTESTPICTURE.propNumber; + short BLIP__PICTUREGRAY = EscherPropertyTypes.BLIP__PICTUREGRAY.propNumber; + short BLIP__PICTUREBILEVEL = EscherPropertyTypes.BLIP__PICTUREBILEVEL.propNumber; + short BLIP__PICTUREACTIVE = EscherPropertyTypes.BLIP__PICTUREACTIVE.propNumber; + short GEOMETRY__LEFT = EscherPropertyTypes.GEOMETRY__LEFT.propNumber; + short GEOMETRY__TOP = EscherPropertyTypes.GEOMETRY__TOP.propNumber; + short GEOMETRY__RIGHT = EscherPropertyTypes.GEOMETRY__RIGHT.propNumber; + short GEOMETRY__BOTTOM = EscherPropertyTypes.GEOMETRY__BOTTOM.propNumber; + short GEOMETRY__SHAPEPATH = EscherPropertyTypes.GEOMETRY__SHAPEPATH.propNumber; + short GEOMETRY__VERTICES = EscherPropertyTypes.GEOMETRY__VERTICES.propNumber; + short GEOMETRY__SEGMENTINFO = EscherPropertyTypes.GEOMETRY__SEGMENTINFO.propNumber; + short GEOMETRY__ADJUSTVALUE = EscherPropertyTypes.GEOMETRY__ADJUSTVALUE.propNumber; + short GEOMETRY__ADJUST2VALUE = EscherPropertyTypes.GEOMETRY__ADJUST2VALUE.propNumber; + short GEOMETRY__ADJUST3VALUE = EscherPropertyTypes.GEOMETRY__ADJUST3VALUE.propNumber; + short GEOMETRY__ADJUST4VALUE = EscherPropertyTypes.GEOMETRY__ADJUST4VALUE.propNumber; + short GEOMETRY__ADJUST5VALUE = EscherPropertyTypes.GEOMETRY__ADJUST5VALUE.propNumber; + short GEOMETRY__ADJUST6VALUE = EscherPropertyTypes.GEOMETRY__ADJUST6VALUE.propNumber; + short GEOMETRY__ADJUST7VALUE = EscherPropertyTypes.GEOMETRY__ADJUST7VALUE.propNumber; + short GEOMETRY__ADJUST8VALUE = EscherPropertyTypes.GEOMETRY__ADJUST8VALUE.propNumber; + short GEOMETRY__ADJUST9VALUE = EscherPropertyTypes.GEOMETRY__ADJUST9VALUE.propNumber; + short GEOMETRY__ADJUST10VALUE = EscherPropertyTypes.GEOMETRY__ADJUST10VALUE.propNumber; + short GEOMETRY__PCONNECTIONSITES = EscherPropertyTypes.GEOMETRY__PCONNECTIONSITES.propNumber; + short GEOMETRY__PCONNECTIONSITESDIR = EscherPropertyTypes.GEOMETRY__PCONNECTIONSITESDIR.propNumber; + short GEOMETRY__XLIMO = EscherPropertyTypes.GEOMETRY__XLIMO.propNumber; + short GEOMETRY__YLIMO = EscherPropertyTypes.GEOMETRY__YLIMO.propNumber; + short GEOMETRY__PADJUSTHANDLES = EscherPropertyTypes.GEOMETRY__PADJUSTHANDLES.propNumber; + short GEOMETRY__PGUIDES = EscherPropertyTypes.GEOMETRY__PGUIDES.propNumber; + short GEOMETRY__PINSCRIBE = EscherPropertyTypes.GEOMETRY__PINSCRIBE.propNumber; + short GEOMETRY__CXK = EscherPropertyTypes.GEOMETRY__CXK.propNumber; + short GEOMETRY__PFRAGMENTS = EscherPropertyTypes.GEOMETRY__PFRAGMENTS.propNumber; + short GEOMETRY__SHADOWok = EscherPropertyTypes.GEOMETRY__SHADOWOK.propNumber; + short GEOMETRY__3DOK = EscherPropertyTypes.GEOMETRY__3DOK.propNumber; + short GEOMETRY__LINEOK = EscherPropertyTypes.GEOMETRY__LINEOK.propNumber; + short GEOMETRY__GEOTEXTOK = EscherPropertyTypes.GEOMETRY__GEOTEXTOK.propNumber; + short GEOMETRY__FILLSHADESHAPEOK = EscherPropertyTypes.GEOMETRY__FILLSHADESHAPEOK.propNumber; + short GEOMETRY__FILLOK = EscherPropertyTypes.GEOMETRY__FILLOK.propNumber; + short FILL__FILLTYPE = EscherPropertyTypes.FILL__FILLTYPE.propNumber; + short FILL__FILLCOLOR = EscherPropertyTypes.FILL__FILLCOLOR.propNumber; + short FILL__FILLOPACITY = EscherPropertyTypes.FILL__FILLOPACITY.propNumber; + short FILL__FILLBACKCOLOR = EscherPropertyTypes.FILL__FILLBACKCOLOR.propNumber; + short FILL__BACKOPACITY = EscherPropertyTypes.FILL__BACKOPACITY.propNumber; + short FILL__CRMOD = EscherPropertyTypes.FILL__CRMOD.propNumber; + short FILL__PATTERNTEXTURE = EscherPropertyTypes.FILL__PATTERNTEXTURE.propNumber; + short FILL__BLIPFILENAME = EscherPropertyTypes.FILL__BLIPFILENAME.propNumber; + short FILL__BLIPFLAGS = EscherPropertyTypes.FILL__BLIPFLAGS.propNumber; + short FILL__WIDTH = EscherPropertyTypes.FILL__WIDTH.propNumber; + short FILL__HEIGHT = EscherPropertyTypes.FILL__HEIGHT.propNumber; + short FILL__ANGLE = EscherPropertyTypes.FILL__ANGLE.propNumber; + short FILL__FOCUS = EscherPropertyTypes.FILL__FOCUS.propNumber; + short FILL__TOLEFT = EscherPropertyTypes.FILL__TOLEFT.propNumber; + short FILL__TOTOP = EscherPropertyTypes.FILL__TOTOP.propNumber; + short FILL__TORIGHT = EscherPropertyTypes.FILL__TORIGHT.propNumber; + short FILL__TOBOTTOM = EscherPropertyTypes.FILL__TOBOTTOM.propNumber; + short FILL__RECTLEFT = EscherPropertyTypes.FILL__RECTLEFT.propNumber; + short FILL__RECTTOP = EscherPropertyTypes.FILL__RECTTOP.propNumber; + short FILL__RECTRIGHT = EscherPropertyTypes.FILL__RECTRIGHT.propNumber; + short FILL__RECTBOTTOM = EscherPropertyTypes.FILL__RECTBOTTOM.propNumber; + short FILL__DZTYPE = EscherPropertyTypes.FILL__DZTYPE.propNumber; + short FILL__SHADEPRESET = EscherPropertyTypes.FILL__SHADEPRESET.propNumber; + short FILL__SHADECOLORS = EscherPropertyTypes.FILL__SHADECOLORS.propNumber; + short FILL__ORIGINX = EscherPropertyTypes.FILL__ORIGINX.propNumber; + short FILL__ORIGINY = EscherPropertyTypes.FILL__ORIGINY.propNumber; + short FILL__SHAPEORIGINX = EscherPropertyTypes.FILL__SHAPEORIGINX.propNumber; + short FILL__SHAPEORIGINY = EscherPropertyTypes.FILL__SHAPEORIGINY.propNumber; + short FILL__SHADETYPE = EscherPropertyTypes.FILL__SHADETYPE.propNumber; + short FILL__FILLED = EscherPropertyTypes.FILL__FILLED.propNumber; + short FILL__HITTESTFILL = EscherPropertyTypes.FILL__HITTESTFILL.propNumber; + short FILL__SHAPE = EscherPropertyTypes.FILL__SHAPE.propNumber; + short FILL__USERECT = EscherPropertyTypes.FILL__USERECT.propNumber; + short FILL__NOFILLHITTEST = EscherPropertyTypes.FILL__NOFILLHITTEST.propNumber; + short LINESTYLE__COLOR = EscherPropertyTypes.LINESTYLE__COLOR.propNumber; + short LINESTYLE__OPACITY = EscherPropertyTypes.LINESTYLE__OPACITY.propNumber; + short LINESTYLE__BACKCOLOR = EscherPropertyTypes.LINESTYLE__BACKCOLOR.propNumber; + short LINESTYLE__CRMOD = EscherPropertyTypes.LINESTYLE__CRMOD.propNumber; + short LINESTYLE__LINETYPE = EscherPropertyTypes.LINESTYLE__LINETYPE.propNumber; + short LINESTYLE__FILLBLIP = EscherPropertyTypes.LINESTYLE__FILLBLIP.propNumber; + short LINESTYLE__FILLBLIPNAME = EscherPropertyTypes.LINESTYLE__FILLBLIPNAME.propNumber; + short LINESTYLE__FILLBLIPFLAGS = EscherPropertyTypes.LINESTYLE__FILLBLIPFLAGS.propNumber; + short LINESTYLE__FILLWIDTH = EscherPropertyTypes.LINESTYLE__FILLWIDTH.propNumber; + short LINESTYLE__FILLHEIGHT = EscherPropertyTypes.LINESTYLE__FILLHEIGHT.propNumber; + short LINESTYLE__FILLDZTYPE = EscherPropertyTypes.LINESTYLE__FILLDZTYPE.propNumber; + short LINESTYLE__LINEWIDTH = EscherPropertyTypes.LINESTYLE__LINEWIDTH.propNumber; + short LINESTYLE__LINEMITERLIMIT = EscherPropertyTypes.LINESTYLE__LINEMITERLIMIT.propNumber; + short LINESTYLE__LINESTYLE = EscherPropertyTypes.LINESTYLE__LINESTYLE.propNumber; + short LINESTYLE__LINEDASHING = EscherPropertyTypes.LINESTYLE__LINEDASHING.propNumber; + short LINESTYLE__LINEDASHSTYLE = EscherPropertyTypes.LINESTYLE__LINEDASHSTYLE.propNumber; + short LINESTYLE__LINESTARTARROWHEAD = EscherPropertyTypes.LINESTYLE__LINESTARTARROWHEAD.propNumber; + short LINESTYLE__LINEENDARROWHEAD = EscherPropertyTypes.LINESTYLE__LINEENDARROWHEAD.propNumber; + short LINESTYLE__LINESTARTARROWWIDTH = EscherPropertyTypes.LINESTYLE__LINESTARTARROWWIDTH.propNumber; + short LINESTYLE__LINESTARTARROWLENGTH = EscherPropertyTypes.LINESTYLE__LINESTARTARROWLENGTH.propNumber; + short LINESTYLE__LINEENDARROWWIDTH = EscherPropertyTypes.LINESTYLE__LINEENDARROWWIDTH.propNumber; + short LINESTYLE__LINEENDARROWLENGTH = EscherPropertyTypes.LINESTYLE__LINEENDARROWLENGTH.propNumber; + short LINESTYLE__LINEJOINSTYLE = EscherPropertyTypes.LINESTYLE__LINEJOINSTYLE.propNumber; + short LINESTYLE__LINEENDCAPSTYLE = EscherPropertyTypes.LINESTYLE__LINEENDCAPSTYLE.propNumber; + short LINESTYLE__ARROWHEADSOK = EscherPropertyTypes.LINESTYLE__ARROWHEADSOK.propNumber; + short LINESTYLE__ANYLINE = EscherPropertyTypes.LINESTYLE__ANYLINE.propNumber; + short LINESTYLE__HITLINETEST = EscherPropertyTypes.LINESTYLE__HITLINETEST.propNumber; + short LINESTYLE__LINEFILLSHAPE = EscherPropertyTypes.LINESTYLE__LINEFILLSHAPE.propNumber; + short LINESTYLE__NOLINEDRAWDASH = EscherPropertyTypes.LINESTYLE__NOLINEDRAWDASH.propNumber; + short LINESTYLE__NOLINEDRAWDASH_LEFT = EscherPropertyTypes.LINESTYLE__NOLINEDRAWDASH_LEFT.propNumber; + short LINESTYLE__NOLINEDRAWDASH_TOP = EscherPropertyTypes.LINESTYLE__NOLINEDRAWDASH_TOP.propNumber; + short LINESTYLE__NOLINEDRAWDASH_BOTTOM = EscherPropertyTypes.LINESTYLE__NOLINEDRAWDASH_BOTTOM.propNumber; + short LINESTYLE__NOLINEDRAWDASH_RIGHT = EscherPropertyTypes.LINESTYLE__NOLINEDRAWDASH_RIGHT.propNumber; + short SHADOWSTYLE__TYPE = EscherPropertyTypes.SHADOWSTYLE__TYPE.propNumber; + short SHADOWSTYLE__COLOR = EscherPropertyTypes.SHADOWSTYLE__COLOR.propNumber; + short SHADOWSTYLE__HIGHLIGHT = EscherPropertyTypes.SHADOWSTYLE__HIGHLIGHT.propNumber; + short SHADOWSTYLE__CRMOD = EscherPropertyTypes.SHADOWSTYLE__CRMOD.propNumber; + short SHADOWSTYLE__OPACITY = EscherPropertyTypes.SHADOWSTYLE__OPACITY.propNumber; + short SHADOWSTYLE__OFFSETX = EscherPropertyTypes.SHADOWSTYLE__OFFSETX.propNumber; + short SHADOWSTYLE__OFFSETY = EscherPropertyTypes.SHADOWSTYLE__OFFSETY.propNumber; + short SHADOWSTYLE__SECONDOFFSETX = EscherPropertyTypes.SHADOWSTYLE__SECONDOFFSETX.propNumber; + short SHADOWSTYLE__SECONDOFFSETY = EscherPropertyTypes.SHADOWSTYLE__SECONDOFFSETY.propNumber; + short SHADOWSTYLE__SCALEXTOX = EscherPropertyTypes.SHADOWSTYLE__SCALEXTOX.propNumber; + short SHADOWSTYLE__SCALEYTOX = EscherPropertyTypes.SHADOWSTYLE__SCALEYTOX.propNumber; + short SHADOWSTYLE__SCALEXTOY = EscherPropertyTypes.SHADOWSTYLE__SCALEXTOY.propNumber; + short SHADOWSTYLE__SCALEYTOY = EscherPropertyTypes.SHADOWSTYLE__SCALEYTOY.propNumber; + short SHADOWSTYLE__PERSPECTIVEX = EscherPropertyTypes.SHADOWSTYLE__PERSPECTIVEX.propNumber; + short SHADOWSTYLE__PERSPECTIVEY = EscherPropertyTypes.SHADOWSTYLE__PERSPECTIVEY.propNumber; + short SHADOWSTYLE__WEIGHT = EscherPropertyTypes.SHADOWSTYLE__WEIGHT.propNumber; + short SHADOWSTYLE__ORIGINX = EscherPropertyTypes.SHADOWSTYLE__ORIGINX.propNumber; + short SHADOWSTYLE__ORIGINY = EscherPropertyTypes.SHADOWSTYLE__ORIGINY.propNumber; + short SHADOWSTYLE__SHADOW = EscherPropertyTypes.SHADOWSTYLE__SHADOW.propNumber; + short SHADOWSTYLE__SHADOWOBSURED = EscherPropertyTypes.SHADOWSTYLE__SHADOWOBSURED.propNumber; + short PERSPECTIVE__TYPE = EscherPropertyTypes.PERSPECTIVE__TYPE.propNumber; + short PERSPECTIVE__OFFSETX = EscherPropertyTypes.PERSPECTIVE__OFFSETX.propNumber; + short PERSPECTIVE__OFFSETY = EscherPropertyTypes.PERSPECTIVE__OFFSETY.propNumber; + short PERSPECTIVE__SCALEXTOX = EscherPropertyTypes.PERSPECTIVE__SCALEXTOX.propNumber; + short PERSPECTIVE__SCALEYTOX = EscherPropertyTypes.PERSPECTIVE__SCALEYTOX.propNumber; + short PERSPECTIVE__SCALEXTOY = EscherPropertyTypes.PERSPECTIVE__SCALEXTOY.propNumber; + short PERSPECTIVE__SCALEYTOY = EscherPropertyTypes.PERSPECTIVE__SCALEYTOY.propNumber; + short PERSPECTIVE__PERSPECTIVEX = EscherPropertyTypes.PERSPECTIVE__PERSPECTIVEX.propNumber; + short PERSPECTIVE__PERSPECTIVEY = EscherPropertyTypes.PERSPECTIVE__PERSPECTIVEY.propNumber; + short PERSPECTIVE__WEIGHT = EscherPropertyTypes.PERSPECTIVE__WEIGHT.propNumber; + short PERSPECTIVE__ORIGINX = EscherPropertyTypes.PERSPECTIVE__ORIGINX.propNumber; + short PERSPECTIVE__ORIGINY = EscherPropertyTypes.PERSPECTIVE__ORIGINY.propNumber; + short PERSPECTIVE__PERSPECTIVEON = EscherPropertyTypes.PERSPECTIVE__PERSPECTIVEON.propNumber; + short THREED__SPECULARAMOUNT = EscherPropertyTypes.THREED__SPECULARAMOUNT.propNumber; + short THREED__DIFFUSEAMOUNT = EscherPropertyTypes.THREED__DIFFUSEAMOUNT.propNumber; + short THREED__SHININESS = EscherPropertyTypes.THREED__SHININESS.propNumber; + short THREED__EDGETHICKNESS = EscherPropertyTypes.THREED__EDGETHICKNESS.propNumber; + short THREED__EXTRUDEFORWARD = EscherPropertyTypes.THREED__EXTRUDEFORWARD.propNumber; + short THREED__EXTRUDEBACKWARD = EscherPropertyTypes.THREED__EXTRUDEBACKWARD.propNumber; + short THREED__EXTRUDEPLANE = EscherPropertyTypes.THREED__EXTRUDEPLANE.propNumber; + short THREED__EXTRUSIONCOLOR = EscherPropertyTypes.THREED__EXTRUSIONCOLOR.propNumber; + short THREED__CRMOD = EscherPropertyTypes.THREED__CRMOD.propNumber; + short THREED__3DEFFECT = EscherPropertyTypes.THREED__3DEFFECT.propNumber; + short THREED__METALLIC = EscherPropertyTypes.THREED__METALLIC.propNumber; + short THREED__USEEXTRUSIONCOLOR = EscherPropertyTypes.THREED__USEEXTRUSIONCOLOR.propNumber; + short THREED__LIGHTFACE = EscherPropertyTypes.THREED__LIGHTFACE.propNumber; + short THREEDSTYLE__YROTATIONANGLE = EscherPropertyTypes.THREEDSTYLE__YROTATIONANGLE.propNumber; + short THREEDSTYLE__XROTATIONANGLE = EscherPropertyTypes.THREEDSTYLE__XROTATIONANGLE.propNumber; + short THREEDSTYLE__ROTATIONAXISX = EscherPropertyTypes.THREEDSTYLE__ROTATIONAXISX.propNumber; + short THREEDSTYLE__ROTATIONAXISY = EscherPropertyTypes.THREEDSTYLE__ROTATIONAXISY.propNumber; + short THREEDSTYLE__ROTATIONAXISZ = EscherPropertyTypes.THREEDSTYLE__ROTATIONAXISZ.propNumber; + short THREEDSTYLE__ROTATIONANGLE = EscherPropertyTypes.THREEDSTYLE__ROTATIONANGLE.propNumber; + short THREEDSTYLE__ROTATIONCENTERX = EscherPropertyTypes.THREEDSTYLE__ROTATIONCENTERX.propNumber; + short THREEDSTYLE__ROTATIONCENTERY = EscherPropertyTypes.THREEDSTYLE__ROTATIONCENTERY.propNumber; + short THREEDSTYLE__ROTATIONCENTERZ = EscherPropertyTypes.THREEDSTYLE__ROTATIONCENTERZ.propNumber; + short THREEDSTYLE__RENDERMODE = EscherPropertyTypes.THREEDSTYLE__RENDERMODE.propNumber; + short THREEDSTYLE__TOLERANCE = EscherPropertyTypes.THREEDSTYLE__TOLERANCE.propNumber; + short THREEDSTYLE__XVIEWPOINT = EscherPropertyTypes.THREEDSTYLE__XVIEWPOINT.propNumber; + short THREEDSTYLE__YVIEWPOINT = EscherPropertyTypes.THREEDSTYLE__YVIEWPOINT.propNumber; + short THREEDSTYLE__ZVIEWPOINT = EscherPropertyTypes.THREEDSTYLE__ZVIEWPOINT.propNumber; + short THREEDSTYLE__ORIGINX = EscherPropertyTypes.THREEDSTYLE__ORIGINX.propNumber; + short THREEDSTYLE__ORIGINY = EscherPropertyTypes.THREEDSTYLE__ORIGINY.propNumber; + short THREEDSTYLE__SKEWANGLE = EscherPropertyTypes.THREEDSTYLE__SKEWANGLE.propNumber; + short THREEDSTYLE__SKEWAMOUNT = EscherPropertyTypes.THREEDSTYLE__SKEWAMOUNT.propNumber; + short THREEDSTYLE__AMBIENTINTENSITY = EscherPropertyTypes.THREEDSTYLE__AMBIENTINTENSITY.propNumber; + short THREEDSTYLE__KEYX = EscherPropertyTypes.THREEDSTYLE__KEYX.propNumber; + short THREEDSTYLE__KEYY = EscherPropertyTypes.THREEDSTYLE__KEYY.propNumber; + short THREEDSTYLE__KEYZ = EscherPropertyTypes.THREEDSTYLE__KEYZ.propNumber; + short THREEDSTYLE__KEYINTENSITY = EscherPropertyTypes.THREEDSTYLE__KEYINTENSITY.propNumber; + short THREEDSTYLE__FILLX = EscherPropertyTypes.THREEDSTYLE__FILLX.propNumber; + short THREEDSTYLE__FILLY = EscherPropertyTypes.THREEDSTYLE__FILLY.propNumber; + short THREEDSTYLE__FILLZ = EscherPropertyTypes.THREEDSTYLE__FILLZ.propNumber; + short THREEDSTYLE__FILLINTENSITY = EscherPropertyTypes.THREEDSTYLE__FILLINTENSITY.propNumber; + short THREEDSTYLE__CONSTRAINROTATION = EscherPropertyTypes.THREEDSTYLE__CONSTRAINROTATION.propNumber; + short THREEDSTYLE__ROTATIONCENTERAUTO = EscherPropertyTypes.THREEDSTYLE__ROTATIONCENTERAUTO.propNumber; + short THREEDSTYLE__PARALLEL = EscherPropertyTypes.THREEDSTYLE__PARALLEL.propNumber; + short THREEDSTYLE__KEYHARSH = EscherPropertyTypes.THREEDSTYLE__KEYHARSH.propNumber; + short THREEDSTYLE__FILLHARSH = EscherPropertyTypes.THREEDSTYLE__FILLHARSH.propNumber; + short SHAPE__MASTER = EscherPropertyTypes.SHAPE__MASTER.propNumber; + short SHAPE__CONNECTORSTYLE = EscherPropertyTypes.SHAPE__CONNECTORSTYLE.propNumber; + short SHAPE__BLACKANDWHITESETTINGS = EscherPropertyTypes.SHAPE__BLACKANDWHITESETTINGS.propNumber; + short SHAPE__WMODEPUREBW = EscherPropertyTypes.SHAPE__WMODEPUREBW.propNumber; + short SHAPE__WMODEBW = EscherPropertyTypes.SHAPE__WMODEBW.propNumber; + short SHAPE__OLEICON = EscherPropertyTypes.SHAPE__OLEICON.propNumber; + short SHAPE__PREFERRELATIVERESIZE = EscherPropertyTypes.SHAPE__PREFERRELATIVERESIZE.propNumber; + short SHAPE__LOCKSHAPETYPE = EscherPropertyTypes.SHAPE__LOCKSHAPETYPE.propNumber; + short SHAPE__DELETEATTACHEDOBJECT = EscherPropertyTypes.SHAPE__DELETEATTACHEDOBJECT.propNumber; + short SHAPE__BACKGROUNDSHAPE = EscherPropertyTypes.SHAPE__BACKGROUNDSHAPE.propNumber; + short CALLOUT__CALLOUTTYPE = EscherPropertyTypes.CALLOUT__CALLOUTTYPE.propNumber; + short CALLOUT__XYCALLOUTGAP = EscherPropertyTypes.CALLOUT__XYCALLOUTGAP.propNumber; + short CALLOUT__CALLOUTANGLE = EscherPropertyTypes.CALLOUT__CALLOUTANGLE.propNumber; + short CALLOUT__CALLOUTDROPTYPE = EscherPropertyTypes.CALLOUT__CALLOUTDROPTYPE.propNumber; + short CALLOUT__CALLOUTDROPSPECIFIED = EscherPropertyTypes.CALLOUT__CALLOUTDROPSPECIFIED.propNumber; + short CALLOUT__CALLOUTLENGTHSPECIFIED = EscherPropertyTypes.CALLOUT__CALLOUTLENGTHSPECIFIED.propNumber; + short CALLOUT__ISCALLOUT = EscherPropertyTypes.CALLOUT__ISCALLOUT.propNumber; + short CALLOUT__CALLOUTACCENTBAR = EscherPropertyTypes.CALLOUT__CALLOUTACCENTBAR.propNumber; + short CALLOUT__CALLOUTTEXTBORDER = EscherPropertyTypes.CALLOUT__CALLOUTTEXTBORDER.propNumber; + short CALLOUT__CALLOUTMINUSX = EscherPropertyTypes.CALLOUT__CALLOUTMINUSX.propNumber; + short CALLOUT__CALLOUTMINUSY = EscherPropertyTypes.CALLOUT__CALLOUTMINUSY.propNumber; + short CALLOUT__DROPAUTO = EscherPropertyTypes.CALLOUT__DROPAUTO.propNumber; + short CALLOUT__LENGTHSPECIFIED = EscherPropertyTypes.CALLOUT__LENGTHSPECIFIED.propNumber; + short GROUPSHAPE__SHAPENAME = EscherPropertyTypes.GROUPSHAPE__SHAPENAME.propNumber; + short GROUPSHAPE__DESCRIPTION = EscherPropertyTypes.GROUPSHAPE__DESCRIPTION.propNumber; + short GROUPSHAPE__HYPERLINK = EscherPropertyTypes.GROUPSHAPE__HYPERLINK.propNumber; + short GROUPSHAPE__WRAPPOLYGONVERTICES = EscherPropertyTypes.GROUPSHAPE__WRAPPOLYGONVERTICES.propNumber; + short GROUPSHAPE__WRAPDISTLEFT = EscherPropertyTypes.GROUPSHAPE__WRAPDISTLEFT.propNumber; + short GROUPSHAPE__WRAPDISTTOP = EscherPropertyTypes.GROUPSHAPE__WRAPDISTTOP.propNumber; + short GROUPSHAPE__WRAPDISTRIGHT = EscherPropertyTypes.GROUPSHAPE__WRAPDISTRIGHT.propNumber; + short GROUPSHAPE__WRAPDISTBOTTOM = EscherPropertyTypes.GROUPSHAPE__WRAPDISTBOTTOM.propNumber; + short GROUPSHAPE__REGROUPID = EscherPropertyTypes.GROUPSHAPE__REGROUPID.propNumber; + short GROUPSHAPE__UNUSED906 = EscherPropertyTypes.GROUPSHAPE__UNUSED906.propNumber; + short GROUPSHAPE__TOOLTIP = EscherPropertyTypes.GROUPSHAPE__TOOLTIP.propNumber; + short GROUPSHAPE__SCRIPT = EscherPropertyTypes.GROUPSHAPE__SCRIPT.propNumber; + short GROUPSHAPE__POSH = EscherPropertyTypes.GROUPSHAPE__POSH.propNumber; + short GROUPSHAPE__POSRELH = EscherPropertyTypes.GROUPSHAPE__POSRELH.propNumber; + short GROUPSHAPE__POSV = EscherPropertyTypes.GROUPSHAPE__POSV.propNumber; + short GROUPSHAPE__POSRELV = EscherPropertyTypes.GROUPSHAPE__POSRELV.propNumber; + short GROUPSHAPE__HR_PCT = EscherPropertyTypes.GROUPSHAPE__HR_PCT.propNumber; + short GROUPSHAPE__HR_ALIGN = EscherPropertyTypes.GROUPSHAPE__HR_ALIGN.propNumber; + short GROUPSHAPE__HR_HEIGHT = EscherPropertyTypes.GROUPSHAPE__HR_HEIGHT.propNumber; + short GROUPSHAPE__HR_WIDTH = EscherPropertyTypes.GROUPSHAPE__HR_WIDTH.propNumber; + short GROUPSHAPE__SCRIPTEXT = EscherPropertyTypes.GROUPSHAPE__SCRIPTEXT.propNumber; + short GROUPSHAPE__SCRIPTLANG = EscherPropertyTypes.GROUPSHAPE__SCRIPTLANG.propNumber; + short GROUPSHAPE__BORDERTOPCOLOR = EscherPropertyTypes.GROUPSHAPE__BORDERTOPCOLOR.propNumber; + short GROUPSHAPE__BORDERLEFTCOLOR = EscherPropertyTypes.GROUPSHAPE__BORDERLEFTCOLOR.propNumber; + short GROUPSHAPE__BORDERBOTTOMCOLOR = EscherPropertyTypes.GROUPSHAPE__BORDERBOTTOMCOLOR.propNumber; + short GROUPSHAPE__BORDERRIGHTCOLOR = EscherPropertyTypes.GROUPSHAPE__BORDERRIGHTCOLOR.propNumber; + short GROUPSHAPE__TABLEPROPERTIES = EscherPropertyTypes.GROUPSHAPE__TABLEPROPERTIES.propNumber; + short GROUPSHAPE__TABLEROWPROPERTIES = EscherPropertyTypes.GROUPSHAPE__TABLEROWPROPERTIES.propNumber; + short GROUPSHAPE__WEBBOT = EscherPropertyTypes.GROUPSHAPE__WEBBOT.propNumber; + short GROUPSHAPE__METROBLOB = EscherPropertyTypes.GROUPSHAPE__METROBLOB.propNumber; + short GROUPSHAPE__ZORDER = EscherPropertyTypes.GROUPSHAPE__ZORDER.propNumber; + short GROUPSHAPE__EDITEDWRAP = EscherPropertyTypes.GROUPSHAPE__EDITEDWRAP.propNumber; + short GROUPSHAPE__BEHINDDOCUMENT = EscherPropertyTypes.GROUPSHAPE__BEHINDDOCUMENT.propNumber; + short GROUPSHAPE__ONDBLCLICKNOTIFY = EscherPropertyTypes.GROUPSHAPE__ONDBLCLICKNOTIFY.propNumber; + short GROUPSHAPE__ISBUTTON = EscherPropertyTypes.GROUPSHAPE__ISBUTTON.propNumber; + short GROUPSHAPE__1DADJUSTMENT = EscherPropertyTypes.GROUPSHAPE__1DADJUSTMENT.propNumber; + short GROUPSHAPE__HIDDEN = EscherPropertyTypes.GROUPSHAPE__HIDDEN.propNumber; + short GROUPSHAPE__FLAGS = EscherPropertyTypes.GROUPSHAPE__FLAGS.propNumber; + short GROUPSHAPE__PRINT = EscherPropertyTypes.GROUPSHAPE__FLAGS.propNumber; - // Property constants - public static final short TRANSFORM__ROTATION = 4; - public static final short PROTECTION__LOCKROTATION = 119; - public static final short PROTECTION__LOCKASPECTRATIO = 120; - public static final short PROTECTION__LOCKPOSITION = 121; - public static final short PROTECTION__LOCKAGAINSTSELECT = 122; - public static final short PROTECTION__LOCKCROPPING = 123; - public static final short PROTECTION__LOCKVERTICES = 124; - public static final short PROTECTION__LOCKTEXT = 125; - public static final short PROTECTION__LOCKADJUSTHANDLES = 126; - public static final short PROTECTION__LOCKAGAINSTGROUPING = 127; - public static final short TEXT__TEXTID = 128; - public static final short TEXT__TEXTLEFT = 129; - public static final short TEXT__TEXTTOP = 130; - public static final short TEXT__TEXTRIGHT = 131; - public static final short TEXT__TEXTBOTTOM = 132; - public static final short TEXT__WRAPTEXT = 133; - public static final short TEXT__SCALETEXT = 134; - public static final short TEXT__ANCHORTEXT = 135; - public static final short TEXT__TEXTFLOW = 136; - public static final short TEXT__FONTROTATION = 137; - public static final short TEXT__IDOFNEXTSHAPE = 138; - public static final short TEXT__BIDIR = 139; - public static final short TEXT__SINGLECLICKSELECTS = 187; - public static final short TEXT__USEHOSTMARGINS = 188; - public static final short TEXT__ROTATETEXTWITHSHAPE = 189; - public static final short TEXT__SIZESHAPETOFITTEXT = 190; - public static final short TEXT__SIZE_TEXT_TO_FIT_SHAPE = 191; - public static final short GEOTEXT__UNICODE = 192; - public static final short GEOTEXT__RTFTEXT = 193; - public static final short GEOTEXT__ALIGNMENTONCURVE = 194; - public static final short GEOTEXT__DEFAULTPOINTSIZE = 195; - public static final short GEOTEXT__TEXTSPACING = 196; - public static final short GEOTEXT__FONTFAMILYNAME = 197; - public static final short GEOTEXT__REVERSEROWORDER = 240; - public static final short GEOTEXT__HASTEXTEFFECT = 241; - public static final short GEOTEXT__ROTATECHARACTERS = 242; - public static final short GEOTEXT__KERNCHARACTERS = 243; - public static final short GEOTEXT__TIGHTORTRACK = 244; - public static final short GEOTEXT__STRETCHTOFITSHAPE = 245; - public static final short GEOTEXT__CHARBOUNDINGBOX = 246; - public static final short GEOTEXT__SCALETEXTONPATH = 247; - public static final short GEOTEXT__STRETCHCHARHEIGHT = 248; - public static final short GEOTEXT__NOMEASUREALONGPATH = 249; - public static final short GEOTEXT__BOLDFONT = 250; - public static final short GEOTEXT__ITALICFONT = 251; - public static final short GEOTEXT__UNDERLINEFONT = 252; - public static final short GEOTEXT__SHADOWFONT = 253; - public static final short GEOTEXT__SMALLCAPSFONT = 254; - public static final short GEOTEXT__STRIKETHROUGHFONT = 255; - public static final short BLIP__CROPFROMTOP = 256; - public static final short BLIP__CROPFROMBOTTOM = 257; - public static final short BLIP__CROPFROMLEFT = 258; - public static final short BLIP__CROPFROMRIGHT = 259; - public static final short BLIP__BLIPTODISPLAY = 260; - public static final short BLIP__BLIPFILENAME = 261; - public static final short BLIP__BLIPFLAGS = 262; - public static final short BLIP__TRANSPARENTCOLOR = 263; - public static final short BLIP__CONTRASTSETTING = 264; - public static final short BLIP__BRIGHTNESSSETTING = 265; - public static final short BLIP__GAMMA = 266; - public static final short BLIP__PICTUREID = 267; - public static final short BLIP__DOUBLEMOD = 268; - public static final short BLIP__PICTUREFILLMOD = 269; - public static final short BLIP__PICTURELINE = 270; - public static final short BLIP__PRINTBLIP = 271; - public static final short BLIP__PRINTBLIPFILENAME = 272; - public static final short BLIP__PRINTFLAGS = 273; - public static final short BLIP__NOHITTESTPICTURE = 316; - public static final short BLIP__PICTUREGRAY = 317; - public static final short BLIP__PICTUREBILEVEL = 318; - public static final short BLIP__PICTUREACTIVE = 319; - public static final short GEOMETRY__LEFT = 320; - public static final short GEOMETRY__TOP = 321; - public static final short GEOMETRY__RIGHT = 322; - public static final short GEOMETRY__BOTTOM = 323; - public static final short GEOMETRY__SHAPEPATH = 324; - public static final short GEOMETRY__VERTICES = 325; - public static final short GEOMETRY__SEGMENTINFO = 326; - public static final short GEOMETRY__ADJUSTVALUE = 327; - public static final short GEOMETRY__ADJUST2VALUE = 328; - public static final short GEOMETRY__ADJUST3VALUE = 329; - public static final short GEOMETRY__ADJUST4VALUE = 330; - public static final short GEOMETRY__ADJUST5VALUE = 331; - public static final short GEOMETRY__ADJUST6VALUE = 332; - public static final short GEOMETRY__ADJUST7VALUE = 333; - public static final short GEOMETRY__ADJUST8VALUE = 334; - public static final short GEOMETRY__ADJUST9VALUE = 335; - public static final short GEOMETRY__ADJUST10VALUE = 336; - public static final short GEOMETRY__PCONNECTIONSITES = 337; - public static final short GEOMETRY__PCONNECTIONSITESDIR = 338; - public static final short GEOMETRY__XLIMO = 339; - public static final short GEOMETRY__YLIMO = 340; - public static final short GEOMETRY__PADJUSTHANDLES = 341; - public static final short GEOMETRY__PGUIDES = 342; - public static final short GEOMETRY__PINSCRIBE = 343; - public static final short GEOMETRY__CXK = 344; - public static final short GEOMETRY__PFRAGMENTS = 345; - public static final short GEOMETRY__SHADOWok = 378; - public static final short GEOMETRY__3DOK = 379; - public static final short GEOMETRY__LINEOK = 380; - public static final short GEOMETRY__GEOTEXTOK = 381; - public static final short GEOMETRY__FILLSHADESHAPEOK = 382; - public static final short GEOMETRY__FILLOK = 383; - public static final short FILL__FILLTYPE = 384; - public static final short FILL__FILLCOLOR = 385; - public static final short FILL__FILLOPACITY = 386; - public static final short FILL__FILLBACKCOLOR = 387; - public static final short FILL__BACKOPACITY = 388; - public static final short FILL__CRMOD = 389; - public static final short FILL__PATTERNTEXTURE = 390; - public static final short FILL__BLIPFILENAME = 391; - public static final short FILL__BLIPFLAGS = 392; - public static final short FILL__WIDTH = 393; - public static final short FILL__HEIGHT = 394; - public static final short FILL__ANGLE = 395; - public static final short FILL__FOCUS = 396; - public static final short FILL__TOLEFT = 397; - public static final short FILL__TOTOP = 398; - public static final short FILL__TORIGHT = 399; - public static final short FILL__TOBOTTOM = 400; - public static final short FILL__RECTLEFT = 401; - public static final short FILL__RECTTOP = 402; - public static final short FILL__RECTRIGHT = 403; - public static final short FILL__RECTBOTTOM = 404; - public static final short FILL__DZTYPE = 405; - public static final short FILL__SHADEPRESET = 406; - public static final short FILL__SHADECOLORS = 407; - public static final short FILL__ORIGINX = 408; - public static final short FILL__ORIGINY = 409; - public static final short FILL__SHAPEORIGINX = 410; - public static final short FILL__SHAPEORIGINY = 411; - public static final short FILL__SHADETYPE = 412; - public static final short FILL__FILLED = 443; - public static final short FILL__HITTESTFILL = 444; - public static final short FILL__SHAPE = 445; - public static final short FILL__USERECT = 446; - public static final short FILL__NOFILLHITTEST = 447; - public static final short LINESTYLE__COLOR = 448; - public static final short LINESTYLE__OPACITY = 449; - public static final short LINESTYLE__BACKCOLOR = 450; - public static final short LINESTYLE__CRMOD = 451; - public static final short LINESTYLE__LINETYPE = 452; - public static final short LINESTYLE__FILLBLIP = 453; - public static final short LINESTYLE__FILLBLIPNAME = 454; - public static final short LINESTYLE__FILLBLIPFLAGS = 455; - public static final short LINESTYLE__FILLWIDTH = 456; - public static final short LINESTYLE__FILLHEIGHT = 457; - public static final short LINESTYLE__FILLDZTYPE = 458; - public static final short LINESTYLE__LINEWIDTH = 459; - public static final short LINESTYLE__LINEMITERLIMIT = 460; - public static final short LINESTYLE__LINESTYLE = 461; - public static final short LINESTYLE__LINEDASHING = 462; - public static final short LINESTYLE__LINEDASHSTYLE = 463; - public static final short LINESTYLE__LINESTARTARROWHEAD = 464; - public static final short LINESTYLE__LINEENDARROWHEAD = 465; - public static final short LINESTYLE__LINESTARTARROWWIDTH = 466; - public static final short LINESTYLE__LINESTARTARROWLENGTH = 467; - public static final short LINESTYLE__LINEENDARROWWIDTH = 468; - public static final short LINESTYLE__LINEENDARROWLENGTH = 469; - public static final short LINESTYLE__LINEJOINSTYLE = 470; - public static final short LINESTYLE__LINEENDCAPSTYLE = 471; - public static final short LINESTYLE__ARROWHEADSOK = 507; - public static final short LINESTYLE__ANYLINE = 508; - public static final short LINESTYLE__HITLINETEST = 509; - public static final short LINESTYLE__LINEFILLSHAPE = 510; - public static final short LINESTYLE__NOLINEDRAWDASH = 511; - public static final short LINESTYLE__NOLINEDRAWDASH_LEFT = 0x057F; - public static final short LINESTYLE__NOLINEDRAWDASH_TOP = 0x05BF; - public static final short LINESTYLE__NOLINEDRAWDASH_BOTTOM = 0x063F; - public static final short LINESTYLE__NOLINEDRAWDASH_RIGHT = 0x05FF; - public static final short SHADOWSTYLE__TYPE = 512; - public static final short SHADOWSTYLE__COLOR = 513; - public static final short SHADOWSTYLE__HIGHLIGHT = 514; - public static final short SHADOWSTYLE__CRMOD = 515; - public static final short SHADOWSTYLE__OPACITY = 516; - public static final short SHADOWSTYLE__OFFSETX = 517; - public static final short SHADOWSTYLE__OFFSETY = 518; - public static final short SHADOWSTYLE__SECONDOFFSETX = 519; - public static final short SHADOWSTYLE__SECONDOFFSETY = 520; - public static final short SHADOWSTYLE__SCALEXTOX = 521; - public static final short SHADOWSTYLE__SCALEYTOX = 522; - public static final short SHADOWSTYLE__SCALEXTOY = 523; - public static final short SHADOWSTYLE__SCALEYTOY = 524; - public static final short SHADOWSTYLE__PERSPECTIVEX = 525; - public static final short SHADOWSTYLE__PERSPECTIVEY = 526; - public static final short SHADOWSTYLE__WEIGHT = 527; - public static final short SHADOWSTYLE__ORIGINX = 528; - public static final short SHADOWSTYLE__ORIGINY = 529; - public static final short SHADOWSTYLE__SHADOW = 574; - public static final short SHADOWSTYLE__SHADOWOBSURED = 575; - public static final short PERSPECTIVE__TYPE = 576; - public static final short PERSPECTIVE__OFFSETX = 577; - public static final short PERSPECTIVE__OFFSETY = 578; - public static final short PERSPECTIVE__SCALEXTOX = 579; - public static final short PERSPECTIVE__SCALEYTOX = 580; - public static final short PERSPECTIVE__SCALEXTOY = 581; - public static final short PERSPECTIVE__SCALEYTOY = 582; - public static final short PERSPECTIVE__PERSPECTIVEX = 583; - public static final short PERSPECTIVE__PERSPECTIVEY = 584; - public static final short PERSPECTIVE__WEIGHT = 585; - public static final short PERSPECTIVE__ORIGINX = 586; - public static final short PERSPECTIVE__ORIGINY = 587; - public static final short PERSPECTIVE__PERSPECTIVEON = 639; - public static final short THREED__SPECULARAMOUNT = 640; - public static final short THREED__DIFFUSEAMOUNT = 661; - public static final short THREED__SHININESS = 662; - public static final short THREED__EDGETHICKNESS = 663; - public static final short THREED__EXTRUDEFORWARD = 664; - public static final short THREED__EXTRUDEBACKWARD = 665; - public static final short THREED__EXTRUDEPLANE = 666; - public static final short THREED__EXTRUSIONCOLOR = 667; - public static final short THREED__CRMOD = 648; - public static final short THREED__3DEFFECT = 700; - public static final short THREED__METALLIC = 701; - public static final short THREED__USEEXTRUSIONCOLOR = 702; - public static final short THREED__LIGHTFACE = 703; - public static final short THREEDSTYLE__YROTATIONANGLE = 704; - public static final short THREEDSTYLE__XROTATIONANGLE = 705; - public static final short THREEDSTYLE__ROTATIONAXISX = 706; - public static final short THREEDSTYLE__ROTATIONAXISY = 707; - public static final short THREEDSTYLE__ROTATIONAXISZ = 708; - public static final short THREEDSTYLE__ROTATIONANGLE = 709; - public static final short THREEDSTYLE__ROTATIONCENTERX = 710; - public static final short THREEDSTYLE__ROTATIONCENTERY = 711; - public static final short THREEDSTYLE__ROTATIONCENTERZ = 712; - public static final short THREEDSTYLE__RENDERMODE = 713; - public static final short THREEDSTYLE__TOLERANCE = 714; - public static final short THREEDSTYLE__XVIEWPOINT = 715; - public static final short THREEDSTYLE__YVIEWPOINT = 716; - public static final short THREEDSTYLE__ZVIEWPOINT = 717; - public static final short THREEDSTYLE__ORIGINX = 718; - public static final short THREEDSTYLE__ORIGINY = 719; - public static final short THREEDSTYLE__SKEWANGLE = 720; - public static final short THREEDSTYLE__SKEWAMOUNT = 721; - public static final short THREEDSTYLE__AMBIENTINTENSITY = 722; - public static final short THREEDSTYLE__KEYX = 723; - public static final short THREEDSTYLE__KEYY = 724; - public static final short THREEDSTYLE__KEYZ = 725; - public static final short THREEDSTYLE__KEYINTENSITY = 726; - public static final short THREEDSTYLE__FILLX = 727; - public static final short THREEDSTYLE__FILLY = 728; - public static final short THREEDSTYLE__FILLZ = 729; - public static final short THREEDSTYLE__FILLINTENSITY = 730; - public static final short THREEDSTYLE__CONSTRAINROTATION = 763; - public static final short THREEDSTYLE__ROTATIONCENTERAUTO = 764; - public static final short THREEDSTYLE__PARALLEL = 765; - public static final short THREEDSTYLE__KEYHARSH = 766; - public static final short THREEDSTYLE__FILLHARSH = 767; - public static final short SHAPE__MASTER = 769; - public static final short SHAPE__CONNECTORSTYLE = 771; - public static final short SHAPE__BLACKANDWHITESETTINGS = 772; - public static final short SHAPE__WMODEPUREBW = 773; - public static final short SHAPE__WMODEBW = 774; - public static final short SHAPE__OLEICON = 826; - public static final short SHAPE__PREFERRELATIVERESIZE = 827; - public static final short SHAPE__LOCKSHAPETYPE = 828; - public static final short SHAPE__DELETEATTACHEDOBJECT = 830; - public static final short SHAPE__BACKGROUNDSHAPE = 831; - public static final short CALLOUT__CALLOUTTYPE = 832; - public static final short CALLOUT__XYCALLOUTGAP = 833; - public static final short CALLOUT__CALLOUTANGLE = 834; - public static final short CALLOUT__CALLOUTDROPTYPE = 835; - public static final short CALLOUT__CALLOUTDROPSPECIFIED = 836; - public static final short CALLOUT__CALLOUTLENGTHSPECIFIED = 837; - public static final short CALLOUT__ISCALLOUT = 889; - public static final short CALLOUT__CALLOUTACCENTBAR = 890; - public static final short CALLOUT__CALLOUTTEXTBORDER = 891; - public static final short CALLOUT__CALLOUTMINUSX = 892; - public static final short CALLOUT__CALLOUTMINUSY = 893; - public static final short CALLOUT__DROPAUTO = 894; - public static final short CALLOUT__LENGTHSPECIFIED = 895; - public static final short GROUPSHAPE__SHAPENAME = 0x0380; - public static final short GROUPSHAPE__DESCRIPTION = 0x0381; - public static final short GROUPSHAPE__HYPERLINK = 0x0382; - public static final short GROUPSHAPE__WRAPPOLYGONVERTICES = 0x0383; - public static final short GROUPSHAPE__WRAPDISTLEFT = 0x0384; - public static final short GROUPSHAPE__WRAPDISTTOP = 0x0385; - public static final short GROUPSHAPE__WRAPDISTRIGHT = 0x0386; - public static final short GROUPSHAPE__WRAPDISTBOTTOM = 0x0387; - public static final short GROUPSHAPE__REGROUPID = 0x0388; - public static final short GROUPSHAPE__UNUSED906 = 0x038A; - public static final short GROUPSHAPE__TOOLTIP = 0x038D; - public static final short GROUPSHAPE__SCRIPT = 0x038E; - public static final short GROUPSHAPE__POSH = 0x038F; - public static final short GROUPSHAPE__POSRELH = 0x0390; - public static final short GROUPSHAPE__POSV = 0x0391; - public static final short GROUPSHAPE__POSRELV = 0x0392; - public static final short GROUPSHAPE__HR_PCT = 0x0393; - public static final short GROUPSHAPE__HR_ALIGN = 0x0394; - public static final short GROUPSHAPE__HR_HEIGHT = 0x0395; - public static final short GROUPSHAPE__HR_WIDTH = 0x0396; - public static final short GROUPSHAPE__SCRIPTEXT = 0x0397; - public static final short GROUPSHAPE__SCRIPTLANG = 0x0398; - public static final short GROUPSHAPE__BORDERTOPCOLOR = 0x039B; - public static final short GROUPSHAPE__BORDERLEFTCOLOR = 0x039C; - public static final short GROUPSHAPE__BORDERBOTTOMCOLOR = 0x039D; - public static final short GROUPSHAPE__BORDERRIGHTCOLOR = 0x039E; - public static final short GROUPSHAPE__TABLEPROPERTIES = 0x039F; - public static final short GROUPSHAPE__TABLEROWPROPERTIES = 0x03A0; - public static final short GROUPSHAPE__WEBBOT = 0x03A5; - public static final short GROUPSHAPE__METROBLOB = 0x03A9; - public static final short GROUPSHAPE__ZORDER = 0x03AA; - public static final short GROUPSHAPE__FLAGS = 0x03BF; - public static final short GROUPSHAPE__EDITEDWRAP = 953; - public static final short GROUPSHAPE__BEHINDDOCUMENT = 954; - public static final short GROUPSHAPE__ONDBLCLICKNOTIFY = 955; - public static final short GROUPSHAPE__ISBUTTON = 956; - public static final short GROUPSHAPE__1DADJUSTMENT = 957; - public static final short GROUPSHAPE__HIDDEN = 958; - public static final short GROUPSHAPE__PRINT = 959; - private static final Map properties = initProps(); - - private EscherProperties() { - } - - private static Map initProps() { - Map m = new HashMap<>(); - addProp(m, TRANSFORM__ROTATION, "transform.rotation"); - addProp(m, PROTECTION__LOCKROTATION, "protection.lockrotation"); - addProp(m, PROTECTION__LOCKASPECTRATIO, "protection.lockaspectratio"); - addProp(m, PROTECTION__LOCKPOSITION, "protection.lockposition"); - addProp(m, PROTECTION__LOCKAGAINSTSELECT, "protection.lockagainstselect"); - addProp(m, PROTECTION__LOCKCROPPING, "protection.lockcropping"); - addProp(m, PROTECTION__LOCKVERTICES, "protection.lockvertices"); - addProp(m, PROTECTION__LOCKTEXT, "protection.locktext"); - addProp(m, PROTECTION__LOCKADJUSTHANDLES, "protection.lockadjusthandles"); - addProp(m, PROTECTION__LOCKAGAINSTGROUPING, "protection.lockagainstgrouping", EscherPropertyMetaData.TYPE_BOOLEAN); - addProp(m, TEXT__TEXTID, "text.textid"); - addProp(m, TEXT__TEXTLEFT, "text.textleft"); - addProp(m, TEXT__TEXTTOP, "text.texttop"); - addProp(m, TEXT__TEXTRIGHT, "text.textright"); - addProp(m, TEXT__TEXTBOTTOM, "text.textbottom"); - addProp(m, TEXT__WRAPTEXT, "text.wraptext"); - addProp(m, TEXT__SCALETEXT, "text.scaletext"); - addProp(m, TEXT__ANCHORTEXT, "text.anchortext"); - addProp(m, TEXT__TEXTFLOW, "text.textflow"); - addProp(m, TEXT__FONTROTATION, "text.fontrotation"); - addProp(m, TEXT__IDOFNEXTSHAPE, "text.idofnextshape"); - addProp(m, TEXT__BIDIR, "text.bidir"); - addProp(m, TEXT__SINGLECLICKSELECTS, "text.singleclickselects"); - addProp(m, TEXT__USEHOSTMARGINS, "text.usehostmargins"); - addProp(m, TEXT__ROTATETEXTWITHSHAPE, "text.rotatetextwithshape"); - addProp(m, TEXT__SIZESHAPETOFITTEXT, "text.sizeshapetofittext"); - addProp(m, TEXT__SIZE_TEXT_TO_FIT_SHAPE, "text.sizetexttofitshape", EscherPropertyMetaData.TYPE_BOOLEAN); - addProp(m, GEOTEXT__UNICODE, "geotext.unicode"); - addProp(m, GEOTEXT__RTFTEXT, "geotext.rtftext"); - addProp(m, GEOTEXT__ALIGNMENTONCURVE, "geotext.alignmentoncurve"); - addProp(m, GEOTEXT__DEFAULTPOINTSIZE, "geotext.defaultpointsize"); - addProp(m, GEOTEXT__TEXTSPACING, "geotext.textspacing"); - addProp(m, GEOTEXT__FONTFAMILYNAME, "geotext.fontfamilyname"); - addProp(m, GEOTEXT__REVERSEROWORDER, "geotext.reverseroworder"); - addProp(m, GEOTEXT__HASTEXTEFFECT, "geotext.hastexteffect"); - addProp(m, GEOTEXT__ROTATECHARACTERS, "geotext.rotatecharacters"); - addProp(m, GEOTEXT__KERNCHARACTERS, "geotext.kerncharacters"); - addProp(m, GEOTEXT__TIGHTORTRACK, "geotext.tightortrack"); - addProp(m, GEOTEXT__STRETCHTOFITSHAPE, "geotext.stretchtofitshape"); - addProp(m, GEOTEXT__CHARBOUNDINGBOX, "geotext.charboundingbox"); - addProp(m, GEOTEXT__SCALETEXTONPATH, "geotext.scaletextonpath"); - addProp(m, GEOTEXT__STRETCHCHARHEIGHT, "geotext.stretchcharheight"); - addProp(m, GEOTEXT__NOMEASUREALONGPATH, "geotext.nomeasurealongpath"); - addProp(m, GEOTEXT__BOLDFONT, "geotext.boldfont"); - addProp(m, GEOTEXT__ITALICFONT, "geotext.italicfont"); - addProp(m, GEOTEXT__UNDERLINEFONT, "geotext.underlinefont"); - addProp(m, GEOTEXT__SHADOWFONT, "geotext.shadowfont"); - addProp(m, GEOTEXT__SMALLCAPSFONT, "geotext.smallcapsfont"); - addProp(m, GEOTEXT__STRIKETHROUGHFONT, "geotext.strikethroughfont"); - addProp(m, BLIP__CROPFROMTOP, "blip.cropfromtop"); - addProp(m, BLIP__CROPFROMBOTTOM, "blip.cropfrombottom"); - addProp(m, BLIP__CROPFROMLEFT, "blip.cropfromleft"); - addProp(m, BLIP__CROPFROMRIGHT, "blip.cropfromright"); - addProp(m, BLIP__BLIPTODISPLAY, "blip.bliptodisplay"); - addProp(m, BLIP__BLIPFILENAME, "blip.blipfilename"); - addProp(m, BLIP__BLIPFLAGS, "blip.blipflags"); - addProp(m, BLIP__TRANSPARENTCOLOR, "blip.transparentcolor"); - addProp(m, BLIP__CONTRASTSETTING, "blip.contrastsetting"); - addProp(m, BLIP__BRIGHTNESSSETTING, "blip.brightnesssetting"); - addProp(m, BLIP__GAMMA, "blip.gamma"); - addProp(m, BLIP__PICTUREID, "blip.pictureid"); - addProp(m, BLIP__DOUBLEMOD, "blip.doublemod"); - addProp(m, BLIP__PICTUREFILLMOD, "blip.picturefillmod"); - addProp(m, BLIP__PICTURELINE, "blip.pictureline"); - addProp(m, BLIP__PRINTBLIP, "blip.printblip"); - addProp(m, BLIP__PRINTBLIPFILENAME, "blip.printblipfilename"); - addProp(m, BLIP__PRINTFLAGS, "blip.printflags"); - addProp(m, BLIP__NOHITTESTPICTURE, "blip.nohittestpicture"); - addProp(m, BLIP__PICTUREGRAY, "blip.picturegray"); - addProp(m, BLIP__PICTUREBILEVEL, "blip.picturebilevel"); - addProp(m, BLIP__PICTUREACTIVE, "blip.pictureactive"); - addProp(m, GEOMETRY__LEFT, "geometry.left"); - addProp(m, GEOMETRY__TOP, "geometry.top"); - addProp(m, GEOMETRY__RIGHT, "geometry.right"); - addProp(m, GEOMETRY__BOTTOM, "geometry.bottom"); - addProp(m, GEOMETRY__SHAPEPATH, "geometry.shapepath", EscherPropertyMetaData.TYPE_SHAPEPATH); - addProp(m, GEOMETRY__VERTICES, "geometry.vertices", EscherPropertyMetaData.TYPE_ARRAY); - addProp(m, GEOMETRY__SEGMENTINFO, "geometry.segmentinfo", EscherPropertyMetaData.TYPE_ARRAY); - addProp(m, GEOMETRY__ADJUSTVALUE, "geometry.adjustvalue"); - addProp(m, GEOMETRY__ADJUST2VALUE, "geometry.adjust2value"); - addProp(m, GEOMETRY__ADJUST3VALUE, "geometry.adjust3value"); - addProp(m, GEOMETRY__ADJUST4VALUE, "geometry.adjust4value"); - addProp(m, GEOMETRY__ADJUST5VALUE, "geometry.adjust5value"); - addProp(m, GEOMETRY__ADJUST6VALUE, "geometry.adjust6value"); - addProp(m, GEOMETRY__ADJUST7VALUE, "geometry.adjust7value"); - addProp(m, GEOMETRY__ADJUST8VALUE, "geometry.adjust8value"); - addProp(m, GEOMETRY__ADJUST9VALUE, "geometry.adjust9value"); - addProp(m, GEOMETRY__ADJUST10VALUE, "geometry.adjust10value"); - addProp(m, GEOMETRY__PCONNECTIONSITES, "geometry.pConnectionSites"); - addProp(m, GEOMETRY__PCONNECTIONSITESDIR, "geometry.pConnectionSitesDir"); - addProp(m, GEOMETRY__XLIMO, "geometry.xLimo"); - addProp(m, GEOMETRY__YLIMO, "geometry.yLimo"); - addProp(m, GEOMETRY__PADJUSTHANDLES, "geometry.pAdjustHandles"); - addProp(m, GEOMETRY__PGUIDES, "geometry.pGuides"); - addProp(m, GEOMETRY__PINSCRIBE, "geometry.pInscribe"); - addProp(m, GEOMETRY__CXK, "geometry.cxk"); - addProp(m, GEOMETRY__PFRAGMENTS, "geometry.pFragments"); - addProp(m, GEOMETRY__SHADOWok, "geometry.shadowOK"); - addProp(m, GEOMETRY__3DOK, "geometry.3dok"); - addProp(m, GEOMETRY__LINEOK, "geometry.lineok"); - addProp(m, GEOMETRY__GEOTEXTOK, "geometry.geotextok"); - addProp(m, GEOMETRY__FILLSHADESHAPEOK, "geometry.fillshadeshapeok"); - addProp(m, GEOMETRY__FILLOK, "geometry.fillok", EscherPropertyMetaData.TYPE_BOOLEAN); - addProp(m, FILL__FILLTYPE, "fill.filltype"); - addProp(m, FILL__FILLCOLOR, "fill.fillcolor", EscherPropertyMetaData.TYPE_RGB); - addProp(m, FILL__FILLOPACITY, "fill.fillopacity"); - addProp(m, FILL__FILLBACKCOLOR, "fill.fillbackcolor", EscherPropertyMetaData.TYPE_RGB); - addProp(m, FILL__BACKOPACITY, "fill.backopacity"); - addProp(m, FILL__CRMOD, "fill.crmod"); - addProp(m, FILL__PATTERNTEXTURE, "fill.patterntexture"); - addProp(m, FILL__BLIPFILENAME, "fill.blipfilename"); - addProp(m, FILL__BLIPFLAGS, "fill.blipflags"); - addProp(m, FILL__WIDTH, "fill.width"); - addProp(m, FILL__HEIGHT, "fill.height"); - addProp(m, FILL__ANGLE, "fill.angle"); - addProp(m, FILL__FOCUS, "fill.focus"); - addProp(m, FILL__TOLEFT, "fill.toleft"); - addProp(m, FILL__TOTOP, "fill.totop"); - addProp(m, FILL__TORIGHT, "fill.toright"); - addProp(m, FILL__TOBOTTOM, "fill.tobottom"); - addProp(m, FILL__RECTLEFT, "fill.rectleft"); - addProp(m, FILL__RECTTOP, "fill.recttop"); - addProp(m, FILL__RECTRIGHT, "fill.rectright"); - addProp(m, FILL__RECTBOTTOM, "fill.rectbottom"); - addProp(m, FILL__DZTYPE, "fill.dztype"); - addProp(m, FILL__SHADEPRESET, "fill.shadepreset"); - addProp(m, FILL__SHADECOLORS, "fill.shadecolors", EscherPropertyMetaData.TYPE_ARRAY); - addProp(m, FILL__ORIGINX, "fill.originx"); - addProp(m, FILL__ORIGINY, "fill.originy"); - addProp(m, FILL__SHAPEORIGINX, "fill.shapeoriginx"); - addProp(m, FILL__SHAPEORIGINY, "fill.shapeoriginy"); - addProp(m, FILL__SHADETYPE, "fill.shadetype"); - addProp(m, FILL__FILLED, "fill.filled"); - addProp(m, FILL__HITTESTFILL, "fill.hittestfill"); - addProp(m, FILL__SHAPE, "fill.shape"); - addProp(m, FILL__USERECT, "fill.userect"); - addProp(m, FILL__NOFILLHITTEST, "fill.nofillhittest", EscherPropertyMetaData.TYPE_BOOLEAN); - addProp(m, LINESTYLE__COLOR, "linestyle.color", EscherPropertyMetaData.TYPE_RGB); - addProp(m, LINESTYLE__OPACITY, "linestyle.opacity"); - addProp(m, LINESTYLE__BACKCOLOR, "linestyle.backcolor", EscherPropertyMetaData.TYPE_RGB); - addProp(m, LINESTYLE__CRMOD, "linestyle.crmod"); - addProp(m, LINESTYLE__LINETYPE, "linestyle.linetype"); - addProp(m, LINESTYLE__FILLBLIP, "linestyle.fillblip"); - addProp(m, LINESTYLE__FILLBLIPNAME, "linestyle.fillblipname"); - addProp(m, LINESTYLE__FILLBLIPFLAGS, "linestyle.fillblipflags"); - addProp(m, LINESTYLE__FILLWIDTH, "linestyle.fillwidth"); - addProp(m, LINESTYLE__FILLHEIGHT, "linestyle.fillheight"); - addProp(m, LINESTYLE__FILLDZTYPE, "linestyle.filldztype"); - addProp(m, LINESTYLE__LINEWIDTH, "linestyle.linewidth"); - addProp(m, LINESTYLE__LINEMITERLIMIT, "linestyle.linemiterlimit"); - addProp(m, LINESTYLE__LINESTYLE, "linestyle.linestyle"); - addProp(m, LINESTYLE__LINEDASHING, "linestyle.linedashing"); - addProp(m, LINESTYLE__LINEDASHSTYLE, "linestyle.linedashstyle", EscherPropertyMetaData.TYPE_ARRAY); - addProp(m, LINESTYLE__LINESTARTARROWHEAD, "linestyle.linestartarrowhead"); - addProp(m, LINESTYLE__LINEENDARROWHEAD, "linestyle.lineendarrowhead"); - addProp(m, LINESTYLE__LINESTARTARROWWIDTH, "linestyle.linestartarrowwidth"); - addProp(m, LINESTYLE__LINESTARTARROWLENGTH, "linestyle.linestartarrowlength"); - addProp(m, LINESTYLE__LINEENDARROWWIDTH, "linestyle.lineendarrowwidth"); - addProp(m, LINESTYLE__LINEENDARROWLENGTH, "linestyle.lineendarrowlength"); - addProp(m, LINESTYLE__LINEJOINSTYLE, "linestyle.linejoinstyle"); - addProp(m, LINESTYLE__LINEENDCAPSTYLE, "linestyle.lineendcapstyle"); - addProp(m, LINESTYLE__ARROWHEADSOK, "linestyle.arrowheadsok"); - addProp(m, LINESTYLE__ANYLINE, "linestyle.anyline"); - addProp(m, LINESTYLE__HITLINETEST, "linestyle.hitlinetest"); - addProp(m, LINESTYLE__LINEFILLSHAPE, "linestyle.linefillshape"); - addProp(m, LINESTYLE__NOLINEDRAWDASH, "linestyle.nolinedrawdash", EscherPropertyMetaData.TYPE_BOOLEAN); - addProp(m, LINESTYLE__NOLINEDRAWDASH_LEFT, "linestyle.nolinedrawdash.left", EscherPropertyMetaData.TYPE_BOOLEAN); - addProp(m, LINESTYLE__NOLINEDRAWDASH_TOP, "linestyle.nolinedrawdash.top", EscherPropertyMetaData.TYPE_BOOLEAN); - addProp(m, LINESTYLE__NOLINEDRAWDASH_BOTTOM, "linestyle.nolinedrawdash.bottom", EscherPropertyMetaData.TYPE_BOOLEAN); - addProp(m, LINESTYLE__NOLINEDRAWDASH_RIGHT, "linestyle.nolinedrawdash.right", EscherPropertyMetaData.TYPE_BOOLEAN); - addProp(m, SHADOWSTYLE__TYPE, "shadowstyle.type"); - addProp(m, SHADOWSTYLE__COLOR, "shadowstyle.color", EscherPropertyMetaData.TYPE_RGB); - addProp(m, SHADOWSTYLE__HIGHLIGHT, "shadowstyle.highlight"); - addProp(m, SHADOWSTYLE__CRMOD, "shadowstyle.crmod"); - addProp(m, SHADOWSTYLE__OPACITY, "shadowstyle.opacity"); - addProp(m, SHADOWSTYLE__OFFSETX, "shadowstyle.offsetx"); - addProp(m, SHADOWSTYLE__OFFSETY, "shadowstyle.offsety"); - addProp(m, SHADOWSTYLE__SECONDOFFSETX, "shadowstyle.secondoffsetx"); - addProp(m, SHADOWSTYLE__SECONDOFFSETY, "shadowstyle.secondoffsety"); - addProp(m, SHADOWSTYLE__SCALEXTOX, "shadowstyle.scalextox"); - addProp(m, SHADOWSTYLE__SCALEYTOX, "shadowstyle.scaleytox"); - addProp(m, SHADOWSTYLE__SCALEXTOY, "shadowstyle.scalextoy"); - addProp(m, SHADOWSTYLE__SCALEYTOY, "shadowstyle.scaleytoy"); - addProp(m, SHADOWSTYLE__PERSPECTIVEX, "shadowstyle.perspectivex"); - addProp(m, SHADOWSTYLE__PERSPECTIVEY, "shadowstyle.perspectivey"); - addProp(m, SHADOWSTYLE__WEIGHT, "shadowstyle.weight"); - addProp(m, SHADOWSTYLE__ORIGINX, "shadowstyle.originx"); - addProp(m, SHADOWSTYLE__ORIGINY, "shadowstyle.originy"); - addProp(m, SHADOWSTYLE__SHADOW, "shadowstyle.shadow"); - addProp(m, SHADOWSTYLE__SHADOWOBSURED, "shadowstyle.shadowobscured"); - addProp(m, PERSPECTIVE__TYPE, "perspective.type"); - addProp(m, PERSPECTIVE__OFFSETX, "perspective.offsetx"); - addProp(m, PERSPECTIVE__OFFSETY, "perspective.offsety"); - addProp(m, PERSPECTIVE__SCALEXTOX, "perspective.scalextox"); - addProp(m, PERSPECTIVE__SCALEYTOX, "perspective.scaleytox"); - addProp(m, PERSPECTIVE__SCALEXTOY, "perspective.scalextoy"); - addProp(m, PERSPECTIVE__SCALEYTOY, "perspective.scaleytoy"); - addProp(m, PERSPECTIVE__PERSPECTIVEX, "perspective.perspectivex"); - addProp(m, PERSPECTIVE__PERSPECTIVEY, "perspective.perspectivey"); - addProp(m, PERSPECTIVE__WEIGHT, "perspective.weight"); - addProp(m, PERSPECTIVE__ORIGINX, "perspective.originx"); - addProp(m, PERSPECTIVE__ORIGINY, "perspective.originy"); - addProp(m, PERSPECTIVE__PERSPECTIVEON, "perspective.perspectiveon"); - addProp(m, THREED__SPECULARAMOUNT, "3d.specularamount"); - addProp(m, THREED__DIFFUSEAMOUNT, "3d.diffuseamount"); - addProp(m, THREED__SHININESS, "3d.shininess"); - addProp(m, THREED__EDGETHICKNESS, "3d.edgethickness"); - addProp(m, THREED__EXTRUDEFORWARD, "3d.extrudeforward"); - addProp(m, THREED__EXTRUDEBACKWARD, "3d.extrudebackward"); - addProp(m, THREED__EXTRUDEPLANE, "3d.extrudeplane"); - addProp(m, THREED__EXTRUSIONCOLOR, "3d.extrusioncolor", EscherPropertyMetaData.TYPE_RGB); - addProp(m, THREED__CRMOD, "3d.crmod"); - addProp(m, THREED__3DEFFECT, "3d.3deffect"); - addProp(m, THREED__METALLIC, "3d.metallic"); - addProp(m, THREED__USEEXTRUSIONCOLOR, "3d.useextrusioncolor", EscherPropertyMetaData.TYPE_RGB); - addProp(m, THREED__LIGHTFACE, "3d.lightface"); - addProp(m, THREEDSTYLE__YROTATIONANGLE, "3dstyle.yrotationangle"); - addProp(m, THREEDSTYLE__XROTATIONANGLE, "3dstyle.xrotationangle"); - addProp(m, THREEDSTYLE__ROTATIONAXISX, "3dstyle.rotationaxisx"); - addProp(m, THREEDSTYLE__ROTATIONAXISY, "3dstyle.rotationaxisy"); - addProp(m, THREEDSTYLE__ROTATIONAXISZ, "3dstyle.rotationaxisz"); - addProp(m, THREEDSTYLE__ROTATIONANGLE, "3dstyle.rotationangle"); - addProp(m, THREEDSTYLE__ROTATIONCENTERX, "3dstyle.rotationcenterx"); - addProp(m, THREEDSTYLE__ROTATIONCENTERY, "3dstyle.rotationcentery"); - addProp(m, THREEDSTYLE__ROTATIONCENTERZ, "3dstyle.rotationcenterz"); - addProp(m, THREEDSTYLE__RENDERMODE, "3dstyle.rendermode"); - addProp(m, THREEDSTYLE__TOLERANCE, "3dstyle.tolerance"); - addProp(m, THREEDSTYLE__XVIEWPOINT, "3dstyle.xviewpoint"); - addProp(m, THREEDSTYLE__YVIEWPOINT, "3dstyle.yviewpoint"); - addProp(m, THREEDSTYLE__ZVIEWPOINT, "3dstyle.zviewpoint"); - addProp(m, THREEDSTYLE__ORIGINX, "3dstyle.originx"); - addProp(m, THREEDSTYLE__ORIGINY, "3dstyle.originy"); - addProp(m, THREEDSTYLE__SKEWANGLE, "3dstyle.skewangle"); - addProp(m, THREEDSTYLE__SKEWAMOUNT, "3dstyle.skewamount"); - addProp(m, THREEDSTYLE__AMBIENTINTENSITY, "3dstyle.ambientintensity"); - addProp(m, THREEDSTYLE__KEYX, "3dstyle.keyx"); - addProp(m, THREEDSTYLE__KEYY, "3dstyle.keyy"); - addProp(m, THREEDSTYLE__KEYZ, "3dstyle.keyz"); - addProp(m, THREEDSTYLE__KEYINTENSITY, "3dstyle.keyintensity"); - addProp(m, THREEDSTYLE__FILLX, "3dstyle.fillx"); - addProp(m, THREEDSTYLE__FILLY, "3dstyle.filly"); - addProp(m, THREEDSTYLE__FILLZ, "3dstyle.fillz"); - addProp(m, THREEDSTYLE__FILLINTENSITY, "3dstyle.fillintensity"); - addProp(m, THREEDSTYLE__CONSTRAINROTATION, "3dstyle.constrainrotation"); - addProp(m, THREEDSTYLE__ROTATIONCENTERAUTO, "3dstyle.rotationcenterauto"); - addProp(m, THREEDSTYLE__PARALLEL, "3dstyle.parallel"); - addProp(m, THREEDSTYLE__KEYHARSH, "3dstyle.keyharsh"); - addProp(m, THREEDSTYLE__FILLHARSH, "3dstyle.fillharsh"); - addProp(m, SHAPE__MASTER, "shape.master"); - addProp(m, SHAPE__CONNECTORSTYLE, "shape.connectorstyle"); - addProp(m, SHAPE__BLACKANDWHITESETTINGS, "shape.blackandwhitesettings"); - addProp(m, SHAPE__WMODEPUREBW, "shape.wmodepurebw"); - addProp(m, SHAPE__WMODEBW, "shape.wmodebw"); - addProp(m, SHAPE__OLEICON, "shape.oleicon"); - addProp(m, SHAPE__PREFERRELATIVERESIZE, "shape.preferrelativeresize"); - addProp(m, SHAPE__LOCKSHAPETYPE, "shape.lockshapetype"); - addProp(m, SHAPE__DELETEATTACHEDOBJECT, "shape.deleteattachedobject"); - addProp(m, SHAPE__BACKGROUNDSHAPE, "shape.backgroundshape"); - addProp(m, CALLOUT__CALLOUTTYPE, "callout.callouttype"); - addProp(m, CALLOUT__XYCALLOUTGAP, "callout.xycalloutgap"); - addProp(m, CALLOUT__CALLOUTANGLE, "callout.calloutangle"); - addProp(m, CALLOUT__CALLOUTDROPTYPE, "callout.calloutdroptype"); - addProp(m, CALLOUT__CALLOUTDROPSPECIFIED, "callout.calloutdropspecified"); - addProp(m, CALLOUT__CALLOUTLENGTHSPECIFIED, "callout.calloutlengthspecified"); - addProp(m, CALLOUT__ISCALLOUT, "callout.iscallout"); - addProp(m, CALLOUT__CALLOUTACCENTBAR, "callout.calloutaccentbar"); - addProp(m, CALLOUT__CALLOUTTEXTBORDER, "callout.callouttextborder"); - addProp(m, CALLOUT__CALLOUTMINUSX, "callout.calloutminusx"); - addProp(m, CALLOUT__CALLOUTMINUSY, "callout.calloutminusy"); - addProp(m, CALLOUT__DROPAUTO, "callout.dropauto"); - addProp(m, CALLOUT__LENGTHSPECIFIED, "callout.lengthspecified"); - addProp(m, GROUPSHAPE__SHAPENAME, "groupshape.shapename"); - addProp(m, GROUPSHAPE__DESCRIPTION, "groupshape.description"); - addProp(m, GROUPSHAPE__HYPERLINK, "groupshape.hyperlink"); - addProp(m, GROUPSHAPE__WRAPPOLYGONVERTICES, "groupshape.wrappolygonvertices", EscherPropertyMetaData.TYPE_ARRAY); - addProp(m, GROUPSHAPE__WRAPDISTLEFT, "groupshape.wrapdistleft"); - addProp(m, GROUPSHAPE__WRAPDISTTOP, "groupshape.wrapdisttop"); - addProp(m, GROUPSHAPE__WRAPDISTRIGHT, "groupshape.wrapdistright"); - addProp(m, GROUPSHAPE__WRAPDISTBOTTOM, "groupshape.wrapdistbottom"); - addProp(m, GROUPSHAPE__REGROUPID, "groupshape.regroupid"); - addProp( m, GROUPSHAPE__UNUSED906, "unused906" ); // 0x038A; - addProp( m, GROUPSHAPE__TOOLTIP, "groupshape.wzTooltip" ); // 0x038D; - addProp( m, GROUPSHAPE__SCRIPT, "groupshape.wzScript" ); // 0x038E; - addProp( m, GROUPSHAPE__POSH, "groupshape.posh" ); // 0x038F; - addProp( m, GROUPSHAPE__POSRELH, "groupshape.posrelh" ); // 0x0390; - addProp( m, GROUPSHAPE__POSV, "groupshape.posv" ); // 0x0391; - addProp( m, GROUPSHAPE__POSRELV, "groupshape.posrelv" ); // 0x0392; - addProp( m, GROUPSHAPE__HR_PCT, "groupshape.pctHR" ); // 0x0393; - addProp( m, GROUPSHAPE__HR_ALIGN, "groupshape.alignHR" ); // 0x0394; - addProp( m, GROUPSHAPE__HR_HEIGHT, "groupshape.dxHeightHR" ); // 0x0395; - addProp( m, GROUPSHAPE__HR_WIDTH, "groupshape.dxWidthHR" ); // 0x0396; - addProp( m, GROUPSHAPE__SCRIPTEXT, "groupshape.wzScriptExtAttr" ); // 0x0397; - addProp( m, GROUPSHAPE__SCRIPTLANG, "groupshape.scriptLang" ); // 0x0398; - addProp( m, GROUPSHAPE__BORDERTOPCOLOR, "groupshape.borderTopColor" ); // 0x039B; - addProp( m, GROUPSHAPE__BORDERLEFTCOLOR, "groupshape.borderLeftColor" ); // 0x039C; - addProp( m, GROUPSHAPE__BORDERBOTTOMCOLOR, "groupshape.borderBottomColor" ); // 0x039D; - addProp( m, GROUPSHAPE__BORDERRIGHTCOLOR, "groupshape.borderRightColor" ); // 0x039E; - addProp( m, GROUPSHAPE__TABLEPROPERTIES, "groupshape.tableProperties" ); // 0x039F; - addProp( m, GROUPSHAPE__TABLEROWPROPERTIES, "groupshape.tableRowProperties", EscherPropertyMetaData.TYPE_ARRAY ); // 0x03A0; - addProp( m, GROUPSHAPE__WEBBOT, "groupshape.wzWebBot" ); // 0x03A5; - addProp( m, GROUPSHAPE__METROBLOB, "groupshape.metroBlob" ); // 0x03A9; - addProp( m, GROUPSHAPE__ZORDER, "groupshape.dhgt" ); // 0x03AA; - addProp( m, GROUPSHAPE__FLAGS, "groupshape.GroupShapeBooleanProperties" ); // 0x03BF; - - addProp(m, GROUPSHAPE__EDITEDWRAP, "groupshape.editedwrap"); - addProp(m, GROUPSHAPE__BEHINDDOCUMENT, "groupshape.behinddocument"); - addProp(m, GROUPSHAPE__ONDBLCLICKNOTIFY, "groupshape.ondblclicknotify"); - addProp(m, GROUPSHAPE__ISBUTTON, "groupshape.isbutton"); - addProp(m, GROUPSHAPE__1DADJUSTMENT, "groupshape.1dadjustment"); - addProp(m, GROUPSHAPE__HIDDEN, "groupshape.hidden"); - addProp(m, GROUPSHAPE__PRINT, "groupshape.print", EscherPropertyMetaData.TYPE_BOOLEAN); - return m; - } - - private static void addProp(Map m, int s, String propName) { - m.put((short) s, new EscherPropertyMetaData(propName)); - } - - private static void addProp(Map m, int s, String propName, byte type) { - m.put((short) s, new EscherPropertyMetaData(propName, type)); - } - - public static String getPropertyName(short propertyId) { - EscherPropertyMetaData o = properties.get(propertyId); - return o == null ? "unknown" : o.getDescription(); + static String getPropertyName(short propertyId) { + return EscherPropertyTypes.forPropertyID(propertyId).propName; } - public static byte getPropertyType(short propertyId) { - EscherPropertyMetaData escherPropertyMetaData = properties.get(propertyId); - return escherPropertyMetaData == null ? 0 : escherPropertyMetaData.getType(); + static byte getPropertyType(short propertyId) { + return (byte)EscherPropertyTypes.forPropertyID(propertyId).holder.ordinal(); } } diff --git a/src/java/org/apache/poi/ddf/EscherProperty.java b/src/java/org/apache/poi/ddf/EscherProperty.java index bb1355c005..35787e2b5c 100644 --- a/src/java/org/apache/poi/ddf/EscherProperty.java +++ b/src/java/org/apache/poi/ddf/EscherProperty.java @@ -17,13 +17,28 @@ package org.apache.poi.ddf; +import java.util.List; +import java.util.Map; +import java.util.function.Supplier; + +import org.apache.poi.common.usermodel.GenericRecord; +import org.apache.poi.util.GenericRecordJsonWriter; +import org.apache.poi.util.GenericRecordUtil; +import org.apache.poi.util.GenericRecordXmlWriter; + /** * This is the abstract base class for all escher properties. * * @see EscherOptRecord */ -public abstract class EscherProperty { - private short _id; +public abstract class EscherProperty implements GenericRecord { + private final short id; + + static final int IS_BLIP = 0x4000; + static final int IS_COMPLEX = 0x8000; + + private static final int[] FLAG_MASK = { IS_BLIP, IS_COMPLEX }; + private static final String[] FLAG_NAMES = { "IS_BLIP", "IS_COMPLEX" }; /** * The id is distinct from the actual property number. The id includes the property number the blip id @@ -31,8 +46,8 @@ public abstract class EscherProperty { * * @param id the combined id */ - public EscherProperty(short id) { - _id = id; + protected EscherProperty(short id) { + this.id = id; } /** @@ -43,30 +58,44 @@ public abstract class EscherProperty { * @param isComplex true, if this is a complex property * @param isBlipId true, if this property is a blip id */ - public EscherProperty(short propertyNumber, boolean isComplex, boolean isBlipId) { - _id = (short)(propertyNumber + - (isComplex ? 0x8000 : 0x0) + - (isBlipId ? 0x4000 : 0x0)); + protected EscherProperty(short propertyNumber, boolean isComplex, boolean isBlipId) { + this((short)(propertyNumber | + (isComplex ? IS_COMPLEX : 0x0) | + (isBlipId ? IS_BLIP : 0x0))); + } + + /** + * Constructs a new escher property. The three parameters are combined to form a property + * id. + * + * @param propertyNumber the property number + * @param isComplex true, if this is a complex property + * @param isBlipId true, if this property is a blip id + */ + protected EscherProperty(EscherPropertyTypes type, boolean isComplex, boolean isBlipId) { + this((short)(type.propNumber | + (isComplex ? IS_COMPLEX : 0) | + (isBlipId ? IS_BLIP : 0))); } public short getId() { - return _id; + return id; } public short getPropertyNumber() { - return (short) (_id & (short) 0x3FFF); + return (short) (id & 0x3FFF); } public boolean isComplex() { - return (_id & (short) 0x8000) != 0; + return (id & IS_COMPLEX) != 0; } public boolean isBlipId() { - return (_id & (short) 0x4000) != 0; + return (id & IS_BLIP) != 0; } public String getName() { - return EscherProperties.getPropertyName(getPropertyNumber()); + return EscherPropertyTypes.forPropertyID(getPropertyNumber()).propName; } /** @@ -79,13 +108,6 @@ public abstract class EscherProperty { return 6; } - public String toXml(String tab){ - StringBuilder builder = new StringBuilder(); - builder.append(tab).append("<").append(getClass().getSimpleName()).append(" id=\"").append(getId()).append("\" name=\"").append(getName()).append("\" blipId=\"") - .append(isBlipId()).append("\"/>\n"); - return builder.toString(); - } - /** * Escher properties consist of a simple fixed length part and a complex variable length part. * The fixed length part is serialized first. @@ -110,5 +132,32 @@ public abstract class EscherProperty { @Override - abstract public String toString(); + public final String toString() { + return GenericRecordJsonWriter.marshal(this); + } + + public final String toXml(String tab){ + return GenericRecordXmlWriter.marshal(this); + } + + @Override + public Map> getGenericProperties() { + return GenericRecordUtil.getGenericProperties( + "id", this::getId, + "name", this::getName, + "propertyNumber", this::getPropertyNumber, + "propertySize", this::getPropertySize, + "flags", GenericRecordUtil.getBitsAsString(this::getId, FLAG_MASK, FLAG_NAMES) + ); + } + + @Override + public List getGenericChildren() { + return null; + } + + @Override + public EscherPropertyTypes getGenericRecordType() { + return EscherPropertyTypes.forPropertyID(id); + } } \ No newline at end of file diff --git a/src/java/org/apache/poi/ddf/EscherPropertyFactory.java b/src/java/org/apache/poi/ddf/EscherPropertyFactory.java index fe51c18c46..eff992c952 100644 --- a/src/java/org/apache/poi/ddf/EscherPropertyFactory.java +++ b/src/java/org/apache/poi/ddf/EscherPropertyFactory.java @@ -19,8 +19,8 @@ package org.apache.poi.ddf; import java.util.ArrayList; import java.util.List; +import java.util.function.BiFunction; -import org.apache.poi.util.IOUtils; import org.apache.poi.util.LittleEndian; /** @@ -28,9 +28,6 @@ import org.apache.poi.util.LittleEndian; */ public final class EscherPropertyFactory { - //arbitrarily selected; may need to increase - private static final int MAX_RECORD_LENGTH = 100_000_000; - /** * Create new properties from a byte array. * @@ -45,57 +42,52 @@ public final class EscherPropertyFactory { int pos = offset; for (int i = 0; i < numProperties; i++) { - short propId; - int propData; - propId = LittleEndian.getShort( data, pos ); - propData = LittleEndian.getInt( data, pos + 2 ); - short propNumber = (short) ( propId & (short) 0x3FFF ); - boolean isComplex = ( propId & (short) 0x8000 ) != 0; - // boolean isBlipId = ( propId & (short) 0x4000 ) != 0; + final short propId = LittleEndian.getShort( data, pos ); + final int propData = LittleEndian.getInt( data, pos + 2 ); + final boolean isComplex = ( propId & EscherProperty.IS_COMPLEX ) != 0; + + EscherPropertyTypes propertyType = EscherPropertyTypes.forPropertyID(propId); - byte propertyType = EscherProperties.getPropertyType(propNumber); - EscherProperty ep; - switch (propertyType) { - case EscherPropertyMetaData.TYPE_BOOLEAN: - ep = new EscherBoolProperty( propId, propData ); + final BiFunction con; + switch (propertyType.holder) { + case BOOLEAN: + con = EscherBoolProperty::new; break; - case EscherPropertyMetaData.TYPE_RGB: - ep = new EscherRGBProperty( propId, propData ); + case RGB: + con = EscherRGBProperty::new; break; - case EscherPropertyMetaData.TYPE_SHAPEPATH: - ep = new EscherShapePathProperty( propId, propData ); + case SHAPE_PATH: + con = EscherShapePathProperty::new; break; default: - if ( !isComplex ) { - ep = new EscherSimpleProperty( propId, propData ); - } else if ( propertyType == EscherPropertyMetaData.TYPE_ARRAY) { - ep = new EscherArrayProperty( propId, IOUtils.safelyAllocate(propData, MAX_RECORD_LENGTH)); + if ( isComplex ) { + con = (propertyType.holder == EscherPropertyTypesHolder.ARRAY) + ? EscherArrayProperty::new + : EscherComplexProperty::new; } else { - ep = new EscherComplexProperty( propId, IOUtils.safelyAllocate(propData, MAX_RECORD_LENGTH)); + con = EscherSimpleProperty::new; } break; } - results.add( ep ); + + results.add( con.apply(propId,propData) ); pos += 6; } // Get complex data for (EscherProperty p : results) { - if (p instanceof EscherComplexProperty) { - if (p instanceof EscherArrayProperty) { - pos += ((EscherArrayProperty)p).setArrayData(data, pos); - } else { - byte[] complexData = ((EscherComplexProperty)p).getComplexData(); - - int leftover = data.length - pos; - if (leftover < complexData.length) { - throw new IllegalStateException("Could not read complex escher property, length was " + complexData.length + ", but had only " + - leftover + " bytes left"); - } - - System.arraycopy(data, pos, complexData, 0, complexData.length); - pos += complexData.length; + if (p instanceof EscherArrayProperty) { + EscherArrayProperty eap = (EscherArrayProperty)p; + pos += eap.setArrayData(data, pos); + } else if (p instanceof EscherComplexProperty) { + EscherComplexProperty ecp = (EscherComplexProperty)p; + int cdLen = ecp.getComplexData().length; + int leftover = data.length - pos; + if (leftover < cdLen) { + throw new IllegalStateException("Could not read complex escher property, length was " + + cdLen + ", but had only " + leftover + " bytes left"); } + pos += ecp.setComplexData(data, pos); } } return results; diff --git a/src/java/org/apache/poi/ddf/EscherPropertyTypes.java b/src/java/org/apache/poi/ddf/EscherPropertyTypes.java new file mode 100644 index 0000000000..cd5b25a7d4 --- /dev/null +++ b/src/java/org/apache/poi/ddf/EscherPropertyTypes.java @@ -0,0 +1,376 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License")), you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ==================================================================== */ + +package org.apache.poi.ddf; + +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * Provides a list of all known escher properties including the description and type. + */ +public enum EscherPropertyTypes { + TRANSFORM__ROTATION(0x0004, "transform.rotation"), + PROTECTION__LOCKROTATION(0x0077, "protection.lockrotation"), + PROTECTION__LOCKASPECTRATIO(0x0078, "protection.lockaspectratio"), + PROTECTION__LOCKPOSITION(0x0079, "protection.lockposition"), + PROTECTION__LOCKAGAINSTSELECT(0x007a, "protection.lockagainstselect"), + PROTECTION__LOCKCROPPING(0x007b, "protection.lockcropping"), + PROTECTION__LOCKVERTICES(0x007c, "protection.lockvertices"), + PROTECTION__LOCKTEXT(0x007d, "protection.locktext"), + PROTECTION__LOCKADJUSTHANDLES(0x007e, "protection.lockadjusthandles"), + PROTECTION__LOCKAGAINSTGROUPING(0x007f, "protection.lockagainstgrouping", EscherPropertyTypesHolder.BOOLEAN), + TEXT__TEXTID(0x0080, "text.textid"), + TEXT__TEXTLEFT(0x0081, "text.textleft"), + TEXT__TEXTTOP(0x0082, "text.texttop"), + TEXT__TEXTRIGHT(0x0083, "text.textright"), + TEXT__TEXTBOTTOM(0x0084, "text.textbottom"), + TEXT__WRAPTEXT(0x0085, "text.wraptext"), + TEXT__SCALETEXT(0x0086, "text.scaletext"), + TEXT__ANCHORTEXT(0x0087, "text.anchortext"), + TEXT__TEXTFLOW(0x0088, "text.textflow"), + TEXT__FONTROTATION(0x0089, "text.fontrotation"), + TEXT__IDOFNEXTSHAPE(0x008a, "text.idofnextshape"), + TEXT__BIDIR(0x008b, "text.bidir"), + TEXT__SINGLECLICKSELECTS(0x00bb, "text.singleclickselects"), + TEXT__USEHOSTMARGINS(0x00bc, "text.usehostmargins"), + TEXT__ROTATETEXTWITHSHAPE(0x00bd, "text.rotatetextwithshape"), + TEXT__SIZESHAPETOFITTEXT(0x00be, "text.sizeshapetofittext"), + TEXT__SIZE_TEXT_TO_FIT_SHAPE(0x00bf, "text.sizetexttofitshape", EscherPropertyTypesHolder.BOOLEAN), + GEOTEXT__UNICODE(0x00c0, "geotext.unicode"), + GEOTEXT__RTFTEXT(0x00c1, "geotext.rtftext"), + GEOTEXT__ALIGNMENTONCURVE(0x00c2, "geotext.alignmentoncurve"), + GEOTEXT__DEFAULTPOINTSIZE(0x00c3, "geotext.defaultpointsize"), + GEOTEXT__TEXTSPACING(0x00c4, "geotext.textspacing"), + GEOTEXT__FONTFAMILYNAME(0x00c5, "geotext.fontfamilyname"), + GEOTEXT__REVERSEROWORDER(0x00f0, "geotext.reverseroworder"), + GEOTEXT__HASTEXTEFFECT(0x00f1, "geotext.hastexteffect"), + GEOTEXT__ROTATECHARACTERS(0x00f2, "geotext.rotatecharacters"), + GEOTEXT__KERNCHARACTERS(0x00f3, "geotext.kerncharacters"), + GEOTEXT__TIGHTORTRACK(0x00f4, "geotext.tightortrack"), + GEOTEXT__STRETCHTOFITSHAPE(0x00f5, "geotext.stretchtofitshape"), + GEOTEXT__CHARBOUNDINGBOX(0x00f6, "geotext.charboundingbox"), + GEOTEXT__SCALETEXTONPATH(0x00f7, "geotext.scaletextonpath"), + GEOTEXT__STRETCHCHARHEIGHT(0x00f8, "geotext.stretchcharheight"), + GEOTEXT__NOMEASUREALONGPATH(0x00f9, "geotext.nomeasurealongpath"), + GEOTEXT__BOLDFONT(0x00fa, "geotext.boldfont"), + GEOTEXT__ITALICFONT(0x00fb, "geotext.italicfont"), + GEOTEXT__UNDERLINEFONT(0x00fc, "geotext.underlinefont"), + GEOTEXT__SHADOWFONT(0x00fd, "geotext.shadowfont"), + GEOTEXT__SMALLCAPSFONT(0x00fe, "geotext.smallcapsfont"), + GEOTEXT__STRIKETHROUGHFONT(0x00ff, "geotext.strikethroughfont"), + BLIP__CROPFROMTOP(0x0100, "blip.cropfromtop"), + BLIP__CROPFROMBOTTOM(0x0101, "blip.cropfrombottom"), + BLIP__CROPFROMLEFT(0x0102, "blip.cropfromleft"), + BLIP__CROPFROMRIGHT(0x0103, "blip.cropfromright"), + BLIP__BLIPTODISPLAY(0x0104, "blip.bliptodisplay"), + BLIP__BLIPFILENAME(0x0105, "blip.blipfilename"), + BLIP__BLIPFLAGS(0x0106, "blip.blipflags"), + BLIP__TRANSPARENTCOLOR(0x0107, "blip.transparentcolor"), + BLIP__CONTRASTSETTING(0x0108, "blip.contrastsetting"), + BLIP__BRIGHTNESSSETTING(0x0109, "blip.brightnesssetting"), + BLIP__GAMMA(0x010a, "blip.gamma"), + BLIP__PICTUREID(0x010b, "blip.pictureid"), + BLIP__DOUBLEMOD(0x010c, "blip.doublemod"), + BLIP__PICTUREFILLMOD(0x010d, "blip.picturefillmod"), + BLIP__PICTURELINE(0x010e, "blip.pictureline"), + BLIP__PRINTBLIP(0x010f, "blip.printblip"), + BLIP__PRINTBLIPFILENAME(0x0110, "blip.printblipfilename"), + BLIP__PRINTFLAGS(0x0111, "blip.printflags"), + BLIP__NOHITTESTPICTURE(0x013c, "blip.nohittestpicture"), + BLIP__PICTUREGRAY(0x013d, "blip.picturegray"), + BLIP__PICTUREBILEVEL(0x013e, "blip.picturebilevel"), + BLIP__PICTUREACTIVE(0x013f, "blip.pictureactive"), + GEOMETRY__LEFT(0x0140, "geometry.left"), + GEOMETRY__TOP(0x0141, "geometry.top"), + GEOMETRY__RIGHT(0x0142, "geometry.right"), + GEOMETRY__BOTTOM(0x0143, "geometry.bottom"), + GEOMETRY__SHAPEPATH(0x0144, "geometry.shapepath", EscherPropertyTypesHolder.SHAPE_PATH), + GEOMETRY__VERTICES(0x0145, "geometry.vertices", EscherPropertyTypesHolder.ARRAY), + GEOMETRY__SEGMENTINFO(0x0146, "geometry.segmentinfo", EscherPropertyTypesHolder.ARRAY), + GEOMETRY__ADJUSTVALUE(0x0147, "geometry.adjustvalue"), + GEOMETRY__ADJUST2VALUE(0x0148, "geometry.adjust2value"), + GEOMETRY__ADJUST3VALUE(0x0149, "geometry.adjust3value"), + GEOMETRY__ADJUST4VALUE(0x014a, "geometry.adjust4value"), + GEOMETRY__ADJUST5VALUE(0x014b, "geometry.adjust5value"), + GEOMETRY__ADJUST6VALUE(0x014c, "geometry.adjust6value"), + GEOMETRY__ADJUST7VALUE(0x014d, "geometry.adjust7value"), + GEOMETRY__ADJUST8VALUE(0x014e, "geometry.adjust8value"), + GEOMETRY__ADJUST9VALUE(0x014f, "geometry.adjust9value"), + GEOMETRY__ADJUST10VALUE(0x0150, "geometry.adjust10value"), + GEOMETRY__PCONNECTIONSITES(0x0151, "geometry.pConnectionSites"), + GEOMETRY__PCONNECTIONSITESDIR(0x0152, "geometry.pConnectionSitesDir"), + GEOMETRY__XLIMO(0x0153, "geometry.xLimo"), + GEOMETRY__YLIMO(0x0154, "geometry.yLimo"), + GEOMETRY__PADJUSTHANDLES(0x0155, "geometry.pAdjustHandles"), + GEOMETRY__PGUIDES(0x0156, "geometry.pGuides"), + GEOMETRY__PINSCRIBE(0x0157, "geometry.pInscribe"), + GEOMETRY__CXK(0x0158, "geometry.cxk"), + GEOMETRY__PFRAGMENTS(0x0159, "geometry.pFragments"), + GEOMETRY__SHADOWOK(0x017a, "geometry.shadowOK"), + GEOMETRY__3DOK(0x017b, "geometry.3dok"), + GEOMETRY__LINEOK(0x017c, "geometry.lineok"), + GEOMETRY__GEOTEXTOK(0x017d, "geometry.geotextok"), + GEOMETRY__FILLSHADESHAPEOK(0x017e, "geometry.fillshadeshapeok"), + GEOMETRY__FILLOK(0x017f, "geometry.fillok", EscherPropertyTypesHolder.BOOLEAN), + FILL__FILLTYPE(0x0180, "fill.filltype"), + FILL__FILLCOLOR(0x0181, "fill.fillcolor", EscherPropertyTypesHolder.RGB), + FILL__FILLOPACITY(0x0182, "fill.fillopacity"), + FILL__FILLBACKCOLOR(0x0183, "fill.fillbackcolor", EscherPropertyTypesHolder.RGB), + FILL__BACKOPACITY(0x0184, "fill.backopacity"), + FILL__CRMOD(0x0185, "fill.crmod"), + FILL__PATTERNTEXTURE(0x0186, "fill.patterntexture"), + FILL__BLIPFILENAME(0x0187, "fill.blipfilename"), + FILL__BLIPFLAGS(0x0188, "fill.blipflags"), + FILL__WIDTH(0x0189, "fill.width"), + FILL__HEIGHT(0x018a, "fill.height"), + FILL__ANGLE(0x018b, "fill.angle"), + FILL__FOCUS(0x018c, "fill.focus"), + FILL__TOLEFT(0x018d, "fill.toleft"), + FILL__TOTOP(0x018e, "fill.totop"), + FILL__TORIGHT(0x018f, "fill.toright"), + FILL__TOBOTTOM(0x0190, "fill.tobottom"), + FILL__RECTLEFT(0x0191, "fill.rectleft"), + FILL__RECTTOP(0x0192, "fill.recttop"), + FILL__RECTRIGHT(0x0193, "fill.rectright"), + FILL__RECTBOTTOM(0x0194, "fill.rectbottom"), + FILL__DZTYPE(0x0195, "fill.dztype"), + FILL__SHADEPRESET(0x0196, "fill.shadepreset"), + FILL__SHADECOLORS(0x0197, "fill.shadecolors", EscherPropertyTypesHolder.ARRAY), + FILL__ORIGINX(0x0198, "fill.originx"), + FILL__ORIGINY(0x0199, "fill.originy"), + FILL__SHAPEORIGINX(0x019a, "fill.shapeoriginx"), + FILL__SHAPEORIGINY(0x019b, "fill.shapeoriginy"), + FILL__SHADETYPE(0x019c, "fill.shadetype"), + FILL__FILLED(0x01bb, "fill.filled"), + FILL__HITTESTFILL(0x01bc, "fill.hittestfill"), + FILL__SHAPE(0x01bd, "fill.shape"), + FILL__USERECT(0x01be, "fill.userect"), + FILL__NOFILLHITTEST(0x01bf, "fill.nofillhittest", EscherPropertyTypesHolder.BOOLEAN), + LINESTYLE__COLOR(0x01c0, "linestyle.color", EscherPropertyTypesHolder.RGB), + LINESTYLE__OPACITY(0x01c1, "linestyle.opacity"), + LINESTYLE__BACKCOLOR(0x01c2, "linestyle.backcolor", EscherPropertyTypesHolder.RGB), + LINESTYLE__CRMOD(0x01c3, "linestyle.crmod"), + LINESTYLE__LINETYPE(0x01c4, "linestyle.linetype"), + LINESTYLE__FILLBLIP(0x01c5, "linestyle.fillblip"), + LINESTYLE__FILLBLIPNAME(0x01c6, "linestyle.fillblipname"), + LINESTYLE__FILLBLIPFLAGS(0x01c7, "linestyle.fillblipflags"), + LINESTYLE__FILLWIDTH(0x01c8, "linestyle.fillwidth"), + LINESTYLE__FILLHEIGHT(0x01c9, "linestyle.fillheight"), + LINESTYLE__FILLDZTYPE(0x01ca, "linestyle.filldztype"), + LINESTYLE__LINEWIDTH(0x01cb, "linestyle.linewidth"), + LINESTYLE__LINEMITERLIMIT(0x01cc, "linestyle.linemiterlimit"), + LINESTYLE__LINESTYLE(0x01cd, "linestyle.linestyle"), + LINESTYLE__LINEDASHING(0x01ce, "linestyle.linedashing"), + LINESTYLE__LINEDASHSTYLE(0x01cf, "linestyle.linedashstyle", EscherPropertyTypesHolder.ARRAY), + LINESTYLE__LINESTARTARROWHEAD(0x01d0, "linestyle.linestartarrowhead"), + LINESTYLE__LINEENDARROWHEAD(0x01d1, "linestyle.lineendarrowhead"), + LINESTYLE__LINESTARTARROWWIDTH(0x01d2, "linestyle.linestartarrowwidth"), + LINESTYLE__LINESTARTARROWLENGTH(0x01d3, "linestyle.linestartarrowlength"), + LINESTYLE__LINEENDARROWWIDTH(0x01d4, "linestyle.lineendarrowwidth"), + LINESTYLE__LINEENDARROWLENGTH(0x01d5, "linestyle.lineendarrowlength"), + LINESTYLE__LINEJOINSTYLE(0x01d6, "linestyle.linejoinstyle"), + LINESTYLE__LINEENDCAPSTYLE(0x01d7, "linestyle.lineendcapstyle"), + LINESTYLE__ARROWHEADSOK(0x01fb, "linestyle.arrowheadsok"), + LINESTYLE__ANYLINE(0x01fc, "linestyle.anyline"), + LINESTYLE__HITLINETEST(0x01fd, "linestyle.hitlinetest"), + LINESTYLE__LINEFILLSHAPE(0x01fe, "linestyle.linefillshape"), + LINESTYLE__NOLINEDRAWDASH(0x01ff, "linestyle.nolinedrawdash", EscherPropertyTypesHolder.BOOLEAN), + LINESTYLE__NOLINEDRAWDASH_LEFT(0x057F, "linestyle.nolinedrawdash.left", EscherPropertyTypesHolder.BOOLEAN), + LINESTYLE__NOLINEDRAWDASH_TOP(0x05BF, "linestyle.nolinedrawdash.top", EscherPropertyTypesHolder.BOOLEAN), + LINESTYLE__NOLINEDRAWDASH_BOTTOM(0x063F, "linestyle.nolinedrawdash.bottom", EscherPropertyTypesHolder.BOOLEAN), + LINESTYLE__NOLINEDRAWDASH_RIGHT(0x05FF, "linestyle.nolinedrawdash.right", EscherPropertyTypesHolder.BOOLEAN), + SHADOWSTYLE__TYPE(0x0200, "shadowstyle.type"), + SHADOWSTYLE__COLOR(0x0201, "shadowstyle.color", EscherPropertyTypesHolder.RGB), + SHADOWSTYLE__HIGHLIGHT(0x0202, "shadowstyle.highlight"), + SHADOWSTYLE__CRMOD(0x0203, "shadowstyle.crmod"), + SHADOWSTYLE__OPACITY(0x0204, "shadowstyle.opacity"), + SHADOWSTYLE__OFFSETX(0x0205, "shadowstyle.offsetx"), + SHADOWSTYLE__OFFSETY(0x0206, "shadowstyle.offsety"), + SHADOWSTYLE__SECONDOFFSETX(0x0207, "shadowstyle.secondoffsetx"), + SHADOWSTYLE__SECONDOFFSETY(0x0208, "shadowstyle.secondoffsety"), + SHADOWSTYLE__SCALEXTOX(0x0209, "shadowstyle.scalextox"), + SHADOWSTYLE__SCALEYTOX(0x020a, "shadowstyle.scaleytox"), + SHADOWSTYLE__SCALEXTOY(0x020b, "shadowstyle.scalextoy"), + SHADOWSTYLE__SCALEYTOY(0x020c, "shadowstyle.scaleytoy"), + SHADOWSTYLE__PERSPECTIVEX(0x020d, "shadowstyle.perspectivex"), + SHADOWSTYLE__PERSPECTIVEY(0x020e, "shadowstyle.perspectivey"), + SHADOWSTYLE__WEIGHT(0x020f, "shadowstyle.weight"), + SHADOWSTYLE__ORIGINX(0x0210, "shadowstyle.originx"), + SHADOWSTYLE__ORIGINY(0x0211, "shadowstyle.originy"), + SHADOWSTYLE__SHADOW(0x023e, "shadowstyle.shadow"), + SHADOWSTYLE__SHADOWOBSURED(0x023f, "shadowstyle.shadowobscured"), + PERSPECTIVE__TYPE(0x0240, "perspective.type"), + PERSPECTIVE__OFFSETX(0x0241, "perspective.offsetx"), + PERSPECTIVE__OFFSETY(0x0242, "perspective.offsety"), + PERSPECTIVE__SCALEXTOX(0x0243, "perspective.scalextox"), + PERSPECTIVE__SCALEYTOX(0x0244, "perspective.scaleytox"), + PERSPECTIVE__SCALEXTOY(0x0245, "perspective.scalextoy"), + PERSPECTIVE__SCALEYTOY(0x0246, "perspective.scaleytoy"), + PERSPECTIVE__PERSPECTIVEX(0x0247, "perspective.perspectivex"), + PERSPECTIVE__PERSPECTIVEY(0x0248, "perspective.perspectivey"), + PERSPECTIVE__WEIGHT(0x0249, "perspective.weight"), + PERSPECTIVE__ORIGINX(0x024a, "perspective.originx"), + PERSPECTIVE__ORIGINY(0x024b, "perspective.originy"), + PERSPECTIVE__PERSPECTIVEON(0x027f, "perspective.perspectiveon"), + THREED__SPECULARAMOUNT(0x0280, "3d.specularamount"), + THREED__DIFFUSEAMOUNT(0x0281, "3d.diffuseamount"), + THREED__SHININESS(0x0282, "3d.shininess"), + THREED__EDGETHICKNESS(0x0283, "3d.edgethickness"), + THREED__EXTRUDEFORWARD(0x0284, "3d.extrudeforward"), + THREED__EXTRUDEBACKWARD(0x0285, "3d.extrudebackward"), + RESERVED646(0x0286, "reserved646"), + THREED__EXTRUSIONCOLOR(0x0287, "3d.extrusioncolor", EscherPropertyTypesHolder.RGB), + THREED__CRMOD(0x0288, "3d.crmod"), + THREED__EXTRUSIONCOLOREXT(0x0289, "3d.extrusioncolorext"), + RESERVED650(0x028A, "reserved650"), + THREED__EXTRUSIONCOLOREXTMOD(0x028B, "3d.extrusioncolorextmod"), + RESERVED652(0x028c, "reserved652"), + RESERVED653(0x028d, "reserved653"), + THREED__BOOLEAN_PROPERTIES(0x028f, "3d.booleanproperties"), + THREED__EXTRUDEPLANE(0x029a, "3d.extrudeplane"), + THREED__3DEFFECT(0x02bc, "3d.3deffect"), + THREED__METALLIC(0x02bd, "3d.metallic"), + THREED__USEEXTRUSIONCOLOR(0x02be, "3d.useextrusioncolor", EscherPropertyTypesHolder.RGB), + THREED__LIGHTFACE(0x02bf, "3d.lightface"), + THREEDSTYLE__YROTATIONANGLE(0x02c0, "3dstyle.yrotationangle"), + THREEDSTYLE__XROTATIONANGLE(0x02c1, "3dstyle.xrotationangle"), + THREEDSTYLE__ROTATIONAXISX(0x02c2, "3dstyle.rotationaxisx"), + THREEDSTYLE__ROTATIONAXISY(0x02c3, "3dstyle.rotationaxisy"), + THREEDSTYLE__ROTATIONAXISZ(0x02c4, "3dstyle.rotationaxisz"), + THREEDSTYLE__ROTATIONANGLE(0x02c5, "3dstyle.rotationangle"), + THREEDSTYLE__ROTATIONCENTERX(0x02c6, "3dstyle.rotationcenterx"), + THREEDSTYLE__ROTATIONCENTERY(0x02c7, "3dstyle.rotationcentery"), + THREEDSTYLE__ROTATIONCENTERZ(0x02c8, "3dstyle.rotationcenterz"), + THREEDSTYLE__RENDERMODE(0x02c9, "3dstyle.rendermode"), + THREEDSTYLE__TOLERANCE(0x02ca, "3dstyle.tolerance"), + THREEDSTYLE__XVIEWPOINT(0x02cb, "3dstyle.xviewpoint"), + THREEDSTYLE__YVIEWPOINT(0x02cc, "3dstyle.yviewpoint"), + THREEDSTYLE__ZVIEWPOINT(0x02cd, "3dstyle.zviewpoint"), + THREEDSTYLE__ORIGINX(0x02ce, "3dstyle.originx"), + THREEDSTYLE__ORIGINY(0x02cf, "3dstyle.originy"), + THREEDSTYLE__SKEWANGLE(0x02d0, "3dstyle.skewangle"), + THREEDSTYLE__SKEWAMOUNT(0x02d1, "3dstyle.skewamount"), + THREEDSTYLE__AMBIENTINTENSITY(0x02d2, "3dstyle.ambientintensity"), + THREEDSTYLE__KEYX(0x02d3, "3dstyle.keyx"), + THREEDSTYLE__KEYY(0x02d4, "3dstyle.keyy"), + THREEDSTYLE__KEYZ(0x02d5, "3dstyle.keyz"), + THREEDSTYLE__KEYINTENSITY(0x02d6, "3dstyle.keyintensity"), + THREEDSTYLE__FILLX(0x02d7, "3dstyle.fillx"), + THREEDSTYLE__FILLY(0x02d8, "3dstyle.filly"), + THREEDSTYLE__FILLZ(0x02d9, "3dstyle.fillz"), + THREEDSTYLE__FILLINTENSITY(0x02da, "3dstyle.fillintensity"), + THREEDSTYLE__CONSTRAINROTATION(0x02fb, "3dstyle.constrainrotation"), + THREEDSTYLE__ROTATIONCENTERAUTO(0x02fc, "3dstyle.rotationcenterauto"), + THREEDSTYLE__PARALLEL(0x02fd, "3dstyle.parallel"), + THREEDSTYLE__KEYHARSH(0x02fe, "3dstyle.keyharsh"), + THREEDSTYLE__FILLHARSH(0x02ff, "3dstyle.fillharsh"), + SHAPE__MASTER(0x0301, "shape.master"), + SHAPE__CONNECTORSTYLE(0x0303, "shape.connectorstyle"), + SHAPE__BLACKANDWHITESETTINGS(0x0304, "shape.blackandwhitesettings"), + SHAPE__WMODEPUREBW(0x0305, "shape.wmodepurebw"), + SHAPE__WMODEBW(0x0306, "shape.wmodebw"), + SHAPE__OLEICON(0x033a, "shape.oleicon"), + SHAPE__PREFERRELATIVERESIZE(0x033b, "shape.preferrelativeresize"), + SHAPE__LOCKSHAPETYPE(0x033c, "shape.lockshapetype"), + SHAPE__DELETEATTACHEDOBJECT(0x033e, "shape.deleteattachedobject"), + SHAPE__BACKGROUNDSHAPE(0x033f, "shape.backgroundshape"), + CALLOUT__CALLOUTTYPE(0x0340, "callout.callouttype"), + CALLOUT__XYCALLOUTGAP(0x0341, "callout.xycalloutgap"), + CALLOUT__CALLOUTANGLE(0x0342, "callout.calloutangle"), + CALLOUT__CALLOUTDROPTYPE(0x0343, "callout.calloutdroptype"), + CALLOUT__CALLOUTDROPSPECIFIED(0x0344, "callout.calloutdropspecified"), + CALLOUT__CALLOUTLENGTHSPECIFIED(0x0345, "callout.calloutlengthspecified"), + CALLOUT__ISCALLOUT(0x0379, "callout.iscallout"), + CALLOUT__CALLOUTACCENTBAR(0x037a, "callout.calloutaccentbar"), + CALLOUT__CALLOUTTEXTBORDER(0x037b, "callout.callouttextborder"), + CALLOUT__CALLOUTMINUSX(0x037c, "callout.calloutminusx"), + CALLOUT__CALLOUTMINUSY(0x037d, "callout.calloutminusy"), + CALLOUT__DROPAUTO(0x037e, "callout.dropauto"), + CALLOUT__LENGTHSPECIFIED(0x037f, "callout.lengthspecified"), + GROUPSHAPE__SHAPENAME(0x0380, "groupshape.shapename"), + GROUPSHAPE__DESCRIPTION(0x0381, "groupshape.description"), + GROUPSHAPE__HYPERLINK(0x0382, "groupshape.hyperlink"), + GROUPSHAPE__WRAPPOLYGONVERTICES(0x0383, "groupshape.wrappolygonvertices", EscherPropertyTypesHolder.ARRAY), + GROUPSHAPE__WRAPDISTLEFT(0x0384, "groupshape.wrapdistleft"), + GROUPSHAPE__WRAPDISTTOP(0x0385, "groupshape.wrapdisttop"), + GROUPSHAPE__WRAPDISTRIGHT(0x0386, "groupshape.wrapdistright"), + GROUPSHAPE__WRAPDISTBOTTOM(0x0387, "groupshape.wrapdistbottom"), + GROUPSHAPE__REGROUPID(0x0388, "groupshape.regroupid"), + GROUPSHAPE__UNUSED906(0x038A, "unused906"), + GROUPSHAPE__TOOLTIP(0x038D, "groupshape.wzTooltip"), + GROUPSHAPE__SCRIPT(0x038E, "groupshape.wzScript"), + GROUPSHAPE__POSH(0x038F, "groupshape.posh"), + GROUPSHAPE__POSRELH(0x0390, "groupshape.posrelh"), + GROUPSHAPE__POSV(0x0391, "groupshape.posv"), + GROUPSHAPE__POSRELV(0x0392, "groupshape.posrelv"), + GROUPSHAPE__HR_PCT(0x0393, "groupshape.pctHR"), + GROUPSHAPE__HR_ALIGN(0x0394, "groupshape.alignHR"), + GROUPSHAPE__HR_HEIGHT(0x0395, "groupshape.dxHeightHR"), + GROUPSHAPE__HR_WIDTH(0x0396, "groupshape.dxWidthHR"), + GROUPSHAPE__SCRIPTEXT(0x0397, "groupshape.wzScriptExtAttr"), + GROUPSHAPE__SCRIPTLANG(0x0398, "groupshape.scriptLang"), + GROUPSHAPE__BORDERTOPCOLOR(0x039B, "groupshape.borderTopColor"), + GROUPSHAPE__BORDERLEFTCOLOR(0x039C, "groupshape.borderLeftColor"), + GROUPSHAPE__BORDERBOTTOMCOLOR(0x039D, "groupshape.borderBottomColor"), + GROUPSHAPE__BORDERRIGHTCOLOR(0x039E, "groupshape.borderRightColor"), + GROUPSHAPE__TABLEPROPERTIES(0x039F, "groupshape.tableProperties"), + GROUPSHAPE__TABLEROWPROPERTIES(0x03A0, "groupshape.tableRowProperties", EscherPropertyTypesHolder.ARRAY), + GROUPSHAPE__WEBBOT(0x03A5, "groupshape.wzWebBot"), + GROUPSHAPE__METROBLOB(0x03A9, "groupshape.metroBlob"), + GROUPSHAPE__ZORDER(0x03AA, "groupshape.dhgt"), + GROUPSHAPE__EDITEDWRAP(0x03b9, "groupshape.editedwrap"), + GROUPSHAPE__BEHINDDOCUMENT(0x03ba, "groupshape.behinddocument"), + GROUPSHAPE__ONDBLCLICKNOTIFY(0x03bb, "groupshape.ondblclicknotify"), + GROUPSHAPE__ISBUTTON(0x03bc, "groupshape.isbutton"), + GROUPSHAPE__1DADJUSTMENT(0x03bd, "groupshape.1dadjustment"), + GROUPSHAPE__HIDDEN(0x03be, "groupshape.hidden"), + GROUPSHAPE__FLAGS(0x03bf, "groupshape.groupShapeBooleanProperties"), + UNKNOWN(0xffff, "unknown") + ; + + /** the property number part of the property id, i.e. the id without is_blip/is_complex flag */ + public final short propNumber; + public final String propName; + public final EscherPropertyTypesHolder holder; + + EscherPropertyTypes(int propNumber, String name) { + this(propNumber, name, EscherPropertyTypesHolder.UNKNOWN); + } + + EscherPropertyTypes(int propNumber, String propName, EscherPropertyTypesHolder holder) { + this.propNumber = (short) propNumber; + this.propName = propName; + this.holder = holder; + } + + public short getPropertyId() { + return propNumber; + } + + private static final Map LOOKUP = + Stream.of(values()).collect(Collectors.toMap(EscherPropertyTypes::getPropertyId, Function.identity())); + + public static EscherPropertyTypes forPropertyID(int propertyId) { + EscherPropertyTypes rt = LOOKUP.get((short)(propertyId & 0x3FFF)); + return (rt != null) ? rt : EscherPropertyTypes.UNKNOWN; + } + +} + diff --git a/src/java/org/apache/poi/ddf/EscherPropertyTypesHolder.java b/src/java/org/apache/poi/ddf/EscherPropertyTypesHolder.java new file mode 100644 index 0000000000..52760e8665 --- /dev/null +++ b/src/java/org/apache/poi/ddf/EscherPropertyTypesHolder.java @@ -0,0 +1,30 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.ddf; + +import org.apache.poi.util.Internal; + +@Internal +public enum EscherPropertyTypesHolder { + UNKNOWN, + BOOLEAN, + RGB, + SHAPE_PATH, + SIMPLE, + ARRAY +} \ No newline at end of file diff --git a/src/java/org/apache/poi/ddf/EscherRGBProperty.java b/src/java/org/apache/poi/ddf/EscherRGBProperty.java index 96d3e55571..fb43e492f0 100644 --- a/src/java/org/apache/poi/ddf/EscherRGBProperty.java +++ b/src/java/org/apache/poi/ddf/EscherRGBProperty.java @@ -17,8 +17,6 @@ package org.apache.poi.ddf; -import org.apache.poi.util.HexDump; - /** * A color property. */ @@ -26,11 +24,27 @@ public class EscherRGBProperty extends EscherSimpleProperty { - public EscherRGBProperty( short propertyNumber, int rgbColor ) - { + /** + * Create an instance of an escher boolean property. + * + * @param propertyNumber The property number (or id) + * @param rgbColor The 24 bit value of this rgb property + */ + public EscherRGBProperty( short propertyNumber, int rgbColor ) { super( propertyNumber, rgbColor ); } + /** + * Create an instance of an escher boolean property. + * + * @param propertyNumber The property type + * @param rgbColor The 24 bit value of this rgb property + */ + public EscherRGBProperty( EscherPropertyTypes propertyType, int rgbColor ) { + super(propertyType.propNumber, rgbColor ); + } + + /** * @return the rgb color as int value */ @@ -62,13 +76,4 @@ public class EscherRGBProperty { return (byte) ( (getRgbColor() >> 16) & 0xFF ); } - - @Override - public String toXml(String tab){ - StringBuilder builder = new StringBuilder(); - builder.append(tab).append("<").append(getClass().getSimpleName()).append(" id=\"0x").append(HexDump.toHex(getId())) - .append("\" name=\"").append(getName()).append("\" blipId=\"") - .append(isBlipId()).append("\" value=\"0x").append(HexDump.toHex(getRgbColor())).append("\"/>"); - return builder.toString(); - } } diff --git a/src/java/org/apache/poi/ddf/EscherRecord.java b/src/java/org/apache/poi/ddf/EscherRecord.java index ff97b87ce3..a8dada3880 100644 --- a/src/java/org/apache/poi/ddf/EscherRecord.java +++ b/src/java/org/apache/poi/ddf/EscherRecord.java @@ -27,8 +27,9 @@ import java.util.function.Supplier; import org.apache.poi.common.usermodel.GenericRecord; import org.apache.poi.util.BitField; import org.apache.poi.util.BitFieldFactory; +import org.apache.poi.util.GenericRecordJsonWriter; import org.apache.poi.util.GenericRecordUtil; -import org.apache.poi.util.HexDump; +import org.apache.poi.util.GenericRecordXmlWriter; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; @@ -321,188 +322,12 @@ public abstract class EscherRecord implements Cloneable, GenericRecord { * @return xml representation of this record */ public final String toXml(String tab){ - final String nl = System.getProperty( "line.separator" ); - String clsNm = getClass().getSimpleName(); - StringBuilder sb = new StringBuilder(1000); - sb.append(tab).append("<").append(clsNm) - .append(" recordId=\"0x").append(HexDump.toHex(getRecordId())) - .append("\" version=\"0x").append(HexDump.toHex(getVersion())) - .append("\" instance=\"0x").append(HexDump.toHex(getInstance())) - .append("\" options=\"0x").append(HexDump.toHex(getOptions())) - .append("\" recordSize=\"").append(getRecordSize()); - Object[][] attrList = getAttributeMap(); - if (attrList == null || attrList.length == 0) { - sb.append("\" />").append(nl); - } else { - sb.append("\">").append(nl); - String childTab = tab+" "; - for (Object[] attrs : attrList) { - String tagName = capitalizeAndTrim((String)attrs[0]); - boolean hasValue = false; - boolean lastChildComplex = false; - for (int i=0; i"); - } - // add names for optional attributes - String optName = capitalizeAndTrim((String)attrs[i+0]); - if (i>0) { - sb.append(nl).append(childTab).append(" <").append(optName).append(">"); - } - lastChildComplex = appendValue(sb, value, true, childTab); - if (i>0) { - sb.append(nl).append(childTab).append(" "); - } - hasValue = true; - } - if (hasValue) { - if (lastChildComplex) { - sb.append(nl).append(childTab); - } - sb.append("").append(nl); - } - } - sb.append(tab).append(""); - } - return sb.toString(); + return GenericRecordXmlWriter.marshal(this); } @Override public final String toString() { - final String nl = System.getProperty( "line.separator" ); - StringBuilder sb = new StringBuilder(1000); - sb.append(getClass().getName()).append(" (").append(getRecordName()).append("):").append(nl) - .append(" RecordId: 0x").append(HexDump.toHex( getRecordId() )).append(nl) - .append(" Version: 0x").append(HexDump.toHex( getVersion() )).append(nl) - .append(" Instance: 0x").append(HexDump.toHex( getInstance() )).append(nl) - .append(" Options: 0x").append(HexDump.toHex( getOptions() )).append(nl) - .append(" Record Size: ").append( getRecordSize() ); - - Object[][] attrList = getAttributeMap(); - if (attrList != null && attrList.length > 0) { - String childTab = " "; - for (Object[] attrs : attrList) { - for (int i=0; i - * - * Null values won't be printed.

- * - * The attributes record, version, instance, options must not be returned. - * - * @return the attribute map - * - * @since POI 3.17-beta2 - */ - @Internal - protected abstract Object[][] getAttributeMap(); - - private static String capitalizeAndTrim(final String str) { - if (str == null || str.length() == 0) { - return str; - } - - StringBuilder sb = new StringBuilder(str.length()); - boolean capitalizeNext = true; - for (char ch : str.toCharArray()) { - if (!Character.isLetterOrDigit(ch)) { - capitalizeNext = true; - continue; - } - - if (capitalizeNext) { - if (!Character.isLetter(ch)) { - sb.append('_'); - } else { - ch = Character.toTitleCase(ch); - } - capitalizeNext = false; - } - sb.append(ch); - } - - return sb.toString(); - } - - private static void escapeXML(String s, StringBuilder out) { - if (s == null || s.isEmpty()) { - return; - } - for (char c : s.toCharArray()) { - if (c > 127 || c == '"' || c == '<' || c == '>' || c == '&') { - out.append("&#"); - out.append((int) c); - out.append(';'); - } else { - out.append(c); - } - } + return GenericRecordJsonWriter.marshal(this); } @Override diff --git a/src/java/org/apache/poi/ddf/EscherShapePathProperty.java b/src/java/org/apache/poi/ddf/EscherShapePathProperty.java index f495f2639d..0d0f422155 100644 --- a/src/java/org/apache/poi/ddf/EscherShapePathProperty.java +++ b/src/java/org/apache/poi/ddf/EscherShapePathProperty.java @@ -19,8 +19,6 @@ package org.apache.poi.ddf; /** * Defines the constants for the various possible shape paths. - * - * @author Glen Stampoultzis (glens at apache.org) */ public class EscherShapePathProperty extends EscherSimpleProperty { @@ -30,8 +28,17 @@ public class EscherShapePathProperty extends EscherSimpleProperty { public static final int CLOSED_CURVES = 3; public static final int COMPLEX = 4; - public EscherShapePathProperty( short propertyNumber, int shapePath ) - { + /** + * Create an instance of an escher shape path property. + * + * @param propertyNumber + * @param shapePath + */ + public EscherShapePathProperty( short propertyNumber, int shapePath ) { super( propertyNumber, false, false, shapePath ); } + + public EscherShapePathProperty( EscherPropertyTypes type, int shapePath ) { + super( type, false, false, shapePath ); + } } diff --git a/src/java/org/apache/poi/ddf/EscherSimpleProperty.java b/src/java/org/apache/poi/ddf/EscherSimpleProperty.java index f5430e60e3..1c9fb8e418 100644 --- a/src/java/org/apache/poi/ddf/EscherSimpleProperty.java +++ b/src/java/org/apache/poi/ddf/EscherSimpleProperty.java @@ -17,7 +17,10 @@ package org.apache.poi.ddf; -import org.apache.poi.util.HexDump; +import java.util.Map; +import java.util.function.Supplier; + +import org.apache.poi.util.GenericRecordUtil; import org.apache.poi.util.LittleEndian; /** @@ -36,12 +39,22 @@ public class EscherSimpleProperty extends EscherProperty * @param id the property id * @param propertyValue the property value */ - public EscherSimpleProperty( short id, int propertyValue ) - { + public EscherSimpleProperty( short id, int propertyValue ) { super( id ); this.propertyValue = propertyValue; } + /** + * The id is distinct from the actual property number. The id includes the property number the blip id + * flag and an indicator whether the property is complex or not. + * + * @param type the property type + * @param propertyValue the property value + */ + public EscherSimpleProperty( EscherPropertyTypes type, int propertyValue ) { + this(type, false, false, propertyValue); + } + /** * Constructs a new escher property. The three parameters are combined to form a property id. * @@ -50,12 +63,24 @@ public class EscherSimpleProperty extends EscherProperty * @param isBlipId true, if its a blip * @param propertyValue the property value */ - public EscherSimpleProperty( short propertyNumber, boolean isComplex, boolean isBlipId, int propertyValue ) - { + public EscherSimpleProperty( short propertyNumber, boolean isComplex, boolean isBlipId, int propertyValue ) { super( propertyNumber, isComplex, isBlipId ); this.propertyValue = propertyValue; } + /** + * Constructs a new escher property. The three parameters are combined to form a property id. + * + * @param propertyNumber the property number + * @param isComplex true, if its a complex property + * @param isBlipId true, if its a blip + * @param propertyValue the property value + */ + public EscherSimpleProperty( EscherPropertyTypes type, boolean isComplex, boolean isBlipId, int propertyValue ) { + super( type, isComplex, isBlipId ); + this.propertyValue = propertyValue; + } + /** * Serialize the simple part of the escher record. * @@ -122,27 +147,11 @@ public class EscherSimpleProperty extends EscherProperty return propertyValue; } - /** - * @return the string representation of this property. - */ - @Override - public String toString() - { - return "propNum: " + getPropertyNumber() - + ", RAW: 0x" + HexDump.toHex( getId() ) - + ", propName: " + EscherProperties.getPropertyName( getPropertyNumber() ) - + ", complex: " + isComplex() - + ", blipId: " + isBlipId() - + ", value: " + propertyValue + " (0x" + HexDump.toHex(propertyValue) + ")"; - } - @Override - public String toXml(String tab){ - StringBuilder builder = new StringBuilder(); - builder.append(tab).append("<").append(getClass().getSimpleName()).append(" id=\"0x").append(HexDump.toHex(getId())) - .append("\" name=\"").append(getName()).append("\" blipId=\"") - .append(isBlipId()).append("\" complex=\"").append(isComplex()).append("\" value=\"").append("0x") - .append(HexDump.toHex(propertyValue)).append("\"/>"); - return builder.toString(); + public Map> getGenericProperties() { + return GenericRecordUtil.getGenericProperties( + "base", super::getGenericProperties, + "value", this::getPropertyValue + ); } } diff --git a/src/java/org/apache/poi/ddf/EscherSpRecord.java b/src/java/org/apache/poi/ddf/EscherSpRecord.java index ad1ce992e3..a60e6e724a 100644 --- a/src/java/org/apache/poi/ddf/EscherSpRecord.java +++ b/src/java/org/apache/poi/ddf/EscherSpRecord.java @@ -23,7 +23,6 @@ import java.util.Map; import java.util.function.Supplier; import org.apache.poi.util.GenericRecordUtil; -import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; /** @@ -247,15 +246,6 @@ public class EscherSpRecord extends EscherRecord { setInstance( value ); } - @Override - protected Object[][] getAttributeMap() { - return new Object[][] { - { "ShapeType", getShapeType() }, - { "ShapeId", field_1_shapeId }, - { "Flags", decodeFlags(field_2_flags)+" (0x"+HexDump.toHex(field_2_flags)+")" } - }; - } - @Override public Map> getGenericProperties() { return GenericRecordUtil.getGenericProperties( diff --git a/src/java/org/apache/poi/ddf/EscherSpgrRecord.java b/src/java/org/apache/poi/ddf/EscherSpgrRecord.java index 49979e5a05..c64f407416 100644 --- a/src/java/org/apache/poi/ddf/EscherSpgrRecord.java +++ b/src/java/org/apache/poi/ddf/EscherSpgrRecord.java @@ -167,16 +167,6 @@ public class EscherSpgrRecord extends EscherRecord { this.field_4_rectY2 = rectY2; } - @Override - protected Object[][] getAttributeMap() { - return new Object[][] { - { "RectX", field_1_rectX1 }, - { "RectY", field_2_rectY1 }, - { "RectWidth", field_3_rectX2 }, - { "RectHeight", field_4_rectY2 } - }; - } - @Override public Map> getGenericProperties() { return GenericRecordUtil.getGenericProperties( diff --git a/src/java/org/apache/poi/ddf/EscherSplitMenuColorsRecord.java b/src/java/org/apache/poi/ddf/EscherSplitMenuColorsRecord.java index b6d2ba4af0..3881d9e667 100644 --- a/src/java/org/apache/poi/ddf/EscherSplitMenuColorsRecord.java +++ b/src/java/org/apache/poi/ddf/EscherSplitMenuColorsRecord.java @@ -158,16 +158,6 @@ public class EscherSplitMenuColorsRecord extends EscherRecord { this.field_4_color4 = field_4_color4; } - @Override - protected Object[][] getAttributeMap() { - return new Object[][] { - { "Color1", field_1_color1 }, - { "Color2", field_2_color2 }, - { "Color3", field_3_color3 }, - { "Color4", field_4_color4 } - }; - } - @Override public Map> getGenericProperties() { return GenericRecordUtil.getGenericProperties( diff --git a/src/java/org/apache/poi/ddf/EscherTextboxRecord.java b/src/java/org/apache/poi/ddf/EscherTextboxRecord.java index 16213b8a3e..505305988b 100644 --- a/src/java/org/apache/poi/ddf/EscherTextboxRecord.java +++ b/src/java/org/apache/poi/ddf/EscherTextboxRecord.java @@ -17,8 +17,6 @@ package org.apache.poi.ddf; -import java.util.ArrayList; -import java.util.List; import java.util.Map; import java.util.function.Supplier; @@ -139,24 +137,6 @@ public final class EscherTextboxRecord extends EscherRecord implements Cloneable return EscherRecordTypes.CLIENT_TEXTBOX.recordName; } - @Override - protected Object[][] getAttributeMap() { - int numCh = getChildRecords().size(); - List chLst = new ArrayList<>(numCh * 2 + 2); - chLst.add("children"); - chLst.add(numCh); - for (EscherRecord er : getChildRecords()) { - chLst.add(er.getRecordName()); - chLst.add(er); - } - - return new Object[][] { - { "isContainer", isContainerRecord() }, - chLst.toArray(), - { "Extra Data", thedata } - }; - } - @Override public Enum getGenericRecordType() { return EscherRecordTypes.CLIENT_TEXTBOX; diff --git a/src/java/org/apache/poi/ddf/UnknownEscherRecord.java b/src/java/org/apache/poi/ddf/UnknownEscherRecord.java index 8db83cd46f..4ab24778f1 100644 --- a/src/java/org/apache/poi/ddf/UnknownEscherRecord.java +++ b/src/java/org/apache/poi/ddf/UnknownEscherRecord.java @@ -144,24 +144,6 @@ public final class UnknownEscherRecord extends EscherRecord implements Cloneable getChildRecords().add( childRecord ); } - @Override - protected Object[][] getAttributeMap() { - int numCh = getChildRecords().size(); - List chLst = new ArrayList<>(numCh * 2 + 2); - chLst.add("children"); - chLst.add(numCh); - for (EscherRecord er : _childRecords) { - chLst.add(er.getRecordName()); - chLst.add(er); - } - - return new Object[][] { - { "isContainer", isContainerRecord() }, - chLst.toArray(), - { "Extra Data", thedata } - }; - } - @Override public Map> getGenericProperties() { return GenericRecordUtil.getGenericProperties( diff --git a/src/java/org/apache/poi/hssf/model/InternalWorkbook.java b/src/java/org/apache/poi/hssf/model/InternalWorkbook.java index 5fa2d315e2..f397ed0fbb 100644 --- a/src/java/org/apache/poi/hssf/model/InternalWorkbook.java +++ b/src/java/org/apache/poi/hssf/model/InternalWorkbook.java @@ -32,56 +32,14 @@ import org.apache.poi.ddf.EscherContainerRecord; import org.apache.poi.ddf.EscherDgRecord; import org.apache.poi.ddf.EscherDggRecord; import org.apache.poi.ddf.EscherOptRecord; -import org.apache.poi.ddf.EscherProperties; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.ddf.EscherRGBProperty; import org.apache.poi.ddf.EscherRecord; import org.apache.poi.ddf.EscherSimpleProperty; import org.apache.poi.ddf.EscherSpRecord; import org.apache.poi.ddf.EscherSplitMenuColorsRecord; import org.apache.poi.hssf.extractor.OldExcelExtractor; -import org.apache.poi.hssf.record.BOFRecord; -import org.apache.poi.hssf.record.BackupRecord; -import org.apache.poi.hssf.record.BookBoolRecord; -import org.apache.poi.hssf.record.BoundSheetRecord; -import org.apache.poi.hssf.record.CodepageRecord; -import org.apache.poi.hssf.record.CountryRecord; -import org.apache.poi.hssf.record.DSFRecord; -import org.apache.poi.hssf.record.DateWindow1904Record; -import org.apache.poi.hssf.record.DrawingGroupRecord; -import org.apache.poi.hssf.record.EOFRecord; -import org.apache.poi.hssf.record.EscherAggregate; -import org.apache.poi.hssf.record.ExtSSTRecord; -import org.apache.poi.hssf.record.ExtendedFormatRecord; -import org.apache.poi.hssf.record.ExternSheetRecord; -import org.apache.poi.hssf.record.FileSharingRecord; -import org.apache.poi.hssf.record.FnGroupCountRecord; -import org.apache.poi.hssf.record.FontRecord; -import org.apache.poi.hssf.record.FormatRecord; -import org.apache.poi.hssf.record.HideObjRecord; -import org.apache.poi.hssf.record.HyperlinkRecord; -import org.apache.poi.hssf.record.InterfaceEndRecord; -import org.apache.poi.hssf.record.InterfaceHdrRecord; -import org.apache.poi.hssf.record.MMSRecord; -import org.apache.poi.hssf.record.NameCommentRecord; -import org.apache.poi.hssf.record.NameRecord; -import org.apache.poi.hssf.record.PaletteRecord; -import org.apache.poi.hssf.record.PasswordRecord; -import org.apache.poi.hssf.record.PasswordRev4Record; -import org.apache.poi.hssf.record.PrecisionRecord; -import org.apache.poi.hssf.record.ProtectRecord; -import org.apache.poi.hssf.record.ProtectionRev4Record; -import org.apache.poi.hssf.record.RecalcIdRecord; -import org.apache.poi.hssf.record.Record; -import org.apache.poi.hssf.record.RefreshAllRecord; -import org.apache.poi.hssf.record.SSTRecord; -import org.apache.poi.hssf.record.StyleRecord; -import org.apache.poi.hssf.record.SupBookRecord; -import org.apache.poi.hssf.record.TabIdRecord; -import org.apache.poi.hssf.record.UseSelFSRecord; -import org.apache.poi.hssf.record.WindowOneRecord; -import org.apache.poi.hssf.record.WindowProtectRecord; -import org.apache.poi.hssf.record.WriteAccessRecord; -import org.apache.poi.hssf.record.WriteProtectRecord; +import org.apache.poi.hssf.record.*; import org.apache.poi.hssf.record.common.UnicodeString; import org.apache.poi.hssf.util.HSSFColor.HSSFColorPredefined; import org.apache.poi.poifs.crypt.CryptoFunctions; @@ -1961,9 +1919,9 @@ public final class InternalWorkbook { } opt.setRecordId((short) 0xF00B); opt.setOptions((short) 0x0033); - opt.addEscherProperty( new EscherBoolProperty(EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 524296) ); - opt.addEscherProperty( new EscherRGBProperty(EscherProperties.FILL__FILLCOLOR, 0x08000041) ); - opt.addEscherProperty( new EscherRGBProperty(EscherProperties.LINESTYLE__COLOR, 134217792) ); + opt.addEscherProperty( new EscherBoolProperty(EscherPropertyTypes.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 524296) ); + opt.addEscherProperty( new EscherRGBProperty(EscherPropertyTypes.FILL__FILLCOLOR, 0x08000041) ); + opt.addEscherProperty( new EscherRGBProperty(EscherPropertyTypes.LINESTYLE__COLOR, 134217792) ); splitMenuColors.setRecordId((short) 0xF11E); splitMenuColors.setOptions((short) 0x0040); splitMenuColors.setColor1(0x0800000D); @@ -2190,7 +2148,7 @@ public final class InternalWorkbook { } else if (recordId == EscherOptRecord.RECORD_ID){ EscherOptRecord opt = (EscherOptRecord)shapeChildRecord; EscherSimpleProperty prop = opt.lookup( - EscherProperties.BLIP__BLIPTODISPLAY ); + EscherPropertyTypes.BLIP__BLIPTODISPLAY ); if (prop != null){ int pictureIndex = prop.getPropertyValue(); // increment reference count for pictures diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFCombobox.java b/src/java/org/apache/poi/hssf/usermodel/HSSFCombobox.java index 5116f07620..262eae5086 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFCombobox.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFCombobox.java @@ -17,8 +17,21 @@ package org.apache.poi.hssf.usermodel; -import org.apache.poi.ddf.*; -import org.apache.poi.hssf.record.*; +import org.apache.poi.ddf.EscherBoolProperty; +import org.apache.poi.ddf.EscherClientDataRecord; +import org.apache.poi.ddf.EscherContainerRecord; +import org.apache.poi.ddf.EscherOptRecord; +import org.apache.poi.ddf.EscherPropertyTypes; +import org.apache.poi.ddf.EscherRecord; +import org.apache.poi.ddf.EscherSimpleProperty; +import org.apache.poi.ddf.EscherSpRecord; +import org.apache.poi.hssf.record.CommonObjectDataSubRecord; +import org.apache.poi.hssf.record.EndSubRecord; +import org.apache.poi.hssf.record.EscherAggregate; +import org.apache.poi.hssf.record.FtCblsSubRecord; +import org.apache.poi.hssf.record.LbsDataSubRecord; +import org.apache.poi.hssf.record.ObjRecord; +import org.apache.poi.hssf.record.TextObjectRecord; import org.apache.poi.ss.usermodel.ClientAnchor.AnchorType; /** @@ -56,10 +69,10 @@ public class HSSFCombobox extends HSSFSimpleShape { sp.setFlags(EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE); opt.setRecordId(EscherOptRecord.RECORD_ID); - opt.addEscherProperty(new EscherBoolProperty(EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 17039620)); - opt.addEscherProperty(new EscherBoolProperty(EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 0x00080008)); - opt.addEscherProperty(new EscherBoolProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x00080000)); - opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GROUPSHAPE__PRINT, 0x00020000)); + opt.addEscherProperty(new EscherBoolProperty(EscherPropertyTypes.PROTECTION__LOCKAGAINSTGROUPING, 17039620)); + opt.addEscherProperty(new EscherBoolProperty(EscherPropertyTypes.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 0x00080008)); + opt.addEscherProperty(new EscherBoolProperty(EscherPropertyTypes.LINESTYLE__NOLINEDRAWDASH, 0x00080000)); + opt.addEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.GROUPSHAPE__FLAGS, 0x00020000)); HSSFClientAnchor userAnchor = (HSSFClientAnchor) getAnchor(); userAnchor.setAnchorType(AnchorType.DONT_MOVE_DO_RESIZE); diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFComment.java b/src/java/org/apache/poi/hssf/usermodel/HSSFComment.java index 593f362c4a..b8bde9a1a0 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFComment.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFComment.java @@ -20,7 +20,7 @@ import org.apache.poi.ddf.DefaultEscherRecordFactory; import org.apache.poi.ddf.EscherBSERecord; import org.apache.poi.ddf.EscherContainerRecord; import org.apache.poi.ddf.EscherOptRecord; -import org.apache.poi.ddf.EscherProperties; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.ddf.EscherSimpleProperty; import org.apache.poi.hssf.record.CommonObjectDataSubRecord; import org.apache.poi.hssf.record.EndSubRecord; @@ -98,11 +98,11 @@ public class HSSFComment extends HSSFTextbox implements Comment { protected EscherContainerRecord createSpContainer() { EscherContainerRecord spContainer = super.createSpContainer(); EscherOptRecord opt = spContainer.getChildById(EscherOptRecord.RECORD_ID); - opt.removeEscherProperty(EscherProperties.TEXT__TEXTLEFT); - opt.removeEscherProperty(EscherProperties.TEXT__TEXTRIGHT); - opt.removeEscherProperty(EscherProperties.TEXT__TEXTTOP); - opt.removeEscherProperty(EscherProperties.TEXT__TEXTBOTTOM); - opt.setEscherProperty(new EscherSimpleProperty(EscherProperties.GROUPSHAPE__PRINT, false, false, GROUP_SHAPE_PROPERTY_DEFAULT_VALUE)); + opt.removeEscherProperty(EscherPropertyTypes.TEXT__TEXTLEFT); + opt.removeEscherProperty(EscherPropertyTypes.TEXT__TEXTRIGHT); + opt.removeEscherProperty(EscherPropertyTypes.TEXT__TEXTTOP); + opt.removeEscherProperty(EscherPropertyTypes.TEXT__TEXTBOTTOM); + opt.setEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.GROUPSHAPE__FLAGS, false, false, GROUP_SHAPE_PROPERTY_DEFAULT_VALUE)); return spContainer; } @@ -290,34 +290,34 @@ public class HSSFComment extends HSSFTextbox implements Comment { } public void setBackgroundImage(int pictureIndex){ - setPropertyValue(new EscherSimpleProperty( EscherProperties.FILL__PATTERNTEXTURE, false, true, pictureIndex)); - setPropertyValue(new EscherSimpleProperty( EscherProperties.FILL__FILLTYPE, false, false, FILL_TYPE_PICTURE)); + setPropertyValue(new EscherSimpleProperty( EscherPropertyTypes.FILL__PATTERNTEXTURE, false, true, pictureIndex)); + setPropertyValue(new EscherSimpleProperty( EscherPropertyTypes.FILL__FILLTYPE, false, false, FILL_TYPE_PICTURE)); EscherBSERecord bse = getPatriarch().getSheet().getWorkbook().getWorkbook().getBSERecord(pictureIndex); bse.setRef(bse.getRef() + 1); } public void resetBackgroundImage(){ - EscherSimpleProperty property = getOptRecord().lookup(EscherProperties.FILL__PATTERNTEXTURE); + EscherSimpleProperty property = getOptRecord().lookup(EscherPropertyTypes.FILL__PATTERNTEXTURE); if (null != property){ EscherBSERecord bse = getPatriarch().getSheet().getWorkbook().getWorkbook().getBSERecord(property.getPropertyValue()); bse.setRef(bse.getRef() - 1); - getOptRecord().removeEscherProperty(EscherProperties.FILL__PATTERNTEXTURE); + getOptRecord().removeEscherProperty(EscherPropertyTypes.FILL__PATTERNTEXTURE); } - setPropertyValue(new EscherSimpleProperty( EscherProperties.FILL__FILLTYPE, false, false, FILL_TYPE_SOLID)); + setPropertyValue(new EscherSimpleProperty( EscherPropertyTypes.FILL__FILLTYPE, false, false, FILL_TYPE_SOLID)); } public int getBackgroundImageId(){ - EscherSimpleProperty property = getOptRecord().lookup(EscherProperties.FILL__PATTERNTEXTURE); + EscherSimpleProperty property = getOptRecord().lookup(EscherPropertyTypes.FILL__PATTERNTEXTURE); return property == null ? 0 : property.getPropertyValue(); } private void setHidden(boolean value){ - EscherSimpleProperty property = getOptRecord().lookup(EscherProperties.GROUPSHAPE__PRINT); + EscherSimpleProperty property = getOptRecord().lookup(EscherPropertyTypes.GROUPSHAPE__FLAGS); // see http://msdn.microsoft.com/en-us/library/dd949807(v=office.12).aspx if (value){ - setPropertyValue(new EscherSimpleProperty(EscherProperties.GROUPSHAPE__PRINT, false, false, property.getPropertyValue() | GROUP_SHAPE_HIDDEN_MASK)); + setPropertyValue(new EscherSimpleProperty(EscherPropertyTypes.GROUPSHAPE__FLAGS, false, false, property.getPropertyValue() | GROUP_SHAPE_HIDDEN_MASK)); } else { - setPropertyValue(new EscherSimpleProperty(EscherProperties.GROUPSHAPE__PRINT, false, false, property.getPropertyValue() & GROUP_SHAPE_NOT_HIDDEN_MASK)); + setPropertyValue(new EscherSimpleProperty(EscherPropertyTypes.GROUPSHAPE__FLAGS, false, false, property.getPropertyValue() & GROUP_SHAPE_NOT_HIDDEN_MASK)); } } diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java b/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java index e10a3e973a..1a877ee3ce 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java @@ -27,7 +27,7 @@ import org.apache.poi.ddf.EscherClientDataRecord; import org.apache.poi.ddf.EscherComplexProperty; import org.apache.poi.ddf.EscherContainerRecord; import org.apache.poi.ddf.EscherOptRecord; -import org.apache.poi.ddf.EscherProperties; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.ddf.EscherSimpleProperty; import org.apache.poi.ddf.EscherTextboxRecord; import org.apache.poi.hssf.model.InternalWorkbook; @@ -72,7 +72,7 @@ public class HSSFPicture extends HSSFSimpleShape implements Picture { public int getPictureIndex() { - EscherSimpleProperty property = getOptRecord().lookup(EscherProperties.BLIP__BLIPTODISPLAY); + EscherSimpleProperty property = getOptRecord().lookup(EscherPropertyTypes.BLIP__BLIPTODISPLAY); if (null == property){ return -1; } @@ -81,15 +81,15 @@ public class HSSFPicture extends HSSFSimpleShape implements Picture { public void setPictureIndex( int pictureIndex ) { - setPropertyValue(new EscherSimpleProperty( EscherProperties.BLIP__BLIPTODISPLAY, false, true, pictureIndex)); + setPropertyValue(new EscherSimpleProperty( EscherPropertyTypes.BLIP__BLIPTODISPLAY, false, true, pictureIndex)); } @Override protected EscherContainerRecord createSpContainer() { EscherContainerRecord spContainer = super.createSpContainer(); EscherOptRecord opt = spContainer.getChildById(EscherOptRecord.RECORD_ID); - opt.removeEscherProperty(EscherProperties.LINESTYLE__LINEDASHING); - opt.removeEscherProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH); + opt.removeEscherProperty(EscherPropertyTypes.LINESTYLE__LINEDASHING); + opt.removeEscherProperty(EscherPropertyTypes.LINESTYLE__NOLINEDRAWDASH); spContainer.removeChildRecord(spContainer.getChildById(EscherTextboxRecord.RECORD_ID)); return spContainer; } @@ -247,8 +247,7 @@ public class HSSFPicture extends HSSFSimpleShape implements Picture { * The filename of the embedded image */ public String getFileName() { - EscherComplexProperty propFile = getOptRecord().lookup( - EscherProperties.BLIP__BLIPFILENAME); + EscherComplexProperty propFile = getOptRecord().lookup(EscherPropertyTypes.BLIP__BLIPFILENAME); return (null == propFile) ? "" : StringUtil.getFromUnicodeLE(propFile.getComplexData()).trim(); @@ -257,7 +256,8 @@ public class HSSFPicture extends HSSFSimpleShape implements Picture { public void setFileName(String data){ // TODO: add trailing \u0000? byte[] bytes = StringUtil.getToUnicodeLE(data); - EscherComplexProperty prop = new EscherComplexProperty(EscherProperties.BLIP__BLIPFILENAME, true, bytes); + EscherComplexProperty prop = new EscherComplexProperty(EscherPropertyTypes.BLIP__BLIPFILENAME, true, bytes.length); + prop.setComplexData(bytes); setPropertyValue(prop); } diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFPolygon.java b/src/java/org/apache/poi/hssf/usermodel/HSSFPolygon.java index 8403a81c4b..1a25103bac 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFPolygon.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFPolygon.java @@ -17,8 +17,22 @@ package org.apache.poi.hssf.usermodel; -import org.apache.poi.ddf.*; -import org.apache.poi.hssf.record.*; +import org.apache.poi.ddf.EscherArrayProperty; +import org.apache.poi.ddf.EscherBoolProperty; +import org.apache.poi.ddf.EscherClientDataRecord; +import org.apache.poi.ddf.EscherContainerRecord; +import org.apache.poi.ddf.EscherOptRecord; +import org.apache.poi.ddf.EscherPropertyTypes; +import org.apache.poi.ddf.EscherRGBProperty; +import org.apache.poi.ddf.EscherRecord; +import org.apache.poi.ddf.EscherShapePathProperty; +import org.apache.poi.ddf.EscherSimpleProperty; +import org.apache.poi.ddf.EscherSpRecord; +import org.apache.poi.hssf.record.CommonObjectDataSubRecord; +import org.apache.poi.hssf.record.EndSubRecord; +import org.apache.poi.hssf.record.EscherAggregate; +import org.apache.poi.hssf.record.ObjRecord; +import org.apache.poi.hssf.record.TextObjectRecord; import org.apache.poi.util.LittleEndian; import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; @@ -66,24 +80,24 @@ public class HSSFPolygon extends HSSFSimpleShape { sp.setFlags(EscherSpRecord.FLAG_CHILD | EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE); } opt.setRecordId(EscherOptRecord.RECORD_ID); - opt.setEscherProperty(new EscherSimpleProperty(EscherProperties.TRANSFORM__ROTATION, false, false, 0)); - opt.setEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__RIGHT, false, false, 100)); - opt.setEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__BOTTOM, false, false, 100)); - opt.setEscherProperty(new EscherShapePathProperty(EscherProperties.GEOMETRY__SHAPEPATH, EscherShapePathProperty.COMPLEX)); + opt.setEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.TRANSFORM__ROTATION, false, false, 0)); + opt.setEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.GEOMETRY__RIGHT, false, false, 100)); + opt.setEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.GEOMETRY__BOTTOM, false, false, 100)); + opt.setEscherProperty(new EscherShapePathProperty(EscherPropertyTypes.GEOMETRY__SHAPEPATH, EscherShapePathProperty.COMPLEX)); - opt.setEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__FILLOK, false, false, 0x00010001)); - opt.setEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINESTARTARROWHEAD, false, false, 0x0)); - opt.setEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEENDARROWHEAD, false, false, 0x0)); - opt.setEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEENDCAPSTYLE, false, false, 0x0)); + opt.setEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.GEOMETRY__FILLOK, false, false, 0x00010001)); + opt.setEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.LINESTYLE__LINESTARTARROWHEAD, false, false, 0x0)); + opt.setEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.LINESTYLE__LINEENDARROWHEAD, false, false, 0x0)); + opt.setEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.LINESTYLE__LINEENDCAPSTYLE, false, false, 0x0)); - opt.setEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEDASHING, LINESTYLE_SOLID)); - opt.setEscherProperty( new EscherBoolProperty( EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x00080008)); - opt.setEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEWIDTH, LINEWIDTH_DEFAULT)); - opt.setEscherProperty(new EscherRGBProperty(EscherProperties.FILL__FILLCOLOR, FILL__FILLCOLOR_DEFAULT)); - opt.setEscherProperty(new EscherRGBProperty(EscherProperties.LINESTYLE__COLOR, LINESTYLE__COLOR_DEFAULT)); - opt.setEscherProperty(new EscherBoolProperty(EscherProperties.FILL__NOFILLHITTEST, 1)); + opt.setEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.LINESTYLE__LINEDASHING, LINESTYLE_SOLID)); + opt.setEscherProperty( new EscherBoolProperty( EscherPropertyTypes.LINESTYLE__NOLINEDRAWDASH, 0x00080008)); + opt.setEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.LINESTYLE__LINEWIDTH, LINEWIDTH_DEFAULT)); + opt.setEscherProperty(new EscherRGBProperty(EscherPropertyTypes.FILL__FILLCOLOR, FILL__FILLCOLOR_DEFAULT)); + opt.setEscherProperty(new EscherRGBProperty(EscherPropertyTypes.LINESTYLE__COLOR, LINESTYLE__COLOR_DEFAULT)); + opt.setEscherProperty(new EscherBoolProperty(EscherPropertyTypes.FILL__NOFILLHITTEST, 1)); - opt.setEscherProperty(new EscherBoolProperty( EscherProperties.GROUPSHAPE__PRINT, 0x080000)); + opt.setEscherProperty(new EscherBoolProperty( EscherPropertyTypes.GROUPSHAPE__FLAGS, 0x080000)); EscherRecord anchor = getAnchor().getEscherAnchor(); clientData.setRecordId(EscherClientDataRecord.RECORD_ID); @@ -123,7 +137,7 @@ public class HSSFPolygon extends HSSFSimpleShape { * @return array of x coordinates */ public int[] getXPoints() { - EscherArrayProperty verticesProp = getOptRecord().lookup(EscherProperties.GEOMETRY__VERTICES); + EscherArrayProperty verticesProp = getOptRecord().lookup(EscherPropertyTypes.GEOMETRY__VERTICES); if (null == verticesProp){ return new int[]{}; } @@ -140,7 +154,7 @@ public class HSSFPolygon extends HSSFSimpleShape { * @return array of y coordinates */ public int[] getYPoints() { - EscherArrayProperty verticesProp = getOptRecord().lookup(EscherProperties.GEOMETRY__VERTICES); + EscherArrayProperty verticesProp = getOptRecord().lookup(EscherPropertyTypes.GEOMETRY__VERTICES); if (null == verticesProp){ return new int[]{}; } @@ -165,7 +179,7 @@ public class HSSFPolygon extends HSSFSimpleShape { if (xPoints.length == 0){ logger.log( POILogger.ERROR, "HSSFPolygon must have at least one point"); } - EscherArrayProperty verticesProp = new EscherArrayProperty(EscherProperties.GEOMETRY__VERTICES, false, new byte[0] ); + EscherArrayProperty verticesProp = new EscherArrayProperty(EscherPropertyTypes.GEOMETRY__VERTICES, false, 0); verticesProp.setNumberOfElementsInArray(xPoints.length+1); verticesProp.setNumberOfElementsInMemory(xPoints.length+1); verticesProp.setSizeOfElements(0xFFF0); @@ -183,7 +197,7 @@ public class HSSFPolygon extends HSSFSimpleShape { verticesProp.setElement(point, data); setPropertyValue(verticesProp); - EscherArrayProperty segmentsProp = new EscherArrayProperty(EscherProperties.GEOMETRY__SEGMENTINFO, false, null ); + EscherArrayProperty segmentsProp = new EscherArrayProperty(EscherPropertyTypes.GEOMETRY__SEGMENTINFO, false, 0); segmentsProp.setSizeOfElements(0x0002); segmentsProp.setNumberOfElementsInArray(xPoints.length * 2 + 4); segmentsProp.setNumberOfElementsInMemory(xPoints.length * 2 + 4); @@ -205,15 +219,15 @@ public class HSSFPolygon extends HSSFSimpleShape { * @param height */ public void setPolygonDrawArea(int width, int height) { - setPropertyValue(new EscherSimpleProperty(EscherProperties.GEOMETRY__RIGHT, width)); - setPropertyValue(new EscherSimpleProperty(EscherProperties.GEOMETRY__BOTTOM, height)); + setPropertyValue(new EscherSimpleProperty(EscherPropertyTypes.GEOMETRY__RIGHT, width)); + setPropertyValue(new EscherSimpleProperty(EscherPropertyTypes.GEOMETRY__BOTTOM, height)); } /** * @return shape width */ public int getDrawAreaWidth() { - EscherSimpleProperty property = getOptRecord().lookup(EscherProperties.GEOMETRY__RIGHT); + EscherSimpleProperty property = getOptRecord().lookup(EscherPropertyTypes.GEOMETRY__RIGHT); return property == null ? 100: property.getPropertyValue(); } @@ -221,7 +235,7 @@ public class HSSFPolygon extends HSSFSimpleShape { * @return shape height */ public int getDrawAreaHeight() { - EscherSimpleProperty property = getOptRecord().lookup(EscherProperties.GEOMETRY__BOTTOM); + EscherSimpleProperty property = getOptRecord().lookup(EscherPropertyTypes.GEOMETRY__BOTTOM); return property == null ? 100: property.getPropertyValue(); } } diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFShape.java b/src/java/org/apache/poi/hssf/usermodel/HSSFShape.java index 47a7887423..95cb0b63d9 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFShape.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFShape.java @@ -26,8 +26,8 @@ import org.apache.poi.ddf.EscherClientAnchorRecord; import org.apache.poi.ddf.EscherComplexProperty; import org.apache.poi.ddf.EscherContainerRecord; import org.apache.poi.ddf.EscherOptRecord; -import org.apache.poi.ddf.EscherProperties; import org.apache.poi.ddf.EscherProperty; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.ddf.EscherRGBProperty; import org.apache.poi.ddf.EscherSimpleProperty; import org.apache.poi.ddf.EscherSpRecord; @@ -222,7 +222,7 @@ public abstract class HSSFShape implements Shape { * The color applied to the lines of this shape. */ public int getLineStyleColor() { - EscherRGBProperty rgbProperty = _optRecord.lookup(EscherProperties.LINESTYLE__COLOR); + EscherRGBProperty rgbProperty = _optRecord.lookup(EscherPropertyTypes.LINESTYLE__COLOR); return rgbProperty == null ? LINESTYLE__COLOR_DEFAULT : rgbProperty.getRgbColor(); } @@ -230,20 +230,20 @@ public abstract class HSSFShape implements Shape { * The color applied to the lines of this shape. */ public void setLineStyleColor(int lineStyleColor) { - setPropertyValue(new EscherRGBProperty(EscherProperties.LINESTYLE__COLOR, lineStyleColor)); + setPropertyValue(new EscherRGBProperty(EscherPropertyTypes.LINESTYLE__COLOR, lineStyleColor)); } @Override public void setLineStyleColor(int red, int green, int blue) { int lineStyleColor = ((blue) << 16) | ((green) << 8) | red; - setPropertyValue(new EscherRGBProperty(EscherProperties.LINESTYLE__COLOR, lineStyleColor)); + setPropertyValue(new EscherRGBProperty(EscherPropertyTypes.LINESTYLE__COLOR, lineStyleColor)); } /** * The color used to fill this shape. */ public int getFillColor() { - EscherRGBProperty rgbProperty = _optRecord.lookup(EscherProperties.FILL__FILLCOLOR); + EscherRGBProperty rgbProperty = _optRecord.lookup(EscherPropertyTypes.FILL__FILLCOLOR); return rgbProperty == null ? FILL__FILLCOLOR_DEFAULT : rgbProperty.getRgbColor(); } @@ -251,20 +251,20 @@ public abstract class HSSFShape implements Shape { * The color used to fill this shape. */ public void setFillColor(int fillColor) { - setPropertyValue(new EscherRGBProperty(EscherProperties.FILL__FILLCOLOR, fillColor)); + setPropertyValue(new EscherRGBProperty(EscherPropertyTypes.FILL__FILLCOLOR, fillColor)); } @Override public void setFillColor(int red, int green, int blue) { int fillColor = ((blue) << 16) | ((green) << 8) | red; - setPropertyValue(new EscherRGBProperty(EscherProperties.FILL__FILLCOLOR, fillColor)); + setPropertyValue(new EscherRGBProperty(EscherPropertyTypes.FILL__FILLCOLOR, fillColor)); } /** * @return returns with width of the line in EMUs. 12700 = 1 pt. */ public int getLineWidth() { - EscherSimpleProperty property = _optRecord.lookup(EscherProperties.LINESTYLE__LINEWIDTH); + EscherSimpleProperty property = _optRecord.lookup(EscherPropertyTypes.LINESTYLE__LINEWIDTH); return property == null ? LINEWIDTH_DEFAULT: property.getPropertyValue(); } @@ -275,14 +275,14 @@ public abstract class HSSFShape implements Shape { * @see HSSFShape#LINEWIDTH_ONE_PT */ public void setLineWidth(int lineWidth) { - setPropertyValue(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEWIDTH, lineWidth)); + setPropertyValue(new EscherSimpleProperty(EscherPropertyTypes.LINESTYLE__LINEWIDTH, lineWidth)); } /** * @return One of the constants in LINESTYLE_* */ public int getLineStyle() { - EscherSimpleProperty property = _optRecord.lookup(EscherProperties.LINESTYLE__LINEDASHING); + EscherSimpleProperty property = _optRecord.lookup(EscherPropertyTypes.LINESTYLE__LINEDASHING); if (null == property){ return LINESTYLE_DEFAULT; } @@ -295,26 +295,26 @@ public abstract class HSSFShape implements Shape { * @param lineStyle One of the constants in LINESTYLE_* */ public void setLineStyle(int lineStyle) { - setPropertyValue(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEDASHING, lineStyle)); + setPropertyValue(new EscherSimpleProperty(EscherPropertyTypes.LINESTYLE__LINEDASHING, lineStyle)); if (getLineStyle() != HSSFShape.LINESTYLE_SOLID) { - setPropertyValue(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEENDCAPSTYLE, 0)); + setPropertyValue(new EscherSimpleProperty(EscherPropertyTypes.LINESTYLE__LINEENDCAPSTYLE, 0)); if (getLineStyle() == HSSFShape.LINESTYLE_NONE){ - setPropertyValue(new EscherBoolProperty( EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x00080000)); + setPropertyValue(new EscherBoolProperty( EscherPropertyTypes.LINESTYLE__NOLINEDRAWDASH, 0x00080000)); } else { - setPropertyValue( new EscherBoolProperty( EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x00080008)); + setPropertyValue( new EscherBoolProperty( EscherPropertyTypes.LINESTYLE__NOLINEDRAWDASH, 0x00080008)); } } } @Override public boolean isNoFill() { - EscherBoolProperty property = _optRecord.lookup(EscherProperties.FILL__NOFILLHITTEST); + EscherBoolProperty property = _optRecord.lookup(EscherPropertyTypes.FILL__NOFILLHITTEST); return property == null ? NO_FILL_DEFAULT : property.getPropertyValue() == NO_FILLHITTEST_TRUE; } @Override public void setNoFill(boolean noFill) { - setPropertyValue(new EscherBoolProperty(EscherProperties.FILL__NOFILLHITTEST, noFill ? NO_FILLHITTEST_TRUE : NO_FILLHITTEST_FALSE)); + setPropertyValue(new EscherBoolProperty(EscherPropertyTypes.FILL__NOFILLHITTEST, noFill ? NO_FILLHITTEST_TRUE : NO_FILLHITTEST_FALSE)); } protected void setPropertyValue(EscherProperty property){ @@ -366,7 +366,7 @@ public abstract class HSSFShape implements Shape { */ public int getRotationDegree(){ ByteArrayOutputStream bos = new ByteArrayOutputStream(); - EscherSimpleProperty property = getOptRecord().lookup(EscherProperties.TRANSFORM__ROTATION); + EscherSimpleProperty property = getOptRecord().lookup(EscherPropertyTypes.TRANSFORM__ROTATION); if (null == property){ return 0; } @@ -388,7 +388,7 @@ public abstract class HSSFShape implements Shape { * @param value */ public void setRotationDegree(short value){ - setPropertyValue(new EscherSimpleProperty(EscherProperties.TRANSFORM__ROTATION , (value << 16))); + setPropertyValue(new EscherSimpleProperty(EscherPropertyTypes.TRANSFORM__ROTATION , (value << 16))); } /** @@ -420,7 +420,7 @@ public abstract class HSSFShape implements Shape { if (eor == null) { return null; } - EscherProperty ep = eor.lookup(EscherProperties.GROUPSHAPE__SHAPENAME); + EscherProperty ep = eor.lookup(EscherPropertyTypes.GROUPSHAPE__SHAPENAME); if (ep instanceof EscherComplexProperty) { return StringUtil.getFromUnicodeLE(((EscherComplexProperty)ep).getComplexData()); } diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFShapeFactory.java b/src/java/org/apache/poi/hssf/usermodel/HSSFShapeFactory.java index 64a027be1f..71784237e0 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFShapeFactory.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFShapeFactory.java @@ -23,8 +23,8 @@ import java.util.Map; import org.apache.poi.ddf.EscherClientDataRecord; import org.apache.poi.ddf.EscherContainerRecord; import org.apache.poi.ddf.EscherOptRecord; -import org.apache.poi.ddf.EscherProperties; import org.apache.poi.ddf.EscherProperty; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.ddf.EscherRecord; import org.apache.poi.ddf.EscherRecordTypes; import org.apache.poi.hssf.record.CommonObjectDataSubRecord; @@ -110,7 +110,7 @@ public class HSSFShapeFactory { if(optRecord == null) { shape = new HSSFSimpleShape(container, objRecord, txtRecord); } else { - EscherProperty property = optRecord.lookup(EscherProperties.GEOMETRY__VERTICES); + EscherProperty property = optRecord.lookup(EscherPropertyTypes.GEOMETRY__VERTICES); if (null != property) { shape = new HSSFPolygon(container, objRecord, txtRecord); } else { diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFShapeGroup.java b/src/java/org/apache/poi/hssf/usermodel/HSSFShapeGroup.java index 1787baaccd..4652693837 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFShapeGroup.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFShapeGroup.java @@ -29,7 +29,7 @@ import org.apache.poi.ddf.EscherClientAnchorRecord; import org.apache.poi.ddf.EscherClientDataRecord; import org.apache.poi.ddf.EscherContainerRecord; import org.apache.poi.ddf.EscherOptRecord; -import org.apache.poi.ddf.EscherProperties; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.ddf.EscherRecord; import org.apache.poi.ddf.EscherRecordTypes; import org.apache.poi.ddf.EscherSpRecord; @@ -104,8 +104,8 @@ public class HSSFShapeGroup extends HSSFShape implements HSSFShapeContainer { } opt.setRecordId(EscherOptRecord.RECORD_ID); opt.setOptions((short) 0x0023); - opt.addEscherProperty(new EscherBoolProperty(EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 0x00040004)); - opt.addEscherProperty(new EscherBoolProperty(EscherProperties.GROUPSHAPE__PRINT, 0x00080000)); + opt.addEscherProperty(new EscherBoolProperty(EscherPropertyTypes.PROTECTION__LOCKAGAINSTGROUPING, 0x00040004)); + opt.addEscherProperty(new EscherBoolProperty(EscherPropertyTypes.GROUPSHAPE__FLAGS, 0x00080000)); anchor = getAnchor().getEscherAnchor(); clientData.setRecordId(EscherClientDataRecord.RECORD_ID); diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFSimpleShape.java b/src/java/org/apache/poi/hssf/usermodel/HSSFSimpleShape.java index d98527a718..27b891321c 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFSimpleShape.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFSimpleShape.java @@ -17,12 +17,15 @@ package org.apache.poi.hssf.usermodel; +import static org.apache.poi.hssf.record.TextObjectRecord.HORIZONTAL_TEXT_ALIGNMENT_CENTERED; +import static org.apache.poi.hssf.record.TextObjectRecord.VERTICAL_TEXT_ALIGNMENT_CENTER; + import org.apache.poi.ddf.DefaultEscherRecordFactory; import org.apache.poi.ddf.EscherBoolProperty; import org.apache.poi.ddf.EscherClientDataRecord; import org.apache.poi.ddf.EscherContainerRecord; import org.apache.poi.ddf.EscherOptRecord; -import org.apache.poi.ddf.EscherProperties; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.ddf.EscherRGBProperty; import org.apache.poi.ddf.EscherShapePathProperty; import org.apache.poi.ddf.EscherSimpleProperty; @@ -36,9 +39,6 @@ import org.apache.poi.hssf.record.TextObjectRecord; import org.apache.poi.ss.usermodel.RichTextString; import org.apache.poi.ss.usermodel.SimpleShape; -import static org.apache.poi.hssf.record.TextObjectRecord.HORIZONTAL_TEXT_ALIGNMENT_CENTERED; -import static org.apache.poi.hssf.record.TextObjectRecord.VERTICAL_TEXT_ALIGNMENT_CENTER; - /** * Represents a simple shape such as a line, rectangle or oval. */ @@ -121,16 +121,16 @@ public class HSSFSimpleShape extends HSSFShape implements SimpleShape clientData.setOptions( (short) (0x0000) ); EscherOptRecord optRecord = new EscherOptRecord(); - optRecord.setEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEDASHING, LINESTYLE_SOLID)); - optRecord.setEscherProperty( new EscherBoolProperty( EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x00080008)); + optRecord.setEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.LINESTYLE__LINEDASHING, LINESTYLE_SOLID)); + optRecord.setEscherProperty( new EscherBoolProperty( EscherPropertyTypes.LINESTYLE__NOLINEDRAWDASH, 0x00080008)); // optRecord.setEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEWIDTH, LINEWIDTH_DEFAULT)); - optRecord.setEscherProperty(new EscherRGBProperty(EscherProperties.FILL__FILLCOLOR, FILL__FILLCOLOR_DEFAULT)); - optRecord.setEscherProperty(new EscherRGBProperty(EscherProperties.LINESTYLE__COLOR, LINESTYLE__COLOR_DEFAULT)); - optRecord.setEscherProperty(new EscherBoolProperty(EscherProperties.FILL__NOFILLHITTEST, NO_FILLHITTEST_FALSE)); - optRecord.setEscherProperty( new EscherBoolProperty( EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x00080008)); + optRecord.setEscherProperty(new EscherRGBProperty(EscherPropertyTypes.FILL__FILLCOLOR, FILL__FILLCOLOR_DEFAULT)); + optRecord.setEscherProperty(new EscherRGBProperty(EscherPropertyTypes.LINESTYLE__COLOR, LINESTYLE__COLOR_DEFAULT)); + optRecord.setEscherProperty(new EscherBoolProperty(EscherPropertyTypes.FILL__NOFILLHITTEST, NO_FILLHITTEST_FALSE)); + optRecord.setEscherProperty( new EscherBoolProperty( EscherPropertyTypes.LINESTYLE__NOLINEDRAWDASH, 0x00080008)); - optRecord.setEscherProperty( new EscherShapePathProperty( EscherProperties.GEOMETRY__SHAPEPATH, EscherShapePathProperty.COMPLEX ) ); - optRecord.setEscherProperty(new EscherBoolProperty( EscherProperties.GROUPSHAPE__PRINT, 0x080000)); + optRecord.setEscherProperty( new EscherShapePathProperty( EscherPropertyTypes.GEOMETRY__SHAPEPATH, EscherShapePathProperty.COMPLEX ) ); + optRecord.setEscherProperty(new EscherBoolProperty( EscherPropertyTypes.GROUPSHAPE__FLAGS, 0x080000)); optRecord.setRecordId( EscherOptRecord.RECORD_ID ); EscherTextboxRecord escherTextbox = new EscherTextboxRecord(); @@ -189,7 +189,7 @@ public class HSSFSimpleShape extends HSSFShape implements SimpleShape TextObjectRecord txo = getOrCreateTextObjRecord(); txo.setStr(rtr); if (string.getString() != null){ - setPropertyValue(new EscherSimpleProperty(EscherProperties.TEXT__TEXTID, string.getString().hashCode())); + setPropertyValue(new EscherSimpleProperty(EscherPropertyTypes.TEXT__TEXTID, string.getString().hashCode())); } } @@ -233,12 +233,12 @@ public class HSSFSimpleShape extends HSSFShape implements SimpleShape } public int getWrapText(){ - EscherSimpleProperty property = getOptRecord().lookup(EscherProperties.TEXT__WRAPTEXT); + EscherSimpleProperty property = getOptRecord().lookup(EscherPropertyTypes.TEXT__WRAPTEXT); return null == property ? WRAP_SQUARE : property.getPropertyValue(); } public void setWrapText(int value){ - setPropertyValue(new EscherSimpleProperty(EscherProperties.TEXT__WRAPTEXT, false, false, value)); + setPropertyValue(new EscherSimpleProperty(EscherPropertyTypes.TEXT__WRAPTEXT, false, false, value)); } /** diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFTextbox.java b/src/java/org/apache/poi/hssf/usermodel/HSSFTextbox.java index d1e8b9ffae..9f59fcd3d9 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFTextbox.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFTextbox.java @@ -17,8 +17,22 @@ package org.apache.poi.hssf.usermodel; -import org.apache.poi.ddf.*; -import org.apache.poi.hssf.record.*; +import org.apache.poi.ddf.DefaultEscherRecordFactory; +import org.apache.poi.ddf.EscherBoolProperty; +import org.apache.poi.ddf.EscherClientDataRecord; +import org.apache.poi.ddf.EscherContainerRecord; +import org.apache.poi.ddf.EscherOptRecord; +import org.apache.poi.ddf.EscherPropertyTypes; +import org.apache.poi.ddf.EscherRGBProperty; +import org.apache.poi.ddf.EscherRecord; +import org.apache.poi.ddf.EscherSimpleProperty; +import org.apache.poi.ddf.EscherSpRecord; +import org.apache.poi.ddf.EscherTextboxRecord; +import org.apache.poi.hssf.record.CommonObjectDataSubRecord; +import org.apache.poi.hssf.record.EndSubRecord; +import org.apache.poi.hssf.record.EscherAggregate; +import org.apache.poi.hssf.record.ObjRecord; +import org.apache.poi.hssf.record.TextObjectRecord; /** * A textbox is a shape that may hold a rich text string. @@ -94,23 +108,23 @@ public class HSSFTextbox extends HSSFSimpleShape { sp.setFlags(EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE); opt.setRecordId(EscherOptRecord.RECORD_ID); - opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__TEXTID, 0)); - opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__WRAPTEXT, 0)); - opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__ANCHORTEXT, 0)); - opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GROUPSHAPE__PRINT, 0x00080000)); - - opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__TEXTLEFT, 0)); - opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__TEXTRIGHT, 0)); - opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__TEXTTOP, 0)); - opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__TEXTBOTTOM, 0)); - - opt.setEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEDASHING, LINESTYLE_SOLID)); - opt.setEscherProperty(new EscherBoolProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x00080008)); - opt.setEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEWIDTH, LINEWIDTH_DEFAULT)); - opt.setEscherProperty(new EscherRGBProperty(EscherProperties.FILL__FILLCOLOR, FILL__FILLCOLOR_DEFAULT)); - opt.setEscherProperty(new EscherRGBProperty(EscherProperties.LINESTYLE__COLOR, LINESTYLE__COLOR_DEFAULT)); - opt.setEscherProperty(new EscherBoolProperty(EscherProperties.FILL__NOFILLHITTEST, NO_FILLHITTEST_FALSE)); - opt.setEscherProperty(new EscherBoolProperty(EscherProperties.GROUPSHAPE__PRINT, 0x080000)); + opt.addEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.TEXT__TEXTID, 0)); + opt.addEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.TEXT__WRAPTEXT, 0)); + opt.addEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.TEXT__ANCHORTEXT, 0)); + opt.addEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.GROUPSHAPE__FLAGS, 0x00080000)); + + opt.addEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.TEXT__TEXTLEFT, 0)); + opt.addEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.TEXT__TEXTRIGHT, 0)); + opt.addEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.TEXT__TEXTTOP, 0)); + opt.addEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.TEXT__TEXTBOTTOM, 0)); + + opt.setEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.LINESTYLE__LINEDASHING, LINESTYLE_SOLID)); + opt.setEscherProperty(new EscherBoolProperty(EscherPropertyTypes.LINESTYLE__NOLINEDRAWDASH, 0x00080008)); + opt.setEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.LINESTYLE__LINEWIDTH, LINEWIDTH_DEFAULT)); + opt.setEscherProperty(new EscherRGBProperty(EscherPropertyTypes.FILL__FILLCOLOR, FILL__FILLCOLOR_DEFAULT)); + opt.setEscherProperty(new EscherRGBProperty(EscherPropertyTypes.LINESTYLE__COLOR, LINESTYLE__COLOR_DEFAULT)); + opt.setEscherProperty(new EscherBoolProperty(EscherPropertyTypes.FILL__NOFILLHITTEST, NO_FILLHITTEST_FALSE)); + opt.setEscherProperty(new EscherBoolProperty(EscherPropertyTypes.GROUPSHAPE__FLAGS, 0x080000)); EscherRecord anchor = getAnchor().getEscherAnchor(); clientData.setRecordId(EscherClientDataRecord.RECORD_ID); @@ -140,7 +154,7 @@ public class HSSFTextbox extends HSSFSimpleShape { * @return Returns the left margin within the textbox. */ public int getMarginLeft() { - EscherSimpleProperty property = getOptRecord().lookup(EscherProperties.TEXT__TEXTLEFT); + EscherSimpleProperty property = getOptRecord().lookup(EscherPropertyTypes.TEXT__TEXTLEFT); return property == null ? 0 : property.getPropertyValue(); } @@ -148,14 +162,14 @@ public class HSSFTextbox extends HSSFSimpleShape { * Sets the left margin within the textbox. */ public void setMarginLeft(int marginLeft) { - setPropertyValue(new EscherSimpleProperty(EscherProperties.TEXT__TEXTLEFT, marginLeft)); + setPropertyValue(new EscherSimpleProperty(EscherPropertyTypes.TEXT__TEXTLEFT, marginLeft)); } /** * @return returns the right margin within the textbox. */ public int getMarginRight() { - EscherSimpleProperty property = getOptRecord().lookup(EscherProperties.TEXT__TEXTRIGHT); + EscherSimpleProperty property = getOptRecord().lookup(EscherPropertyTypes.TEXT__TEXTRIGHT); return property == null ? 0 : property.getPropertyValue(); } @@ -163,14 +177,14 @@ public class HSSFTextbox extends HSSFSimpleShape { * Sets the right margin within the textbox. */ public void setMarginRight(int marginRight) { - setPropertyValue(new EscherSimpleProperty(EscherProperties.TEXT__TEXTRIGHT, marginRight)); + setPropertyValue(new EscherSimpleProperty(EscherPropertyTypes.TEXT__TEXTRIGHT, marginRight)); } /** * @return returns the top margin within the textbox. */ public int getMarginTop() { - EscherSimpleProperty property = getOptRecord().lookup(EscherProperties.TEXT__TEXTTOP); + EscherSimpleProperty property = getOptRecord().lookup(EscherPropertyTypes.TEXT__TEXTTOP); return property == null ? 0 : property.getPropertyValue(); } @@ -178,14 +192,14 @@ public class HSSFTextbox extends HSSFSimpleShape { * Sets the top margin within the textbox. */ public void setMarginTop(int marginTop) { - setPropertyValue(new EscherSimpleProperty(EscherProperties.TEXT__TEXTTOP, marginTop)); + setPropertyValue(new EscherSimpleProperty(EscherPropertyTypes.TEXT__TEXTTOP, marginTop)); } /** * Gets the bottom margin within the textbox. */ public int getMarginBottom() { - EscherSimpleProperty property = getOptRecord().lookup(EscherProperties.TEXT__TEXTBOTTOM); + EscherSimpleProperty property = getOptRecord().lookup(EscherPropertyTypes.TEXT__TEXTBOTTOM); return property == null ? 0 : property.getPropertyValue(); } @@ -193,7 +207,7 @@ public class HSSFTextbox extends HSSFSimpleShape { * Sets the bottom margin within the textbox. */ public void setMarginBottom(int marginBottom) { - setPropertyValue(new EscherSimpleProperty(EscherProperties.TEXT__TEXTBOTTOM, marginBottom)); + setPropertyValue(new EscherSimpleProperty(EscherPropertyTypes.TEXT__TEXTBOTTOM, marginBottom)); } /** diff --git a/src/java/org/apache/poi/sl/usermodel/PictureData.java b/src/java/org/apache/poi/sl/usermodel/PictureData.java index 0285dd5845..83b54d75c7 100644 --- a/src/java/org/apache/poi/sl/usermodel/PictureData.java +++ b/src/java/org/apache/poi/sl/usermodel/PictureData.java @@ -38,7 +38,7 @@ public interface PictureData { /** GIF image format */ GIF(-1,8,"image/gif",".gif"), /** Tag Image File (.tiff) */ - TIFF(-1,9,"image/tiff",".tif"), + TIFF(17,9,"image/tiff",".tif"), /** Encapsulated Postscript (.eps) */ EPS(-1,10,"image/x-eps",".eps"), /** Windows Bitmap (.bmp) */ @@ -48,7 +48,15 @@ public interface PictureData { /** Microsoft Windows Media Photo image (.wdp) */ WDP(-1,13,"image/vnd.ms-photo",".wdp"), /** Scalable vector graphics (.svg) - supported by Office 2016 and higher */ - SVG(-1, -1, "image/svg+xml", ".svg") + SVG(-1, -1, "image/svg+xml", ".svg"), + /** Unknown picture type - specific to escher bse record */ + UNKNOWN(1, -1, "", ".dat"), + /** Picture type error - specific to escher bse record */ + ERROR(0, -1, "", ".dat"), + /** JPEG in the YCCK or CMYK color space. */ + CMYKJPEG( 18, -1, "image/jpeg", ".jpg"), + /** client defined blip type - native-id 32 to 255 */ + CLIENT( 32, -1, "", ".dat") ; public final int nativeId, ooxmlId; @@ -65,7 +73,7 @@ public interface PictureData { for (PictureType ans : values()) { if (ans.nativeId == nativeId) return ans; } - return null; + return nativeId >= CLIENT.nativeId ? CLIENT : UNKNOWN; } public static PictureType forOoxmlID(int ooxmlId) { diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java b/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java index db0ea9b1ac..f8c02deac7 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java @@ -20,7 +20,7 @@ package org.apache.poi.hslf.model; import org.apache.poi.ddf.AbstractEscherOptRecord; import org.apache.poi.ddf.EscherComplexProperty; import org.apache.poi.ddf.EscherContainerRecord; -import org.apache.poi.ddf.EscherProperties; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.ddf.EscherSpRecord; import org.apache.poi.hslf.exceptions.HSLFException; import org.apache.poi.hslf.record.Document; @@ -79,11 +79,11 @@ public final class ActiveXShape extends HSLFPictureShape { spRecord.setFlags(EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE | EscherSpRecord.FLAG_OLESHAPE); setShapeType(ShapeType.HOST_CONTROL); - setEscherProperty(EscherProperties.BLIP__PICTUREID, idx); - setEscherProperty(EscherProperties.LINESTYLE__COLOR, 0x8000001); - setEscherProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x80008); - setEscherProperty(EscherProperties.SHADOWSTYLE__COLOR, 0x8000002); - setEscherProperty(EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, -1); + setEscherProperty(EscherPropertyTypes.BLIP__PICTUREID, idx); + setEscherProperty(EscherPropertyTypes.LINESTYLE__COLOR, 0x8000001); + setEscherProperty(EscherPropertyTypes.LINESTYLE__NOLINEDRAWDASH, 0x80008); + setEscherProperty(EscherPropertyTypes.SHADOWSTYLE__COLOR, 0x8000002); + setEscherProperty(EscherPropertyTypes.PROTECTION__LOCKAGAINSTGROUPING, -1); HSLFEscherClientDataRecord cldata = getClientData(true); cldata.addChild(new ExObjRefAtom()); @@ -155,7 +155,8 @@ public final class ActiveXShape extends HSLFPictureShape { String name = ctrl.getProgId() + "-" + getControlIndex() + '\u0000'; byte[] data = StringUtil.getToUnicodeLE(name); - EscherComplexProperty prop = new EscherComplexProperty(EscherProperties.GROUPSHAPE__SHAPENAME, false, data); + EscherComplexProperty prop = new EscherComplexProperty(EscherPropertyTypes.GROUPSHAPE__SHAPENAME, false, data.length); + prop.setComplexData(data); AbstractEscherOptRecord opt = getEscherOptRecord(); opt.addEscherProperty(prop); } diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/HSLFMetroShape.java b/src/scratchpad/src/org/apache/poi/hslf/model/HSLFMetroShape.java index 741862b5f7..f65d0fb178 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/model/HSLFMetroShape.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/HSLFMetroShape.java @@ -21,7 +21,7 @@ import java.lang.reflect.Method; import org.apache.poi.ddf.AbstractEscherOptRecord; import org.apache.poi.ddf.EscherComplexProperty; -import org.apache.poi.ddf.EscherProperties; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.ddf.EscherTertiaryOptRecord; import org.apache.poi.hslf.usermodel.HSLFShape; import org.apache.poi.sl.usermodel.Shape; @@ -60,7 +60,7 @@ public class HSLFMetroShape> { private EscherComplexProperty getMetroProp() { AbstractEscherOptRecord opt = shape.getEscherChild(EscherTertiaryOptRecord.RECORD_ID); - return (opt == null) ? null : (EscherComplexProperty)opt.lookup(EscherProperties.GROUPSHAPE__METROBLOB); + return (opt == null) ? null : (EscherComplexProperty)opt.lookup(EscherPropertyTypes.GROUPSHAPE__METROBLOB.propNumber); } /** diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/MovieShape.java b/src/scratchpad/src/org/apache/poi/hslf/model/MovieShape.java index 4452e758c9..ee00ae73ab 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/model/MovieShape.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/MovieShape.java @@ -18,7 +18,7 @@ package org.apache.poi.hslf.model; import org.apache.poi.ddf.EscherContainerRecord; -import org.apache.poi.ddf.EscherProperties; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.hslf.record.AnimationInfo; import org.apache.poi.hslf.record.AnimationInfoAtom; import org.apache.poi.hslf.record.ExMCIMovie; @@ -90,8 +90,8 @@ public final class MovieShape extends HSLFPictureShape { protected EscherContainerRecord createSpContainer(int idx, boolean isChild) { EscherContainerRecord ecr = super.createSpContainer(idx, isChild); - setEscherProperty(EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 0x1000100); - setEscherProperty(EscherProperties.FILL__NOFILLHITTEST, 0x10001); + setEscherProperty(EscherPropertyTypes.PROTECTION__LOCKAGAINSTGROUPING, 0x1000100); + setEscherProperty(EscherPropertyTypes.FILL__NOFILLHITTEST, 0x10001); ExObjRefAtom oe = new ExObjRefAtom(); InteractiveInfo info = new InteractiveInfo(); diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/Polygon.java b/src/scratchpad/src/org/apache/poi/hslf/model/Polygon.java index 5a0b4bff11..061e89555c 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/model/Polygon.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/Polygon.java @@ -17,15 +17,22 @@ package org.apache.poi.hslf.model; -import org.apache.poi.ddf.*; -import org.apache.poi.hslf.usermodel.*; +import java.awt.geom.Point2D; + +import org.apache.poi.ddf.AbstractEscherOptRecord; +import org.apache.poi.ddf.EscherArrayProperty; +import org.apache.poi.ddf.EscherContainerRecord; +import org.apache.poi.ddf.EscherPropertyTypes; +import org.apache.poi.ddf.EscherSimpleProperty; +import org.apache.poi.hslf.usermodel.HSLFAutoShape; +import org.apache.poi.hslf.usermodel.HSLFGroupShape; +import org.apache.poi.hslf.usermodel.HSLFShape; +import org.apache.poi.hslf.usermodel.HSLFTextParagraph; import org.apache.poi.sl.usermodel.ShapeContainer; import org.apache.poi.sl.usermodel.ShapeType; import org.apache.poi.util.LittleEndian; import org.apache.poi.util.Units; -import java.awt.geom.Point2D; - /** * A simple closed polygon shape * @@ -76,8 +83,8 @@ public final class Polygon extends HSLFAutoShape { float top = findSmallest(yPoints); AbstractEscherOptRecord opt = getEscherOptRecord(); - opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__RIGHT, Units.pointsToMaster(right - left))); - opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__BOTTOM, Units.pointsToMaster(bottom - top))); + opt.addEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.GEOMETRY__RIGHT, Units.pointsToMaster(right - left))); + opt.addEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.GEOMETRY__BOTTOM, Units.pointsToMaster(bottom - top))); for (int i = 0; i < xPoints.length; i++) { xPoints[i] += -left; @@ -86,7 +93,7 @@ public final class Polygon extends HSLFAutoShape { int numpoints = xPoints.length; - EscherArrayProperty verticesProp = new EscherArrayProperty(EscherProperties.GEOMETRY__VERTICES, false, new byte[0] ); + EscherArrayProperty verticesProp = new EscherArrayProperty(EscherPropertyTypes.GEOMETRY__VERTICES, false, 0); verticesProp.setNumberOfElementsInArray(numpoints+1); verticesProp.setNumberOfElementsInMemory(numpoints+1); verticesProp.setSizeOfElements(0xFFF0); @@ -103,7 +110,7 @@ public final class Polygon extends HSLFAutoShape { verticesProp.setElement(numpoints, data); opt.addEscherProperty(verticesProp); - EscherArrayProperty segmentsProp = new EscherArrayProperty(EscherProperties.GEOMETRY__SEGMENTINFO, false, null ); + EscherArrayProperty segmentsProp = new EscherArrayProperty(EscherPropertyTypes.GEOMETRY__SEGMENTINFO, false, 0); segmentsProp.setSizeOfElements(0x0002); segmentsProp.setNumberOfElementsInArray(numpoints * 2 + 4); segmentsProp.setNumberOfElementsInMemory(numpoints * 2 + 4); diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/EscherPlaceholder.java b/src/scratchpad/src/org/apache/poi/hslf/record/EscherPlaceholder.java index a3d29b01da..7c6002d26c 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/EscherPlaceholder.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/EscherPlaceholder.java @@ -93,16 +93,6 @@ public class EscherPlaceholder extends EscherRecord { return size; } - @Override - protected Object[][] getAttributeMap() { - return new Object[][] { - { "position", position }, - { "placementId", placementId }, - { "placehoder size", size }, - { "unused", unused } - }; - } - @Override public Map> getGenericProperties() { return GenericRecordUtil.getGenericProperties( diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java b/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java index c2bceecd81..01bb78eb7e 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java @@ -35,7 +35,7 @@ import org.apache.poi.ddf.EscherBoolProperty; import org.apache.poi.ddf.EscherContainerRecord; import org.apache.poi.ddf.EscherDgRecord; import org.apache.poi.ddf.EscherOptRecord; -import org.apache.poi.ddf.EscherProperties; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.ddf.EscherRGBProperty; import org.apache.poi.ddf.EscherRecord; import org.apache.poi.ddf.EscherRecordTypes; @@ -331,14 +331,14 @@ public final class PPDrawing extends RecordAtom implements Iterable 9) throw new IllegalArgumentException("The index of an adjustment value must be in the [0, 9] range"); - - return getEscherProperty((short)(EscherProperties.GEOMETRY__ADJUSTVALUE + idx)); + return getEscherProperty(ADJUST_VALUES[idx]); } /** @@ -200,8 +211,7 @@ public class HSLFAutoShape extends HSLFTextShape implements AutoShape 9) throw new IllegalArgumentException("The index of an adjustment value must be in the [0, 9] range"); - - setEscherProperty((short)(EscherProperties.GEOMETRY__ADJUSTVALUE + idx), val); + setEscherProperty(ADJUST_VALUES[idx], val); } @Override @@ -219,8 +229,8 @@ public class HSLFAutoShape extends HSLFTextShape implements AutoShape T getShapeProp(AbstractEscherOptRecord opt, int propId) { - T prop = getEscherProperty(opt, (short)(propId + 0x4000)); - if (prop == null) { - prop = getEscherProperty(opt, propId); - } - return prop; - } - private CTAdjPoint2D fillPoint(byte[] xyMaster, int[] xyPoints) { if (xyMaster == null || xyPoints == null) { LOG.log(POILogger.WARN, "Master bytes or points not set - ignore point"); diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFill.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFill.java index 52952e2191..b87d2869be 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFill.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFill.java @@ -27,7 +27,7 @@ import org.apache.poi.ddf.EscherArrayProperty; import org.apache.poi.ddf.EscherBSERecord; import org.apache.poi.ddf.EscherColorRef; import org.apache.poi.ddf.EscherContainerRecord; -import org.apache.poi.ddf.EscherProperties; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.ddf.EscherRecord; import org.apache.poi.ddf.EscherRecordTypes; import org.apache.poi.ddf.EscherSimpleProperty; @@ -258,14 +258,14 @@ public final class HSLFFill { // NOFILLHITTEST can be in the normal escher opt record but also in the tertiary record // the extended bit fields seem to be in the second AbstractEscherOptRecord opt = shape.getEscherChild(EscherRecordTypes.USER_DEFINED); - EscherSimpleProperty p = HSLFShape.getEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST); + EscherSimpleProperty p = HSLFShape.getEscherProperty(opt, EscherPropertyTypes.FILL__NOFILLHITTEST); int propVal = (p == null) ? 0 : p.getPropertyValue(); return FILL_USE_USE_SHAPE_ANCHOR.isSet(propVal) && FILL_USE_SHAPE_ANCHOR.isSet(propVal); } private GradientPaint getGradientPaint(final GradientType gradientType) { AbstractEscherOptRecord opt = shape.getEscherOptRecord(); - final EscherArrayProperty ep = HSLFShape.getEscherProperty(opt, EscherProperties.FILL__SHADECOLORS); + final EscherArrayProperty ep = HSLFShape.getEscherProperty(opt, EscherPropertyTypes.FILL__SHADECOLORS); final int colorCnt = (ep == null) ? 0 : ep.getNumberOfElementsInArray(); return new GradientPaint() { @@ -274,7 +274,7 @@ public final class HSLFFill { // A value of type FixedPoint, as specified in [MS-OSHARED] section 2.2.1.6, // that specifies the angle of the gradient fill. Zero degrees represents a vertical vector from // bottom to top. The default value for this property is 0x00000000. - int rot = shape.getEscherProperty(EscherProperties.FILL__ANGLE); + int rot = shape.getEscherProperty(EscherPropertyTypes.FILL__ANGLE); return 90-Units.fixedPointToDouble(rot); } @@ -348,7 +348,7 @@ public final class HSLFFill { @Override public int getAlpha() { - return (int)(shape.getAlpha(EscherProperties.FILL__FILLOPACITY)*100000.0); + return (int)(shape.getAlpha(EscherPropertyTypes.FILL__FILLOPACITY)*100000.0); } @Override @@ -366,13 +366,13 @@ public final class HSLFFill { */ public int getFillType(){ AbstractEscherOptRecord opt = shape.getEscherOptRecord(); - EscherSimpleProperty prop = HSLFShape.getEscherProperty(opt, EscherProperties.FILL__FILLTYPE); + EscherSimpleProperty prop = HSLFShape.getEscherProperty(opt, EscherPropertyTypes.FILL__FILLTYPE); return prop == null ? FILL_SOLID : prop.getPropertyValue(); } void afterInsert(HSLFSheet sh){ AbstractEscherOptRecord opt = shape.getEscherOptRecord(); - EscherSimpleProperty p = HSLFShape.getEscherProperty(opt, EscherProperties.FILL__PATTERNTEXTURE); + EscherSimpleProperty p = HSLFShape.getEscherProperty(opt, EscherPropertyTypes.FILL__PATTERNTEXTURE); if(p != null) { int idx = p.getPropertyValue(); EscherBSERecord bse = getEscherBSERecord(idx); @@ -409,7 +409,7 @@ public final class HSLFFill { */ public void setFillType(int type){ AbstractEscherOptRecord opt = shape.getEscherOptRecord(); - HSLFShape.setEscherProperty(opt, EscherProperties.FILL__FILLTYPE, type); + HSLFShape.setEscherProperty(opt, EscherPropertyTypes.FILL__FILLTYPE, type); } /** @@ -417,11 +417,11 @@ public final class HSLFFill { */ public Color getForegroundColor(){ AbstractEscherOptRecord opt = shape.getEscherOptRecord(); - EscherSimpleProperty p = HSLFShape.getEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST); + EscherSimpleProperty p = HSLFShape.getEscherProperty(opt, EscherPropertyTypes.FILL__NOFILLHITTEST); int propVal = (p == null) ? 0 : p.getPropertyValue(); return (FILL_USE_FILLED.isSet(propVal) && FILL_FILLED.isSet(propVal)) - ? shape.getColor(EscherProperties.FILL__FILLCOLOR, EscherProperties.FILL__FILLOPACITY) + ? shape.getColor(EscherPropertyTypes.FILL__FILLCOLOR, EscherPropertyTypes.FILL__FILLOPACITY) : null; } @@ -430,20 +430,20 @@ public final class HSLFFill { */ public void setForegroundColor(Color color){ AbstractEscherOptRecord opt = shape.getEscherOptRecord(); - opt.removeEscherProperty(EscherProperties.FILL__FILLOPACITY); - opt.removeEscherProperty(EscherProperties.FILL__FILLCOLOR); + opt.removeEscherProperty(EscherPropertyTypes.FILL__FILLOPACITY); + opt.removeEscherProperty(EscherPropertyTypes.FILL__FILLCOLOR); if (color != null) { int rgb = new Color(color.getBlue(), color.getGreen(), color.getRed(), 0).getRGB(); - HSLFShape.setEscherProperty(opt, EscherProperties.FILL__FILLCOLOR, rgb); + HSLFShape.setEscherProperty(opt, EscherPropertyTypes.FILL__FILLCOLOR, rgb); int alpha = color.getAlpha(); if (alpha < 255) { int alphaFP = Units.doubleToFixedPoint(alpha/255d); - HSLFShape.setEscherProperty(opt, EscherProperties.FILL__FILLOPACITY, alphaFP); + HSLFShape.setEscherProperty(opt, EscherPropertyTypes.FILL__FILLOPACITY, alphaFP); } } - EscherSimpleProperty p = HSLFShape.getEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST); + EscherSimpleProperty p = HSLFShape.getEscherProperty(opt, EscherPropertyTypes.FILL__NOFILLHITTEST); int propVal = (p == null) ? 0 : p.getPropertyValue(); propVal = FILL_FILLED.setBoolean(propVal, color != null); propVal = FILL_NO_FILL_HIT_TEST.setBoolean(propVal, color != null); @@ -453,7 +453,7 @@ public final class HSLFFill { // TODO: check why we always clear this ... propVal = FILL_FILL_SHAPE.clear(propVal); - HSLFShape.setEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST, propVal); + HSLFShape.setEscherProperty(opt, EscherPropertyTypes.FILL__NOFILLHITTEST, propVal); } /** @@ -461,11 +461,11 @@ public final class HSLFFill { */ public Color getBackgroundColor(){ AbstractEscherOptRecord opt = shape.getEscherOptRecord(); - EscherSimpleProperty p = HSLFShape.getEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST); + EscherSimpleProperty p = HSLFShape.getEscherProperty(opt, EscherPropertyTypes.FILL__NOFILLHITTEST); int propVal = (p == null) ? 0 : p.getPropertyValue(); return (FILL_USE_FILLED.isSet(propVal) && FILL_FILLED.isSet(propVal)) - ? shape.getColor(EscherProperties.FILL__FILLBACKCOLOR, EscherProperties.FILL__FILLOPACITY) + ? shape.getColor(EscherPropertyTypes.FILL__FILLBACKCOLOR, EscherPropertyTypes.FILL__FILLOPACITY) : null; } @@ -475,11 +475,11 @@ public final class HSLFFill { public void setBackgroundColor(Color color){ AbstractEscherOptRecord opt = shape.getEscherOptRecord(); if (color == null) { - HSLFShape.setEscherProperty(opt, EscherProperties.FILL__FILLBACKCOLOR, -1); + HSLFShape.setEscherProperty(opt, EscherPropertyTypes.FILL__FILLBACKCOLOR, -1); } else { int rgb = new Color(color.getBlue(), color.getGreen(), color.getRed(), 0).getRGB(); - HSLFShape.setEscherProperty(opt, EscherProperties.FILL__FILLBACKCOLOR, rgb); + HSLFShape.setEscherProperty(opt, EscherPropertyTypes.FILL__FILLBACKCOLOR, rgb); } } @@ -489,7 +489,7 @@ public final class HSLFFill { @SuppressWarnings("resource") public HSLFPictureData getPictureData(){ AbstractEscherOptRecord opt = shape.getEscherOptRecord(); - EscherSimpleProperty p = HSLFShape.getEscherProperty(opt, EscherProperties.FILL__PATTERNTEXTURE); + EscherSimpleProperty p = HSLFShape.getEscherProperty(opt, EscherPropertyTypes.FILL__PATTERNTEXTURE); if (p == null) { return null; } @@ -524,7 +524,7 @@ public final class HSLFFill { */ public void setPictureData(HSLFPictureData data){ AbstractEscherOptRecord opt = shape.getEscherOptRecord(); - HSLFShape.setEscherProperty(opt, (short)(EscherProperties.FILL__PATTERNTEXTURE + 0x4000), (data == null ? 0 : data.getIndex())); + HSLFShape.setEscherProperty(opt, EscherPropertyTypes.FILL__PATTERNTEXTURE, true, (data == null ? 0 : data.getIndex())); if(data != null && shape.getSheet() != null) { EscherBSERecord bse = getEscherBSERecord(data.getIndex()); if (bse != null) { diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFreeformShape.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFreeformShape.java index 10eeb7b19c..a079c794a0 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFreeformShape.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFreeformShape.java @@ -28,7 +28,7 @@ import java.util.List; import org.apache.poi.ddf.AbstractEscherOptRecord; import org.apache.poi.ddf.EscherArrayProperty; import org.apache.poi.ddf.EscherContainerRecord; -import org.apache.poi.ddf.EscherProperties; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.ddf.EscherSimpleProperty; import org.apache.poi.sl.usermodel.FreeformShape; import org.apache.poi.sl.usermodel.ShapeContainer; @@ -162,9 +162,9 @@ public final class HSLFFreeformShape extends HSLFAutoShape implements FreeformSh segInfo.add(SEGMENTINFO_END); AbstractEscherOptRecord opt = getEscherOptRecord(); - opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__SHAPEPATH, 0x4)); + opt.addEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.GEOMETRY__SHAPEPATH, 0x4)); - EscherArrayProperty verticesProp = new EscherArrayProperty((short)(EscherProperties.GEOMETRY__VERTICES + 0x4000), false, null); + EscherArrayProperty verticesProp = new EscherArrayProperty(EscherPropertyTypes.GEOMETRY__VERTICES, true, 0); verticesProp.setNumberOfElementsInArray(pntInfo.size()); verticesProp.setNumberOfElementsInMemory(pntInfo.size()); verticesProp.setSizeOfElements(8); @@ -177,7 +177,7 @@ public final class HSLFFreeformShape extends HSLFAutoShape implements FreeformSh } opt.addEscherProperty(verticesProp); - EscherArrayProperty segmentsProp = new EscherArrayProperty((short)(EscherProperties.GEOMETRY__SEGMENTINFO + 0x4000), false, null); + EscherArrayProperty segmentsProp = new EscherArrayProperty(EscherPropertyTypes.GEOMETRY__SEGMENTINFO, true, 0); segmentsProp.setNumberOfElementsInArray(segInfo.size()); segmentsProp.setNumberOfElementsInMemory(segInfo.size()); segmentsProp.setSizeOfElements(0x2); @@ -187,8 +187,8 @@ public final class HSLFFreeformShape extends HSLFAutoShape implements FreeformSh } opt.addEscherProperty(segmentsProp); - opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__RIGHT, Units.pointsToMaster(bounds.getWidth()))); - opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__BOTTOM, Units.pointsToMaster(bounds.getHeight()))); + opt.addEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.GEOMETRY__RIGHT, Units.pointsToMaster(bounds.getWidth()))); + opt.addEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.GEOMETRY__BOTTOM, Units.pointsToMaster(bounds.getHeight()))); opt.sortProperties(); diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFLine.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFLine.java index 668b3e88ec..1e42326f26 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFLine.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFLine.java @@ -19,7 +19,7 @@ package org.apache.poi.hslf.usermodel; import org.apache.poi.ddf.AbstractEscherOptRecord; import org.apache.poi.ddf.EscherContainerRecord; -import org.apache.poi.ddf.EscherProperties; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.ddf.EscherSpRecord; import org.apache.poi.sl.usermodel.Line; import org.apache.poi.sl.usermodel.ShapeContainer; @@ -58,12 +58,12 @@ public final class HSLFLine extends HSLFTextShape implements Line { */ @Override public String getShapeName(){ - final EscherComplexProperty ep = getEscherProperty(getEscherOptRecord(), EscherProperties.GROUPSHAPE__SHAPENAME); + final EscherComplexProperty ep = getEscherProperty(getEscherOptRecord(), EscherPropertyTypes.GROUPSHAPE__SHAPENAME); if (ep != null) { final byte[] cd = ep.getComplexData(); return StringUtil.getFromUnicodeLE0Terminated(cd, 0, cd.length/2); @@ -260,20 +261,37 @@ public abstract class HSLFShape implements Shape { * Returns escher property by id. * * @return escher property or null if not found. + * + * @deprecated use {@link #getEscherProperty(EscherPropertyTypes)} instead */ + @Deprecated + @Removal(version = "5.0.0") public static T getEscherProperty(AbstractEscherOptRecord opt, int propId){ return (opt == null) ? null : opt.lookup(propId); } + /** + * Returns escher property by type. + * + * @return escher property or null if not found. + */ + public static T getEscherProperty(AbstractEscherOptRecord opt, EscherPropertyTypes type){ + return (opt == null) ? null : opt.lookup(type); + } + /** * Set an escher property for this shape. * * @param opt The opt record to set the properties to. * @param propId The id of the property. One of the constants defined in EscherOptRecord. * @param value value of the property. If value = -1 then the property is removed. + * + * @deprecated use {@link #setEscherProperty(AbstractEscherOptRecord, EscherPropertyTypes, int)} */ - public static void setEscherProperty(AbstractEscherOptRecord opt, short propId, int value){ - java.util.List props = opt.getEscherProperties(); + @Deprecated + @Removal(version = "5.0.0") + public static void setEscherProperty(AbstractEscherOptRecord opt, short propId, int value){ + List props = opt.getEscherProperties(); for ( Iterator iterator = props.iterator(); iterator.hasNext(); ) { if (iterator.next().getPropertyNumber() == propId){ iterator.remove(); @@ -286,39 +304,107 @@ public abstract class HSLFShape implements Shape { } } + /** + * Set an escher property for this shape. + * + * @param opt The opt record to set the properties to. + * @param propType The type of the property. + * @param value value of the property. If value = -1 then the property is removed. + */ + public static void setEscherProperty(AbstractEscherOptRecord opt, EscherPropertyTypes propType, int value){ + setEscherProperty(opt, propType, false, value); + } + + public static void setEscherProperty(AbstractEscherOptRecord opt, EscherPropertyTypes propType, boolean isBlipId, int value){ + List props = opt.getEscherProperties(); + for ( Iterator iterator = props.iterator(); iterator.hasNext(); ) { + if (iterator.next().getPropertyNumber() == propType.propNumber){ + iterator.remove(); + break; + } + } + if (value != -1) { + opt.addEscherProperty(new EscherSimpleProperty(propType, false, isBlipId, value)); + opt.sortProperties(); + } + } + + + /** * Set an simple escher property for this shape. * * @param propId The id of the property. One of the constants defined in EscherOptRecord. * @param value value of the property. If value = -1 then the property is removed. + * + * @deprecated use {@link #setEscherProperty(EscherPropertyTypes, int)} */ + @Deprecated + @Removal(version = "5.0.0") public void setEscherProperty(short propId, int value){ AbstractEscherOptRecord opt = getEscherOptRecord(); setEscherProperty(opt, propId, value); } + /** + * Set an simple escher property for this shape. + * + * @param propType The type of the property. + * @param value value of the property. If value = -1 then the property is removed. + */ + public void setEscherProperty(EscherPropertyTypes propType, int value){ + AbstractEscherOptRecord opt = getEscherOptRecord(); + setEscherProperty(opt, propType, value); + } + /** * Get the value of a simple escher property for this shape. * * @param propId The id of the property. One of the constants defined in EscherOptRecord. */ - public int getEscherProperty(short propId){ - AbstractEscherOptRecord opt = getEscherOptRecord(); + public int getEscherProperty(short propId){ + AbstractEscherOptRecord opt = getEscherOptRecord(); EscherSimpleProperty prop = getEscherProperty(opt, propId); return prop == null ? 0 : prop.getPropertyValue(); } + /** + * Get the value of a simple escher property for this shape. + * + * @param propType The type of the property. One of the constants defined in EscherOptRecord. + */ + public int getEscherProperty(EscherPropertyTypes propType){ + AbstractEscherOptRecord opt = getEscherOptRecord(); + EscherSimpleProperty prop = getEscherProperty(opt, propType); + return prop == null ? 0 : prop.getPropertyValue(); + } + /** * Get the value of a simple escher property for this shape. * * @param propId The id of the property. One of the constants defined in EscherOptRecord. + * + * @deprecated use {@link #getEscherProperty(EscherPropertyTypes, int)} instead */ - public int getEscherProperty(short propId, int defaultValue){ - AbstractEscherOptRecord opt = getEscherOptRecord(); + @Deprecated + @Removal(version = "5.0.0") + public int getEscherProperty(short propId, int defaultValue){ + AbstractEscherOptRecord opt = getEscherOptRecord(); EscherSimpleProperty prop = getEscherProperty(opt, propId); return prop == null ? defaultValue : prop.getPropertyValue(); } + /** + * Get the value of a simple escher property for this shape. + * + * @param type The type of the property. + */ + public int getEscherProperty(EscherPropertyTypes type, int defaultValue){ + AbstractEscherOptRecord opt = getEscherOptRecord(); + EscherSimpleProperty prop = getEscherProperty(opt, type); + return prop == null ? defaultValue : prop.getPropertyValue(); + } + /** * @return The shape container and it's children that can represent this * shape. @@ -358,7 +444,7 @@ public abstract class HSLFShape implements Shape { _sheet = sheet; } - Color getColor(short colorProperty, short opacityProperty){ + Color getColor(EscherPropertyTypes colorProperty, EscherPropertyTypes opacityProperty){ final AbstractEscherOptRecord opt = getEscherOptRecord(); final EscherSimpleProperty colProp = getEscherProperty(opt, colorProperty); final Color col; @@ -509,7 +595,7 @@ public abstract class HSLFShape implements Shape { return col; } - double getAlpha(short opacityProperty) { + double getAlpha(EscherPropertyTypes opacityProperty) { AbstractEscherOptRecord opt = getEscherOptRecord(); EscherSimpleProperty op = getEscherProperty(opt, opacityProperty); int defaultOpacity = 0x00010000; @@ -607,13 +693,13 @@ public abstract class HSLFShape implements Shape { } public double getRotation(){ - int rot = getEscherProperty(EscherProperties.TRANSFORM__ROTATION); + int rot = getEscherProperty(EscherPropertyTypes.TRANSFORM__ROTATION); return Units.fixedPointToDouble(rot); } public void setRotation(double theta){ int rot = Units.doubleToFixedPoint(theta % 360.0); - setEscherProperty(EscherProperties.TRANSFORM__ROTATION, rot); + setEscherProperty(EscherPropertyTypes.TRANSFORM__ROTATION, rot); } public boolean isPlaceholder() { diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapeFactory.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapeFactory.java index 7ff8404e7f..9bd016187f 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapeFactory.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapeFactory.java @@ -23,9 +23,9 @@ import org.apache.poi.ddf.AbstractEscherOptRecord; import org.apache.poi.ddf.EscherClientDataRecord; import org.apache.poi.ddf.EscherContainerRecord; import org.apache.poi.ddf.EscherOptRecord; -import org.apache.poi.ddf.EscherProperties; import org.apache.poi.ddf.EscherProperty; import org.apache.poi.ddf.EscherPropertyFactory; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.ddf.EscherRecord; import org.apache.poi.ddf.EscherRecordTypes; import org.apache.poi.ddf.EscherSimpleProperty; @@ -71,7 +71,7 @@ public final class HSLFShapeFactory { EscherPropertyFactory f = new EscherPropertyFactory(); List props = f.createProperties( opt.serialize(), 8, opt.getInstance() ); for (EscherProperty ep : props) { - if (ep.getPropertyNumber() == EscherProperties.GROUPSHAPE__TABLEPROPERTIES + if (ep.getPropertyNumber() == EscherPropertyTypes.GROUPSHAPE__TABLEPROPERTIES.propNumber && ep instanceof EscherSimpleProperty && (((EscherSimpleProperty)ep).getPropertyValue() & 1) == 1) { isTable = true; @@ -150,7 +150,7 @@ public final class HSLFShapeFactory { private static HSLFShape createNonPrimitive(EscherContainerRecord spContainer, ShapeContainer parent) { AbstractEscherOptRecord opt = HSLFShape.getEscherChild(spContainer, EscherOptRecord.RECORD_ID); - EscherProperty prop = HSLFShape.getEscherProperty(opt, EscherProperties.GEOMETRY__VERTICES); + EscherProperty prop = HSLFShape.getEscherProperty(opt, EscherPropertyTypes.GEOMETRY__VERTICES); if(prop != null) { return new HSLFFreeformShape(spContainer, parent); } diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapePlaceholderDetails.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapePlaceholderDetails.java index 181f172e19..519bb3ac76 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapePlaceholderDetails.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapePlaceholderDetails.java @@ -17,7 +17,7 @@ package org.apache.poi.hslf.usermodel; -import org.apache.poi.ddf.EscherProperties; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.ddf.EscherSpRecord; import org.apache.poi.hslf.exceptions.HSLFException; import org.apache.poi.hslf.record.HSLFEscherClientDataRecord; @@ -96,7 +96,7 @@ public class HSLFShapePlaceholderDetails extends HSLFPlaceholderDetails { spRecord.setFlags(flags); // Placeholders can't be grouped - shape.setEscherProperty(EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, (placeholder == null ? -1 : 262144)); + shape.setEscherProperty(EscherPropertyTypes.PROTECTION__LOCKAGAINSTGROUPING, (placeholder == null ? -1 : 262144)); if (placeholder == null) { removePlaceholder(); diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java index 55d3932d02..824122b565 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java @@ -24,8 +24,8 @@ import org.apache.poi.ddf.EscherChildAnchorRecord; import org.apache.poi.ddf.EscherClientAnchorRecord; import org.apache.poi.ddf.EscherContainerRecord; import org.apache.poi.ddf.EscherOptRecord; -import org.apache.poi.ddf.EscherProperties; import org.apache.poi.ddf.EscherProperty; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.ddf.EscherRecord; import org.apache.poi.ddf.EscherSimpleProperty; import org.apache.poi.ddf.EscherSpRecord; @@ -62,6 +62,19 @@ public abstract class HSLFSimpleShape extends HSLFShape implements SimpleShape 10) { + throw new HSLFException("invalid adjust value: "+adjInt); } + + EscherPropertyTypes escherProp = ADJUST_VALUES[adjInt]; + int adjval = getEscherProperty(escherProp, -1); if (adjval == -1) { @@ -389,18 +390,18 @@ public abstract class HSLFSimpleShape extends HSLFShape implements SimpleShapejava.awt.Color.black */ public Color getShadowColor(){ - Color clr = getColor(EscherProperties.SHADOWSTYLE__COLOR, EscherProperties.SHADOWSTYLE__OPACITY); + Color clr = getColor(EscherPropertyTypes.SHADOWSTYLE__COLOR, EscherPropertyTypes.SHADOWSTYLE__OPACITY); return clr == null ? Color.black : clr; } @@ -419,7 +420,7 @@ public abstract class HSLFSimpleShape extends HSLFShape implements SimpleShape { EscherContainerRecord spCont = (EscherContainerRecord) getSpContainer().getChild(0); AbstractEscherOptRecord opt = new EscherOptRecord(); opt.setRecordId(EscherRecordTypes.USER_DEFINED.typeID); - opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GROUPSHAPE__TABLEPROPERTIES, 1)); - EscherArrayProperty p = new EscherArrayProperty((short)(0x4000 | EscherProperties.GROUPSHAPE__TABLEROWPROPERTIES), false, null); + opt.addEscherProperty(new EscherSimpleProperty(EscherPropertyTypes.GROUPSHAPE__TABLEPROPERTIES, 1)); + EscherArrayProperty p = new EscherArrayProperty(EscherPropertyTypes.GROUPSHAPE__TABLEROWPROPERTIES, true, 0); p.setSizeOfElements(0x0004); p.setNumberOfElementsInArray(numRows); p.setNumberOfElementsInMemory(numRows); @@ -368,7 +368,7 @@ implements HSLFShapeContainer, TableShape { // update row height in the table properties AbstractEscherOptRecord opt = getEscherChild(EscherRecordTypes.USER_DEFINED); - EscherArrayProperty p = opt.lookup(EscherProperties.GROUPSHAPE__TABLEROWPROPERTIES); + EscherArrayProperty p = opt.lookup(EscherPropertyTypes.GROUPSHAPE__TABLEROWPROPERTIES); byte[] masterBytes = p.getElement(row); double currentHeight = Units.masterToPoints(LittleEndian.getInt(masterBytes, 0)); LittleEndian.putInt(masterBytes, 0, Units.pointsToMaster(height)); @@ -461,7 +461,7 @@ implements HSLFShapeContainer, TableShape { private void updateRowHeightsProperty() { AbstractEscherOptRecord opt = getEscherChild(EscherRecordTypes.USER_DEFINED); - EscherArrayProperty p = opt.lookup(EscherProperties.GROUPSHAPE__TABLEROWPROPERTIES); + EscherArrayProperty p = opt.lookup(EscherPropertyTypes.GROUPSHAPE__TABLEROWPROPERTIES); byte[] val = new byte[4]; for (int rowIdx = 0; rowIdx < cells.length; rowIdx++) { int rowHeight = Units.pointsToMaster(cells[rowIdx][0].getAnchor().getHeight()); diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTableCell.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTableCell.java index 8477cadde0..0956e6f31d 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTableCell.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTableCell.java @@ -22,7 +22,7 @@ import java.awt.geom.Rectangle2D; import org.apache.poi.ddf.AbstractEscherOptRecord; import org.apache.poi.ddf.EscherContainerRecord; -import org.apache.poi.ddf.EscherProperties; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.sl.draw.DrawPaint; import org.apache.poi.sl.usermodel.PaintStyle; import org.apache.poi.sl.usermodel.ShapeType; @@ -81,11 +81,11 @@ public final class HSLFTableCell extends HSLFTextBox implements TableCell { */ /* package */ HSLFTextAnchor getAlignment(){ AbstractEscherOptRecord opt = getEscherOptRecord(); - EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.TEXT__ANCHORTEXT); + EscherSimpleProperty prop = getEscherProperty(opt, EscherPropertyTypes.TEXT__ANCHORTEXT); final HSLFTextAnchor align; if (prop == null){ /** @@ -416,7 +416,7 @@ implements TextShape { (hta.vAlign == vAlign) && (hta.baseline == null || hta.baseline == baseline) ) { - setEscherProperty(EscherProperties.TEXT__ANCHORTEXT, hta.nativeId); + setEscherProperty(EscherPropertyTypes.TEXT__ANCHORTEXT, hta.nativeId); break; } } @@ -467,7 +467,7 @@ implements TextShape { * @return the botom margin */ public double getBottomInset(){ - return getInset(EscherProperties.TEXT__TEXTBOTTOM, .05); + return getInset(EscherPropertyTypes.TEXT__TEXTBOTTOM, .05); } /** @@ -477,7 +477,7 @@ implements TextShape { * @param margin the bottom margin */ public void setBottomInset(double margin){ - setInset(EscherProperties.TEXT__TEXTBOTTOM, margin); + setInset(EscherPropertyTypes.TEXT__TEXTBOTTOM, margin); } /** @@ -489,7 +489,7 @@ implements TextShape { * @return the left margin */ public double getLeftInset(){ - return getInset(EscherProperties.TEXT__TEXTLEFT, .1); + return getInset(EscherPropertyTypes.TEXT__TEXTLEFT, .1); } /** @@ -499,7 +499,7 @@ implements TextShape { * @param margin the left margin */ public void setLeftInset(double margin){ - setInset(EscherProperties.TEXT__TEXTLEFT, margin); + setInset(EscherPropertyTypes.TEXT__TEXTLEFT, margin); } /** @@ -511,7 +511,7 @@ implements TextShape { * @return the right margin */ public double getRightInset(){ - return getInset(EscherProperties.TEXT__TEXTRIGHT, .1); + return getInset(EscherPropertyTypes.TEXT__TEXTRIGHT, .1); } /** @@ -521,7 +521,7 @@ implements TextShape { * @param margin the right margin */ public void setRightInset(double margin){ - setInset(EscherProperties.TEXT__TEXTRIGHT, margin); + setInset(EscherPropertyTypes.TEXT__TEXTRIGHT, margin); } /** @@ -532,7 +532,7 @@ implements TextShape { * @return the top margin */ public double getTopInset(){ - return getInset(EscherProperties.TEXT__TEXTTOP, .05); + return getInset(EscherPropertyTypes.TEXT__TEXTTOP, .05); } /** @@ -542,7 +542,7 @@ implements TextShape { * @param margin the top margin */ public void setTopInset(double margin){ - setInset(EscherProperties.TEXT__TEXTTOP, margin); + setInset(EscherPropertyTypes.TEXT__TEXTTOP, margin); } /** @@ -550,22 +550,22 @@ implements TextShape { * and the edge of the inscribed rectangle of the shape that contains the text. * Default value is 1/20 inch. * - * @param propId the id of the inset edge + * @param type the type of the inset edge * @return the inset in points */ - private double getInset(short propId, double defaultInch) { + private double getInset(EscherPropertyTypes type, double defaultInch) { AbstractEscherOptRecord opt = getEscherOptRecord(); - EscherSimpleProperty prop = getEscherProperty(opt, propId); + EscherSimpleProperty prop = getEscherProperty(opt, type); int val = prop == null ? (int)(Units.toEMU(Units.POINT_DPI)*defaultInch) : prop.getPropertyValue(); return Units.toPoints(val); } /** - * @param propId the id of the inset edge + * @param type the type of the inset edge * @param margin the inset in points */ - private void setInset(short propId, double margin){ - setEscherProperty(propId, Units.toEMU(margin)); + private void setInset(EscherPropertyTypes type, double margin){ + setEscherProperty(type, Units.toEMU(margin)); } /** @@ -578,7 +578,7 @@ implements TextShape { */ public int getWordWrapEx() { AbstractEscherOptRecord opt = getEscherOptRecord(); - EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.TEXT__WRAPTEXT); + EscherSimpleProperty prop = getEscherProperty(opt, EscherPropertyTypes.TEXT__WRAPTEXT); return prop == null ? WrapSquare : prop.getPropertyValue(); } @@ -589,7 +589,7 @@ implements TextShape { * Must be one of the Wrap* constants defined in this class. */ public void setWordWrapEx(int wrap){ - setEscherProperty(EscherProperties.TEXT__WRAPTEXT, wrap); + setEscherProperty(EscherPropertyTypes.TEXT__WRAPTEXT, wrap); } @Override @@ -608,7 +608,7 @@ implements TextShape { */ public int getTextId(){ AbstractEscherOptRecord opt = getEscherOptRecord(); - EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.TEXT__TEXTID); + EscherSimpleProperty prop = getEscherProperty(opt, EscherPropertyTypes.TEXT__TEXTID); return prop == null ? 0 : prop.getPropertyValue(); } @@ -618,7 +618,7 @@ implements TextShape { * @param id of the text */ public void setTextId(int id){ - setEscherProperty(EscherProperties.TEXT__TEXTID, id); + setEscherProperty(EscherPropertyTypes.TEXT__TEXTID, id); } @Override @@ -732,7 +732,7 @@ implements TextShape { public TextDirection getTextDirection() { // see 2.4.5 MSOTXFL AbstractEscherOptRecord opt = getEscherOptRecord(); - EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.TEXT__TEXTFLOW); + EscherSimpleProperty prop = getEscherProperty(opt, EscherPropertyTypes.TEXT__TEXTFLOW); int msotxfl = (prop == null) ? 0 : prop.getPropertyValue(); switch (msotxfl) { default: @@ -774,14 +774,14 @@ implements TextShape { break; } } - setEscherProperty(opt, EscherProperties.TEXT__TEXTFLOW, msotxfl); + setEscherProperty(opt, EscherPropertyTypes.TEXT__TEXTFLOW, msotxfl); } @Override public Double getTextRotation() { // see 2.4.6 MSOCDIR AbstractEscherOptRecord opt = getEscherOptRecord(); - EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.TEXT__FONTROTATION); + EscherSimpleProperty prop = getEscherProperty(opt, EscherPropertyTypes.TEXT__FONTROTATION); return (prop == null) ? null : (90. * prop.getPropertyValue()); } @@ -789,10 +789,10 @@ implements TextShape { public void setTextRotation(Double rotation) { AbstractEscherOptRecord opt = getEscherOptRecord(); if (rotation == null) { - opt.removeEscherProperty(EscherProperties.TEXT__FONTROTATION); + opt.removeEscherProperty(EscherPropertyTypes.TEXT__FONTROTATION); } else { int rot = (int)(Math.round(rotation / 90.) % 4L); - setEscherProperty(EscherProperties.TEXT__FONTROTATION, rot); + setEscherProperty(EscherPropertyTypes.TEXT__FONTROTATION, rot); } } diff --git a/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfColorRef.java b/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfColorRef.java index cd78ccdc8a..1ea80968a3 100644 --- a/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfColorRef.java +++ b/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfColorRef.java @@ -86,6 +86,6 @@ public class HwmfColorRef implements Cloneable, GenericRecord { @Override public Map> getGenericProperties() { - return GenericRecordUtil.getGenericProperties("color", colorRef::getRGB); + return GenericRecordUtil.getGenericProperties("color", this::getColor); } } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/OfficeDrawingsImpl.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/OfficeDrawingsImpl.java index d1a6e284db..c71ed6cc7f 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/OfficeDrawingsImpl.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/OfficeDrawingsImpl.java @@ -21,18 +21,17 @@ import java.util.Collection; import java.util.Collections; import java.util.List; -import org.apache.poi.ddf.EscherTertiaryOptRecord; - import org.apache.poi.ddf.DefaultEscherRecordFactory; import org.apache.poi.ddf.EscherBSERecord; import org.apache.poi.ddf.EscherBlipRecord; import org.apache.poi.ddf.EscherContainerRecord; import org.apache.poi.ddf.EscherOptRecord; -import org.apache.poi.ddf.EscherProperties; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.ddf.EscherRecord; import org.apache.poi.ddf.EscherRecordFactory; import org.apache.poi.ddf.EscherSimpleProperty; import org.apache.poi.ddf.EscherSpRecord; +import org.apache.poi.ddf.EscherTertiaryOptRecord; import org.apache.poi.hwpf.model.EscherRecordHolder; import org.apache.poi.hwpf.model.FSPA; import org.apache.poi.hwpf.model.FSPATable; @@ -125,8 +124,7 @@ public class OfficeDrawingsImpl implements OfficeDrawings { public HorizontalPositioning getHorizontalPositioning() { - int value = getTertiaryPropertyValue( - EscherProperties.GROUPSHAPE__POSH, -1 ); + int value = getTertiaryPropertyValue(EscherPropertyTypes.GROUPSHAPE__POSH ); switch ( value ) { @@ -149,8 +147,7 @@ public class OfficeDrawingsImpl implements OfficeDrawings public HorizontalRelativeElement getHorizontalRelative() { - int value = getTertiaryPropertyValue( - EscherProperties.GROUPSHAPE__POSRELH, -1 ); + int value = getTertiaryPropertyValue( EscherPropertyTypes.GROUPSHAPE__POSRELH ); switch ( value ) { @@ -184,7 +181,7 @@ public class OfficeDrawingsImpl implements OfficeDrawings return null; EscherSimpleProperty escherProperty = escherOptRecord - .lookup( EscherProperties.BLIP__BLIPTODISPLAY ); + .lookup( EscherPropertyTypes.BLIP__BLIPTODISPLAY ); if ( escherProperty == null ) return null; @@ -221,30 +218,25 @@ public class OfficeDrawingsImpl implements OfficeDrawings return fspa.getSpid(); } - private int getTertiaryPropertyValue( int propertyId, - int defaultValue ) - { + private int getTertiaryPropertyValue( EscherPropertyTypes type ) { EscherContainerRecord shapeDescription = getEscherShapeRecordContainer( getShapeId() ); - if ( shapeDescription == null ) - return defaultValue; + if ( shapeDescription == null ) { + return -1; + } EscherTertiaryOptRecord escherTertiaryOptRecord = shapeDescription .getChildById( EscherTertiaryOptRecord.RECORD_ID ); - if ( escherTertiaryOptRecord == null ) - return defaultValue; - - EscherSimpleProperty escherProperty = escherTertiaryOptRecord - .lookup( propertyId ); - if ( escherProperty == null ) - return defaultValue; + if ( escherTertiaryOptRecord == null ) { + return -1; + } - return escherProperty.getPropertyValue(); + EscherSimpleProperty escherProperty = escherTertiaryOptRecord.lookup( type ); + return ( escherProperty == null ) ? -1 : escherProperty.getPropertyValue(); } public VerticalPositioning getVerticalPositioning() { - int value = getTertiaryPropertyValue( - EscherProperties.GROUPSHAPE__POSV, -1 ); + int value = getTertiaryPropertyValue( EscherPropertyTypes.GROUPSHAPE__POSV ); switch ( value ) { @@ -267,8 +259,7 @@ public class OfficeDrawingsImpl implements OfficeDrawings public VerticalRelativeElement getVerticalRelativeElement() { - int value = getTertiaryPropertyValue( - EscherProperties.GROUPSHAPE__POSV, -1 ); + int value = getTertiaryPropertyValue( EscherPropertyTypes.GROUPSHAPE__POSV ); switch ( value ) { diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java index d8ab165f03..d38e883aaf 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java @@ -29,8 +29,8 @@ import org.apache.poi.ddf.EscherBSERecord; import org.apache.poi.ddf.EscherBlipRecord; import org.apache.poi.ddf.EscherComplexProperty; import org.apache.poi.ddf.EscherOptRecord; -import org.apache.poi.ddf.EscherProperties; import org.apache.poi.ddf.EscherProperty; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.ddf.EscherRecord; import org.apache.poi.hwpf.model.PICF; import org.apache.poi.hwpf.model.PICFAndOfficeArtData; @@ -468,11 +468,11 @@ public final class Picture { */ public String getDescription() { - for(EscherRecord escherRecord : _picfAndOfficeArtData.getShape().getChildRecords()){ + for(EscherRecord escherRecord : _picfAndOfficeArtData.getShape()){ if(escherRecord instanceof EscherOptRecord){ EscherOptRecord escherOptRecord = (EscherOptRecord) escherRecord; for(EscherProperty property : escherOptRecord.getEscherProperties()){ - if(EscherProperties.GROUPSHAPE__DESCRIPTION == property.getPropertyNumber()){ + if (EscherPropertyTypes.GROUPSHAPE__DESCRIPTION.propNumber == property.getPropertyNumber()){ byte[] complexData = ((EscherComplexProperty)property).getComplexData(); return StringUtil.getFromUnicodeLE(complexData,0,complexData.length/2-1); } diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java index ce4ce48fb5..34de4fb252 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java @@ -38,7 +38,7 @@ import org.apache.poi.POIDataSamples; import org.apache.poi.ddf.AbstractEscherOptRecord; import org.apache.poi.ddf.EscherDgRecord; import org.apache.poi.ddf.EscherDggRecord; -import org.apache.poi.ddf.EscherProperties; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.ddf.EscherSimpleProperty; import org.apache.poi.hslf.usermodel.HSLFAutoShape; import org.apache.poi.hslf.usermodel.HSLFGroupShape; @@ -407,12 +407,12 @@ public final class TestShapes { HSLFSimpleShape sh = new HSLFAutoShape(ShapeType.RT_TRIANGLE); AbstractEscherOptRecord opt = sh.getEscherOptRecord(); - EscherSimpleProperty prop = HSLFSimpleShape.getEscherProperty(opt, EscherProperties.LINESTYLE__LINEWIDTH); + EscherSimpleProperty prop = HSLFSimpleShape.getEscherProperty(opt, EscherPropertyTypes.LINESTYLE__LINEWIDTH); assertNull(prop); assertEquals(HSLFSimpleShape.DEFAULT_LINE_WIDTH, sh.getLineWidth(), 0); sh.setLineWidth(1.0); - prop = HSLFSimpleShape.getEscherProperty(opt, EscherProperties.LINESTYLE__LINEWIDTH); + prop = HSLFSimpleShape.getEscherProperty(opt, EscherPropertyTypes.LINESTYLE__LINEWIDTH); assertNotNull(prop); assertEquals(1.0, sh.getLineWidth(), 0); } diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBackground.java b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBackground.java index 2732d16183..8853530f60 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBackground.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBackground.java @@ -28,18 +28,11 @@ import org.apache.poi.POIDataSamples; import org.apache.poi.ddf.AbstractEscherOptRecord; import org.apache.poi.ddf.EscherBSERecord; import org.apache.poi.ddf.EscherContainerRecord; -import org.apache.poi.ddf.EscherProperties; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.ddf.EscherRecord; import org.apache.poi.ddf.EscherSimpleProperty; import org.apache.poi.hslf.HSLFTestDataSamples; import org.apache.poi.hslf.record.Document; -import org.apache.poi.hslf.usermodel.HSLFAutoShape; -import org.apache.poi.hslf.usermodel.HSLFFill; -import org.apache.poi.hslf.usermodel.HSLFPictureData; -import org.apache.poi.hslf.usermodel.HSLFShape; -import org.apache.poi.hslf.usermodel.HSLFSheet; -import org.apache.poi.hslf.usermodel.HSLFSlide; -import org.apache.poi.hslf.usermodel.HSLFSlideShow; import org.apache.poi.sl.usermodel.PictureData.PictureType; import org.apache.poi.sl.usermodel.ShapeType; import org.junit.Test; @@ -209,7 +202,7 @@ public final class TestBackground { private int getFillPictureRefCount(HSLFShape shape, HSLFFill fill) { AbstractEscherOptRecord opt = shape.getEscherOptRecord(); - EscherSimpleProperty p = HSLFShape.getEscherProperty(opt, EscherProperties.FILL__PATTERNTEXTURE); + EscherSimpleProperty p = HSLFShape.getEscherProperty(opt, EscherPropertyTypes.FILL__PATTERNTEXTURE); if(p != null) { int idx = p.getPropertyValue(); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java index 4d06249f6a..43a855c8f7 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java @@ -53,7 +53,7 @@ import org.apache.poi.common.usermodel.fonts.FontGroup; import org.apache.poi.ddf.AbstractEscherOptRecord; import org.apache.poi.ddf.EscherArrayProperty; import org.apache.poi.ddf.EscherColorRef; -import org.apache.poi.ddf.EscherProperties; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.hslf.HSLFTestDataSamples; import org.apache.poi.hslf.exceptions.OldPowerPointFormatException; import org.apache.poi.hslf.model.HeadersFooters; @@ -600,7 +600,7 @@ public final class TestBugs { HSLFSlideShow ppt = open("bug46441.ppt"); HSLFAutoShape as = (HSLFAutoShape)ppt.getSlides().get(0).getShapes().get(0); AbstractEscherOptRecord opt = as.getEscherOptRecord(); - EscherArrayProperty ep = HSLFShape.getEscherProperty(opt, EscherProperties.FILL__SHADECOLORS); + EscherArrayProperty ep = HSLFShape.getEscherProperty(opt, EscherPropertyTypes.FILL__SHADECOLORS); double[][] exp = { // r, g, b, position {94, 158, 255, 0}, diff --git a/src/testcases/org/apache/poi/ddf/TestEscherBSERecord.java b/src/testcases/org/apache/poi/ddf/TestEscherBSERecord.java index 903ccb24b7..5cf82068a7 100644 --- a/src/testcases/org/apache/poi/ddf/TestEscherBSERecord.java +++ b/src/testcases/org/apache/poi/ddf/TestEscherBSERecord.java @@ -23,6 +23,7 @@ import static org.junit.Assert.assertEquals; import java.io.IOException; import org.apache.poi.poifs.storage.RawDataUtil; +import org.apache.poi.sl.usermodel.PictureData; import org.apache.poi.util.HexDump; import org.apache.poi.util.HexRead; import org.junit.Test; @@ -37,8 +38,8 @@ public final class TestEscherBSERecord { int bytesWritten = r.fillFields( HexRead.readFromString( data ), 0, new DefaultEscherRecordFactory() ); assertEquals( 44, bytesWritten ); assertEquals( (short) 0x0001, r.getOptions() ); - assertEquals( EscherBSERecord.BT_JPEG, r.getBlipTypeWin32() ); - assertEquals( EscherBSERecord.BT_JPEG, r.getBlipTypeMacOS() ); + assertEquals( PictureData.PictureType.JPEG.nativeId, r.getBlipTypeWin32() ); + assertEquals( PictureData.PictureType.JPEG.nativeId, r.getBlipTypeMacOS() ); assertEquals( "[01, 02, 03, 04, 05, 06, 07, 08, 09, 0A, 0B, 0C, 0D, 0E, 0F, 00]", HexDump.toHex( r.getUid() ) ); assertEquals( (short) 1, r.getTag() ); assertEquals( 2, r.getRef() ); @@ -65,8 +66,8 @@ public final class TestEscherBSERecord { private EscherBSERecord createRecord() { EscherBSERecord r = new EscherBSERecord(); r.setOptions( (short) 0x0001 ); - r.setBlipTypeWin32( EscherBSERecord.BT_JPEG ); - r.setBlipTypeMacOS( EscherBSERecord.BT_JPEG ); + r.setBlipTypeWin32( (byte)PictureData.PictureType.JPEG.nativeId ); + r.setBlipTypeMacOS( (byte)PictureData.PictureType.JPEG.nativeId ); r.setUid( HexRead.readFromString( "01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00" ) ); r.setTag( (short) 1 ); r.setRef( 2 ); @@ -82,29 +83,31 @@ public final class TestEscherBSERecord { @Test public void testToString() { - String nl = System.getProperty("line.separator"); EscherBSERecord record = createRecord(); String expected = - "org.apache.poi.ddf.EscherBSERecord (BSE):" + nl + - " RecordId: 0xF007" + nl + - " Version: 0x0001" + nl + - " Instance: 0x0000" + nl + - " Options: 0x0001" + nl + - " Record Size: 44" + nl + - " BlipTypeWin32: 0x05" + nl + - " BlipTypeMacOS: 0x05" + nl + - " SUID: " + nl + - " 00: 01, 02, 03, 04, 05, 06, 07, 08, 09, 0A, 0B, 0C, 0D, 0E, 0F, 00" + nl + - " Tag: 0x0001" + nl + - " Size: 0x00000000" + nl + - " Ref: 0x00000002" + nl + - " Offset: 0x00000003" + nl + - " Usage: 0x04" + nl + - " Name: 0x05" + nl + - " Unused2: 0x06" + nl + - " Unused3: 0x07" + nl + - " Extra Data: " + nl + - " : 0"; + "{ /* BSE */\n" + + "\t recordId: -4089 /* 0xf007 */\n" + + "\t, version: 1\n" + + "\t, instance: 0\n" + + "\t, options: 1\n" + + "\t, recordSize: 44 /* 0x0000002c */\n" + + "\t, blipTypeWin32: 5\n" + + "\t, pictureTypeWin32: \"JPEG\"\n" + + "\t, blipTypeMacOS: 5\n" + + "\t, pictureTypeMacOS: \"JPEG\"\n" + + "\t, suid: \"AQIDBAUGBwgJCgsMDQ4PAA==\"\n" + + "\t, tag: 1\n" + + "\t, size: 0\n" + + "\t, ref: 2\n" + + "\t, offset: 3\n" + + "\t, usage: 4\n" + + "\t, name: 5\n" + + "\t, unused2: 6\n" + + "\t, unused3: 7\n" + + "\t, blipRecord: null\n" + + "\t, remainingData: \"\"\n" + + "}"; + String actual = record.toString(); assertEquals( expected, actual ); } diff --git a/src/testcases/org/apache/poi/ddf/TestEscherBlipRecord.java b/src/testcases/org/apache/poi/ddf/TestEscherBlipRecord.java index 8061186557..818a5cb97b 100644 --- a/src/testcases/org/apache/poi/ddf/TestEscherBlipRecord.java +++ b/src/testcases/org/apache/poi/ddf/TestEscherBlipRecord.java @@ -23,6 +23,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import org.apache.poi.POIDataSamples; +import org.apache.poi.sl.usermodel.PictureData; import org.junit.Test; /** @@ -41,8 +42,8 @@ public final class TestEscherBlipRecord { record.fillFields(data, 0, new DefaultEscherRecordFactory()); EscherContainerRecord bstore = (EscherContainerRecord)record.getChild(1); EscherBSERecord bse1 = (EscherBSERecord)bstore.getChild(0); - assertEquals(EscherBSERecord.BT_PNG, bse1.getBlipTypeWin32()); - assertEquals(EscherBSERecord.BT_PNG, bse1.getBlipTypeMacOS()); + assertEquals(PictureData.PictureType.PNG.nativeId, bse1.getBlipTypeWin32()); + assertEquals(PictureData.PictureType.PNG.nativeId, bse1.getBlipTypeMacOS()); assertArrayEquals(new byte[]{ 0x65, 0x07, 0x4A, (byte)0x8D, 0x3E, 0x42, (byte)0x8B, (byte)0xAC, 0x1D, (byte)0x89, 0x35, 0x4F, 0x48, (byte)0xFA, 0x37, (byte)0xC2 @@ -88,8 +89,8 @@ public final class TestEscherBlipRecord { EscherContainerRecord bstore = (EscherContainerRecord)record.getChild(1); EscherBSERecord bse1 = (EscherBSERecord)bstore.getChild(1); //System.out.println(bse1); - assertEquals(EscherBSERecord.BT_WMF, bse1.getBlipTypeWin32()); - assertEquals(EscherBSERecord.BT_PICT, bse1.getBlipTypeMacOS()); + assertEquals(PictureData.PictureType.WMF.nativeId, bse1.getBlipTypeWin32()); + assertEquals(PictureData.PictureType.PICT.nativeId, bse1.getBlipTypeMacOS()); assertArrayEquals(new byte[]{ (byte)0xC7, 0x15, 0x69, 0x2D, (byte)0xE5, (byte)0x89, (byte)0xA3, 0x6F, 0x66, 0x03, (byte)0xD6, 0x24, (byte)0xF7, (byte)0xDB, 0x1D, 0x13 diff --git a/src/testcases/org/apache/poi/ddf/TestEscherBoolProperty.java b/src/testcases/org/apache/poi/ddf/TestEscherBoolProperty.java index 5e65da8987..339f7e7894 100644 --- a/src/testcases/org/apache/poi/ddf/TestEscherBoolProperty.java +++ b/src/testcases/org/apache/poi/ddf/TestEscherBoolProperty.java @@ -24,7 +24,16 @@ import org.junit.Test; public final class TestEscherBoolProperty { @Test public void testToString() { - EscherBoolProperty p = new EscherBoolProperty((short)1, 1); - assertEquals("propNum: 1, RAW: 0x0001, propName: unknown, complex: false, blipId: false, value: 1 (0x00000001)", p.toString()); + EscherBoolProperty p = new EscherBoolProperty(EscherPropertyTypes.GEOMETRY__FILLOK, 1); + String expected = + "{ /* GEOMETRY__FILLOK */\n" + + "\t id: 383 /* 0x017f */\n" + + "\t, name: \"geometry.fillok\"\n" + + "\t, propertyNumber: 383 /* 0x017f */\n" + + "\t, propertySize: 6\n" + + "\t, flags: 0x17f /* */ \n" + + "\t, value: 1\n" + + "}"; + assertEquals(expected, p.toString()); } } diff --git a/src/testcases/org/apache/poi/ddf/TestEscherChildAnchorRecord.java b/src/testcases/org/apache/poi/ddf/TestEscherChildAnchorRecord.java index c1cc52c841..39d88a3c2d 100644 --- a/src/testcases/org/apache/poi/ddf/TestEscherChildAnchorRecord.java +++ b/src/testcases/org/apache/poi/ddf/TestEscherChildAnchorRecord.java @@ -64,19 +64,18 @@ public final class TestEscherChildAnchorRecord { @Test public void testToString(){ - String nl = System.getProperty( "line.separator" ); - String expected = - "org.apache.poi.ddf.EscherChildAnchorRecord (ChildAnchor):" + nl + - " RecordId: 0xF00F" + nl + - " Version: 0x0001" + nl + - " Instance: 0x0000" + nl + - " Options: 0x0001" + nl + - " Record Size: 24" + nl + - " X1: 0x00000001" + nl + - " Y1: 0x00000002" + nl + - " X2: 0x00000003" + nl + - " Y2: 0x00000004"; + "{ /* CHILD_ANCHOR */\n" + + "\t recordId: -4081 /* 0xf00f */\n" + + "\t, version: 1\n" + + "\t, instance: 0\n" + + "\t, options: 1\n" + + "\t, recordSize: 24 /* 0x00000018 */\n" + + "\t, x1: 1\n" + + "\t, y1: 2\n" + + "\t, x2: 3\n" + + "\t, y2: 4\n" + + "}"; assertEquals( expected, createRecord().toString() ); } diff --git a/src/testcases/org/apache/poi/ddf/TestEscherClientAnchorRecord.java b/src/testcases/org/apache/poi/ddf/TestEscherClientAnchorRecord.java index e9f1536994..f2ea01fe83 100644 --- a/src/testcases/org/apache/poi/ddf/TestEscherClientAnchorRecord.java +++ b/src/testcases/org/apache/poi/ddf/TestEscherClientAnchorRecord.java @@ -70,25 +70,24 @@ public class TestEscherClientAnchorRecord { @Test public void testToString() { - String nl = System.getProperty("line.separator"); String expected = - "org.apache.poi.ddf.EscherClientAnchorRecord (ClientAnchor):" + nl + - " RecordId: 0xF010" + nl + - " Version: 0x0001" + nl + - " Instance: 0x0000" + nl + - " Options: 0x0001" + nl + - " Record Size: 28" + nl + - " Flag: 0x004D" + nl + - " Col1: 0x0037" + nl + - " DX1: 0x0021" + nl + - " Row1: 0x0058" + nl + - " DY1: 0x000B" + nl + - " Col2: 0x002C" + nl + - " DX2: 0x0016" + nl + - " Row2: 0x0063" + nl + - " DY2: 0x0042" + nl + - " Extra Data: " + nl + - " 0: FF, DD"; + "{ /* CLIENT_ANCHOR */\n" + + "\t recordId: -4080 /* 0xf010 */\n" + + "\t, version: 1\n" + + "\t, instance: 0\n" + + "\t, options: 1\n" + + "\t, recordSize: 28 /* 0x0000001c */\n" + + "\t, flag: 77 /* 0x004d */\n" + + "\t, col1: 55 /* 0x0037 */\n" + + "\t, dx1: 33 /* 0x0021 */\n" + + "\t, row1: 88 /* 0x0058 */\n" + + "\t, dy1: 11 /* 0x000b */\n" + + "\t, col2: 44 /* 0x002c */\n" + + "\t, dx2: 22 /* 0x0016 */\n" + + "\t, row2: 99 /* 0x0063 */\n" + + "\t, dy2: 66 /* 0x0042 */\n" + + "\t, remainingData: \"/90=\"\n" + + "}"; assertEquals( expected, createRecord().toString() ); } diff --git a/src/testcases/org/apache/poi/ddf/TestEscherClientDataRecord.java b/src/testcases/org/apache/poi/ddf/TestEscherClientDataRecord.java index 4844c06829..106d098019 100644 --- a/src/testcases/org/apache/poi/ddf/TestEscherClientDataRecord.java +++ b/src/testcases/org/apache/poi/ddf/TestEscherClientDataRecord.java @@ -53,17 +53,15 @@ public class TestEscherClientDataRecord { @Test public void testToString() { - String nl = System.getProperty("line.separator"); - String expected = - "org.apache.poi.ddf.EscherClientDataRecord (ClientData):" + nl + - " RecordId: 0xF011" + nl + - " Version: 0x0002" + nl + - " Instance: 0x0000" + nl + - " Options: 0x0002" + nl + - " Record Size: 8" + nl + - " Extra Data: " + nl + - " : 0"; + "{ /* CLIENT_DATA */\n" + + "\t recordId: -4079 /* 0xf011 */\n" + + "\t, version: 2\n" + + "\t, instance: 0\n" + + "\t, options: 2\n" + + "\t, recordSize: 8\n" + + "\t, remainingData: \"\"\n" + + "}"; assertEquals( expected, createRecord().toString() ); } diff --git a/src/testcases/org/apache/poi/ddf/TestEscherContainerRecord.java b/src/testcases/org/apache/poi/ddf/TestEscherContainerRecord.java index d5264c8339..350f99d9da 100644 --- a/src/testcases/org/apache/poi/ddf/TestEscherContainerRecord.java +++ b/src/testcases/org/apache/poi/ddf/TestEscherContainerRecord.java @@ -19,6 +19,7 @@ package org.apache.poi.ddf; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertTrue; import java.util.List; @@ -80,16 +81,15 @@ public final class TestEscherContainerRecord { EscherContainerRecord r = new EscherContainerRecord(); r.setRecordId(EscherContainerRecord.SP_CONTAINER); r.setOptions((short) 0x000F); - String nl = System.getProperty("line.separator"); String expected = - "org.apache.poi.ddf.EscherContainerRecord (SpContainer):" + nl + - " RecordId: 0xF004" + nl + - " Version: 0x000F" + nl + - " Instance: 0x0000" + nl + - " Options: 0x000F" + nl + - " Record Size: 8" + nl + - " isContainer: true" + nl + - " children: 0x00000000"; + "{ /* SP_CONTAINER */\n" + + "\t recordId: -4092 /* 0xf004 */\n" + + "\t, version: 15 /* 0x000f */\n" + + "\t, instance: 0\n" + + "\t, options: 15 /* 0x000f */\n" + + "\t, recordSize: 8\n" + + "\t, isContainer: true\n" + + "}"; assertEquals(expected, r.toString()); EscherOptRecord r2 = new EscherOptRecord(); @@ -98,54 +98,62 @@ public final class TestEscherContainerRecord { r2.setRecordId(EscherOptRecord.RECORD_ID); r.addChildRecord(r2); - expected = - "org.apache.poi.ddf.EscherContainerRecord (SpContainer):" + nl + - " RecordId: 0xF004" + nl + - " Version: 0x000F" + nl + - " Instance: 0x0000" + nl + - " Options: 0x000F" + nl + - " Record Size: 16" + nl + - " isContainer: true" + nl + - " children: 0x00000001" + nl + - " Child 0: org.apache.poi.ddf.EscherOptRecord (Opt):" + nl + - " RecordId: 0xF00B" + nl + - " Version: 0x0003" + nl + - " Instance: 0x0000" + nl + - " Options: 0x0003" + nl + - " Record Size: 8" + nl + - " isContainer: false" + nl + - " numchildren: 0x00000000" + nl + - " properties: 0x00000000"; + expected = + "{ /* SP_CONTAINER */\n" + + "\t recordId: -4092 /* 0xf004 */\n" + + "\t, version: 15 /* 0x000f */\n" + + "\t, instance: 0\n" + + "\t, options: 15 /* 0x000f */\n" + + "\t, recordSize: 16 /* 0x00000010 */\n" + + "\t, isContainer: true\n" + + "\t, children: [\n" + + "\t\t{ /* OPT */\n" + + "\t\t\t recordId: -4085 /* 0xf00b */\n" + + "\t\t\t, version: 3\n" + + "\t\t\t, instance: 0\n" + + "\t\t\t, options: 3\n" + + "\t\t\t, recordSize: 8\n" + + "\t\t\t, isContainer: false\n" + + "\t\t\t, properties: [\n" + + "]\n" + + "\t\t}\n" + + "\t]\n" + + "}"; assertEquals(expected, r.toString()); r.addChildRecord(r2); expected = - "org.apache.poi.ddf.EscherContainerRecord (SpContainer):" + nl + - " RecordId: 0xF004" + nl + - " Version: 0x000F" + nl + - " Instance: 0x0000" + nl + - " Options: 0x000F" + nl + - " Record Size: 24" + nl + - " isContainer: true" + nl + - " children: 0x00000002" + nl + - " Child 0: org.apache.poi.ddf.EscherOptRecord (Opt):" + nl + - " RecordId: 0xF00B" + nl + - " Version: 0x0003" + nl + - " Instance: 0x0000" + nl + - " Options: 0x0003" + nl + - " Record Size: 8" + nl + - " isContainer: false" + nl + - " numchildren: 0x00000000" + nl + - " properties: 0x00000000" + nl + - " Child 1: org.apache.poi.ddf.EscherOptRecord (Opt):" + nl + - " RecordId: 0xF00B" + nl + - " Version: 0x0003" + nl + - " Instance: 0x0000" + nl + - " Options: 0x0003" + nl + - " Record Size: 8" + nl + - " isContainer: false" + nl + - " numchildren: 0x00000000" + nl + - " properties: 0x00000000"; + "{ /* SP_CONTAINER */\n" + + "\t recordId: -4092 /* 0xf004 */\n" + + "\t, version: 15 /* 0x000f */\n" + + "\t, instance: 0\n" + + "\t, options: 15 /* 0x000f */\n" + + "\t, recordSize: 24 /* 0x00000018 */\n" + + "\t, isContainer: true\n" + + "\t, children: [\n" + + "\t\t{ /* OPT */\n" + + "\t\t\t recordId: -4085 /* 0xf00b */\n" + + "\t\t\t, version: 3\n" + + "\t\t\t, instance: 0\n" + + "\t\t\t, options: 3\n" + + "\t\t\t, recordSize: 8\n" + + "\t\t\t, isContainer: false\n" + + "\t\t\t, properties: [\n" + + "]\n" + + "\t\t},\n" + + "\n" + + "\t\t{ /* OPT - index: 1 */\n" + + "\t\t\t recordId: -4085 /* 0xf00b */\n" + + "\t\t\t, version: 3\n" + + "\t\t\t, instance: 0\n" + + "\t\t\t, options: 3\n" + + "\t\t\t, recordSize: 8\n" + + "\t\t\t, isContainer: false\n" + + "\t\t\t, properties: [\n" + + "]\n" + + "\t\t}\n" + + "\t]\n" + + "}"; assertEquals(expected, r.toString()); } @@ -159,8 +167,6 @@ public final class TestEscherContainerRecord { public int getRecordSize() { return 10; } @Override public String getRecordName() { return ""; } - @Override - protected Object[][] getAttributeMap() { return null; } @Override public Enum getGenericRecordType() { return EscherRecordTypes.UNKNOWN; } } @@ -203,7 +209,7 @@ public final class TestEscherContainerRecord { children0.add(chC); List children1 = ecr.getChildRecords(); - assertTrue(children0 != children1); + assertNotSame(children0, children1); assertEquals(2, children1.size()); assertEquals(chA, children1.get(0)); assertEquals(chB, children1.get(1)); diff --git a/src/testcases/org/apache/poi/ddf/TestEscherDgRecord.java b/src/testcases/org/apache/poi/ddf/TestEscherDgRecord.java index 159781d410..246a895b16 100644 --- a/src/testcases/org/apache/poi/ddf/TestEscherDgRecord.java +++ b/src/testcases/org/apache/poi/ddf/TestEscherDgRecord.java @@ -57,16 +57,17 @@ public final class TestEscherDgRecord { @Test public void testToString() { - String nl = System.getProperty("line.separator"); String expected = - "org.apache.poi.ddf.EscherDgRecord (Dg):" + nl + - " RecordId: 0xF008" + nl + - " Version: 0x0000" + nl + - " Instance: 0x0001" + nl + - " Options: 0x0010" + nl + - " Record Size: 16" + nl + - " NumShapes: 0x00000002" + nl + - " LastMSOSPID: 0x00000401"; + "{ /* DG */\n" + + "\t recordId: -4088 /* 0xf008 */\n" + + "\t, version: 0\n" + + "\t, instance: 1\n" + + "\t, options: 16 /* 0x0010 */\n" + + "\t, recordSize: 16 /* 0x00000010 */\n" + + "\t, numShapes: 2\n" + + "\t, lastMSOSPID: 1025 /* 0x00000401 */\n" + + "\t, drawingGroupId: 1\n" + + "}"; assertEquals( expected, createRecord().toString() ); } diff --git a/src/testcases/org/apache/poi/ddf/TestEscherDggRecord.java b/src/testcases/org/apache/poi/ddf/TestEscherDggRecord.java index 1008c1de21..ed3b70c1ba 100644 --- a/src/testcases/org/apache/poi/ddf/TestEscherDggRecord.java +++ b/src/testcases/org/apache/poi/ddf/TestEscherDggRecord.java @@ -68,20 +68,24 @@ public final class TestEscherDggRecord { @Test public void testToString() { - String nl = System.getProperty("line.separator"); String expected = - "org.apache.poi.ddf.EscherDggRecord (Dgg):" + nl + - " RecordId: 0xF006" + nl + - " Version: 0x0000" + nl + - " Instance: 0x0000" + nl + - " Options: 0x0000" + nl + - " Record Size: 32" + nl + - " ShapeIdMax: 0x00000402" + nl + - " NumIdClusters: 0x00000002" + nl + - " NumShapesSaved: 0x00000002" + nl + - " DrawingsSaved: 0x00000001" + nl + - " FileId Clusters: 0x00000001" + nl + - " Group1: 0x00000002"; + "{ /* DGG */\n" + + "\t recordId: -4090 /* 0xf006 */\n" + + "\t, version: 0\n" + + "\t, instance: 0\n" + + "\t, options: 0\n" + + "\t, recordSize: 32 /* 0x00000020 */\n" + + "\t, fileIdClusters: [\n" + + "\n" + + "\t{ /* FileIdCluster */\n" + + "\t\t drawingGroupId: 1\n" + + "\t\t, numShapeIdUsed: 2\n" + + "\t}]\n" + + "\t, shapeIdMax: 1026 /* 0x00000402 */\n" + + "\t, numIdClusters: 2\n" + + "\t, numShapesSaved: 2\n" + + "\t, drawingsSaved: 1\n" + + "}"; assertEquals( expected, createRecord().toString() ); } diff --git a/src/testcases/org/apache/poi/ddf/TestEscherDump.java b/src/testcases/org/apache/poi/ddf/TestEscherDump.java index 64da89d9c6..7674c17997 100644 --- a/src/testcases/org/apache/poi/ddf/TestEscherDump.java +++ b/src/testcases/org/apache/poi/ddf/TestEscherDump.java @@ -19,13 +19,13 @@ package org.apache.poi.ddf; import static org.junit.Assert.assertTrue; -import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.PrintStream; import java.io.UnsupportedEncodingException; import org.apache.poi.POIDataSamples; import org.apache.poi.hssf.HSSFTestDataSamples; +import org.apache.poi.poifs.storage.RawDataUtil; import org.apache.poi.util.IOUtils; import org.apache.poi.util.LocaleUtil; import org.apache.poi.util.NullOutputStream; @@ -39,20 +39,51 @@ public class TestEscherDump { public static void init() throws UnsupportedEncodingException { nullPS = new NullPrinterStream(); } - + + // simple test to at least cover some parts of the class @Test public void testSimple() throws Exception { - // simple test to at least cover some parts of the class - EscherDump.main(new String[] {}, nullPS); - - new EscherDump().dump(0, new byte[] {}, nullPS); - new EscherDump().dump(new byte[] {}, 0, 0, nullPS); - new EscherDump().dumpOld(0, new ByteArrayInputStream(new byte[] {}), nullPS); + final String recordData = + "H4sIAAAAAAAAAL2UaVCSWxjHX0SBChABLRXM1FxSEzXTzHK7dpVIcMmwxXCP9KaGTaWlGYLrtGmGmYEmYmqF2qIt4ppmjNG+" + + "2dWulUtOUdq1NHjva8v90HT7eM+Z5znP/M9/zpk5v3mONgAoc5AANBDKeVDW0gQAjZkVCti3mKnpAExpB/m8AKTyEiTCNd2J" + + "Z+O0o6W+srDCyH3DhzkgUAD76v86QNA4mKTMg4QfnUew/5qA29CZz6ALqGcSgNzOICB05gD1rhODJR2AZu3Ox3YOKAfVUPhH" + + "ULtbpdVJ0ccdijw0pY1A56M3Jup7U15jp7X4PPTTecx92/MT9eZwtUICrLJvsB6z0fHG5qbw7mRpFRaOnPYJ6SqXd5AQMSKM" + + "jceyMD4NsULkj1OwHncz5cO3pPvCXXPTMNdNa+kDfwku4q0RnFL8YGBI6N+oXHlgzCkGWGRdONJPK1PbusJrhBltylPBMm3e" + + "G0kw6DGdLhoU3pmgJ6n1maC1fXrs0uUL6cWG/kGVm3MWHh3pALq4+PH55k7Uu3d+x85u9zxwIzfQuU+3TIG5SkOgrS1tCJb3" + + "3nqHrxcx3XlJA6vZJ6Oi1ctaXppQyBQLbLLrPJaKKq+zIexFLrVdZM+r34pJJpNN1hSrWbM/lIyRmKpYRIi7CybTTUzBWt49" + + "11HRM/VbCiZ6Gyt9TZmhGXPS75xYjpH366vhgLJu4ZoZfM+/4FvGaBZIE9aZ2SduMrUT4mJA4NpP8F2AhB+dT+D/jY/7DZ84" + + "ULbaK4C4crJvZ4qej2+em2+Vni4mPluh2e5xyoGUWYRaoFnWubHcaX+L09Ya0ta4KrP13C2ozMyicr4ovY0fNhT2wfMF7ip8" + + "/tD0u96myXcn92gtTnEuGfBJxY0lFG0mJxPWpknjNxmzWvzKj18rpjO4hhQXAtaRVSmJu+D8egI3RdQVXYxzRhs1+HE2iNvM" + + "fVe2DsSjqJQbBdUajcaECC3/58MP97Q0Eo+GNTdKbhk1r7UJadrVj0rLplmAqU/BlGeXDObGLtl69vITp9tD25vVY9vUT17u" + + "WTGW8idcxUDMMX2PHa8X6xzG0C5cGJcVth40m3ycwCpcfuP4OClu6IpysV/9QuvrdW/Yb3Qj6Ul7e3nybqemdkvLXsXG2N3v" + + "qeVE0woXb06pLduuFWUv7NxY8jq1k63fcD5jvG/w/IE8eUNh0Pohz0WRx6tdOlf4XhlbF5pgfYYzn8w6cjYx/8rBXvtWNz8L" + + "6uu+ig35t+dgOc4jOpLirmFPtjQdKHovGZ4Bff4LaIPLnx6cbnKFo8JHDoGpJ1+BwKGfgM6GhB+d+F/0acj3PiVEABoProzN" + + "1dcsVo9TPoPIF+r9EQI0qtveV4WEI1YhFjfmLxDsyFJptHvx/0BD3bfKJY/XqlFTReyIko4tQSzFFRyGRbkyg7MyuCqTmsiA" + + "mAgs3FGB0BOR7LzNuUYMC9QWaXyUTcxELLOFQvaRIQZ1HlgkJtE25Ohym/xzkqxqbFI1fWKsGgKq0m/q9kwkVDJAvdKM+7c8" + + "wj8GVPdneU0GVaeLVO6Kd3T2lMQFRNeCRwUyx5LSIxI5RmIFNc2RnuSIfYOeOZ+0CwzE7BFTJO+5cVeUz2nDN7mMYUSYOZyv" + + "SyyaRRydLKPYMmqFbS5K8RJ6vQNIGtiuI8AKCEgXsqV9Vz1tgvzovKiD2FPtpNgRlb0keoprdS+hnsP6ICwLBrE9dz26g2YP" + + "DszibWNE7zW5xndwlsoqFRh87XTFw8BXiFdv0SDsGBnfNcOu/Qu7y7SLppfzLJq714byzYQ590BA+BN2xyDhR+fZX7CL/s5u" + + "Q9f/8ccWX28U3BaGw9qTiSqDfOtHmXXZq8XiHXAYoz901c5V2lVulTXZEMqwnLq8+8ds95s0FFrdl73saRntr/UuUxFHY0WU" + + "z5b333qXTe/NagSRrmqkqypoNG12Oz3nE5Yzyt7d05eY66Ci2oTR+rNS3K4OiClGK+07HWtFFLvAqv6sNkpFsLs4Wp8XfRp/" + + "11oPk3uTQB0ftHg1C16KRTBl+AbCzVaYfx6VFlJ7GL7Jme8bVOku8FKZL0eGgMVk4qhEnpZogNrtFU5yEyswJ+LbHOKsOPCn" + + "cT19LR+PfTgjN4CKCS5Es4LS+7nLt9hQ7ejwGQnEyxebOgJzlHjotWUACpoZsFkAgGqBeUDZAzB6h4N2MFCNhmIuFJMAgPsH" + + "eJr+iZEHAAA="; + + // Create a new instance of the escher dumper + EscherDump dumper = new EscherDump(); + + // Decode the stream to bytes + byte[] bytes = RawDataUtil.decompress(recordData); + // Dump the contents of scher to screen. + dumper.dump(bytes, 0, bytes.length, nullPS); + + dumper.dump(0, new byte[] {}, nullPS); + dumper.dump(new byte[] {}, 0, 0, nullPS); } @Test public void testWithData() throws Exception { - new EscherDump().dumpOld(8, new ByteArrayInputStream(new byte[] {0, 0, 0, 0, 0, 0, 0, 0}), nullPS); + new EscherDump().dump(8, new byte[] {0, 0, 0, 0, 0, 0, 0, 0}, nullPS); } @Test diff --git a/src/testcases/org/apache/poi/ddf/TestEscherOptRecord.java b/src/testcases/org/apache/poi/ddf/TestEscherOptRecord.java index 0359f50296..5a293a293c 100644 --- a/src/testcases/org/apache/poi/ddf/TestEscherOptRecord.java +++ b/src/testcases/org/apache/poi/ddf/TestEscherOptRecord.java @@ -49,9 +49,10 @@ public final class TestEscherOptRecord { assertEquals( (short) 0x0033, r.getOptions() ); assertEquals( (short) 0xF00B, r.getRecordId() ); assertEquals( 3, r.getEscherProperties().size() ); - EscherBoolProperty prop1 = new EscherBoolProperty( EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 1 ); - EscherComplexProperty prop2 = new EscherComplexProperty( (short) 1, false, new byte[] { 0x01, 0x02 } ); - EscherBoolProperty prop3 = new EscherBoolProperty( EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 1 ); + EscherBoolProperty prop1 = new EscherBoolProperty( EscherPropertyTypes.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 1 ); + EscherComplexProperty prop2 = new EscherComplexProperty( EscherPropertyTypes.TEXT__SIZE_TEXT_TO_FIT_SHAPE, false, 2); + prop2.setComplexData(new byte[] { 0x01, 0x02 }); + EscherBoolProperty prop3 = new EscherBoolProperty( EscherPropertyTypes.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 1 ); assertEquals( prop1, r.getEscherProperty( 0 ) ); assertEquals( prop2, r.getEscherProperty( 1 ) ); assertEquals( prop3, r.getEscherProperty( 2 ) ); @@ -71,9 +72,9 @@ public final class TestEscherOptRecord { assertEquals( (short) 0x0033, r.getOptions() ); assertEquals( (short) 0xF00B, r.getRecordId() ); assertEquals( 3, r.getEscherProperties().size() ); - EscherBoolProperty prop1 = new EscherBoolProperty( EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 524296 ); - EscherRGBProperty prop2 = new EscherRGBProperty( EscherProperties.FILL__FILLCOLOR, 0x08000009 ); - EscherRGBProperty prop3 = new EscherRGBProperty( EscherProperties.LINESTYLE__COLOR, 0x08000040 ); + EscherBoolProperty prop1 = new EscherBoolProperty( EscherPropertyTypes.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 524296 ); + EscherRGBProperty prop2 = new EscherRGBProperty( EscherPropertyTypes.FILL__FILLCOLOR, 0x08000009 ); + EscherRGBProperty prop3 = new EscherRGBProperty( EscherPropertyTypes.LINESTYLE__COLOR, 0x08000040 ); assertEquals( prop1, r.getEscherProperty( 0 ) ); assertEquals( prop2, r.getEscherProperty( 1 ) ); assertEquals( prop3, r.getEscherProperty( 2 ) ); @@ -91,9 +92,10 @@ public final class TestEscherOptRecord { EscherOptRecord r = new EscherOptRecord(); r.setOptions( (short) 0x0033 ); r.setRecordId( (short) 0xF00B ); - EscherBoolProperty prop1 = new EscherBoolProperty( EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 1 ); - EscherComplexProperty prop2 = new EscherComplexProperty( (short) 1, false, new byte[] { 0x01, 0x02 } ); - EscherBoolProperty prop3 = new EscherBoolProperty( EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 1 ); + EscherBoolProperty prop1 = new EscherBoolProperty( EscherPropertyTypes.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 1 ); + EscherComplexProperty prop2 = new EscherComplexProperty( EscherPropertyTypes.TEXT__SIZE_TEXT_TO_FIT_SHAPE, false, 2); + prop2.setComplexData(new byte[] { 0x01, 0x02 }); + EscherBoolProperty prop3 = new EscherBoolProperty( EscherPropertyTypes.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 1 ); r.addEscherProperty( prop1 ); r.addEscherProperty( prop2 ); r.addEscherProperty( prop3 ); @@ -105,7 +107,7 @@ public final class TestEscherOptRecord { "0B, F0, " + "14, 00, 00, 00, " + "BF, 00, 01, 00, 00, 00, " + - "01, 80, 02, 00, 00, 00, " + + "BF, 80, 02, 00, 00, 00, " + "BF, 00, 01, 00, 00, 00, " + "01, 02]"; assertEquals( dataStr, HexDump.toHex(data) ); @@ -117,9 +119,9 @@ public final class TestEscherOptRecord { EscherOptRecord r = new EscherOptRecord(); r.setOptions( (short) 0x0033 ); r.setRecordId( (short) 0xF00B ); - EscherBoolProperty prop1 = new EscherBoolProperty( EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 1 ); - EscherRGBProperty prop2 = new EscherRGBProperty( EscherProperties.FILL__FILLCOLOR, 0x08000009 ); - EscherRGBProperty prop3 = new EscherRGBProperty( EscherProperties.LINESTYLE__COLOR, 0x08000040 ); + EscherBoolProperty prop1 = new EscherBoolProperty( EscherPropertyTypes.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 1 ); + EscherRGBProperty prop2 = new EscherRGBProperty( EscherPropertyTypes.FILL__FILLCOLOR, 0x08000009 ); + EscherRGBProperty prop3 = new EscherRGBProperty( EscherPropertyTypes.LINESTYLE__COLOR, 0x08000040 ); r.addEscherProperty( prop1 ); r.addEscherProperty( prop2 ); r.addEscherProperty( prop3 ); @@ -138,24 +140,31 @@ public final class TestEscherOptRecord { @Test public void testToString() { - String nl = System.getProperty("line.separator"); EscherOptRecord r = new EscherOptRecord(); // don't try to shoot in foot, please -- vlsergey // r.setOptions((short)0x000F); r.setRecordId(EscherOptRecord.RECORD_ID); - EscherProperty prop1 = new EscherBoolProperty((short)1, 1); + EscherProperty prop1 = new EscherBoolProperty(EscherPropertyTypes.GEOMETRY__FILLOK, 1); r.addEscherProperty(prop1); String expected = - "org.apache.poi.ddf.EscherOptRecord (Opt):" + nl + - " RecordId: 0xF00B" + nl + - " Version: 0x0003" + nl + - " Instance: 0x0001" + nl + - " Options: 0x0013" + nl + - " Record Size: 14" + nl + - " isContainer: false" + nl + - " numchildren: 0x00000000" + nl + - " properties: 0x00000001" + nl + - " unknown: propNum: 1, RAW: 0x0001, propName: unknown, complex: false, blipId: false, value: 1 (0x00000001)"; + "{ /* OPT */\n" + + "\t recordId: -4085 /* 0xf00b */\n" + + "\t, version: 3\n" + + "\t, instance: 1\n" + + "\t, options: 19 /* 0x0013 */\n" + + "\t, recordSize: 14 /* 0x0000000e */\n" + + "\t, isContainer: false\n" + + "\t, properties: [\n" + + "\n" + + "\t{ /* GEOMETRY__FILLOK */\n" + + "\t\t id: 383 /* 0x017f */\n" + + "\t\t, name: \"geometry.fillok\"\n" + + "\t\t, propertyNumber: 383 /* 0x017f */\n" + + "\t\t, propertySize: 6\n" + + "\t\t, flags: 0x17f /* */ \n" + + "\t\t, value: 1\n" + + "\t}]\n" + + "}"; assertEquals( expected, r.toString()); } @@ -255,7 +264,7 @@ public final class TestEscherOptRecord { /** * Test read/write against an OPT record from a real ppt file. - * In PowerPoint is is legal to have array properties with empty complex part. + * In PowerPoint it is legal to have array properties with empty complex part. * In Glen's original implementation complex part is always 6 bytes which resulted * in +6 extra bytes when writing back out. As the result the ppt becomes unreadable. * @@ -295,7 +304,7 @@ public final class TestEscherOptRecord { @Test public void testEmptyArrayProperty() { EscherOptRecord r = new EscherOptRecord(); - EscherArrayProperty p = new EscherArrayProperty((short)(EscherProperties.FILL__SHADECOLORS + 0x8000), new byte[0] ); + EscherArrayProperty p = new EscherArrayProperty(EscherPropertyTypes.FILL__SHADECOLORS, false, 0); assertEquals(0, p.getNumberOfElementsInArray()); r.addEscherProperty(p); diff --git a/src/testcases/org/apache/poi/ddf/TestEscherProperty.java b/src/testcases/org/apache/poi/ddf/TestEscherProperty.java index b102af43f8..62c6879f7f 100644 --- a/src/testcases/org/apache/poi/ddf/TestEscherProperty.java +++ b/src/testcases/org/apache/poi/ddf/TestEscherProperty.java @@ -31,22 +31,24 @@ public class TestEscherProperty { */ @Test public void testPropertyNames() throws Exception { - EscherProperty p1 = new EscherSimpleProperty( EscherProperties.GROUPSHAPE__SHAPENAME, 0); + EscherProperty p1 = new EscherSimpleProperty( EscherPropertyTypes.GROUPSHAPE__SHAPENAME, 0); assertEquals("groupshape.shapename", p1.getName()); - assertEquals(EscherProperties.GROUPSHAPE__SHAPENAME, p1.getPropertyNumber()); + assertEquals(EscherPropertyTypes.GROUPSHAPE__SHAPENAME.propNumber, p1.getPropertyNumber()); assertFalse(p1.isComplex()); - EscherProperty p2 = new EscherComplexProperty( - EscherProperties.GROUPSHAPE__SHAPENAME, false, new byte[10]); + EscherComplexProperty p2 = new EscherComplexProperty( + EscherPropertyTypes.GROUPSHAPE__SHAPENAME, false, 10); + p2.setComplexData(new byte[10]); assertEquals("groupshape.shapename", p2.getName()); - assertEquals(EscherProperties.GROUPSHAPE__SHAPENAME, p2.getPropertyNumber()); + assertEquals(EscherPropertyTypes.GROUPSHAPE__SHAPENAME.propNumber, p2.getPropertyNumber()); assertTrue(p2.isComplex()); assertFalse(p2.isBlipId()); - EscherProperty p3 = new EscherComplexProperty( - EscherProperties.GROUPSHAPE__SHAPENAME, true, new byte[10]); + EscherComplexProperty p3 = new EscherComplexProperty( + EscherPropertyTypes.GROUPSHAPE__SHAPENAME, true, 10); + p2.setComplexData(new byte[10]); assertEquals("groupshape.shapename", p3.getName()); - assertEquals(EscherProperties.GROUPSHAPE__SHAPENAME, p3.getPropertyNumber()); + assertEquals(EscherPropertyTypes.GROUPSHAPE__SHAPENAME.propNumber, p3.getPropertyNumber()); assertTrue(p3.isComplex()); assertTrue(p3.isBlipId()); } diff --git a/src/testcases/org/apache/poi/ddf/TestEscherSpRecord.java b/src/testcases/org/apache/poi/ddf/TestEscherSpRecord.java index eec0d40d55..241a09dfd1 100644 --- a/src/testcases/org/apache/poi/ddf/TestEscherSpRecord.java +++ b/src/testcases/org/apache/poi/ddf/TestEscherSpRecord.java @@ -57,18 +57,17 @@ public class TestEscherSpRecord { @Test public void testToString() { - String nl = System.getProperty("line.separator"); - String expected = - "org.apache.poi.ddf.EscherSpRecord (Sp):" + nl + - " RecordId: 0xF00A" + nl + - " Version: 0x0002" + nl + - " Instance: 0x0000" + nl + - " Options: 0x0002" + nl + - " Record Size: 16" + nl + - " ShapeType: 0x0000" + nl + - " ShapeId: 0x00000400" + nl + - " Flags: GROUP|PATRIARCH (0x00000005)"; + "{ /* SP */\n" + + "\t recordId: -4086 /* 0xf00a */\n" + + "\t, version: 2\n" + + "\t, instance: 0\n" + + "\t, options: 2\n" + + "\t, recordSize: 16 /* 0x00000010 */\n" + + "\t, shapeType: 0\n" + + "\t, shapeId: 1024 /* 0x00000400 */\n" + + "\t, flags: 0x5 /* GROUP | PATRIARCH */ \n" + + "}"; assertEquals( expected, createRecord().toString() ); } diff --git a/src/testcases/org/apache/poi/ddf/TestEscherSpgrRecord.java b/src/testcases/org/apache/poi/ddf/TestEscherSpgrRecord.java index 6020b4667f..6f414f1d6d 100644 --- a/src/testcases/org/apache/poi/ddf/TestEscherSpgrRecord.java +++ b/src/testcases/org/apache/poi/ddf/TestEscherSpgrRecord.java @@ -63,18 +63,18 @@ public final class TestEscherSpgrRecord { @Test public void testToString() { - String nl = System.getProperty("line.separator"); String expected = - "org.apache.poi.ddf.EscherSpgrRecord (Spgr):" + nl + - " RecordId: 0xF009" + nl + - " Version: 0x0000" + nl + - " Instance: 0x0001" + nl + - " Options: 0x0010" + nl + - " Record Size: 24" + nl + - " RectX: 0x00000001" + nl + - " RectY: 0x00000002" + nl + - " RectWidth: 0x00000003" + nl + - " RectHeight: 0x00000004"; + "{ /* SPGR */\n" + + "\t recordId: -4087 /* 0xf009 */\n" + + "\t, version: 0\n" + + "\t, instance: 1\n" + + "\t, options: 16 /* 0x0010 */\n" + + "\t, recordSize: 24 /* 0x00000018 */\n" + + "\t, rectX1: 1\n" + + "\t, rectY1: 2\n" + + "\t, rectX2: 3\n" + + "\t, rectY2: 4\n" + + "}"; assertEquals( expected, createRecord().toString() ); } diff --git a/src/testcases/org/apache/poi/ddf/TestEscherSplitMenuColorsRecord.java b/src/testcases/org/apache/poi/ddf/TestEscherSplitMenuColorsRecord.java index 084a452fec..9ac3c5d403 100644 --- a/src/testcases/org/apache/poi/ddf/TestEscherSplitMenuColorsRecord.java +++ b/src/testcases/org/apache/poi/ddf/TestEscherSplitMenuColorsRecord.java @@ -63,18 +63,18 @@ public final class TestEscherSplitMenuColorsRecord { @Test public void testToString() { - String nl = System.getProperty("line.separator"); String expected = - "org.apache.poi.ddf.EscherSplitMenuColorsRecord (SplitMenuColors):" + nl + - " RecordId: 0xF11E" + nl + - " Version: 0x0000" + nl + - " Instance: 0x0004" + nl + - " Options: 0x0040" + nl + - " Record Size: 24" + nl + - " Color1: 0x00000402" + nl + - " Color2: 0x00000002" + nl + - " Color3: 0x00000002" + nl + - " Color4: 0x00000001"; + "{ /* SPLIT_MENU_COLORS */\n" + + "\t recordId: -3810 /* 0xf11e */\n" + + "\t, version: 0\n" + + "\t, instance: 4\n" + + "\t, options: 64 /* 0x0040 */\n" + + "\t, recordSize: 24 /* 0x00000018 */\n" + + "\t, color1: 1026 /* 0x00000402 */\n" + + "\t, color2: 2\n" + + "\t, color3: 2\n" + + "\t, color4: 1\n" + + "}"; assertEquals( expected, createRecord().toString() ); } diff --git a/src/testcases/org/apache/poi/ddf/TestUnknownEscherRecord.java b/src/testcases/org/apache/poi/ddf/TestUnknownEscherRecord.java index 70429a9672..3ee6f9feb3 100644 --- a/src/testcases/org/apache/poi/ddf/TestUnknownEscherRecord.java +++ b/src/testcases/org/apache/poi/ddf/TestUnknownEscherRecord.java @@ -150,20 +150,15 @@ public final class TestUnknownEscherRecord { r.setRecordId( (short) 0xF112 ); byte[] data = new byte[8]; r.serialize( 0, data, new NullEscherSerializationListener() ); - String nl = System.getProperty("line.separator"); String expected = - "org.apache.poi.ddf.UnknownEscherRecord (Unknown 0xF112):" + nl + - " RecordId: 0xF112" + nl + - " Version: 0x0004" + nl + - " Instance: 0x0123" + nl + - " Options: 0x1234" + nl + - " Record Size: 8" + nl + - " isContainer: false" + nl + - " children: 0x00000000" + nl + - " Extra Data: " + nl + - " : 0"; - - + "{ /* UNKNOWN */\n" + + "\t recordId: -3822 /* 0xf112 */\n" + + "\t, version: 4\n" + + "\t, instance: 291 /* 0x0123 */\n" + + "\t, options: 4660 /* 0x1234 */\n" + + "\t, recordSize: 8\n" + + "\t, data: \"\"\n" + + "}"; assertEquals(expected, r.toString() ); } } diff --git a/src/testcases/org/apache/poi/hssf/model/TestDrawingShapes.java b/src/testcases/org/apache/poi/hssf/model/TestDrawingShapes.java index 27089fe8d5..a6ef067cf2 100644 --- a/src/testcases/org/apache/poi/hssf/model/TestDrawingShapes.java +++ b/src/testcases/org/apache/poi/hssf/model/TestDrawingShapes.java @@ -19,6 +19,7 @@ package org.apache.poi.hssf.model; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; @@ -27,7 +28,16 @@ import static org.junit.Assert.assertTrue; import java.io.IOException; import java.util.List; -import org.apache.poi.ddf.*; +import org.apache.poi.ddf.EscherBoolProperty; +import org.apache.poi.ddf.EscherContainerRecord; +import org.apache.poi.ddf.EscherDgRecord; +import org.apache.poi.ddf.EscherOptRecord; +import org.apache.poi.ddf.EscherProperty; +import org.apache.poi.ddf.EscherPropertyTypes; +import org.apache.poi.ddf.EscherRecord; +import org.apache.poi.ddf.EscherSimpleProperty; +import org.apache.poi.ddf.EscherSpRecord; +import org.apache.poi.ddf.EscherTextboxRecord; import org.apache.poi.hssf.HSSFTestDataSamples; import org.apache.poi.hssf.record.CommonObjectDataSubRecord; import org.apache.poi.hssf.record.EscherAggregate; @@ -101,10 +111,10 @@ public class TestDrawingShapes { EscherOptRecord opt = shape.getOptRecord(); assertEquals(7, opt.getEscherProperties().size()); - assertTrue(((EscherBoolProperty) opt.lookup(EscherProperties.GROUPSHAPE__PRINT)).isTrue()); - assertTrue(((EscherBoolProperty) opt.lookup(EscherProperties.LINESTYLE__NOLINEDRAWDASH)).isTrue()); - assertEquals(0x00000004, ((EscherSimpleProperty) opt.lookup(EscherProperties.GEOMETRY__SHAPEPATH)).getPropertyValue()); - assertNull(opt.lookup(EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE)); + assertNotEquals(((EscherSimpleProperty) opt.lookup(EscherPropertyTypes.GROUPSHAPE__FLAGS)).getPropertyValue(), 0); + assertTrue(((EscherBoolProperty) opt.lookup(EscherPropertyTypes.LINESTYLE__NOLINEDRAWDASH)).isTrue()); + assertEquals(0x00000004, ((EscherSimpleProperty) opt.lookup(EscherPropertyTypes.GEOMETRY__SHAPEPATH)).getPropertyValue()); + assertNull(opt.lookup(EscherPropertyTypes.TEXT__SIZE_TEXT_TO_FIT_SHAPE)); } @Test @@ -153,7 +163,6 @@ public class TestDrawingShapes { HSSFClientAnchor anchor = new HSSFClientAnchor(10, 10, 50, 50, (short) 2, 2, (short) 4, 4); anchor.setAnchorType(AnchorType.MOVE_DONT_RESIZE); assertEquals(AnchorType.MOVE_DONT_RESIZE, anchor.getAnchorType()); - //noinspection deprecation anchor.setAnchorType(AnchorType.MOVE_DONT_RESIZE); assertEquals(AnchorType.MOVE_DONT_RESIZE, anchor.getAnchorType()); @@ -175,10 +184,10 @@ public class TestDrawingShapes { assertNotNull(escherContainer); EscherRecord childById = escherContainer.getChildById(EscherOptRecord.RECORD_ID); assertNotNull(childById); - EscherProperty lookup = ((EscherOptRecord) childById).lookup(EscherProperties.TEXT__TEXTID); + EscherProperty lookup = ((EscherOptRecord) childById).lookup(EscherPropertyTypes.TEXT__TEXTID); assertNotNull(lookup); assertEquals(((EscherSimpleProperty) lookup).getPropertyValue(), "teeeest".hashCode()); - assertEquals(rectangle.isNoFill(), true); + assertTrue(rectangle.isNoFill()); assertEquals(rectangle.getWrapText(), HSSFSimpleShape.WRAP_NONE); assertEquals(rectangle.getString().getString(), "teeeest"); @@ -197,7 +206,7 @@ public class TestDrawingShapes { assertEquals(anchor, rectangle2.getAnchor()); assertEquals(rectangle2.getLineStyleColor(), 1111); assertEquals(rectangle2.getFillColor(), 777); - assertEquals(rectangle2.isNoFill(), true); + assertTrue(rectangle2.isNoFill()); assertEquals(rectangle2.getString().getString(), "teeeest"); assertEquals(rectangle.getWrapText(), HSSFSimpleShape.WRAP_NONE); @@ -229,7 +238,7 @@ public class TestDrawingShapes { assertEquals(rectangle2.getAnchor().getDx2(), 3); assertEquals(rectangle2.getAnchor().getDy1(), 4); assertEquals(rectangle2.getAnchor().getDy2(), 5); - assertEquals(rectangle2.isNoFill(), false); + assertFalse(rectangle2.isNoFill()); assertEquals(rectangle2.getString().getString(), "test22"); HSSFSimpleShape rect3 = drawing.createSimpleShape(new HSSFClientAnchor()); @@ -255,7 +264,7 @@ public class TestDrawingShapes { assertEquals(picture.getFillColor(), 0x5DC943); assertEquals(picture.getLineWidth(), HSSFShape.LINEWIDTH_DEFAULT); assertEquals(picture.getLineStyle(), HSSFShape.LINESTYLE_DEFAULT); - assertEquals(picture.isNoFill(), false); + assertFalse(picture.isNoFill()); picture.setPictureIndex(2); assertEquals(picture.getPictureIndex(), 2); @@ -272,7 +281,7 @@ public class TestDrawingShapes { assertEquals(1, drawing.getChildren().size()); HSSFSimpleShape shape = (HSSFSimpleShape) drawing.getChildren().get(0); - assertEquals(shape.isNoFill(), false); + assertFalse(shape.isNoFill()); assertEquals(shape.getLineStyle(), HSSFShape.LINESTYLE_DASHDOTGEL); assertEquals(shape.getLineStyleColor(), 0x616161); assertEquals(HexDump.toHex(shape.getFillColor()), shape.getFillColor(), 0x2CE03D); @@ -332,10 +341,8 @@ public class TestDrawingShapes { HSSFSheet sheet = wb.getSheetAt(0); HSSFPatriarch patriarch = sheet.getDrawingPatriarch(); - /** - * 2048 - main SpContainer id - * 2049 - existing shape id - */ + // 2048 - main SpContainer id + // 2049 - existing shape id assertEquals(HSSFTestHelper.allocateNewShapeId(patriarch), 2050); assertEquals(HSSFTestHelper.allocateNewShapeId(patriarch), 2051); assertEquals(HSSFTestHelper.allocateNewShapeId(patriarch), 2052); @@ -343,10 +350,8 @@ public class TestDrawingShapes { sheet = wb.getSheetAt(1); patriarch = sheet.getDrawingPatriarch(); - /** - * 3072 - main SpContainer id - * 3073 - existing shape id - */ + // 3072 - main SpContainer id + // 3073 - existing shape id assertEquals(HSSFTestHelper.allocateNewShapeId(patriarch), 3074); assertEquals(HSSFTestHelper.allocateNewShapeId(patriarch), 3075); assertEquals(HSSFTestHelper.allocateNewShapeId(patriarch), 3076); @@ -617,13 +622,13 @@ public class TestDrawingShapes { HSSFSimpleShape rectangle = patriarch.createSimpleShape(new HSSFClientAnchor()); rectangle.setShapeType(HSSFSimpleShape.OBJECT_TYPE_RECTANGLE); - assertEquals(rectangle.isFlipVertical(), false); - assertEquals(rectangle.isFlipHorizontal(), false); + assertFalse(rectangle.isFlipVertical()); + assertFalse(rectangle.isFlipHorizontal()); rectangle.setFlipVertical(true); - assertEquals(rectangle.isFlipVertical(), true); + assertTrue(rectangle.isFlipVertical()); rectangle.setFlipHorizontal(true); - assertEquals(rectangle.isFlipHorizontal(), true); + assertTrue(rectangle.isFlipHorizontal()); HSSFWorkbook wb2 = HSSFTestDataSamples.writeOutAndReadBack(wb1); wb1.close(); @@ -632,13 +637,13 @@ public class TestDrawingShapes { rectangle = (HSSFSimpleShape) patriarch.getChildren().get(0); - assertEquals(rectangle.isFlipHorizontal(), true); + assertTrue(rectangle.isFlipHorizontal()); rectangle.setFlipHorizontal(false); - assertEquals(rectangle.isFlipHorizontal(), false); + assertFalse(rectangle.isFlipHorizontal()); - assertEquals(rectangle.isFlipVertical(), true); + assertTrue(rectangle.isFlipVertical()); rectangle.setFlipVertical(false); - assertEquals(rectangle.isFlipVertical(), false); + assertFalse(rectangle.isFlipVertical()); HSSFWorkbook wb3 = HSSFTestDataSamples.writeOutAndReadBack(wb2); wb2.close(); @@ -647,8 +652,8 @@ public class TestDrawingShapes { rectangle = (HSSFSimpleShape) patriarch.getChildren().get(0); - assertEquals(rectangle.isFlipVertical(), false); - assertEquals(rectangle.isFlipHorizontal(), false); + assertFalse(rectangle.isFlipVertical()); + assertFalse(rectangle.isFlipHorizontal()); wb3.close(); } @@ -735,8 +740,7 @@ public class TestDrawingShapes { @Test public void testBug45312() throws Exception { - HSSFWorkbook wb = new HSSFWorkbook(); - try { + try (HSSFWorkbook wb = new HSSFWorkbook()) { HSSFSheet sheet = wb.createSheet(); HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); @@ -768,16 +772,7 @@ public class TestDrawingShapes { shape1.setShapeType(HSSFSimpleShape.OBJECT_TYPE_LINE); } - /*OutputStream stream = new FileOutputStream("/tmp/45312.xls"); - try { - wb.write(stream); - } finally { - stream.close(); - }*/ - checkWorkbookBack(wb); - } finally { - wb.close(); } } diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestPolygon.java b/src/testcases/org/apache/poi/hssf/usermodel/TestPolygon.java index 1e250bdfd8..252273076c 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestPolygon.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestPolygon.java @@ -25,7 +25,7 @@ import static org.junit.Assert.assertTrue; import java.io.IOException; import org.apache.poi.ddf.EscherArrayProperty; -import org.apache.poi.ddf.EscherProperties; +import org.apache.poi.ddf.EscherPropertyTypes; import org.apache.poi.ddf.EscherSpRecord; import org.apache.poi.hssf.HSSFTestDataSamples; import org.apache.poi.hssf.record.ObjRecord; @@ -85,16 +85,20 @@ public class TestPolygon { polygon.setPolygonDrawArea( 100, 100 ); polygon.setPoints( new int[]{0, 90, 50, 90}, new int[]{5, 5, 44, 88} ); - EscherArrayProperty verticesProp1 = polygon.getOptRecord().lookup(EscherProperties.GEOMETRY__VERTICES); + EscherArrayProperty verticesProp1 = polygon.getOptRecord().lookup(EscherPropertyTypes.GEOMETRY__VERTICES); String expected = - ""+ - "[00, 00, 05, 00]"+ - "[5A, 00, 05, 00]"+ - "[32, 00, 2C, 00]"+ - "[5A, 00, 58, 00]"+ - "[00, 00, 05, 00]"+ - ""; + "" + + "" + + "BQAFAPD/AAAFAFoABQAyACwAWgBYAAAABQA=" + + "" + + ">AAAFAA==" + + ">WgAFAA==" + + ">MgAsAA==" + + ">WgBYAA==" + + ">AAAFAA==" + + "" + + ""; String actual = verticesProp1.toXml("").replaceAll("[\r\n\t]",""); assertEquals(verticesProp1.getNumberOfElementsInArray(), 5); @@ -104,15 +108,18 @@ public class TestPolygon { assertArrayEquals(polygon.getXPoints(), new int[]{1, 2, 3}); assertArrayEquals(polygon.getYPoints(), new int[]{4, 5, 6}); - verticesProp1 = polygon.getOptRecord().lookup(EscherProperties.GEOMETRY__VERTICES); + verticesProp1 = polygon.getOptRecord().lookup(EscherPropertyTypes.GEOMETRY__VERTICES); expected = - "" + - "[01, 00, 04, 00]" + - "[02, 00, 05, 00]" + - "[03, 00, 06, 00]" + - "[01, 00, 04, 00]" + - ""; + "" + + "" + + "BAAEAPD/AQAEAAIABQADAAYAAQAEAA==" + + "" + + ">AQAEAA==" + + ">AgAFAA==" + + ">AwAGAA==" + + ">AQAEAA==" + + ""; actual = verticesProp1.toXml("").replaceAll("[\r\n\t]",""); assertEquals(verticesProp1.getNumberOfElementsInArray(), 4); @@ -261,7 +268,7 @@ public class TestPolygon { EscherSpRecord spRecord = polygon1.getEscherContainer().getChildById(EscherSpRecord.RECORD_ID); - spRecord.setShapeType((short)77/**RANDOM**/); + spRecord.setShapeType((short)77/*RANDOM*/); HSSFWorkbook wb3 = HSSFTestDataSamples.writeOutAndReadBack(wb2); wb2.close(); -- 2.39.5