Background
, ShapeGroup
, SimpleShape
public abstract class Shape
extends java.lang.Object
Represents a Shape which is the elemental object that composes a drawing. This class is a wrapper around EscherSpContainer which holds all information about a shape in PowerPoint document.
When you add a shape, you usually specify the dimensions of the shape and the position of the upper'left corner of the bounding box for the shape relative to the upper'left corner of the page, worksheet, or slide. Distances in the drawing layer are measured in points (72 points = 1 inch).
Modifier and Type | Field | Description |
---|---|---|
protected EscherContainerRecord |
_escherContainer |
Either EscherSpContainer or EscheSpgrContainer record
which holds information about this shape.
|
protected Fill |
_fill |
Fill
|
protected Shape |
_parent |
Parent of this shape.
|
protected Sheet |
_sheet |
The
Sheet this shape belongs to |
static int |
EMU_PER_CENTIMETER |
|
static int |
EMU_PER_INCH |
In 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.
|
static int |
EMU_PER_POINT |
|
protected POILogger |
logger |
|
static int |
MASTER_DPI |
Master DPI (576 pixels per inch).
|
static int |
PIXEL_DPI |
Pixels DPI (96 pixels per inch)
|
static int |
POINT_DPI |
Points DPI (72 pixels per inch)
|
Modifier | Constructor | Description |
---|---|---|
protected |
Shape(EscherContainerRecord escherRecord,
Shape parent) |
Create a Shape object.
|
Modifier and Type | Method | Description |
---|---|---|
protected void |
afterInsert(Sheet sh) |
Event which fires when a shape is inserted in the sheet.
|
protected abstract EscherContainerRecord |
createSpContainer(boolean isChild) |
Creates the lowerlevel escher records for this shape.
|
void |
draw(java.awt.Graphics2D graphics) |
|
java.awt.Rectangle |
getAnchor() |
Returns the anchor (the bounding box rectangle) of this shape.
|
java.awt.geom.Rectangle2D |
getAnchor2D() |
Returns the anchor (the bounding box rectangle) of this shape.
|
<T extends EscherRecord> |
getEscherChild(int recordId) |
|
static <T extends EscherRecord> |
getEscherChild(EscherContainerRecord owner,
int recordId) |
Helper method to return escher child by record ID
|
EscherOptRecord |
getEscherOptRecord() |
|
int |
getEscherProperty(short propId) |
Get the value of a simple escher property for this shape.
|
int |
getEscherProperty(short propId,
int defaultValue) |
Get the value of a simple escher property for this shape.
|
static <T extends EscherProperty> |
getEscherProperty(EscherOptRecord opt,
int propId) |
Returns escher property by id.
|
Fill |
getFill() |
Fill properties of this shape
|
boolean |
getFlipHorizontal() |
Whether the shape is horizontally flipped
|
boolean |
getFlipVertical() |
Whether the shape is vertically flipped
|
Hyperlink |
getHyperlink() |
Returns the hyperlink assigned to this shape
|
java.awt.geom.Rectangle2D |
getLogicalAnchor2D() |
|
java.awt.Shape |
getOutline() |
Return shape outline as a java.awt.Shape object
|
Shape |
getParent() |
|
int |
getRotation() |
Rotation angle in degrees
|
int |
getShapeId() |
|
java.lang.String |
getShapeName() |
|
int |
getShapeType() |
|
Sheet |
getSheet() |
|
EscherContainerRecord |
getSpContainer() |
|
void |
moveTo(float x,
float y) |
Moves the top left corner of the shape to the specified point.
|
void |
setAnchor(java.awt.geom.Rectangle2D anchor) |
Sets the anchor (the bounding box rectangle) of this shape.
|
void |
setEscherProperty(short propId,
int value) |
Set an simple escher property for this shape.
|
static void |
setEscherProperty(EscherOptRecord opt,
short propId,
int value) |
Set an escher property for this shape.
|
void |
setRotation(int theta) |
Rotate this shape
|
void |
setShapeId(int id) |
Sets shape ID
|
void |
setShapeType(int type) |
|
void |
setSheet(Sheet sheet) |
Assign the
SlideShow this shape belongs to |
protected POILogger logger
public static final int EMU_PER_INCH
public static final int EMU_PER_POINT
public static final int EMU_PER_CENTIMETER
public static final int MASTER_DPI
public static final int PIXEL_DPI
public static final int POINT_DPI
protected EscherContainerRecord _escherContainer
protected Shape _parent
null
for the topmost shapes.protected Sheet _sheet
Sheet
this shape belongs toprotected Fill _fill
protected Shape(EscherContainerRecord escherRecord, Shape parent)
escherRecord
- EscherSpContainer
container which holds information about this shapeparent
- the parent of this Shapeprotected abstract EscherContainerRecord createSpContainer(boolean isChild)
public Shape getParent()
public java.lang.String getShapeName()
public int getShapeType()
RecordTypes
public void setShapeType(int type)
type
- type of the shape.RecordTypes
public java.awt.Rectangle getAnchor()
public java.awt.geom.Rectangle2D getAnchor2D()
public java.awt.geom.Rectangle2D getLogicalAnchor2D()
public void setAnchor(java.awt.geom.Rectangle2D anchor)
anchor
- new anchorpublic void moveTo(float x, float y)
x
- the x coordinate of the top left corner of the shapey
- the y coordinate of the top left corner of the shapepublic static <T extends EscherRecord> T getEscherChild(EscherContainerRecord owner, int recordId)
null
if not found.public <T extends EscherRecord> T getEscherChild(int recordId)
public static <T extends EscherProperty> T getEscherProperty(EscherOptRecord opt, int propId)
null
if not found.public static void setEscherProperty(EscherOptRecord opt, short propId, int value)
opt
- The opt record to set the properties to.propId
- The id of the property. One of the constants defined in EscherOptRecord.value
- value of the property. If value = -1 then the property is removed.public void setEscherProperty(short propId, int value)
propId
- The id of the property. One of the constants defined in EscherOptRecord.value
- value of the property. If value = -1 then the property is removed.public int getEscherProperty(short propId)
propId
- The id of the property. One of the constants defined in EscherOptRecord.public int getEscherProperty(short propId, int defaultValue)
propId
- The id of the property. One of the constants defined in EscherOptRecord.public EscherContainerRecord getSpContainer()
protected void afterInsert(Sheet sh)
sh
- - owning shapepublic Sheet getSheet()
SlideShow
this shape belongs topublic void setSheet(Sheet sheet)
SlideShow
this shape belongs tosheet
- owner of this shapepublic int getShapeId()
public void setShapeId(int id)
id
- of the shapepublic Fill getFill()
public Hyperlink getHyperlink()
null
if not found.public void draw(java.awt.Graphics2D graphics)
public java.awt.Shape getOutline()
public EscherOptRecord getEscherOptRecord()
public boolean getFlipHorizontal()
public boolean getFlipVertical()
public int getRotation()
public void setRotation(int theta)
theta
- the rotation angle in degreesCopyright 2018 The Apache Software Foundation or its licensors, as applicable.