org.apache.poi.hssf.usermodel
Class HSSFPatriarch

java.lang.Object
  extended by org.apache.poi.hssf.usermodel.HSSFPatriarch
All Implemented Interfaces:
HSSFShapeContainer, Drawing

public final class HSSFPatriarch
extends java.lang.Object
implements HSSFShapeContainer, Drawing

The patriarch is the toplevel container for shapes in a sheet. It does little other than act as a container for other shapes and groups.

Author:
Glen Stampoultzis (glens at apache.org)

Method Summary
protected  EscherAggregate _getBoundAggregate()
          Returns the aggregate escher record we're bound to
 void addShape(HSSFShape shape)
          add a shape to this drawing
 boolean containsChart()
          Does this HSSFPatriarch contain a chart? (Technically a reference to a chart, since they get stored in a different block of records) FIXME - detect chart in all cases (only seems to work on some charts so far)
 int countOfAllChildren()
          Total count of all children and their children's children.
 HSSFClientAnchor createAnchor(int dx1, int dy1, int dx2, int dy2, int col1, int row1, int col2, int row2)
          Creates a new client anchor and sets the top-left and bottom-right coordinates of the anchor.
 HSSFComment createCellComment(ClientAnchor anchor)
          Creates a comment.
 Chart createChart(ClientAnchor anchor)
          Creates a chart.
 HSSFComment createComment(HSSFAnchor anchor)
          Constructs a cell comment.
 HSSFShapeGroup createGroup(HSSFClientAnchor anchor)
          Creates a new group record stored under this patriarch.
 HSSFPicture createPicture(ClientAnchor anchor, int pictureIndex)
          Creates a picture.
 HSSFPicture createPicture(HSSFClientAnchor anchor, int pictureIndex)
          Creates a picture.
 HSSFPolygon createPolygon(HSSFClientAnchor anchor)
          Creates a polygon
 HSSFSimpleShape createSimpleShape(HSSFClientAnchor anchor)
          Creates a simple shape.
 HSSFTextbox createTextbox(HSSFClientAnchor anchor)
          Constructs a textbox under the patriarch.
 java.util.List<HSSFShape> getChildren()
          Returns a list of all shapes contained by the patriarch.
 int getX1()
          The top left x coordinate of this group.
 int getX2()
          The bottom right x coordinate of this group.
 int getY1()
          The top left y coordinate of this group.
 int getY2()
          The bottom right y coordinate of this group.
 void setCoordinates(int x1, int y1, int x2, int y2)
          Sets the coordinate space of this group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createGroup

public HSSFShapeGroup createGroup(HSSFClientAnchor anchor)
Creates a new group record stored under this patriarch.

Parameters:
anchor - the client anchor describes how this group is attached to the sheet.
Returns:
the newly created group.

createSimpleShape

public HSSFSimpleShape createSimpleShape(HSSFClientAnchor anchor)
Creates a simple shape. This includes such shapes as lines, rectangles, and ovals.

Parameters:
anchor - the client anchor describes how this group is attached to the sheet.
Returns:
the newly created shape.

createPicture

public HSSFPicture createPicture(HSSFClientAnchor anchor,
                                 int pictureIndex)
Creates a picture.

Parameters:
anchor - the client anchor describes how this group is attached to the sheet.
Returns:
the newly created shape.

createPicture

public HSSFPicture createPicture(ClientAnchor anchor,
                                 int pictureIndex)
Description copied from interface: Drawing
Creates a picture.

Specified by:
createPicture in interface Drawing
Parameters:
anchor - the client anchor describes how this picture is attached to the sheet.
pictureIndex - the index of the picture in the workbook collection of pictures.
Returns:
the newly created picture.

createPolygon

public HSSFPolygon createPolygon(HSSFClientAnchor anchor)
Creates a polygon

Parameters:
anchor - the client anchor describes how this group is attached to the sheet.
Returns:
the newly created shape.

createTextbox

public HSSFTextbox createTextbox(HSSFClientAnchor anchor)
Constructs a textbox under the patriarch.

Parameters:
anchor - the client anchor describes how this group is attached to the sheet.
Returns:
the newly created textbox.

createComment

public HSSFComment createComment(HSSFAnchor anchor)
Constructs a cell comment.

Parameters:
anchor - the client anchor describes how this comment is attached to the sheet.
Returns:
the newly created comment.

createCellComment

public HSSFComment createCellComment(ClientAnchor anchor)
Description copied from interface: Drawing
Creates a comment.

Specified by:
createCellComment in interface Drawing
Parameters:
anchor - the client anchor describes how this comment is attached to the sheet.
Returns:
the newly created comment.

getChildren

public java.util.List<HSSFShape> getChildren()
Returns a list of all shapes contained by the patriarch.

Specified by:
getChildren in interface HSSFShapeContainer
Returns:
Any children contained by this shape.

addShape

@Internal
public void addShape(HSSFShape shape)
add a shape to this drawing


countOfAllChildren

public int countOfAllChildren()
Total count of all children and their children's children.


setCoordinates

public void setCoordinates(int x1,
                           int y1,
                           int x2,
                           int y2)
Sets the coordinate space of this group. All children are constrained to these coordinates.


containsChart

public boolean containsChart()
Does this HSSFPatriarch contain a chart? (Technically a reference to a chart, since they get stored in a different block of records) FIXME - detect chart in all cases (only seems to work on some charts so far)


getX1

public int getX1()
The top left x coordinate of this group.


getY1

public int getY1()
The top left y coordinate of this group.


getX2

public int getX2()
The bottom right x coordinate of this group.


getY2

public int getY2()
The bottom right y coordinate of this group.


_getBoundAggregate

protected EscherAggregate _getBoundAggregate()
Returns the aggregate escher record we're bound to


createAnchor

public HSSFClientAnchor createAnchor(int dx1,
                                     int dy1,
                                     int dx2,
                                     int dy2,
                                     int col1,
                                     int row1,
                                     int col2,
                                     int row2)
Creates a new client anchor and sets the top-left and bottom-right coordinates of the anchor.

Specified by:
createAnchor in interface Drawing
Parameters:
dx1 - the x coordinate in EMU within the first cell.
dy1 - the y coordinate in EMU within the first cell.
dx2 - the x coordinate in EMU within the second cell.
dy2 - the y coordinate in EMU within the second cell.
col1 - the column (0 based) of the first cell.
row1 - the row (0 based) of the first cell.
col2 - the column (0 based) of the second cell.
row2 - the row (0 based) of the second cell.
Returns:
the newly created client anchor

createChart

public Chart createChart(ClientAnchor anchor)
Description copied from interface: Drawing
Creates a chart.

Specified by:
createChart in interface Drawing
Parameters:
anchor - the client anchor describes how this chart is attached to the sheet.
Returns:
the newly created chart


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