org.apache.poi.xslf.usermodel
Class XSLFSimpleShape

java.lang.Object
  extended by org.apache.poi.xslf.usermodel.XSLFShape
      extended by org.apache.poi.xslf.usermodel.XSLFSimpleShape
All Implemented Interfaces:
IAdjustableShape, PlaceableShape<XSLFShape,XSLFTextParagraph>, Shape<XSLFShape,XSLFTextParagraph>, SimpleShape<XSLFShape,XSLFTextParagraph>
Direct Known Subclasses:
XSLFBackground, XSLFConnectorShape, XSLFPictureShape, XSLFTextShape

@Beta
public abstract class XSLFSimpleShape
extends XSLFShape
implements SimpleShape<XSLFShape,XSLFTextParagraph>

Represents a single (non-group) shape in a .pptx slide show

Author:
Yegor Kozlov

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.poi.sl.usermodel.SimpleShape
SimpleShape.Placeholder
 
Method Summary
 Guide getAdjustValue(java.lang.String name)
           
 java.awt.geom.Rectangle2D getAnchor()
          Returns the anchor (the bounding box rectangle) of this shape.
 java.awt.Color getFillColor()
          Returns the solid color fill.
 FillStyle getFillStyle()
          fetch shape fill as a java.awt.Paint
 boolean getFlipHorizontal()
          Whether the shape is horizontally flipped
 boolean getFlipVertical()
          Whether the shape is vertically flipped
 CustomGeometry getGeometry()
           
 StrokeStyle.LineCap getLineCap()
           
 java.awt.Color getLineColor()
           
 StrokeStyle.LineCompound getLineCompound()
           
 StrokeStyle.LineDash getLineDash()
           
 LineDecoration getLineDecoration()
           
 LineDecoration.DecorationShape getLineHeadDecoration()
           
 LineDecoration.DecorationSize getLineHeadLength()
           
 LineDecoration.DecorationSize getLineHeadWidth()
           
protected  PaintStyle getLinePaint()
           
 LineDecoration.DecorationShape getLineTailDecoration()
           
 LineDecoration.DecorationSize getLineTailLength()
           
 LineDecoration.DecorationSize getLineTailWidth()
           
 double getLineWidth()
           
 double getRotation()
          Rotation angle in degrees
protected  org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D getSafeXfrm()
           
 XSLFShadow getShadow()
           
 ShapeType getShapeType()
           
 StrokeStyle getStrokeStyle()
           
protected  org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D getXfrm()
           
 boolean isPlaceholder()
           
 void setAnchor(java.awt.geom.Rectangle2D anchor)
           
 void setFillColor(java.awt.Color color)
          Specifies a solid color fill.
 void setFlipHorizontal(boolean flip)
           
 void setFlipVertical(boolean flip)
          Whether the shape is vertically flipped
 void setLineCap(StrokeStyle.LineCap cap)
           
 void setLineColor(java.awt.Color color)
           
 void setLineCompound(StrokeStyle.LineCompound compound)
           
 void setLineDash(StrokeStyle.LineDash dash)
           
 void setLineHeadDecoration(LineDecoration.DecorationShape style)
          Specifies the line end decoration, such as a triangle or arrowhead.
 void setLineHeadLength(LineDecoration.DecorationSize style)
          Specifies the line end width in relation to the line width.
 void setLineHeadWidth(LineDecoration.DecorationSize style)
          specifies decorations which can be added to the head of a line.
 void setLineTailDecoration(LineDecoration.DecorationShape style)
          Specifies the line end decoration, such as a triangle or arrowhead.
 void setLineTailLength(LineDecoration.DecorationSize style)
          Specifies the line end width in relation to the line width.
 void setLineTailWidth(LineDecoration.DecorationSize style)
          specifies decorations which can be added to the tail of a line.
 void setLineWidth(double width)
           
 void setRotation(double theta)
          Rotate this shape.
 void setShapeType(ShapeType type)
           
 void setStrokeStyle(java.lang.Object... styles)
          Sets the line attributes.
 
