replace getInstance() / getOptions() with getShapeType for EscherSpRecord

replace getOptions() with getInstance() for other cases

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1163615 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2011-08-31 13:14:09 +00:00
parent 62613ea8db
commit 940d0e3efc
21 changed files with 67 additions and 23 deletions

View File

@ -152,8 +152,11 @@ public abstract class AbstractEscherOptRecord extends EscherRecord
stringBuilder.append( " isContainer: " );
stringBuilder.append( isContainerRecord() );
stringBuilder.append( nl );
stringBuilder.append( " options: 0x" );
stringBuilder.append( HexDump.toHex( getOptions() ) );
stringBuilder.append( " version: 0x" );
stringBuilder.append( HexDump.toHex( getVersion() ) );
stringBuilder.append( nl );
stringBuilder.append( " instance: 0x" );
stringBuilder.append( HexDump.toHex( getInstance() ) );
stringBuilder.append( nl );
stringBuilder.append( " recordId: 0x" );
stringBuilder.append( HexDump.toHex( getRecordId() ) );

View File

@ -313,7 +313,8 @@ public final class EscherBSERecord extends EscherRecord {
String extraData = _remainingData == null ? null : HexDump.toHex(_remainingData, 32);
return getClass().getName() + ":" + '\n' +
" RecordId: 0x" + HexDump.toHex( RECORD_ID ) + '\n' +
" Options: 0x" + HexDump.toHex( getOptions() ) + '\n' +
" Version: 0x" + HexDump.toHex( getVersion() ) + '\n' +
" Instance: 0x" + HexDump.toHex( getInstance() ) + '\n' +
" BlipTypeWin32: " + field_1_blipTypeWin32 + '\n' +
" BlipTypeMacOS: " + field_2_blipTypeMacOS + '\n' +
" SUID: " + (field_3_uid == null ? "" : HexDump.toHex(field_3_uid)) + '\n' +

View File

@ -108,7 +108,8 @@ public class EscherBitmapBlip extends EscherBlipRecord {
}
return getClass().getName() + ":" + nl +
" RecordId: 0x" + HexDump.toHex( getRecordId() ) + nl +
" Options: 0x" + HexDump.toHex( getOptions() ) + nl +
" Version: 0x" + HexDump.toHex( getVersion() ) + nl +
" Instance: 0x" + HexDump.toHex( getInstance() ) + nl +
" UID: 0x" + HexDump.toHex( field_1_UID ) + nl +
" Marker: 0x" + HexDump.toHex( field_2_marker ) + nl +
" Extra Data:" + nl + extraData;

View File

@ -77,7 +77,8 @@ public class EscherBlipRecord extends EscherRecord { // TODO - instantiable supe
String extraData = HexDump.toHex(field_pictureData, 32);
return getClass().getName() + ":" + '\n' +
" RecordId: 0x" + HexDump.toHex( getRecordId() ) + '\n' +
" Options: 0x" + HexDump.toHex( getOptions() ) + '\n' +
" Version: 0x" + HexDump.toHex( getVersion() ) + '\n' +
" Instance: 0x" + HexDump.toHex( getInstance() ) + '\n' +
" Extra Data:" + '\n' + extraData;
}
}

View File

@ -334,7 +334,8 @@ public class EscherBlipWMFRecord
}
return getClass().getName() + ":" + nl +
" RecordId: 0x" + HexDump.toHex( getRecordId() ) + nl +
" Options: 0x" + HexDump.toHex( getOptions() ) + nl +
" Version: 0x" + HexDump.toHex( getVersion() ) + nl +
" Instance: 0x" + HexDump.toHex( getInstance() ) + nl +
" Secondary UID: " + HexDump.toHex( field_1_secondaryUID ) + nl +
" CacheOfSize: " + field_2_cacheOfSize + nl +
" BoundaryTop: " + field_3_boundaryTop + nl +

View File

@ -88,7 +88,8 @@ public class EscherChildAnchorRecord
return getClass().getName() + ":" + nl +
" RecordId: 0x" + HexDump.toHex(RECORD_ID) + nl +
" Options: 0x" + HexDump.toHex(getOptions()) + nl +
" Version: 0x" + HexDump.toHex(getVersion()) + nl +
" Instance: 0x" + HexDump.toHex(getInstance()) + nl +
" X1: " + field_1_dx1 + nl +
" Y1: " + field_2_dy1 + nl +
" X2: " + field_3_dx2 + nl +

View File

