Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.poi.hslf.model
Class Shape

    java.lang.Object
      org.apache.poi.hslf.model.Shape

Direct Known Subclasses:
  Background, ShapeGroup, SimpleShape

    public abstract class Shape

extends java.lang.Object

Represents a Shape which is the elemental object that composes a drawing. This class is a wrapper around EscherSpContainer which holds all information about a shape in PowerPoint document.

When you add a shape, you usually specify the dimensions of the shape and the position of the upper'left corner of the bounding box for the shape relative to the upper'left corner of the page, worksheet, or slide. Distances in the drawing layer are measured in points (72 points = 1 inch).

Author:
  Yegor Kozlov

Field Summary
`static int` | `EMU_PER_CENTIMETER`
`static int` | `EMU_PER_INCH` In Escher absolute distances are specified in English Metric Units (EMUs), occasionally referred to as A units; there are 360000 EMUs per centimeter, 914400 EMUs per inch, 12700 EMUs per point.
`static int` | `EMU_PER_POINT`
`static int` | `MASTER_DPI` Master DPI (576 pixels per inch).
`static int` | `PIXEL_DPI` Pixels DPI (96 pixels per inch)
`static int` | `POINT_DPI` Points DPI (72 pixels per inch)

Method Summary
`void` | `draw(java.awt.Graphics2D graphics)`
`java.awt.Rectangle` | `getAnchor()` Returns the anchor (the bounding box rectangle) of this shape.
`java.awt.geom.Rectangle2D` | `getAnchor2D()` Returns the anchor (the bounding box rectangle) of this shape.
`static org.apache.poi.ddf.EscherRecord` | `getEscherChild(org.apache.poi.ddf.EscherContainerRecord owner, int recordId)` Helper method to return escher child by record ID
`static org.apache.poi.ddf.EscherProperty` | `getEscherProperty(org.apache.poi.ddf.EscherOptRecord opt, int propId)` Returns escher property by id.
`int` | `getEscherProperty(short propId)` Get the value of a simple escher property for this shape.
`int` | `getEscherProperty(short propId, int defaultValue)` Get the value of a simple escher property for this shape.
`Fill` | `getFill()` Fill properties of this shape
`Hyperlink` | `getHyperlink()` Returns the hyperlink assigned to this shape
`java.awt.geom.Rectangle2D` | `getLogicalAnchor2D()`
`java.awt.Shape` | `getOutline()` Return shape outline as a java.awt.Shape object
`Shape` | `getParent()`
`int` | `getShapeId()`
`java.lang.String` | `getShapeName()`
`int` | `getShapeType()`
`Sheet` | `getSheet()`
`org.apache.poi.ddf.EscherContainerRecord` | `getSpContainer()`
`void` | `moveTo(float x, float y)` Moves the top left corner of the shape to the specified point.
`void` | `setAnchor(java.awt.geom.Rectangle2D anchor)` Sets the anchor (the bounding box rectangle) of this shape.
`static void` | `setEscherProperty(org.apache.poi.ddf.EscherOptRecord opt, short propId, int value)` Set an escher property for this shape.
`void` | `setEscherProperty(short propId, int value)` Set an simple escher property for this shape.
`void` | `setShapeId(int id)` Sets shape ID
`void` | `setShapeType(int type)`
`void` | `setSheet(Sheet sheet)` Assign the `SlideShow` this shape belongs to

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### EMU_PER_INCH

    public static final int EMU_PER_INCH

  In Escher absolute distances are specified in English Metric Units (EMUs), occasionally referred to as A units; there are 360000 EMUs per centimeter, 914400 EMUs per inch, 12700 EMUs per point.

  See Also:
    Constant Field Values

### EMU_PER_POINT

    public static final int EMU_PER_POINT

See Also:
  Constant Field Values

### EMU_PER_CENTIMETER

    public static final int EMU_PER_CENTIMETER

See Also:
  Constant Field Values

### MASTER_DPI

    public static final int MASTER_DPI

  Master DPI (576 pixels per inch). Used by the reference coordinate system in PowerPoint.

  See Also:
    Constant Field Values

### PIXEL_DPI

    public static final int PIXEL_DPI

  Pixels DPI (96 pixels per inch)

  See Also:
    Constant Field Values