Methods inherited from class org.apache.poi.xslf.usermodel.XSLFShape
fetchShapeProperty, getBgPr, getBgRef, getCNvPr, getCTPlaceholder, getFillPaint, getGrpSpPr, getPaint, getParent, getShapeId, getShapeName, getSheet, getSpPr, getSpStyle, getXmlObject, selectPaint, selectPaint, selectPaint, selectPaint, selectPaint, selectProperty, setParent, setPlaceholder
 
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
getParent, getSheet
 
Methods inherited from interface org.apache.poi.sl.usermodel.PlaceableShape
getParent
 

Method Detail

setShapeType

public void setShapeType(ShapeType type)
Specified by:
setShapeType in interface SimpleShape<XSLFShape,XSLFTextParagraph>

getShapeType

public ShapeType getShapeType()
Specified by:
getShapeType in interface SimpleShape<XSLFShape,XSLFTextParagraph>

getSafeXfrm

protected org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D getSafeXfrm()

getXfrm

protected org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D getXfrm()

getAnchor

public java.awt.geom.Rectangle2D getAnchor()
Description copied from interface: Shape
Returns the anchor (the bounding box rectangle) of this shape. All coordinates are expressed in points (72 dpi).

Specified by:
getAnchor in interface PlaceableShape<XSLFShape,XSLFTextParagraph>
Specified by:
getAnchor in interface Shape<XSLFShape,XSLFTextParagraph>
Returns:
the anchor of this shape

setAnchor

public void setAnchor(java.awt.geom.Rectangle2D anchor)
Specified by:
setAnchor in interface PlaceableShape<XSLFShape,XSLFTextParagraph>
Parameters:
anchor - the position of this shape within the drawing canvas. The coordinates are expressed in points

setRotation

public void setRotation(double theta)
Description copied from interface: PlaceableShape
Rotate this shape.

Positive angles are clockwise (i.e., towards the positive y axis); negative angles are counter-clockwise (i.e., towards the negative y axis).

Specified by:
setRotation in interface PlaceableShape<XSLFShape,XSLFTextParagraph>
Parameters:
theta - the rotation angle in degrees.

getRotation

public double getRotation()
Description copied from interface: PlaceableShape
Rotation angle in degrees

Positive angles are clockwise (i.e., towards the positive y axis); negative angles are counter-clockwise (i.e., towards the negative y axis).

Specified by:
getRotation in interface PlaceableShape<XSLFShape,XSLFTextParagraph>
Returns:
rotation angle in degrees

setFlipHorizontal

public void setFlipHorizontal(boolean flip)
Specified by:
setFlipHorizontal in interface PlaceableShape<XSLFShape,XSLFTextParagraph>
Parameters:
flip - whether the shape is horizontally flipped

setFlipVertical

public void setFlipVertical(boolean flip)
Description copied from interface: PlaceableShape
Whether the shape is vertically flipped

Specified by:
setFlipVertical in interface PlaceableShape<XSLFShape,XSLFTextParagraph>
Parameters:
flip - whether the shape is vertically flipped

getFlipHorizontal

public boolean getFlipHorizontal()
Description copied from interface: PlaceableShape
Whether the shape is horizontally flipped

Specified by:
getFlipHorizontal in interface PlaceableShape<XSLFShape,XSLFTextParagraph>
Returns:
whether the shape is horizontally flipped

getFlipVertical

public boolean getFlipVertical()
Description copied from interface: PlaceableShape
Whether the shape is vertically flipped

Specified by:
getFlipVertical in interface PlaceableShape<XSLFShape,XSLFTextParagraph>
Returns:
whether the shape is vertically flipped

setLineColor

public void setLineColor(java.awt.Color color)
Parameters:
color - the color to paint the shape outline. A null value turns off the shape outline.

