org.apache.poi.hslf.usermodel
Class HSLFSimpleShape

java.lang.Object
  extended by org.apache.poi.hslf.usermodel.HSLFShape
      extended by org.apache.poi.hslf.usermodel.HSLFSimpleShape
All Implemented Interfaces:
IAdjustableShape, PlaceableShape<HSLFShape,HSLFTextParagraph>, Shape<HSLFShape,HSLFTextParagraph>, SimpleShape<HSLFShape,HSLFTextParagraph>
Direct Known Subclasses:
HSLFConnectorShape, HSLFPictureShape, HSLFTextShape

public abstract class HSLFSimpleShape
extends HSLFShape
implements SimpleShape<HSLFShape,HSLFTextParagraph>

An abstract simple (non-group) shape. This is the parent class for all primitive shapes like Line, Rectangle, etc.


Field Summary
protected  HSLFHyperlink _hyperlink
          Hyperlink
static double DEFAULT_LINE_WIDTH
           
 
Constructor Summary
protected HSLFSimpleShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape,HSLFTextParagraph> parent)
          Create a SimpleShape object and initialize it from the supplied Record container.
 
Method Summary
 HSLFHyperlink createHyperlink()
          Creates a hyperlink and asigns it to this shape.
protected  EscherContainerRecord createSpContainer(boolean isChild)
          Create a new Shape
 Guide getAdjustValue(java.lang.String name)
           
 java.awt.Color getFillColor()
          Returns the solid color fill.
 CustomGeometry getGeometry()
           
 HSLFHyperlink getHyperlink()
          Returns the hyperlink assigned to this shape
 java.awt.Color getLineBackgroundColor()
           
 StrokeStyle.LineCap getLineCap()
          Gets line cap.
 java.awt.Color getLineColor()
           
 StrokeStyle.LineCompound getLineCompound()
          Gets the line compound style
 StrokeStyle.LineDash getLineDash()
          Gets line dashing.
 LineDecoration getLineDecoration()
           
 LineDecoration.DecorationShape getLineHeadDecoration()
           
 LineDecoration.DecorationSize getLineHeadLength()
           
 LineDecoration.DecorationSize getLineHeadWidth()
           
 LineDecoration.DecorationShape getLineTailDecoration()
           
 LineDecoration.DecorationSize getLineTailLength()
           
 LineDecoration.DecorationSize getLineTailWidth()
           
 double getLineWidth()
          Returns width of the line in in points
 Placeholder getPlaceholder()
           
 Shadow<HSLFShape,HSLFTextParagraph> getShadow()
           
 double getShadowAngle()
           
 java.awt.Color getShadowColor()
           
 double getShadowDistance()
           
 StrokeStyle getStrokeStyle()
          Returns line style.
 void setFillColor(java.awt.Color color)
          Specifies a solid color fill.
protected  void setHyperlink(HSLFHyperlink link)
          Sets the hyperlink - used when the document is parsed
 void setLineBackgroundColor(java.awt.Color color)
          Sets the background color of line
 void setLineCap(StrokeStyle.LineCap pen)
          Sets line cap.
 void setLineColor(java.awt.Color color)
          Sets the color of line
 void setLineCompound(StrokeStyle.LineCompound style)
          Sets the line compound style
 void setLineDash(StrokeStyle.LineDash pen)
          Sets line dashing.
 void setLineHeadDecoration(LineDecoration.DecorationShape decoShape)
           
 void setLineHeadLength(LineDecoration.DecorationSize decoSize)
           
 void setLineHeadWidth(LineDecoration.DecorationSize decoSize)
           
 void setLineTailDecoration(LineDecoration.DecorationShape decoShape)
           
 void setLineTailLength(LineDecoration.DecorationSize decoSize)
           
 void setLineTailWidth(LineDecoration.DecorationSize decoSize)
           
 void setLineWidth(double width)
          Sets the width of line in in points
 void setPlaceholder(Placeholder placeholder)
          Specifies that the corresponding shape should be represented by the generating application as a placeholder.
 void setStrokeStyle(java.lang.Object... styles)
          Sets the line attributes.
 
