org.apache.poi.hslf.usermodel
Class HSLFGroupShape

java.lang.Object
  extended by org.apache.poi.hslf.usermodel.HSLFShape
      extended by org.apache.poi.hslf.usermodel.HSLFGroupShape
All Implemented Interfaces:
java.lang.Iterable<HSLFShape>, HSLFShapeContainer, GroupShape<HSLFShape,HSLFTextParagraph>, PlaceableShape<HSLFShape,HSLFTextParagraph>, Shape<HSLFShape,HSLFTextParagraph>, ShapeContainer<HSLFShape,HSLFTextParagraph>
Direct Known Subclasses:
HSLFTable

public class HSLFGroupShape
extends HSLFShape
implements HSLFShapeContainer, GroupShape<HSLFShape,HSLFTextParagraph>

Represents a group of shapes.


Constructor Summary
  HSLFGroupShape()
          Create a new ShapeGroup.
protected HSLFGroupShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape,HSLFTextParagraph> parent)
          Create a ShapeGroup object and initialize it from the supplied Record container.
  HSLFGroupShape(ShapeContainer<HSLFShape,HSLFTextParagraph> parent)
          Create a new ShapeGroup.
 
Method Summary
 void addShape(HSLFShape shape)
          Add a shape to this group.
 HSLFAutoShape createAutoShape()
           
 HSLFConnectorShape createConnector()
           
 HSLFFreeformShape createFreeform()
           
 HSLFGroupShape createGroup()
           
 HSLFPictureShape createPicture(PictureData pictureData)
           
protected  EscherContainerRecord createSpContainer(boolean isChild)
          Create a new ShapeGroup and create an instance of EscherSpgrContainer which represents a group of shapes
 HSLFTable createTable(int numRows, int numCols)
           
 HSLFTextBox createTextBox()
           
 java.awt.geom.Rectangle2D getAnchor()
          Returns the anchor (the bounding box rectangle) of this shape group.
<T extends EscherRecord>
T
getEscherChild(int recordId)
           
 HSLFHyperlink getHyperlink()
          Returns null - shape groups can't have hyperlinks
 java.awt.geom.Rectangle2D getInteriorAnchor()
           
 java.util.List<HSLFShape> getShapes()
           
 ShapeType getShapeType()
          Return type of the shape.
 java.util.Iterator<HSLFShape> iterator()
           
protected  void moveAndScale(java.awt.geom.Rectangle2D anchorDest)
          Moves and scales this ShapeGroup to the specified anchor.
 boolean removeShape(HSLFShape shape)
           
 void setAnchor(java.awt.geom.Rectangle2D anchor)
          Sets the anchor (the bounding box rectangle) of this shape.
protected  void setExteriorAnchor(java.awt.geom.Rectangle2D anchor)
           
 void setInteriorAnchor(java.awt.geom.Rectangle2D anchor)
           
 
Methods inherited from class org.apache.poi.hslf.usermodel.HSLFShape
afterInsert, draw, getClientData, getClientDataRecord, getClientRecords, getEscherChild, getEscherChild, getEscherChild, getEscherOptRecord, getEscherProperty, getEscherProperty, getEscherProperty, getFill, getFillStyle, getFlipHorizontal, getFlipVertical, getParent, getRotation, getShapeId, getShapeName, getSheet, getSpContainer, isPlaceholder, moveTo, setEscherProperty, setEscherProperty, setFlipHorizontal, setFlipVertical, setRotation, setShapeId, setShapeType, setSheet
 
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
getFlipHorizontal, getFlipVertical, getParent, getRotation, getSheet, setFlipHorizontal, setFlipVertical, setRotation
 

Constructor Detail

HSLFGroupShape

public HSLFGroupShape()
Create a new ShapeGroup. This constructor is used when a new shape is created.


HSLFGroupShape

public HSLFGroupShape(ShapeContainer<HSLFShape,HSLFTextParagraph> parent)
Create a new ShapeGroup. This constructor is used when a new shape is created.

Parameters:
parent - the parent of the shape

HSLFGroupShape

protected HSLFGroupShape(EscherContainerRecord escherRecord,
                         ShapeContainer<HSLFShape,HSLFTextParagraph> parent)
Create a ShapeGroup object and initialize it from the supplied Record container.

Parameters:
escherRecord - EscherSpContainer container which holds information about this shape
parent - the parent of the shape
Method Detail

setAnchor

