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.
This class declares 42 methods for ShapeCollection objects in Java programs.
Available methods include: ShapeCollection, addAutoShape, addAutoShapeImpl, addConnector, addConnectorImpl, addPictureFrame, addPictureFrameImpl, addTable, addTableImpl, asICollection, asIEnumerable, buildAutoShapeXml, and 23 additional methods.
Public members are accessible to any Java application after installing the Aspose.Slides FOSS for Java package.
Properties: parentGroup, spTree.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
spTree | Element | Read | Gets the {@code <p:spTree>} element from the slide XML. |
parentGroup | IGroupShape | Read/Write | Gets or sets the parent group. |
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 group. |
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 | Calls size on this ShapeCollection instance. |
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 | Calls addAutoShape(shapeType, x, y, width, height, createFromTemplate) on this ShapeCollection instance. |
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 | Calls insertAutoShape(index, shapeType, x, y, width, height, createFromTemplate) on this ShapeCollection instance. |
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 | Calls addConnector(shapeType, x, y, width, height, createFromTemplate) on this ShapeCollection instance. |
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 | Calls insertConnector(index, shapeType, x, y, width, height, createFromTemplate) on this ShapeCollection instance. |
addPictureFrame(shapeType: ShapeType, x: double, y: double, width: double, height: double, image: IPPImage) → IPictureFrame | Calls addPictureFrame(shapeType, x, y, width, height, image) on this ShapeCollection instance. |
insertPictureFrame(index: int, shapeType: ShapeType, x: double, y: double, width: double, height: double, image: IPPImage) → IPictureFrame | Calls insertPictureFrame(index, shapeType, x, y, width, height, image) on this ShapeCollection instance. |
addTable(x: double, y: double, colWidths: double[], rowHeights: double[]) → ITable | Calls addTable(x, y, colWidths, rowHeights) on this ShapeCollection instance. |
insertTable(index: int, x: double, y: double, colWidths: double[], rowHeights: double[]) → ITable | Calls insertTable(index, x, y, colWidths, rowHeights) on this ShapeCollection instance. |
indexOf(shape: IShape) → int | Calls indexOf(shape) on this ShapeCollection instance. |
toArray() → IShape[] | Calls toArray on this ShapeCollection instance. |
toArray(startIndex: int, count: int) → IShape[] | Calls toArray(startIndex, count) on this ShapeCollection instance. |
reorder(index: int, shape: IShape) | Calls reorder(index, shape) on this ShapeCollection instance. |
reorder(index: int, shapesToReorder: IShape[]) | Calls reorder(index, shapesToReorder) on this ShapeCollection instance. |
removeAt(index: int) | Calls removeAt(index) on this ShapeCollection instance. |
remove(shape: IShape) | Calls remove(shape) on this ShapeCollection instance. |
clear() | Calls clear on this ShapeCollection instance. |