@ -145,7 +145,8 @@ public class EscherClientAnchorRecord
}
return getClass().getName() + ":" + nl +
" RecordId: 0x" + HexDump.toHex(RECORD_ID) + nl +
" Options: 0x" + HexDump.toHex(getOptions()) + nl +
" Version: 0x" + HexDump.toHex(getVersion()) + nl +
" Instance: 0x" + HexDump.toHex(getInstance()) + nl +
" Flag: " + field_1_flag + nl +
" Col1: " + field_2_col1 + nl +
" DX1: " + field_3_dx1 + nl +

View File

@ -92,7 +92,8 @@ public class EscherClientDataRecord
}
return getClass().getName() + ":" + nl +
" RecordId: 0x" + HexDump.toHex(RECORD_ID) + nl +
" Options: 0x" + HexDump.toHex(getOptions()) + nl +
" Version: 0x" + HexDump.toHex(getVersion()) + nl +
" Instance: 0x" + HexDump.toHex(getInstance()) + nl +
" Extra Data:" + nl +
extraData;

View File

@ -248,7 +248,8 @@ public final class EscherContainerRecord extends EscherRecord {
return getClass().getName() + " (" + getRecordName() + "):" + nl
+ " isContainer: " + isContainerRecord() + nl
+ " options: 0x" + HexDump.toHex( getOptions() ) + nl
+ " version: 0x" + HexDump.toHex( getVersion() ) + nl
+ " instance: 0x" + HexDump.toHex( getInstance() ) + nl
+ " recordId: 0x" + HexDump.toHex( getRecordId() ) + nl
+ " numchildren: " + _childRecords.size() + nl
+ children.toString();

View File

@ -88,7 +88,8 @@ public class EscherDgRecord
public String toString() {
return getClass().getName() + ":" + '\n' +
" RecordId: 0x" + HexDump.toHex(RECORD_ID) + '\n' +
" Options: 0x" + HexDump.toHex(getOptions()) + '\n' +
" Version: 0x" + HexDump.toHex(getVersion()) + '\n' +
" Instance: 0x" + HexDump.toHex(getInstance()) + '\n' +
" NumShapes: " + field_1_numShapes + '\n' +
" LastMSOSPID: " + field_2_lastMSOSPID + '\n';

View File

@ -132,7 +132,8 @@ public final class EscherDggRecord extends EscherRecord {
}
return getClass().getName() + ":" + '\n' +
" RecordId: 0x" + HexDump.toHex(RECORD_ID) + '\n' +
" Options: 0x" + HexDump.toHex(getOptions()) + '\n' +
" Version: 0x" + HexDump.toHex(getVersion()) + '\n' +
" Instance: 0x" + HexDump.toHex(getInstance()) + '\n' +
" ShapeIdMax: " + field_1_shapeIdMax + '\n' +
" NumIdClusters: " + getNumIdClusters() + '\n' +
" NumShapesSaved: " + field_3_numShapesSaved + '\n' +

View File

@ -247,7 +247,8 @@ public final class EscherMetafileBlip extends EscherBlipRecord {
String extraData = "";//HexDump.toHex(field_pictureData, 32);
return getClass().getName() + ":" + '\n' +
" RecordId: 0x" + HexDump.toHex( getRecordId() ) + '\n' +
" Options: 0x" + HexDump.toHex( getOptions() ) + '\n' +
" Version: 0x" + HexDump.toHex( getVersion() ) + '\n' +
" Instance: 0x" + HexDump.toHex( getInstance() ) + '\n' +
" UID: 0x" + HexDump.toHex( field_1_UID ) + '\n' +
(field_2_UID == null ? "" : (" UID2: 0x" + HexDump.toHex( field_2_UID ) + '\n')) +
" Uncompressed Size: " + HexDump.toHex( field_2_cb ) + '\n' +

View File

@ -202,7 +202,8 @@ public final class EscherPictBlip extends EscherBlipRecord {
String extraData = HexDump.toHex(field_pictureData, 32);
return getClass().getName() + ":" + '\n' +
" RecordId: 0x" + HexDump.toHex( getRecordId() ) + '\n' +
" Options: 0x" + HexDump.toHex( getOptions() ) + '\n' +
" Version: 0x" + HexDump.toHex( getVersion() ) + '\n' +
" Instance: 0x" + HexDump.toHex( getInstance() ) + '\n' +
" UID: 0x" + HexDump.toHex( field_1_UID ) + '\n' +
" Uncompressed Size: " + HexDump.toHex( field_2_cb ) + '\n' +
" Bounds: " + getBounds() + '\n' +

View File

@ -108,7 +108,8 @@ public class EscherSpRecord
return getClass().getName() + ":" + nl +
" RecordId: 0x" + HexDump.toHex(RECORD_ID) + nl +
" Options: 0x" + HexDump.toHex(getOptions()) + nl +
" Version: 0x" + HexDump.toHex(getVersion()) + nl +
" ShapeType: 0x" + HexDump.toHex(getShapeType()) + nl +
" ShapeId: " + field_1_shapeId + nl +
" Flags: " + decodeFlags(field_2_flags) + " (0x" + HexDump.toHex(field_2_flags) + ")" + nl;
@ -197,4 +198,27 @@ public class EscherSpRecord
{
this.field_2_flags = field_2_flags;
}
/**
* Returns shape type. Must be one of MSOSPT values (see [MS-ODRAW] for
* details).
*
* @return shape type
*/
public short getShapeType()
{
return getInstance();
}
/**
* Sets shape type. Must be one of MSOSPT values (see [MS-ODRAW] for
* details).
*
* @param value
* new shape type
*/
public void setShapeType( short value )
{
setInstance( value );
}
}

View File

@ -89,7 +89,8 @@ public class EscherSpgrRecord
public String toString() {
return getClass().getName() + ":" + '\n' +
" RecordId: 0x" + HexDump.toHex(RECORD_ID) + '\n' +
" Options: 0x" + HexDump.toHex(getOptions()) + '\n' +
" Version: 0x" + HexDump.toHex(getVersion()) + '\n' +
" Instance: 0x" + HexDump.toHex(getInstance()) + '\n' +
" RectX: " + field_1_rectX1 + '\n' +
" RectY: " + field_2_rectY1 + '\n' +
" RectWidth: " + field_3_rectX2 + '\n' +

View File

@ -90,7 +90,8 @@ public class EscherSplitMenuColorsRecord
public String toString() {
return getClass().getName() + ":" + '\n' +
" RecordId: 0x" + HexDump.toHex(RECORD_ID) + '\n' +
" Options: 0x" + HexDump.toHex(getOptions()) + '\n' +
" Version: 0x" + HexDump.toHex(getVersion()) + '\n' +
" Instance: 0x" + HexDump.toHex(getInstance()) + '\n' +
" Color1: 0x" + HexDump.toHex(field_1_color1) + '\n' +
" Color2: 0x" + HexDump.toHex(field_2_color2) + '\n' +
" Color3: 0x" + HexDump.toHex(field_3_color3) + '\n' +

View File

@ -132,7 +132,8 @@ public class EscherTextboxRecord extends EscherRecord
return getClass().getName() + ":" + nl +
" isContainer: " + isContainerRecord() + nl +
" options: 0x" + HexDump.toHex( getOptions() ) + nl +
" version: 0x" + HexDump.toHex( getVersion() ) + nl +
" instance: 0x" + HexDump.toHex( getInstance() ) + nl +
" recordId: 0x" + HexDump.toHex( getRecordId() ) + nl +
" numchildren: " + getChildRecords().size() + nl +
theDumpHex;

View File

@ -135,7 +135,8 @@ public final class UnknownEscherRecord extends EscherRecord {
return getClass().getName() + ":" + '\n' +
" isContainer: " + isContainerRecord() + '\n' +
" options: 0x" + HexDump.toHex( getOptions() ) + '\n' +
" version: 0x" + HexDump.toHex( getVersion() ) + '\n' +
" instance: 0x" + HexDump.toHex( getInstance() ) + '\n' +
" recordId: 0x" + HexDump.toHex( getRecordId() ) + '\n' +
" numchildren: " + getChildRecords().size() + '\n' +
theDumpHex +

View File

@ -616,7 +616,7 @@ public final class EscherAggregate extends AbstractEscherHolderRecord {
{
EscherSpRecord spRecord = shapeContainer
.getChildById( EscherSpRecord.RECORD_ID );
int type = spRecord.getOptions() >> 4;
int type = spRecord.getShapeType();
switch (type)
{

View File

@ -130,7 +130,7 @@ public abstract class Shape {
*/
public int getShapeType(){
EscherSpRecord spRecord = _escherContainer.getChildById(EscherSpRecord.RECORD_ID);
return spRecord.getOptions() >> 4;
return spRecord.getShapeType();
}
/**
@ -139,7 +139,8 @@ public abstract class Shape {
*/
public void setShapeType(int type){
EscherSpRecord spRecord = _escherContainer.getChildById(EscherSpRecord.RECORD_ID);
spRecord.setOptions((short)(type << 4 | 0x2));
spRecord.setShapeType( (short) type );
spRecord.setVersion( (short) 0x2 );
}
/**

View File

@ -72,7 +72,7 @@ public final class ShapeFactory {
Shape shape = null;
EscherSpRecord spRecord = spContainer.getChildById(EscherSpRecord.RECORD_ID);
int type = spRecord.getOptions() >> 4;
int type = spRecord.getShapeType();
switch (type){
case ShapeTypes.TextBox:
shape = new TextBox(spContainer, parent);