Unified access to escher opt record

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1647927 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2014-12-26 00:11:23 +00:00
parent 0c580c8f45
commit 47fe5b9651
11 changed files with 35 additions and 31 deletions

View File

@ -159,7 +159,7 @@ public final class ActiveXShape extends Picture {
String name = ctrl.getProgId() + "-" + getControlIndex(); String name = ctrl.getProgId() + "-" + getControlIndex();
byte[] data = (name + '\u0000').getBytes("UTF-16LE"); byte[] data = (name + '\u0000').getBytes("UTF-16LE");
EscherComplexProperty prop = new EscherComplexProperty(EscherProperties.GROUPSHAPE__SHAPENAME, false, data); EscherComplexProperty prop = new EscherComplexProperty(EscherProperties.GROUPSHAPE__SHAPENAME, false, data);
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
opt.addEscherProperty(prop); opt.addEscherProperty(prop);
} catch (UnsupportedEncodingException e){ } catch (UnsupportedEncodingException e){
throw new HSLFException(e); throw new HSLFException(e);

View File

@ -136,7 +136,7 @@ public final class Freeform extends AutoShape {
if(!isClosed) segInfo.add(SEGMENTINFO_LINETO); if(!isClosed) segInfo.add(SEGMENTINFO_LINETO);
segInfo.add(new byte[]{0x00, (byte)0x80}); segInfo.add(new byte[]{0x00, (byte)0x80});
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__SHAPEPATH, 0x4)); opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__SHAPEPATH, 0x4));
EscherArrayProperty verticesProp = new EscherArrayProperty((short)(EscherProperties.GEOMETRY__VERTICES + 0x4000), false, null); EscherArrayProperty verticesProp = new EscherArrayProperty((short)(EscherProperties.GEOMETRY__VERTICES + 0x4000), false, null);
@ -176,7 +176,7 @@ public final class Freeform extends AutoShape {
* @return the freeform path * @return the freeform path
*/ */
public GeneralPath getPath(){ public GeneralPath getPath(){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__SHAPEPATH, 0x4)); opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__SHAPEPATH, 0x4));
EscherArrayProperty verticesProp = (EscherArrayProperty)getEscherProperty(opt, (short)(EscherProperties.GEOMETRY__VERTICES + 0x4000)); EscherArrayProperty verticesProp = (EscherArrayProperty)getEscherProperty(opt, (short)(EscherProperties.GEOMETRY__VERTICES + 0x4000));

View File

