Fields Summary |
---|
protected POILogger | logger |
public static final int | EMU_PER_INCHIn Escher absolute distances are specified in
English Metric Units (EMUs), occasionally referred to as A units;
there are 360000 EMUs per centimeter, 914400 EMUs per inch, 12700 EMUs per point. |
public static final int | EMU_PER_POINT |
public static final int | EMU_PER_CENTIMETER |
public static final int | MASTER_DPIMaster DPI (576 pixels per inch).
Used by the reference coordinate system in PowerPoint. |
public static final int | PIXEL_DPIPixels DPI (96 pixels per inch) |
public static final int | POINT_DPIPoints DPI (72 pixels per inch) |
protected EscherContainerRecord | _escherContainerEither EscherSpContainer or EscheSpgrContainer record
which holds information about this shape. |
protected Shape | _parentParent of this shape.
null for the topmost shapes. |
protected Sheet | _sheetThe Sheet this shape belongs to |
Methods Summary |
---|
protected void | afterInsert(org.apache.poi.hslf.model.Sheet sh)Event which fires when a shape is inserted in the sheet.
In some cases we need to propagate changes to upper level containers.
Default implementation does nothing.
|
protected abstract org.apache.poi.ddf.EscherContainerRecord | createSpContainer(boolean isChild)Creates the lowerlevel escher records for this shape.
|
public java.awt.Rectangle | getAnchor()Returns the anchor (the bounding box rectangle) of this shape.
All coordinates are expressed in points (72 dpi).
EscherSpRecord spRecord = _escherContainer.getChildById(EscherSpRecord.RECORD_ID);
int flags = spRecord.getFlags();
java.awt.Rectangle anchor=null;
if ((flags & EscherSpRecord.FLAG_CHILD) != 0){
EscherChildAnchorRecord rec = (EscherChildAnchorRecord)getEscherChild(_escherContainer, EscherChildAnchorRecord.RECORD_ID);
anchor = new java.awt.Rectangle();
anchor.x = rec.getDx1()*POINT_DPI/MASTER_DPI;
anchor.y = rec.getDy1()*POINT_DPI/MASTER_DPI;
anchor.width = (rec.getDx2() - anchor.x)*POINT_DPI/MASTER_DPI;
anchor.height = (rec.getDy2() - anchor.y)*POINT_DPI/MASTER_DPI;
}
else {
EscherClientAnchorRecord rec = (EscherClientAnchorRecord)getEscherChild(_escherContainer, EscherClientAnchorRecord.RECORD_ID);
anchor = new java.awt.Rectangle();
anchor.y = rec.getFlag()*POINT_DPI/MASTER_DPI;
anchor.x = rec.getCol1()*POINT_DPI/MASTER_DPI;
anchor.width = (rec.getDx1() - rec.getCol1())*POINT_DPI/MASTER_DPI;
anchor.height = (rec.getRow1() - rec.getFlag())*POINT_DPI/MASTER_DPI;
}
return anchor;
|
protected java.awt.Color | getColor(int rgb)
if (rgb >= 0x8000000) {
int idx = rgb - 0x8000000;
ColorSchemeAtom ca = getSheet().getColorScheme();
if(idx >= 0 && idx <= 7) rgb = ca.getColor(idx);
}
Color tmp = new Color(rgb, true);
return new Color(tmp.getBlue(), tmp.getGreen(), tmp.getRed());
|
public static org.apache.poi.ddf.EscherRecord | getEscherChild(org.apache.poi.ddf.EscherContainerRecord owner, int recordId)Helper method to return escher child by record ID
for ( Iterator iterator = owner.getChildRecords().iterator(); iterator.hasNext(); )
{
EscherRecord escherRecord = (EscherRecord) iterator.next();
if (escherRecord.getRecordId() == recordId)
return escherRecord;
}
return null;
|
public static org.apache.poi.ddf.EscherProperty | getEscherProperty(org.apache.poi.ddf.EscherOptRecord opt, int propId)Returns escher property by id.
for ( Iterator iterator = opt.getEscherProperties().iterator(); iterator.hasNext(); )
{
EscherProperty prop = (EscherProperty) iterator.next();
if (prop.getId() == propId)
return prop;
}
return null;
|
public org.apache.poi.hslf.model.Fill | getFill()Fill properties of this shape
return new Fill(this);
|
public org.apache.poi.hslf.model.Hyperlink | getHyperlink()Returns the hyperlink assigned to this shape
return Hyperlink.find(this);
|
public org.apache.poi.hslf.model.Shape | getParent()
return _parent;
|
public java.lang.String | getShapeName()
return ShapeTypes.typeName(getShapeType());
|
public int | getShapeType()
EscherSpRecord spRecord = _escherContainer.getChildById(EscherSpRecord.RECORD_ID);
return spRecord.getOptions() >> 4;
|
public org.apache.poi.hslf.model.Sheet | getSheet()
return _sheet;
|
public org.apache.poi.ddf.EscherContainerRecord | getSpContainer()
return _escherContainer;
|
public void | moveTo(int x, int y)Moves the top left corner of the shape to the specified point.
java.awt.Rectangle anchor = getAnchor();
anchor.setLocation(x, y);
setAnchor(anchor);
|
public void | setAnchor(java.awt.Rectangle anchor)Sets the anchor (the bounding box rectangle) of this shape.
All coordinates should be expressed in points (72 dpi).
EscherSpRecord spRecord = _escherContainer.getChildById(EscherSpRecord.RECORD_ID);
int flags = spRecord.getFlags();
if ((flags & EscherSpRecord.FLAG_CHILD) != 0){
EscherChildAnchorRecord rec = (EscherChildAnchorRecord)getEscherChild(_escherContainer, EscherChildAnchorRecord.RECORD_ID);
rec.setDx1(anchor.x*MASTER_DPI/POINT_DPI);
rec.setDy1(anchor.y*MASTER_DPI/POINT_DPI);
rec.setDx2((anchor.width + anchor.x)*MASTER_DPI/POINT_DPI);
rec.setDy2((anchor.height + anchor.y)*MASTER_DPI/POINT_DPI);
}
else {
EscherClientAnchorRecord rec = (EscherClientAnchorRecord)getEscherChild(_escherContainer, EscherClientAnchorRecord.RECORD_ID);
rec.setFlag((short)(anchor.y*MASTER_DPI/POINT_DPI));
rec.setCol1((short)(anchor.x*MASTER_DPI/POINT_DPI));
rec.setDx1((short)((anchor.width + anchor.x)*MASTER_DPI/POINT_DPI));
rec.setRow1((short)((anchor.height + anchor.y)*MASTER_DPI/POINT_DPI));
}
|
public static void | setEscherProperty(org.apache.poi.ddf.EscherOptRecord opt, short propId, int value)Set an escher property for this shape.
java.util.List props = opt.getEscherProperties();
for ( Iterator iterator = props.iterator(); iterator.hasNext(); ) {
EscherProperty prop = (EscherProperty) iterator.next();
if (prop.getId() == propId){
iterator.remove();
}
}
if (value != -1) {
opt.addEscherProperty(new EscherSimpleProperty(propId, value));
opt.sortProperties();
}
|
public void | setShapeType(int type)
EscherSpRecord spRecord = _escherContainer.getChildById(EscherSpRecord.RECORD_ID);
spRecord.setOptions((short)(type << 4 | 0x2));
|
public void | setSheet(org.apache.poi.hslf.model.Sheet sheet)Assign the SlideShow this shape belongs to
_sheet = sheet;
|