org.apache.poi.hssf.usermodel
Class HSSFShape

java.lang.Object
  extended by org.apache.poi.hssf.usermodel.HSSFShape
All Implemented Interfaces:
Shape
Direct Known Subclasses:
HSSFShapeGroup, HSSFSimpleShape

public abstract class HSSFShape
extends java.lang.Object
implements Shape

An abstract shape. Note: Microsoft Excel seems to sometimes disallow higher y1 than y2 or higher x1 than x2 in the anchor, you might need to reverse them and draw shapes vertically or horizontally flipped via setFlipVertical() or setFlipHorizontally().


Field Summary
static int FILL__FILLCOLOR_DEFAULT
           
static int LINESTYLE__COLOR_DEFAULT
           
static int LINESTYLE_DASHDOTDOTSYS
           
static int LINESTYLE_DASHDOTGEL
           
static int LINESTYLE_DASHDOTSYS
           
static int LINESTYLE_DASHGEL
           
static int LINESTYLE_DASHSYS
           
static int LINESTYLE_DEFAULT
           
static int LINESTYLE_DOTGEL
           
static int LINESTYLE_DOTSYS
           
static int LINESTYLE_LONGDASHDOTDOTGEL
           
static int LINESTYLE_LONGDASHDOTGEL
           
static int LINESTYLE_LONGDASHGEL
           
static int LINESTYLE_NONE
           
static int LINESTYLE_SOLID
           
static int LINEWIDTH_DEFAULT
           
static int LINEWIDTH_ONE_PT
           
static boolean NO_FILL_DEFAULT
           
static int NO_FILLHITTEST_FALSE
           
static int NO_FILLHITTEST_TRUE
           
 
Constructor Summary
HSSFShape(EscherContainerRecord spContainer, ObjRecord objRecord)
          creates shapes from existing file
HSSFShape(HSSFShape parent, HSSFAnchor anchor)
          Create a new shape with the specified parent and anchor.
 
Method Summary
protected abstract  void afterRemove(HSSFPatriarch patriarch)
          remove escher container from the patriarch.escherAggregate remove obj, textObj and note records if it's necessary in case of ShapeGroup remove all contained shapes
protected abstract  HSSFShape cloneShape()
           
 int countOfAllChildren()
          Count of all children and their children's children.
protected abstract  ObjRecord createObjRecord()
           
protected abstract  EscherContainerRecord createSpContainer()
           
 HSSFAnchor getAnchor()
           
protected  EscherContainerRecord getEscherContainer()
           
 int getFillColor()
          The color used to fill this shape.
 int getLineStyle()
           
 int getLineStyleColor()
          The color applied to the lines of this shape.
 int getLineWidth()
           
protected  ObjRecord getObjRecord()
           
 EscherOptRecord getOptRecord()
          Return the low-level EscherOptRecord to read/modify not yet wrapped escher properties
 HSSFShape getParent()
           
 HSSFPatriarch getPatriarch()
           
 int getRotationDegree()
           
 java.lang.String getShapeName()
           
 boolean isFlipHorizontal()
           
 boolean isFlipVertical()
           
 boolean isNoFill()
          Whether this shape is not filled with a color
 void setAnchor(HSSFAnchor anchor)
          Sets a particular anchor.
 void setFillColor(int fillColor)
          The color used to fill this shape.
 void setFillColor(int red, int green, int blue)
          Sets the color used to fill this shape using the solid fill pattern.
 void setFlipHorizontal(boolean value)
           
 void setFlipVertical(boolean value)
           
 void setLineStyle(int lineStyle)
          Sets the line style.
 void setLineStyleColor(int lineStyleColor)
          The color applied to the lines of this shape.
 void setLineStyleColor(int red, int green, int blue)
          The color applied to the lines of this shape.
 void setLineWidth(int lineWidth)
          Sets the width of the line.
 void setNoFill(boolean noFill)
          Sets whether this shape is filled or transparent.
