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).
(表示一个 Shape,它是构成绘图的基本对象。此类是 EscherSpContainer 的包装器,它包含有关 PowerPoint 文档中形状的所有信息。添加形状时,通常会指定形状的尺寸以及形状边界框的左上角相对于页面、工作表或幻灯片的左上角的位置。绘图层中的距离以点为单位(72 点 = 1 英寸)。)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
(创建并将较低级别的 escher 记录分配给此形状)
|
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
(创建一个新的 HSLF 特定的 EscherClientDataRecord)
|
<T extends Record> |
getClientDataRecord(int recordType)
Find a record in the underlying EscherClientDataRecord
(在底层 EscherClientDataRecord 中查找记录)
|
protected java.util.List<? extends Record> |
getClientRecords()
Search for EscherClientDataRecord, if found, convert its contents into an array of HSLF records
(搜索 EscherClientDataRecord,如果找到,将其内容转换为 HSLF 记录数组)
|
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
(通过记录 ID 返回 escher 孩子的辅助方法)
|
<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.
(按类型返回 escher 属性。)
|
static <T extends EscherProperty> |
getEscherProperty(AbstractEscherOptRecord opt, int propId)
Deprecated.
use
(已弃用。改用 getEscherProperty(EscherPropertyTypes))
getEscherProperty(EscherPropertyTypes) instead
|
int |
getEscherProperty(EscherPropertyTypes propType)
Get the value of a simple escher property for this shape.
(获取此形状的简单 escher 属性的值。)
|
int |
getEscherProperty(EscherPropertyTypes type, int defaultValue)
Get the value of a simple escher property for this shape.
(获取此形状的简单 escher 属性的值。)
|
int |
getEscherProperty(short propId)
Get the value of a simple escher property for this shape.
(获取此形状的简单 escher 属性的值。)
|
int |
getEscherProperty(short propId, int defaultValue)
Deprecated.
use
(已弃用。改用 getEscherProperty(EscherPropertyTypes, int))
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.
(为这个形状设置一个 escher 属性。)
|
static void |
setEscherProperty(AbstractEscherOptRecord opt, short propId, int value)
Deprecated.
(已弃用。使用 setEscherProperty(AbstractEscherOptRecord, EscherPropertyTypes, int))
|
void |
setEscherProperty(EscherPropertyTypes propType, int value)
Set an simple escher property for this shape.
(为此形状设置一个简单的 escher 属性。)
|
void |
setEscherProperty(short propId, int value)
Deprecated.
(已弃用。使用 setEscherProperty(EscherPropertyTypes, int))
|
void |
setFlipHorizontal(boolean flip) |
void |
setFlipVertical(boolean flip) |
void |
setRotation(double theta) |
void |
setShapeId(int id)
Sets shape ID
(设置形状 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 shape
(escherRecord - 包含此形状信息的 EscherSpContainer 容器)
parent
- the parent of this Shape
(parent - 此 Shape 的父级)
protected EscherContainerRecord createSpContainer(boolean isChild)
public ShapeContainer<HSLFShape,HSLFTextParagraph> getParent()
getParent
in interface
Shape<HSLFShape,HSLFTextParagraph>
(接口 Shape 中的 getParent
public java.lang.String getShapeName()
getShapeName
in interface
Shape<HSLFShape,HSLFTextParagraph>
(接口 Shape 中的 getShapeName
public ShapeType getShapeType()
public void setShapeType(ShapeType type)
public java.awt.geom.Rectangle2D getAnchor()
getAnchor
in interface
Shape<HSLFShape,HSLFTextParagraph>
(接口 Shape 中的 getAnchor
public void setAnchor(java.awt.geom.Rectangle2D anchor)
anchor
- new anchor
(锚 - 新锚)
public final void moveTo(double x, double y)
x
- the x coordinate of the top left corner of the shape
(x - 形状左上角的 x 坐标)
y
- the y coordinate of the top left corner of the shape
(y - 形状左上角的 y 坐标)
public static <T extends EscherRecord> T getEscherChild(EscherContainerRecord owner, int recordId)
null
if not found.
(escher 记录,如果未找到,则返回 null。)
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)
instead
null
if not found.
(escher 属性,如果未找到,则返回 null。)
public static <T extends EscherProperty> T getEscherProperty(AbstractEscherOptRecord opt, EscherPropertyTypes type)
null
if not found.
(escher 属性,如果未找到,则返回 null。)
@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.
(opt - 要将属性设置到的 opt 记录。)
propId
- The id of the property. One of the constants defined in EscherOptRecord.
(propId - 属性的 ID。 EscherOptRecord 中定义的常量之一。)
value
- value of the property. If value = -1 then the property is removed.
(value - 财产的价值。如果 value = -1,则删除该属性。)
public static void setEscherProperty(AbstractEscherOptRecord opt, EscherPropertyTypes propType, int value)
opt
- The opt record to set the properties to.
(opt - 要将属性设置到的 opt 记录。)
propType
- The type of the property.
(propType - 属性的类型。)
value
- value of the property. If value = -1 then the property is removed.
(value - 财产的价值。如果 value = -1,则删除该属性。)
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.
(propId - 属性的 ID。 EscherOptRecord 中定义的常量之一。)
value
- value of the property. If value = -1 then the property is removed.
(value - 财产的价值。如果 value = -1,则删除该属性。)
public void setEscherProperty(EscherPropertyTypes propType, int value)
propType
- The type of the property.
(propType - 属性的类型。)
value
- value of the property. If value = -1 then the property is removed.
(value - 财产的价值。如果 value = -1,则删除该属性。)
public int getEscherProperty(short propId)
propId
- The id of the property. One of the constants defined in EscherOptRecord.
(propId - 属性的 ID。 EscherOptRecord 中定义的常量之一。)
public int getEscherProperty(EscherPropertyTypes propType)
propType
- The type of the property. One of the constants defined in EscherOptRecord.
(propType - 属性的类型。 EscherOptRecord 中定义的常量之一。)
@Deprecated @Removal(version="5.0.0") public int getEscherProperty(short propId, int defaultValue)
getEscherProperty(EscherPropertyTypes, int)
instead
propId
- The id of the property. One of the constants defined in EscherOptRecord.
(propId - 属性的 ID。 EscherOptRecord 中定义的常量之一。)
public int getEscherProperty(EscherPropertyTypes type, int defaultValue)
type
- The type of the property.
(type - 属性的类型。)
public EscherContainerRecord getSpContainer()
protected void afterInsert(HSLFSheet sh)
sh
- - owning shape
(sh - - 拥有形状)
public HSLFSheet getSheet()
getSheet
in interface
Shape<HSLFShape,HSLFTextParagraph>
(接口 Shape 中的 getSheet
SlideShow
this shape belongs to
(这个形状所属的幻灯片)
public void setSheet(HSLFSheet sheet)
SlideShow
this shape belongs to
(分配此形状所属的幻灯片)
sheet
- owner of this shape
(sheet - 此形状的所有者)
public int getShapeId()
Shape
If multiple objects within the same slide share the same id attribute value, then the document shall be considered non-conformant.
(返回当前幻灯片中此形状的唯一标识符。此 ID 可用于帮助唯一标识此对象,以便文档的其他部分可以引用它。如果同一张幻灯片中的多个对象共享相同的 id 属性值,则该文档应被视为不合格。)getShapeId
in interface
Shape<HSLFShape,HSLFTextParagraph>
(接口 Shape 中的 getShapeId
public void setShapeId(int id)
id
- of the shape
(id - 形状)
public HSLFFill getFill()
public FillStyle getFillStyle()
public void draw(java.awt.Graphics2D graphics, java.awt.geom.Rectangle2D bounds)
Shape
draw
in interface
Shape<HSLFShape,HSLFTextParagraph>
(在界面Shape中绘制
graphics
- the graphics context
(graphics - 图形上下文)
bounds
- the rectangle to fit the shape to. if null, the bounds of the shape are used.
(bounds - 适合形状的矩形。如果为 null,则使用形状的边界。)
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 search
(recordType - 要搜索的记录的类型)
protected java.util.List<? extends Record> getClientRecords()
null
(形状的 EscherClientDataRecord 中包含的 HSLF 记录数组或 null)
protected HSLFEscherClientDataRecord getClientData(boolean create)
create
- if true, create the missing record
(create - 如果为真,则创建缺失的记录)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.