public void setAnchor(java.awt.geom.Rectangle2D anchor)
Description copied from class: HSLFShape
Sets the anchor (the bounding box rectangle) of this shape. All coordinates should be expressed in points (72 dpi).

Specified by:
setAnchor in interface PlaceableShape<HSLFShape,HSLFTextParagraph>
Overrides:
setAnchor in class HSLFShape
Parameters:
anchor - new anchor

setInteriorAnchor

public void setInteriorAnchor(java.awt.geom.Rectangle2D anchor)
Specified by:
setInteriorAnchor in interface GroupShape<HSLFShape,HSLFTextParagraph>

getInteriorAnchor

public java.awt.geom.Rectangle2D getInteriorAnchor()
Specified by:
getInteriorAnchor in interface GroupShape<HSLFShape,HSLFTextParagraph>

setExteriorAnchor

protected void setExteriorAnchor(java.awt.geom.Rectangle2D anchor)

createSpContainer

protected EscherContainerRecord createSpContainer(boolean isChild)
Create a new ShapeGroup and create an instance of EscherSpgrContainer which represents a group of shapes

Overrides:
createSpContainer in class HSLFShape

addShape

public void addShape(HSLFShape shape)
Add a shape to this group.

Specified by:
addShape in interface ShapeContainer<HSLFShape,HSLFTextParagraph>
Parameters:
shape - - the Shape to add

moveAndScale

protected void moveAndScale(java.awt.geom.Rectangle2D anchorDest)
Moves and scales this ShapeGroup to the specified anchor.


getAnchor

public java.awt.geom.Rectangle2D getAnchor()
Returns the anchor (the bounding box rectangle) of this shape group. All coordinates are expressed in points (72 dpi).

Specified by:
getAnchor in interface PlaceableShape<HSLFShape,HSLFTextParagraph>
Specified by:
getAnchor in interface Shape<HSLFShape,HSLFTextParagraph>
Overrides:
getAnchor in class HSLFShape
Returns:
the anchor of this shape group

getShapeType

public ShapeType getShapeType()
Return type of the shape. In most cases shape group type is ShapeType.NOT_PRIMITIVE

Overrides:
getShapeType in class HSLFShape
Returns:
type of the shape.

getHyperlink

public HSLFHyperlink getHyperlink()
Returns null - shape groups can't have hyperlinks

Returns:
null.

getEscherChild

public <T extends EscherRecord> T getEscherChild(int recordId)
Overrides:
getEscherChild in class HSLFShape

iterator

public java.util.Iterator<HSLFShape> iterator()
Specified by:
iterator in interface java.lang.Iterable<HSLFShape>

removeShape

public boolean removeShape(HSLFShape shape)
Specified by:
removeShape in interface ShapeContainer<HSLFShape,HSLFTextParagraph>

getShapes

public java.util.List<HSLFShape> getShapes()
Specified by:
getShapes in interface ShapeContainer<HSLFShape,HSLFTextParagraph>

createTextBox

public HSLFTextBox createTextBox()
Specified by:
createTextBox in interface HSLFShapeContainer
Specified by:
createTextBox in interface ShapeContainer<HSLFShape,HSLFTextParagraph>

createAutoShape

public HSLFAutoShape createAutoShape()
Specified by:
createAutoShape in interface HSLFShapeContainer
Specified by:
createAutoShape in interface ShapeContainer<HSLFShape,HSLFTextParagraph>

createFreeform

public HSLFFreeformShape createFreeform()
Specified by:
createFreeform in interface HSLFShapeContainer
Specified by:
createFreeform in interface ShapeContainer<HSLFShape,HSLFTextParagraph>

createConnector

public HSLFConnectorShape createConnector()
Specified by:
createConnector in interface HSLFShapeContainer
Specified by:
createConnector in interface ShapeContainer<HSLFShape,HSLFTextParagraph>

createGroup

public HSLFGroupShape createGroup()
Specified by:
createGroup in interface HSLFShapeContainer
Specified by:
createGroup in interface ShapeContainer<HSLFShape,HSLFTextParagraph>

createPicture

public HSLFPictureShape createPicture(PictureData pictureData)
Specified by:
createPicture in interface HSLFShapeContainer
Specified by:
createPicture in interface ShapeContainer<HSLFShape,HSLFTextParagraph>

createTable

public HSLFTable createTable(int numRows,
                             int numCols)
Specified by:
createTable in interface ShapeContainer<HSLFShape,HSLFTextParagraph>