@ -116,7 +116,7 @@ public final class Line extends SimpleShape {
spRecord.setOptions(type); spRecord.setOptions(type);
//set default properties for a line //set default properties for a line
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
//default line properties //default line properties
setEscherProperty(opt, EscherProperties.GEOMETRY__SHAPEPATH, 4); setEscherProperty(opt, EscherProperties.GEOMETRY__SHAPEPATH, 4);

View File

@ -111,7 +111,7 @@ public class Picture extends SimpleShape {
* @return the index to this picture (1 based). * @return the index to this picture (1 based).
*/ */
public int getPictureIndex(){ public int getPictureIndex(){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.BLIP__BLIPTODISPLAY); EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.BLIP__BLIPTODISPLAY);
return prop == null ? 0 : prop.getPropertyValue(); return prop == null ? 0 : prop.getPropertyValue();
} }
@ -130,7 +130,7 @@ public class Picture extends SimpleShape {
spRecord.setOptions((short)((ShapeTypes.PictureFrame << 4) | 0x2)); spRecord.setOptions((short)((ShapeTypes.PictureFrame << 4) | 0x2));
//set default properties for a picture //set default properties for a picture
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
setEscherProperty(opt, EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 0x800080); setEscherProperty(opt, EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 0x800080);
//another weird feature of powerpoint: for picture id we must add 0x4000. //another weird feature of powerpoint: for picture id we must add 0x4000.
@ -214,7 +214,7 @@ public class Picture extends SimpleShape {
* @return name of this picture * @return name of this picture
*/ */
public String getPictureName(){ public String getPictureName(){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
EscherComplexProperty prop = (EscherComplexProperty)getEscherProperty(opt, EscherProperties.BLIP__BLIPFILENAME); EscherComplexProperty prop = (EscherComplexProperty)getEscherProperty(opt, EscherProperties.BLIP__BLIPFILENAME);
String name = null; String name = null;
if(prop != null){ if(prop != null){
@ -235,7 +235,7 @@ public class Picture extends SimpleShape {
* @param name of this picture * @param name of this picture
*/ */
public void setPictureName(String name){ public void setPictureName(String name){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
try { try {
byte[] data = (name + '\u0000').getBytes("UTF-16LE"); byte[] data = (name + '\u0000').getBytes("UTF-16LE");
EscherComplexProperty prop = new EscherComplexProperty(EscherProperties.BLIP__BLIPFILENAME, false, data); EscherComplexProperty prop = new EscherComplexProperty(EscherProperties.BLIP__BLIPFILENAME, false, data);

View File

@ -56,7 +56,7 @@ public final class Placeholder extends TextBox {
EscherClientDataRecord cldata = new EscherClientDataRecord(); EscherClientDataRecord cldata = new EscherClientDataRecord();
cldata.setOptions((short)15); cldata.setOptions((short)15);
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
//Placeholders can't be grouped //Placeholders can't be grouped
setEscherProperty(opt, EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 262144); setEscherProperty(opt, EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 262144);

View File

@ -71,7 +71,7 @@ public final class Polygon extends AutoShape {
float left = findSmallest(xPoints); float left = findSmallest(xPoints);
float top = findSmallest(yPoints); float top = findSmallest(yPoints);
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__RIGHT, (int)((right - left)*POINT_DPI/MASTER_DPI))); opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__RIGHT, (int)((right - left)*POINT_DPI/MASTER_DPI)));
opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__BOTTOM, (int)((bottom - top)*POINT_DPI/MASTER_DPI))); opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__BOTTOM, (int)((bottom - top)*POINT_DPI/MASTER_DPI)));

View File

@ -299,7 +299,7 @@ public abstract class Shape {
* @param value value of the property. If value = -1 then the property is removed. * @param value value of the property. If value = -1 then the property is removed.
*/ */
public void setEscherProperty(short propId, int value){ public void setEscherProperty(short propId, int value){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
setEscherProperty(opt, propId, value); setEscherProperty(opt, propId, value);
} }
@ -309,7 +309,7 @@ public abstract class Shape {
* @param propId The id of the property. One of the constants defined in EscherOptRecord. * @param propId The id of the property. One of the constants defined in EscherOptRecord.
*/ */
public int getEscherProperty(short propId){ public int getEscherProperty(short propId){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, propId); EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, propId);
return prop == null ? 0 : prop.getPropertyValue(); return prop == null ? 0 : prop.getPropertyValue();
} }
@ -320,7 +320,7 @@ public abstract class Shape {
* @param propId The id of the property. One of the constants defined in EscherOptRecord. * @param propId The id of the property. One of the constants defined in EscherOptRecord.
*/ */
public int getEscherProperty(short propId, int defaultValue){ public int getEscherProperty(short propId, int defaultValue){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, propId); EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, propId);
return prop == null ? defaultValue : prop.getPropertyValue(); return prop == null ? defaultValue : prop.getPropertyValue();
} }
@ -364,7 +364,7 @@ public abstract class Shape {
} }
Color getColor(short colorProperty, short opacityProperty, int defaultColor){ Color getColor(short colorProperty, short opacityProperty, int defaultColor){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty p = (EscherSimpleProperty)getEscherProperty(opt, colorProperty); EscherSimpleProperty p = (EscherSimpleProperty)getEscherProperty(opt, colorProperty);
if(p == null && defaultColor == -1) return null; if(p == null && defaultColor == -1) return null;
@ -483,4 +483,8 @@ public abstract class Shape {
public java.awt.Shape getOutline(){ public java.awt.Shape getOutline(){
return getLogicalAnchor2D(); return getLogicalAnchor2D();
} }
protected EscherOptRecord getEscherOptRecord() {
return (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID);
}
} }

View File

@ -102,7 +102,7 @@ public abstract class SimpleShape extends Shape {
* Returns width of the line in in points * Returns width of the line in in points
*/ */
public double getLineWidth(){ public double getLineWidth(){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.LINESTYLE__LINEWIDTH); EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.LINESTYLE__LINEWIDTH);
double width = prop == null ? DEFAULT_LINE_WIDTH : (double)prop.getPropertyValue()/EMU_PER_POINT; double width = prop == null ? DEFAULT_LINE_WIDTH : (double)prop.getPropertyValue()/EMU_PER_POINT;
return width; return width;
@ -113,7 +113,7 @@ public abstract class SimpleShape extends Shape {
* @param width the width of line in in points * @param width the width of line in in points
*/ */
public void setLineWidth(double width){ public void setLineWidth(double width){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
setEscherProperty(opt, EscherProperties.LINESTYLE__LINEWIDTH, (int)(width*EMU_PER_POINT)); setEscherProperty(opt, EscherProperties.LINESTYLE__LINEWIDTH, (int)(width*EMU_PER_POINT));
} }
@ -123,7 +123,7 @@ public abstract class SimpleShape extends Shape {
* @param color new color of the line * @param color new color of the line
*/ */
public void setLineColor(Color color){ public void setLineColor(Color color){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
if (color == null) { if (color == null) {
setEscherProperty(opt, EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x80000); setEscherProperty(opt, EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x80000);
} else { } else {
@ -137,7 +137,7 @@ public abstract class SimpleShape extends Shape {
* @return color of the line. If color is not set returns <code>java.awt.Color.black</code> * @return color of the line. If color is not set returns <code>java.awt.Color.black</code>
*/ */
public Color getLineColor(){ public Color getLineColor(){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty p = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.LINESTYLE__NOLINEDRAWDASH); EscherSimpleProperty p = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.LINESTYLE__NOLINEDRAWDASH);
if(p != null && (p.getPropertyValue() & 0x8) == 0) return null; if(p != null && (p.getPropertyValue() & 0x8) == 0) return null;
@ -152,7 +152,7 @@ public abstract class SimpleShape extends Shape {
* @return dashing of the line. * @return dashing of the line.
*/ */
public int getLineDashing(){ public int getLineDashing(){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.LINESTYLE__LINEDASHING); EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.LINESTYLE__LINEDASHING);
return prop == null ? Line.PEN_SOLID : prop.getPropertyValue(); return prop == null ? Line.PEN_SOLID : prop.getPropertyValue();
@ -164,7 +164,7 @@ public abstract class SimpleShape extends Shape {
* @param pen new style of the line. * @param pen new style of the line.
*/ */
public void setLineDashing(int pen){ public void setLineDashing(int pen){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
setEscherProperty(opt, EscherProperties.LINESTYLE__LINEDASHING, pen == Line.PEN_SOLID ? -1 : pen); setEscherProperty(opt, EscherProperties.LINESTYLE__LINEDASHING, pen == Line.PEN_SOLID ? -1 : pen);
} }
@ -175,7 +175,7 @@ public abstract class SimpleShape extends Shape {
* @param style new style of the line. * @param style new style of the line.
*/ */
public void setLineStyle(int style){ public void setLineStyle(int style){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
setEscherProperty(opt, EscherProperties.LINESTYLE__LINESTYLE, style == Line.LINE_SIMPLE ? -1 : style); setEscherProperty(opt, EscherProperties.LINESTYLE__LINESTYLE, style == Line.LINE_SIMPLE ? -1 : style);
} }
@ -185,7 +185,7 @@ public abstract class SimpleShape extends Shape {
* @return style of the line. * @return style of the line.
*/ */
public int getLineStyle(){ public int getLineStyle(){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.LINESTYLE__LINESTYLE); EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.LINESTYLE__LINESTYLE);
return prop == null ? Line.LINE_SIMPLE : prop.getPropertyValue(); return prop == null ? Line.LINE_SIMPLE : prop.getPropertyValue();
} }

View File

@ -332,7 +332,7 @@ public final class Table extends ShapeGroup {
public Line createBorder(){ public Line createBorder(){
Line line = new Line(this); Line line = new Line(this);
EscherOptRecord opt = (EscherOptRecord)getEscherChild(line.getSpContainer(), EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
setEscherProperty(opt, EscherProperties.GEOMETRY__SHAPEPATH, -1); setEscherProperty(opt, EscherProperties.GEOMETRY__SHAPEPATH, -1);
setEscherProperty(opt, EscherProperties.GEOMETRY__FILLOK, -1); setEscherProperty(opt, EscherProperties.GEOMETRY__FILLOK, -1);
setEscherProperty(opt, EscherProperties.SHADOWSTYLE__SHADOWOBSURED, 0x20000); setEscherProperty(opt, EscherProperties.SHADOWSTYLE__SHADOWOBSURED, 0x20000);

View File

@ -61,7 +61,7 @@ public final class TableCell extends TextBox {
protected EscherContainerRecord createSpContainer(boolean isChild){ protected EscherContainerRecord createSpContainer(boolean isChild){
_escherContainer = super.createSpContainer(isChild); _escherContainer = super.createSpContainer(isChild);
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
setEscherProperty(opt, EscherProperties.TEXT__TEXTID, 0); setEscherProperty(opt, EscherProperties.TEXT__TEXTID, 0);
setEscherProperty(opt, EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 0x20000); setEscherProperty(opt, EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 0x20000);
setEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST, 0x150001); setEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST, 0x150001);

View File

@ -280,7 +280,7 @@ public abstract class TextShape extends SimpleShape {
* @return the type of alignment * @return the type of alignment
*/ */
public int getVerticalAlignment(){ public int getVerticalAlignment(){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.TEXT__ANCHORTEXT); EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.TEXT__ANCHORTEXT);
int valign = TextShape.AnchorTop; int valign = TextShape.AnchorTop;
if (prop == null){ if (prop == null){
@ -351,7 +351,7 @@ public abstract class TextShape extends SimpleShape {
* @return the botom margin * @return the botom margin
*/ */
public float getMarginBottom(){ public float getMarginBottom(){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.TEXT__TEXTBOTTOM); EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.TEXT__TEXTBOTTOM);
int val = prop == null ? EMU_PER_INCH/20 : prop.getPropertyValue(); int val = prop == null ? EMU_PER_INCH/20 : prop.getPropertyValue();
return (float)val/EMU_PER_POINT; return (float)val/EMU_PER_POINT;
@ -376,7 +376,7 @@ public abstract class TextShape extends SimpleShape {
* @return the left margin * @return the left margin
*/ */
public float getMarginLeft(){ public float getMarginLeft(){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.TEXT__TEXTLEFT); EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.TEXT__TEXTLEFT);
int val = prop == null ? EMU_PER_INCH/10 : prop.getPropertyValue(); int val = prop == null ? EMU_PER_INCH/10 : prop.getPropertyValue();
return (float)val/EMU_PER_POINT; return (float)val/EMU_PER_POINT;
@ -401,7 +401,7 @@ public abstract class TextShape extends SimpleShape {
* @return the right margin * @return the right margin
*/ */
public float getMarginRight(){ public float getMarginRight(){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.TEXT__TEXTRIGHT); EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.TEXT__TEXTRIGHT);
int val = prop == null ? EMU_PER_INCH/10 : prop.getPropertyValue(); int val = prop == null ? EMU_PER_INCH/10 : prop.getPropertyValue();
return (float)val/EMU_PER_POINT; return (float)val/EMU_PER_POINT;
@ -425,7 +425,7 @@ public abstract class TextShape extends SimpleShape {
* @return the top margin * @return the top margin
*/ */
public float getMarginTop(){ public float getMarginTop(){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.TEXT__TEXTTOP); EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.TEXT__TEXTTOP);
int val = prop == null ? EMU_PER_INCH/20 : prop.getPropertyValue(); int val = prop == null ? EMU_PER_INCH/20 : prop.getPropertyValue();
return (float)val/EMU_PER_POINT; return (float)val/EMU_PER_POINT;
@ -449,7 +449,7 @@ public abstract class TextShape extends SimpleShape {
* Must be one of the <code>Wrap*</code> constants defined in this class. * Must be one of the <code>Wrap*</code> constants defined in this class.
*/ */
public int getWordWrap(){ public int getWordWrap(){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.TEXT__WRAPTEXT); EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.TEXT__WRAPTEXT);
return prop == null ? WrapSquare : prop.getPropertyValue(); return prop == null ? WrapSquare : prop.getPropertyValue();
} }
@ -468,7 +468,7 @@ public abstract class TextShape extends SimpleShape {
* @return id for the text. * @return id for the text.
*/ */
public int getTextId(){ public int getTextId(){
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); EscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.TEXT__TEXTID); EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.TEXT__TEXTID);
return prop == null ? 0 : prop.getPropertyValue(); return prop == null ? 0 : prop.getPropertyValue();
} }