org.apache.poi.xslf.usermodel
Class XSLFGroupShape

java.lang.Object
  extended by org.apache.poi.xslf.usermodel.XSLFShape
      extended by org.apache.poi.xslf.usermodel.XSLFGroupShape
All Implemented Interfaces:
java.lang.Iterable<XSLFShape>, GroupShape<XSLFShape,XSLFTextParagraph>, PlaceableShape<XSLFShape,XSLFTextParagraph>, Shape<XSLFShape,XSLFTextParagraph>, ShapeContainer<XSLFShape,XSLFTextParagraph>, XSLFShapeContainer

@Beta
public class XSLFGroupShape
extends XSLFShape
implements XSLFShapeContainer, GroupShape<XSLFShape,XSLFTextParagraph>

Represents a group shape that consists of many shapes grouped together.

Author:
Yegor Kozlov

Field Summary
 
Fields inherited from class org.apache.poi.xslf.usermodel.XSLFShape
PML_NS
 
Constructor Summary
protected XSLFGroupShape(org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape shape, XSLFSheet sheet)
           
 
Method Summary
 void addShape(XSLFShape shape)
           
 void clear()
          Removes all of the elements from this container (optional operation).
 XSLFAutoShape createAutoShape()
          create a new shape with a predefined geometry and add it to this shape container
 XSLFConnectorShape createConnector()
          create a connector
 XSLFFreeformShape createFreeform()
          create a new shape with a custom geometry
 XSLFGroupShape createGroup()
          create a group of shapes belonging to this container
 XSLFPictureShape createPicture(PictureData pictureData)
          create a picture belonging to this container
 XSLFTable createTable()
           
 XSLFTable createTable(int numRows, int numCols)
          Create a new Table of the given number of rows and columns
 XSLFTextBox createTextBox()
          create a text box
 java.awt.geom.Rectangle2D getAnchor()
          Returns the anchor (the bounding box rectangle) of this shape.
 boolean getFlipHorizontal()
          Whether the shape is horizontally flipped
 boolean getFlipVertical()
          Whether the shape is vertically flipped
protected  org.openxmlformats.schemas.drawingml.x2006.main.CTGroupShapeProperties getGrpSpPr()
           
 java.awt.geom.Rectangle2D getInteriorAnchor()
          Gets the coordinate space of this group.
 double getRotation()
          Rotation angle in degrees
protected  org.openxmlformats.schemas.drawingml.x2006.main.CTGroupTransform2D getSafeXfrm()
           
 java.util.List<XSLFShape> getShapes()
          Returns an list containing all of the elements in this container in proper sequence (from first to last element).
protected  org.openxmlformats.schemas.drawingml.x2006.main.CTGroupTransform2D getXfrm()
           
 java.util.Iterator<XSLFShape> iterator()
          Returns an iterator over the shapes in this sheet
 boolean removeShape(XSLFShape xShape)
          Remove the specified shape from this group
 void setAnchor(java.awt.geom.Rectangle2D anchor)
           
 void setFlipHorizontal(boolean flip)
           
 void setFlipVertical(boolean flip)
          Whether the shape is vertically flipped
 void setInteriorAnchor(java.awt.geom.Rectangle2D anchor)
          Sets the coordinate space of this group.
 void setRotation(double theta)
          Rotate this shape.
 
Methods inherited from class org.apache.poi.xslf.usermodel.XSLFShape
draw, fetchShapeProperty, getBgPr, getBgRef, getChild, getCNvPr, getCTPlaceholder, getFillPaint, getParent, getPlaceholder, getShapeId, getShapeName, getShapeProperties, getSheet, getSpStyle, getXmlObject, selectPaint, selectPaint, selectPaint, selectPaint, selectPaint, selectProperty, setParent, setPlaceholder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.poi.sl.usermodel.Shape
draw, getParent, getSheet
 
Methods inherited from interface org.apache.poi.sl.usermodel.PlaceableShape
getParent, getSheet
 

Constructor Detail

XSLFGroupShape

protected XSLFGroupShape(org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape shape,
                         XSLFSheet sheet)
Method Detail

getGrpSpPr

protected org.openxmlformats.schemas.drawingml.x2006.main.CTGroupShapeProperties getGrpSpPr()
Overrides:
getGrpSpPr in class XSLFShape

getSafeXfrm

protected org.openxmlformats.schemas.drawingml.x2006.main.CTGroupTransform2D getSafeXfrm()

getXfrm

protected org.openxmlformats.schemas.drawingml.x2006.main.CTGroupTransform2D getXfrm()

getAnchor

public java.awt.geom.Rectangle2D getAnchor()
Description copied from interface: Shape
Returns the anchor (the bounding box rectangle) of this shape. All coordinates are expressed in points (72 dpi).

Specified by:
getAnchor in interface PlaceableShape<XSLFShape,XSLFTextParagraph>
Specified by:
getAnchor in interface Shape<XSLFShape,XSLFTextParagraph>
Returns:
the anchor of this shape

setAnchor

public void setAnchor(java.awt.geom.Rectangle2D anchor)
Specified by:
setAnchor in interface PlaceableShape<XSLFShape,XSLFTextParagraph>
Parameters:
anchor - the position of this shape within the drawing canvas. The coordinates are expressed in points

getInteriorAnchor

public java.awt.geom.Rectangle2D getInteriorAnchor()
Description copied from interface: GroupShape
Gets the coordinate space of this group. All children are constrained to these coordinates.

Specified by:
getInteriorAnchor in interface GroupShape<XSLFShape,XSLFTextParagraph>
Returns:
the coordinates of the child extents rectangle used for calculations of grouping, scaling, and rotation behavior of shapes placed within a group.