getLineColor

public java.awt.Color getLineColor()
Returns:
the color of the shape outline or null if outline is turned off

getLinePaint

protected PaintStyle getLinePaint()

setLineWidth

public void setLineWidth(double width)
Parameters:
width - line width in points. 0 means no line

getLineWidth

public double getLineWidth()
Returns:
line width in points. 0 means no line.

setLineCompound

public void setLineCompound(StrokeStyle.LineCompound compound)
Parameters:
compound - set the line compound style

getLineCompound

public StrokeStyle.LineCompound getLineCompound()
Returns:
the line compound

setLineDash

public void setLineDash(StrokeStyle.LineDash dash)
Parameters:
dash - a preset line dashing scheme to stroke thr shape outline

getLineDash

public StrokeStyle.LineDash getLineDash()
Returns:
a preset line dashing scheme to stroke thr shape outline

setLineCap

public void setLineCap(StrokeStyle.LineCap cap)
Parameters:
cap - the line end cap style

getLineCap

public StrokeStyle.LineCap getLineCap()
Returns:
the line end cap style

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<XSLFShape,XSLFTextParagraph>
Parameters:
color - the solid color fill. The value of null unsets the solid fill attribute from the underlying implementation

getFillColor

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

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

getShadow

public XSLFShadow getShadow()
Specified by:
getShadow in interface SimpleShape<XSLFShape,XSLFTextParagraph>
Returns:
shadow of this shape or null if shadow is disabled

getGeometry

public CustomGeometry getGeometry()
Specified by:
getGeometry in interface SimpleShape<XSLFShape,XSLFTextParagraph>
Returns:
definition of the shape geometry

setLineHeadDecoration

public void setLineHeadDecoration(LineDecoration.DecorationShape style)
Specifies the line end decoration, such as a triangle or arrowhead.


getLineHeadDecoration

public LineDecoration.DecorationShape getLineHeadDecoration()

setLineHeadWidth

public void setLineHeadWidth(LineDecoration.DecorationSize style)
specifies decorations which can be added to the head of a line.


getLineHeadWidth

public LineDecoration.DecorationSize getLineHeadWidth()

setLineHeadLength

public void setLineHeadLength(LineDecoration.DecorationSize style)
Specifies the line end width in relation to the line width.


getLineHeadLength

public LineDecoration.DecorationSize getLineHeadLength()

setLineTailDecoration

public void setLineTailDecoration(LineDecoration.DecorationShape style)
Specifies the line end decoration, such as a triangle or arrowhead.


getLineTailDecoration

public LineDecoration.DecorationShape getLineTailDecoration()

setLineTailWidth

public void setLineTailWidth(LineDecoration.DecorationSize style)
specifies decorations which can be added to the tail of a line.


getLineTailWidth

public LineDecoration.DecorationSize getLineTailWidth()

setLineTailLength

public void setLineTailLength(LineDecoration.DecorationSize style)
Specifies the line end width in relation to the line width.


getLineTailLength

public LineDecoration.DecorationSize getLineTailLength()

isPlaceholder

public boolean isPlaceholder()
Specified by:
isPlaceholder in interface SimpleShape<XSLFShape,XSLFTextParagraph>

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

getLineDecoration

public LineDecoration getLineDecoration()
Specified by:
getLineDecoration in interface SimpleShape<XSLFShape,XSLFTextParagraph>

getFillStyle

public FillStyle getFillStyle()
fetch shape fill as a java.awt.Paint

Specified by:
getFillStyle in interface SimpleShape<XSLFShape,XSLFTextParagraph>
Returns:
either Color or GradientPaint or TexturePaint or null

getStrokeStyle

public StrokeStyle getStrokeStyle()
Specified by:
getStrokeStyle in interface SimpleShape<XSLFShape,XSLFTextParagraph>

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<XSLFShape,XSLFTextParagraph>
Parameters:
styles - the line attributes


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