Methods inherited from class org.apache.poi.hslf.usermodel.HSLFShape
afterInsert, draw, getAnchor, getClientData, getClientDataRecord, getClientRecords, getEscherChild, getEscherChild, getEscherChild, getEscherChild, getEscherOptRecord, getEscherProperty, getEscherProperty, getEscherProperty, getFill, getFillStyle, getFlipHorizontal, getFlipVertical, getParent, getRotation, getShapeId, getShapeName, getShapeType, getSheet, getSpContainer, isPlaceholder, moveTo, setAnchor, 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.SimpleShape
getFillStyle, getShapeType, setShapeType
 
Methods inherited from interface org.apache.poi.sl.usermodel.Shape
draw, getAnchor, getParent, getSheet
 
Methods inherited from interface org.apache.poi.sl.usermodel.PlaceableShape
getAnchor, getFlipHorizontal, getFlipVertical, getParent, getRotation, getSheet, setAnchor, setFlipHorizontal, setFlipVertical, setRotation
 

Field Detail

DEFAULT_LINE_WIDTH

public static final double DEFAULT_LINE_WIDTH
See Also:
Constant Field Values

_hyperlink

protected HSLFHyperlink _hyperlink
Hyperlink

Constructor Detail

HSLFSimpleShape

protected HSLFSimpleShape(EscherContainerRecord escherRecord,
                          ShapeContainer<HSLFShape,HSLFTextParagraph> parent)
Create a SimpleShape 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

createSpContainer

protected EscherContainerRecord createSpContainer(boolean isChild)
Create a new Shape

Overrides:
createSpContainer in class HSLFShape
Parameters:
isChild - true if the Line is inside a group, false otherwise
Returns:
the record container which holds this shape

getLineWidth

public double getLineWidth()
Returns width of the line in in points


setLineWidth

public void setLineWidth(double width)
Sets the width of line in in points

Parameters:
width - the width of line in in points

setLineColor

public void setLineColor(java.awt.Color color)
Sets the color of line

Parameters:
color - new color of the line

getLineColor

public java.awt.Color getLineColor()
Returns:
color of the line. If color is not set returns null

getLineBackgroundColor

public java.awt.Color getLineBackgroundColor()
Returns:
background color of the line. If color is not set returns null

setLineBackgroundColor

public void setLineBackgroundColor(java.awt.Color color)
Sets the background color of line

Parameters:
color - new background color of the line

getLineCap

public StrokeStyle.LineCap getLineCap()
Gets line cap.

Returns:
cap of the line.

setLineCap

public void setLineCap(StrokeStyle.LineCap pen)
Sets line cap.

Parameters:
pen - new style of the line.

getLineDash

public StrokeStyle.LineDash getLineDash()
Gets line dashing.

Returns:
dashing of the line.

setLineDash

public void setLineDash(StrokeStyle.LineDash pen)
Sets line dashing.

Parameters:
pen - new style of the line.

getLineCompound

public StrokeStyle.LineCompound getLineCompound()
Gets the line compound style

Returns:
the compound style of the line.

setLineCompound

public void setLineCompound(StrokeStyle.LineCompound style)
Sets the line compound style

Parameters:
style - new compound style of the line.

getStrokeStyle

public StrokeStyle getStrokeStyle()
Returns line style. One of the constants defined in this class.

Specified by:
getStrokeStyle in interface SimpleShape<HSLFShape,HSLFTextParagraph>
Returns:
style of the line.

getFillColor

public java.awt.Color getFillColor()
Description copied from interface: SimpleShape
Returns the solid color fill.

Specified by:
getFillColor in interface SimpleShape<HSLFShape,HSLFTextParagraph>
Returns:
solid fill color of null if not set or fill color is not solid (pattern or gradient)

setFillColor

public void setFillColor(java.awt.Color color)
Description copied from interface: SimpleShape
Specifies a solid color fill. The shape is filled entirely with the specified color.

Specified by:
setFillColor in interface SimpleShape<HSLFShape,HSLFTextParagraph>
Parameters:
color - the solid color fill. The value of null unsets the solid fill attribute from the underlying implementation