### POINT_DPI

    public static final int POINT_DPI

  Points DPI (72 pixels per inch)

  See Also:
    Constant Field Values

Method Detail

### getParent

    public Shape getParent()

  Returns:
    the parent of this shape

### getShapeName

    public java.lang.String getShapeName()

  Returns:
    name of the shape.

### getShapeType

    public int getShapeType()

  Returns:
    type of the shape.
  See Also:
    `RecordTypes`

### setShapeType

    public void setShapeType(int type)

  Parameters:
    `type` - type of the shape.
  See Also:
    `RecordTypes`

### getAnchor

    public java.awt.Rectangle getAnchor()

  Returns the anchor (the bounding box rectangle) of this shape. All coordinates are expressed in points (72 dpi).

  Returns:
    the anchor of this shape

### getAnchor2D

    public java.awt.geom.Rectangle2D getAnchor2D()

  Returns the anchor (the bounding box rectangle) of this shape. All coordinates are expressed in points (72 dpi).

  Returns:
    the anchor of this shape

### getLogicalAnchor2D

    public java.awt.geom.Rectangle2D getLogicalAnchor2D()

### setAnchor

    public void setAnchor(java.awt.geom.Rectangle2D anchor)

  Sets the anchor (the bounding box rectangle) of this shape. All coordinates should be expressed in points (72 dpi).

  Parameters:
    `anchor` - new anchor

### moveTo

    public void moveTo(float x,
                       float y)

  Moves the top left corner of the shape to the specified point.

  Parameters:
    `x` - the x coordinate of the top left corner of the shape
    `y` - the y coordinate of the top left corner of the shape

### getEscherChild

    public static org.apache.poi.ddf.EscherRecord getEscherChild(org.apache.poi.ddf.EscherContainerRecord owner,
                                                                 int recordId)

  Helper method to return escher child by record ID

  Returns:
    escher record or `null` if not found.

### getEscherProperty

    public static org.apache.poi.ddf.EscherProperty getEscherProperty(org.apache.poi.ddf.EscherOptRecord opt,
                                                                      int propId)

  Returns escher property by id.

  Returns:
    escher property or `null` if not found.

### setEscherProperty

    public static void setEscherProperty(org.apache.poi.ddf.EscherOptRecord opt,
                                         short propId,
                                         int value)

  Set an escher property for this shape.

  Parameters:
    `opt` - The opt record to set the properties to.
    `propId` - The id of the property. One of the constants defined in EscherOptRecord.
    `value` - value of the property. If value = -1 then the property is removed.

### setEscherProperty

    public void setEscherProperty(short propId,
                                  int value)

  Set an simple escher property for this shape.

  Parameters:
    `propId` - The id of the property. One of the constants defined in EscherOptRecord.
    `value` - value of the property. If value = -1 then the property is removed.

### getEscherProperty

    public int getEscherProperty(short propId)

  Get the value of a simple escher property for this shape.

  Parameters:
    `propId` - The id of the property. One of the constants defined in EscherOptRecord.

### getEscherProperty

    public int getEscherProperty(short propId,
                                 int defaultValue)

  Get the value of a simple escher property for this shape.

  Parameters:
    `propId` - The id of the property. One of the constants defined in EscherOptRecord.

### getSpContainer

    public org.apache.poi.ddf.EscherContainerRecord getSpContainer()

  Returns:
    The shape container and it's children that can represent this shape.

### getSheet

    public Sheet getSheet()

  Returns:
    the `SlideShow` this shape belongs to

### setSheet

    public void setSheet(Sheet sheet)

  Assign the `SlideShow` this shape belongs to

  Parameters:
    `sheet` - owner of this shape

### getShapeId

    public int getShapeId()

  Returns:
    id for the shape.

### setShapeId

    public void setShapeId(int id)

  Sets shape ID

  Parameters:
    `id` - of the shape

### getFill

    public Fill getFill()

  Fill properties of this shape

  Returns:
    fill properties of this shape

### getHyperlink

    public Hyperlink getHyperlink()

  Returns the hyperlink assigned to this shape

  Returns:
    the hyperlink assigned to this shape or `null` if not found.

### draw

    public void draw(java.awt.Graphics2D graphics)

### getOutline

    public java.awt.Shape getOutline()

  Return shape outline as a java.awt.Shape object

  Returns:
    the shape outline

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD