public abstract class HSLFShape extends java.lang.Object implements Shape<HSLFShape,HSLFTextParagraph>
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 | Constructor and Description |
---|---|
protected |
HSLFShape(EscherContainerRecord escherRecord,
ShapeContainer<HSLFShape,HSLFTextParagraph> parent)
Create a Shape object.
|
Modifier and Type | Method and Description |
---|---|
protected void |
afterInsert(HSLFSheet sh)
Event which fires when a shape is inserted in the sheet.
|
protected EscherContainerRecord |
createSpContainer(boolean isChild)
Create and assign the lower level escher record to this shape
|
void |
draw(java.awt.Graphics2D graphics,
java.awt.geom.Rectangle2D bounds)
Convenience method to draw a single shape
|
java.awt.geom.Rectangle2D |
getAnchor()
Returns the anchor (the bounding box rectangle) of this shape.
|
protected HSLFEscherClientDataRecord |
getClientData(boolean create)
Create a new HSLF-specific EscherClientDataRecord
|
<T extends Record> |
getClientDataRecord(int recordType)
Find a record in the underlying EscherClientDataRecord
|
protected java.util.List<? extends Record> |
getClientRecords()
Search for EscherClientDataRecord, if found, convert its contents into an array of HSLF records
|
static <T extends EscherRecord> |
getEscherChild(EscherContainerRecord owner,
EscherRecordTypes recordId) |
static <T extends EscherRecord> |
getEscherChild(EscherContainerRecord owner,
int recordId)
Helper method to return escher child by record ID
|
<T extends EscherRecord> |
getEscherChild(EscherRecordTypes recordId) |
<T extends EscherRecord> |
getEscherChild(int recordId) |
AbstractEscherOptRecord |
getEscherOptRecord() |
static <T extends EscherProperty> |
getEscherProperty(AbstractEscherOptRecord opt,
EscherPropertyTypes type)
Returns escher property by type.
|
static <T extends EscherProperty> |
getEscherProperty(AbstractEscherOptRecord opt,
int propId)
Deprecated.
use
getEscherProperty(EscherPropertyTypes) instead |
int |
getEscherProperty(EscherPropertyTypes propType)
Get the value of a simple escher property for this shape.
|
int |
getEscherProperty(EscherPropertyTypes type,
int defaultValue)
Get the value of a simple escher property for this shape.
|
int |
getEscherProperty(short propId)
Get the value of a simple escher property for this shape.
|
int |
getEscherProperty(short propId,
int defaultValue)
Deprecated.
use
getEscherProperty(EscherPropertyTypes, int) instead |
HSLFFill |
getFill()
Fill properties of this shape
|
FillStyle |
getFillStyle() |
boolean |
getFlipHorizontal() |
boolean |
getFlipVertical() |
ShapeContainer<HSLFShape,HSLFTextParagraph> |
getParent() |
double |
getRotation() |
int |
getShapeId()
Returns a unique identifier for this shape within the current slide.
|
java.lang.String |
getShapeName() |
ShapeType |
getShapeType() |
HSLFSheet |
getSheet() |
EscherContainerRecord |
getSpContainer() |
boolean |
isPlaceholder() |
void |
moveTo(double x,
double 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.
|
static void |
setEscherProperty(AbstractEscherOptRecord opt,
EscherPropertyTypes propType,
boolean isBlipId,
int value) |
static void |
setEscherProperty(AbstractEscherOptRecord opt,
EscherPropertyTypes propType,
int value)
Set an escher property for this shape.
|
static void |
setEscherProperty(AbstractEscherOptRecord opt,
short propId,
int value)
|
void |
setEscherProperty(EscherPropertyTypes propType,
int value)
Set an simple escher property for this shape.
|
void |
setEscherProperty(short propId,
int value)
Deprecated.
|
void |
setFlipHorizontal(boolean flip) |
void |
setFlipVertical(boolean flip) |
void |
setRotation(double theta) |
void |
setShapeId(int id)
Sets shape ID
|
void |
setShapeType(ShapeType type) |
void |
setSheet(HSLFSheet sheet)
Assign the
SlideShow this shape belongs to |
protected HSLFShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape,HSLFTextParagraph> parent)
escherRecord
- EscherSpContainer
container which holds information about this shapeparent
- the parent of this Shapeprotected EscherContainerRecord createSpContainer(boolean isChild)
public ShapeContainer<HSLFShape,HSLFTextParagraph> getParent()
getParent
in interface Shape<HSLFShape,HSLFTextParagraph>
public java.lang.String getShapeName()
getShapeName
in interface Shape<HSLFShape,HSLFTextParagraph>
public ShapeType getShapeType()
public void setShapeType(ShapeType type)
public java.awt.geom.Rectangle2D getAnchor()
getAnchor
in interface Shape<HSLFShape,HSLFTextParagraph>
public void setAnchor(java.awt.geom.Rectangle2D anchor)
anchor
- new anchorpublic final void moveTo(double x, double 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 static <T extends EscherRecord> T getEscherChild(EscherContainerRecord owner, EscherRecordTypes recordId)
public <T extends EscherRecord> T getEscherChild(int recordId)
public <T extends EscherRecord> T getEscherChild(EscherRecordTypes recordId)
@Deprecated @Removal(version="5.0.0") public static <T extends EscherProperty> T getEscherProperty(AbstractEscherOptRecord opt, int propId)
getEscherProperty(EscherPropertyTypes)
insteadnull
if not found.public static <T extends EscherProperty> T getEscherProperty(AbstractEscherOptRecord opt, EscherPropertyTypes type)
null
if not found.@Deprecated @Removal(version="5.0.0") public static void setEscherProperty(AbstractEscherOptRecord 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 static void setEscherProperty(AbstractEscherOptRecord opt, EscherPropertyTypes propType, int value)
opt
- The opt record to set the properties to.propType
- The type of the property.value
- value of the property. If value = -1 then the property is removed.public static void setEscherProperty(AbstractEscherOptRecord opt, EscherPropertyTypes propType, boolean isBlipId, int value)
@Deprecated @Removal(version="5.0.0") public void setEscherProperty(short propId, int value)
setEscherProperty(EscherPropertyTypes, int)
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(EscherPropertyTypes propType, int value)
propType
- The type of the property.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(EscherPropertyTypes propType)
propType
- The type of the property. One of the constants defined in EscherOptRecord.@Deprecated @Removal(version="5.0.0") public int getEscherProperty(short propId, int defaultValue)
getEscherProperty(EscherPropertyTypes, int)
insteadpropId
- The id of the property. One of the constants defined in EscherOptRecord.public int getEscherProperty(EscherPropertyTypes type, int defaultValue)
type
- The type of the property.public EscherContainerRecord getSpContainer()
protected void afterInsert(HSLFSheet sh)
sh
- - owning shapepublic HSLFSheet getSheet()
getSheet
in interface Shape<HSLFShape,HSLFTextParagraph>
SlideShow
this shape belongs topublic void setSheet(HSLFSheet sheet)
SlideShow
this shape belongs tosheet
- owner of this shapepublic int getShapeId()
Shape
If multiple objects within the same slide share the same id attribute value, then the document shall be considered non-conformant.
getShapeId
in interface Shape<HSLFShape,HSLFTextParagraph>
public void setShapeId(int id)
id
- of the shapepublic HSLFFill getFill()
public FillStyle getFillStyle()
public void draw(java.awt.Graphics2D graphics, java.awt.geom.Rectangle2D bounds)
Shape
draw
in interface Shape<HSLFShape,HSLFTextParagraph>
graphics
- the graphics contextbounds
- the rectangle to fit the shape to.
if null, the bounds of the shape are used.public AbstractEscherOptRecord getEscherOptRecord()
public boolean getFlipHorizontal()
public void setFlipHorizontal(boolean flip)
public boolean getFlipVertical()
public void setFlipVertical(boolean flip)
public double getRotation()
public void setRotation(double theta)
public boolean isPlaceholder()
public <T extends Record> T getClientDataRecord(int recordType)
recordType
- type of the record to searchprotected java.util.List<? extends Record> getClientRecords()
null
protected HSLFEscherClientDataRecord getClientData(boolean create)
create
- if true, create the missing recordCopyright 2020 The Apache Software Foundation or its licensors, as applicable.