protected  void setParent(HSSFShape parent)
           
protected  void setPatriarch(HSSFPatriarch _patriarch)
           
protected  void setPropertyValue(EscherProperty property)
           
 void setRotationDegree(short value)
          specifies the rotation, in degrees, that is applied to a shape.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LINEWIDTH_ONE_PT

public static final int LINEWIDTH_ONE_PT
See Also:
Constant Field Values

LINEWIDTH_DEFAULT

public static final int LINEWIDTH_DEFAULT
See Also:
Constant Field Values

LINESTYLE__COLOR_DEFAULT

public static final int LINESTYLE__COLOR_DEFAULT
See Also:
Constant Field Values

FILL__FILLCOLOR_DEFAULT

public static final int FILL__FILLCOLOR_DEFAULT
See Also:
Constant Field Values

NO_FILL_DEFAULT

public static final boolean NO_FILL_DEFAULT
See Also:
Constant Field Values

LINESTYLE_SOLID

public static final int LINESTYLE_SOLID
See Also:
Constant Field Values

LINESTYLE_DASHSYS

public static final int LINESTYLE_DASHSYS
See Also:
Constant Field Values

LINESTYLE_DOTSYS

public static final int LINESTYLE_DOTSYS
See Also:
Constant Field Values

LINESTYLE_DASHDOTSYS

public static final int LINESTYLE_DASHDOTSYS
See Also:
Constant Field Values

LINESTYLE_DASHDOTDOTSYS

public static final int LINESTYLE_DASHDOTDOTSYS
See Also:
Constant Field Values

LINESTYLE_DOTGEL

public static final int LINESTYLE_DOTGEL
See Also:
Constant Field Values

LINESTYLE_DASHGEL

public static final int LINESTYLE_DASHGEL
See Also:
Constant Field Values

LINESTYLE_LONGDASHGEL

public static final int LINESTYLE_LONGDASHGEL
See Also:
Constant Field Values

LINESTYLE_DASHDOTGEL

public static final int LINESTYLE_DASHDOTGEL
See Also:
Constant Field Values

LINESTYLE_LONGDASHDOTGEL

public static final int LINESTYLE_LONGDASHDOTGEL
See Also:
Constant Field Values

LINESTYLE_LONGDASHDOTDOTGEL

public static final int LINESTYLE_LONGDASHDOTDOTGEL
See Also:
Constant Field Values

LINESTYLE_NONE

public static final int LINESTYLE_NONE
See Also:
Constant Field Values

LINESTYLE_DEFAULT

public static final int LINESTYLE_DEFAULT
See Also:
Constant Field Values

NO_FILLHITTEST_TRUE

public static final int NO_FILLHITTEST_TRUE
See Also:
Constant Field Values

NO_FILLHITTEST_FALSE

public static final int NO_FILLHITTEST_FALSE
See Also:
Constant Field Values
Constructor Detail

HSSFShape

public HSSFShape(EscherContainerRecord spContainer,
                 ObjRecord objRecord)
creates shapes from existing file

Parameters:
spContainer -
objRecord -

HSSFShape

public HSSFShape(HSSFShape parent,
                 HSSFAnchor anchor)
Create a new shape with the specified parent and anchor.

Method Detail

createSpContainer

protected abstract EscherContainerRecord createSpContainer()

createObjRecord

protected abstract ObjRecord createObjRecord()

afterRemove

protected abstract void afterRemove(HSSFPatriarch patriarch)
remove escher container from the patriarch.escherAggregate remove obj, textObj and note records if it's necessary in case of ShapeGroup remove all contained shapes

Parameters:
patriarch -

getEscherContainer

protected EscherContainerRecord getEscherContainer()

getObjRecord

protected ObjRecord getObjRecord()

getOptRecord

public EscherOptRecord getOptRecord()
Return the low-level EscherOptRecord to read/modify not yet wrapped escher properties