setInteriorAnchor

public void setInteriorAnchor(java.awt.geom.Rectangle2D anchor)
Description copied from interface: GroupShape
Sets the coordinate space of this group. All children are constrained to these coordinates.

Specified by:
setInteriorAnchor in interface GroupShape<XSLFShape,XSLFTextParagraph>
Parameters:
anchor - the coordinates of the child extents rectangle used for calculations of grouping, scaling, and rotation behavior of shapes placed within a group.

getShapes

public java.util.List<XSLFShape> getShapes()
Description copied from interface: ShapeContainer
Returns an list containing all of the elements in this container in proper sequence (from first to last element).

Specified by:
getShapes in interface ShapeContainer<XSLFShape,XSLFTextParagraph>
Returns:
child shapes contained within this group

iterator

public java.util.Iterator<XSLFShape> iterator()
Returns an iterator over the shapes in this sheet

Specified by:
iterator in interface java.lang.Iterable<XSLFShape>
Returns:
an iterator over the shapes in this sheet

removeShape

public boolean removeShape(XSLFShape xShape)
Remove the specified shape from this group

Specified by:
removeShape in interface ShapeContainer<XSLFShape,XSLFTextParagraph>
Parameters:
xShape - the shape to be removed from this sheet, if present
Returns:
true if this sheet contained the specified element

createAutoShape

public XSLFAutoShape createAutoShape()
Description copied from interface: ShapeContainer
create a new shape with a predefined geometry and add it to this shape container

Specified by:
createAutoShape in interface ShapeContainer<XSLFShape,XSLFTextParagraph>
Specified by:
createAutoShape in interface XSLFShapeContainer

createFreeform

public XSLFFreeformShape createFreeform()
Description copied from interface: ShapeContainer
create a new shape with a custom geometry

Specified by:
createFreeform in interface ShapeContainer<XSLFShape,XSLFTextParagraph>
Specified by:
createFreeform in interface XSLFShapeContainer

createTextBox

public XSLFTextBox createTextBox()
Description copied from interface: ShapeContainer
create a text box

Specified by:
createTextBox in interface ShapeContainer<XSLFShape,XSLFTextParagraph>
Specified by:
createTextBox in interface XSLFShapeContainer

createConnector

public XSLFConnectorShape createConnector()
Description copied from interface: ShapeContainer
create a connector

Specified by:
createConnector in interface ShapeContainer<XSLFShape,XSLFTextParagraph>
Specified by:
createConnector in interface XSLFShapeContainer

createGroup

public XSLFGroupShape createGroup()
Description copied from interface: ShapeContainer
create a group of shapes belonging to this container

Specified by:
createGroup in interface ShapeContainer<XSLFShape,XSLFTextParagraph>
Specified by:
createGroup in interface XSLFShapeContainer

createPicture

public XSLFPictureShape createPicture(PictureData pictureData)
Description copied from interface: ShapeContainer
create a picture belonging to this container

Specified by:
createPicture in interface ShapeContainer<XSLFShape,XSLFTextParagraph>
Specified by:
createPicture in interface XSLFShapeContainer

createTable

public XSLFTable createTable()

createTable

public XSLFTable createTable(int numRows,
                             int numCols)
Description copied from interface: ShapeContainer
Create a new Table of the given number of rows and columns

Specified by:
createTable in interface ShapeContainer<XSLFShape,XSLFTextParagraph>
Parameters:
numRows - the number of rows
numCols - the number of columns

setFlipHorizontal

public void setFlipHorizontal(boolean flip)
Specified by:
setFlipHorizontal in interface PlaceableShape<XSLFShape,XSLFTextParagraph>
Parameters:
flip - whether the shape is horizontally flipped

setFlipVertical

public void setFlipVertical(boolean flip)
Description copied from interface: PlaceableShape
Whether the shape is vertically flipped

Specified by:
setFlipVertical in interface PlaceableShape<XSLFShape,XSLFTextParagraph>
Parameters:
flip - whether the shape is vertically flipped

getFlipHorizontal

public boolean getFlipHorizontal()
Description copied from interface: PlaceableShape
Whether the shape is horizontally flipped

Specified by:
getFlipHorizontal in interface PlaceableShape<XSLFShape,XSLFTextParagraph>
Returns:
whether the shape is horizontally flipped

getFlipVertical

public boolean getFlipVertical()
Description copied from interface: PlaceableShape
Whether the shape is vertically flipped

Specified by:
getFlipVertical in interface PlaceableShape<XSLFShape,XSLFTextParagraph>
Returns:
whether the shape is vertically flipped

setRotation

public void setRotation(double theta)
Description copied from interface: PlaceableShape
Rotate this shape.

Positive angles are clockwise (i.e., towards the positive y axis); negative angles are counter-clockwise (i.e., towards the negative y axis).

Specified by:
setRotation in interface PlaceableShape<XSLFShape,XSLFTextParagraph>
Parameters:
theta - the rotation angle in degrees.

getRotation

public double getRotation()
Description copied from interface: PlaceableShape
Rotation angle in degrees

Positive angles are clockwise (i.e., towards the positive y axis); negative angles are counter-clockwise (i.e., towards the negative y axis).

Specified by:
getRotation in interface PlaceableShape<XSLFShape,XSLFTextParagraph>
Returns:
rotation angle in degrees

clear

public void clear()
Removes all of the elements from this container (optional operation). The container will be empty after this call returns.

Specified by:
clear in interface XSLFShapeContainer

addShape

public void addShape(XSLFShape shape)
Specified by:
addShape in interface ShapeContainer<XSLFShape,XSLFTextParagraph>


Copyright 2017 The Apache Software Foundation or its licensors, as applicable.