ShapeCollection
Overview
ShapeCollection is a class in Aspose.Slides FOSS for Java.
Inherits from: IShapeCollection, Iterable<IShape>.
Represents a collection of shapes on a slide.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
spTree | Element | Read | Gets the {@code <p:spTree>} element from the slide XML. |
parentGroup | IGroupShape | Read | Gets or sets the parent group shape for this collection |
Methods
| Signature | Description |
|---|---|
ShapeCollection() | Creates an empty ShapeCollection. |
ShapeCollection(spTree: Element, saveCallback: Runnable) | Creates a ShapeCollection backed by the given shape tree element. |
initInternal(spTree: Element, saveCallback: Runnable) | Internal initialization with slide context. |
getSpTree() → Element | Gets the {@code <p:spTree>} element from the slide XML. |
loadShapes() → List<IShape> | Loads all shapes from the XML, using the cache when available. |
invalidateCache() | Invalidates the shapes cache, forcing a reload on next access. |
save() | Persists changes to the slide part via the save callback. |
nextShapeId() → int | Finds the next available shape ID by scanning all {@code id} attributes |
| in the spTree. | |
buildAutoShapeXml(shapeId: int, name: String, shapeType: ShapeType, x: double, y: double, width: double, height: double, createFromTemplate: boolean) → Element | Builds XML for a new AutoShape ({@code <p:sp>}) element. |
buildConnectorXml(shapeId: int, name: String, shapeType: ShapeType, x: double, y: double, width: double, height: double, createFromTemplate: boolean) → Element | Builds XML for a new connector ({@code <p:cxnSp>}) element. |
addAutoShapeImpl(index: Integer, shapeType: ShapeType, x: double, y: double, width: double, height: double, createFromTemplate: boolean) → IAutoShape | Core implementation for adding or inserting an AutoShape. |
addConnectorImpl(index: Integer, shapeType: ShapeType, x: double, y: double, width: double, height: double, createFromTemplate: boolean) → IConnector | Core implementation for adding or inserting a connector. |
addPictureFrameImpl(index: Integer, shapeType: ShapeType, x: double, y: double, width: double, height: double, image: IPPImage) → IPictureFrame | Core implementation for adding or inserting a picture frame. |
addTableImpl(index: Integer, x: double, y: double, colWidths: double[], rowHeights: double[]) → ITable | Core implementation for adding or inserting a table. |
reorderSingle(newIndex: int, shape: IShape) | Reorders a single shape to a new position within the spTree XML. |
getParentGroup() → IGroupShape | Returns the parent IGroupShape of this collection |
setParentGroup(parentGroup: IGroupShape) | Sets the parent group shape for this collection. |
asICollection() → List<IShape> | Returns the shapes as a List |
asIEnumerable() → Iterable<IShape> | Returns the shapes as an Iterable |
get(index: int) → IShape | Returns the shape at the specified index |
size() → int | |
iterator() → Iterator<IShape> | Returns an iterator over the shapes in this collection. |
addAutoShape(shapeType: ShapeType, x: double, y: double, width: double, height: double) → IAutoShape | Adds a new AutoShape with given type and geometry |
addAutoShape(shapeType: ShapeType, x: double, y: double, width: double, height: double, createFromTemplate: boolean) → IAutoShape | |
insertAutoShape(index: int, shapeType: ShapeType, x: double, y: double, width: double, height: double) → IAutoShape | Inserts a new AutoShape at index with given type and geometry |
insertAutoShape(index: int, shapeType: ShapeType, x: double, y: double, width: double, height: double, createFromTemplate: boolean) → IAutoShape | |
addConnector(shapeType: ShapeType, x: double, y: double, width: double, height: double) → IConnector | Adds a new connector with given type and geometry |
addConnector(shapeType: ShapeType, x: double, y: double, width: double, height: double, createFromTemplate: boolean) → IConnector | |
insertConnector(index: int, shapeType: ShapeType, x: double, y: double, width: double, height: double) → IConnector | Inserts a connector at index with given type and geometry |
insertConnector(index: int, shapeType: ShapeType, x: double, y: double, width: double, height: double, createFromTemplate: boolean) → IConnector | |
addPictureFrame(shapeType: ShapeType, x: double, y: double, width: double, height: double, image: IPPImage) → IPictureFrame | |
insertPictureFrame(index: int, shapeType: ShapeType, x: double, y: double, width: double, height: double, image: IPPImage) → IPictureFrame | |
addTable(x: double, y: double, colWidths: double[], rowHeights: double[]) → ITable | |
insertTable(index: int, x: double, y: double, colWidths: double[], rowHeights: double[]) → ITable | |
indexOf(shape: IShape) → int | |
toArray() → IShape[] | |
toArray(startIndex: int, count: int) → IShape[] | |
reorder(index: int, shape: IShape) | |
reorder(index: int, shapesToReorder: IShape[]) | |
removeAt(index: int) | |
remove(shape: IShape) | |
clear() |