Returns:
the low-level EscherOptRecord

getParent

public HSSFShape getParent()
Specified by:
getParent in interface Shape
Returns:
the parent shape.

getAnchor

public HSSFAnchor getAnchor()
Specified by:
getAnchor in interface Shape
Returns:
the anchor that is used by this shape.

setAnchor

public void setAnchor(HSSFAnchor anchor)
Sets a particular anchor. A top-level shape must have an anchor of HSSFClientAnchor. A child anchor must have an anchor of HSSFChildAnchor

Parameters:
anchor - the anchor to use.
Throws:
java.lang.IllegalArgumentException - when the wrong anchor is used for this particular shape.
See Also:
HSSFChildAnchor, HSSFClientAnchor

getLineStyleColor

public int getLineStyleColor()
The color applied to the lines of this shape.


setLineStyleColor

public void setLineStyleColor(int lineStyleColor)
The color applied to the lines of this shape.


setLineStyleColor

public void setLineStyleColor(int red,
                              int green,
                              int blue)
Description copied from interface: Shape
The color applied to the lines of this shape.

Specified by:
setLineStyleColor in interface Shape

getFillColor

public int getFillColor()
The color used to fill this shape.


setFillColor

public void setFillColor(int fillColor)
The color used to fill this shape.


setFillColor

public void setFillColor(int red,
                         int green,
                         int blue)
Description copied from interface: Shape
Sets the color used to fill this shape using the solid fill pattern.

Specified by:
setFillColor in interface Shape

getLineWidth

public int getLineWidth()
Returns:
returns with width of the line in EMUs. 12700 = 1 pt.

setLineWidth

public void setLineWidth(int lineWidth)
Sets the width of the line. 12700 = 1 pt.

Parameters:
lineWidth - width in EMU's. 12700EMU's = 1 pt
See Also:
LINEWIDTH_ONE_PT

getLineStyle

public int getLineStyle()
Returns:
One of the constants in LINESTYLE_*

setLineStyle

public void setLineStyle(int lineStyle)
Sets the line style.

Parameters:
lineStyle - One of the constants in LINESTYLE_*

isNoFill

public boolean isNoFill()
Description copied from interface: Shape
Whether this shape is not filled with a color

Specified by:
isNoFill in interface Shape
Returns:
true if this shape is not filled with a color.

setNoFill

public void setNoFill(boolean noFill)
Description copied from interface: Shape
Sets whether this shape is filled or transparent.

Specified by:
setNoFill in interface Shape
Parameters:
noFill - if true then no fill will be applied to the shape element.

setPropertyValue

protected void setPropertyValue(EscherProperty property)

setFlipVertical

public void setFlipVertical(boolean value)
Parameters:
value - specifies whether this shape is vertically flipped.

setFlipHorizontal

public void setFlipHorizontal(boolean value)
Parameters:
value - specifies whether this shape is horizontally flipped.

isFlipVertical

public boolean isFlipVertical()
Returns:
whether this shape is vertically flipped.

isFlipHorizontal

public boolean isFlipHorizontal()
Returns:
whether this shape is horizontally flipped.

getRotationDegree

public int getRotationDegree()
Returns:
the rotation, in degrees, that is applied to a shape.

setRotationDegree

public void setRotationDegree(short value)
specifies the rotation, in degrees, that is applied to a shape. Positive values specify rotation in the clockwise direction. Negative values specify rotation in the counterclockwise direction. Rotation occurs around the center of the shape. The default value for this property is 0x00000000

Parameters:
value -

countOfAllChildren

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


cloneShape

protected abstract HSSFShape cloneShape()

setPatriarch

protected void setPatriarch(HSSFPatriarch _patriarch)

getPatriarch

public HSSFPatriarch getPatriarch()

setParent

protected void setParent(HSSFShape parent)

getShapeName

public java.lang.String getShapeName()
Specified by:
getShapeName in interface Shape
Returns:
the name of this shape