getAdjustValue

public Guide getAdjustValue(java.lang.String name)
Specified by:
getAdjustValue in interface IAdjustableShape
Parameters:
name - name of a adjust value, e.g. adj1
Returns:
adjust guide defined in the shape or null

getGeometry

public CustomGeometry getGeometry()
Specified by:
getGeometry in interface SimpleShape<HSLFShape,HSLFTextParagraph>

getShadowAngle

public double getShadowAngle()

getShadowDistance

public double getShadowDistance()

getShadowColor

public java.awt.Color getShadowColor()
Returns:
color of the line. If color is not set returns java.awt.Color.black

getShadow

public Shadow<HSLFShape,HSLFTextParagraph> getShadow()
Specified by:
getShadow in interface SimpleShape<HSLFShape,HSLFTextParagraph>

getLineHeadDecoration

public LineDecoration.DecorationShape getLineHeadDecoration()

setLineHeadDecoration

public void setLineHeadDecoration(LineDecoration.DecorationShape decoShape)

getLineHeadWidth

public LineDecoration.DecorationSize getLineHeadWidth()

setLineHeadWidth

public void setLineHeadWidth(LineDecoration.DecorationSize decoSize)

getLineHeadLength

public LineDecoration.DecorationSize getLineHeadLength()

setLineHeadLength

public void setLineHeadLength(LineDecoration.DecorationSize decoSize)

getLineTailDecoration

public LineDecoration.DecorationShape getLineTailDecoration()

setLineTailDecoration

public void setLineTailDecoration(LineDecoration.DecorationShape decoShape)

getLineTailWidth

public LineDecoration.DecorationSize getLineTailWidth()

setLineTailWidth

public void setLineTailWidth(LineDecoration.DecorationSize decoSize)

getLineTailLength

public LineDecoration.DecorationSize getLineTailLength()

setLineTailLength

public void setLineTailLength(LineDecoration.DecorationSize decoSize)

getLineDecoration

public LineDecoration getLineDecoration()
Specified by:
getLineDecoration in interface SimpleShape<HSLFShape,HSLFTextParagraph>

getPlaceholder

public Placeholder getPlaceholder()
Specified by:
getPlaceholder in interface SimpleShape<HSLFShape,HSLFTextParagraph>
Returns:
the placeholder or null if none is assigned
See Also:
SimpleShape.setPlaceholder(Placeholder)

setPlaceholder

public void setPlaceholder(Placeholder placeholder)
Description copied from interface: SimpleShape
Specifies that the corresponding shape should be represented by the generating application as a placeholder. When a shape is considered a placeholder by the generating application it can have special properties to alert the user that they may enter content into the shape.

Specified by:
setPlaceholder in interface SimpleShape<HSLFShape,HSLFTextParagraph>
Parameters:
placeholder - the placeholder or null to remove the reference to the placeholder

setStrokeStyle

public void setStrokeStyle(java.lang.Object... styles)
Description copied from interface: SimpleShape
Sets the line attributes. Possible attributes are Double (width), LineCap, LineDash, LineCompound, Color (implementations of PaintStyle aren't yet supported ...) If no styles are given, the line will be hidden

Specified by:
setStrokeStyle in interface SimpleShape<HSLFShape,HSLFTextParagraph>
Parameters:
styles - the line attributes

getHyperlink

public HSLFHyperlink getHyperlink()
Description copied from interface: SimpleShape
Returns the hyperlink assigned to this shape

Specified by:
getHyperlink in interface SimpleShape<HSLFShape,HSLFTextParagraph>
Returns:
the hyperlink assigned to this shape or null if not found.

createHyperlink

public HSLFHyperlink createHyperlink()
Description copied from interface: SimpleShape
Creates a hyperlink and asigns it to this shape. If the shape has already a hyperlink assigned, return it instead

Specified by:
createHyperlink in interface SimpleShape<HSLFShape,HSLFTextParagraph>
Returns:
the hyperlink assigned to this shape

setHyperlink

protected void setHyperlink(HSLFHyperlink link)
Sets the hyperlink - used when the document is parsed

Parameters:
link - the hyperlink


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