com.aspose.slides
Class Shape

java.lang.Object
  extended by com.aspose.slides.Shape
All Implemented Interfaces:
IShape, IShapeFormat
Direct Known Subclasses:
AutoShape, Ellipse, GroupShape, Line, PictureFrame, Polyline, Rectangle, TextFrame

public class Shape
extends java.lang.Object
implements IShape, IShapeFormat

Represents the abstract shape on a slide.


Method Summary
 Link addLink()
          Adds the new link to a shape.
 TextFrame addTextFrame(java.lang.String text)
          Adds a new TextFrame to a shape.
 void clearLink()
          Clears the Link.
 ShapeElement[] createShapeElements()
          Creates and returns array of shape elements.
 ShapeElement[] createShapeElements(ShapeDrawingOptions shapeDrawingOptions)
          Creates array of shape's elements.
 java.lang.String getAlternativeText()
          Returns the alternative text associated with a shape in a Web presentation.
 AnimationSettings getAnimationSettings()
          Returns the AnimationSettings object that contains animation properties of a shape.
 java.awt.geom.Point2D.Float[] getConnectionSites()
          Returns array of points, where connector can be attached.
 java.awt.geom.Point2D.Float[] getConnectionSitesRaw()
          Returns array of points, where connector can be attached.
 FillFormat getFillFormat()
          Returns the FillFormat object that contains fill formatting properties of a shape.
 int getHeight()
          Returns the height of a shape.
 LineFormat getLineFormat()
          Returns the LineFormat object that contains line formatting properties of a shape.
 Link getLink()
          Return the Link object for a shape.
 int getMasterShapeId()
          Returns the unique Id of a master shape or 0 in case shape is not inherited from any master shapes.
 java.lang.String getName()
          Returns the name of a shape.
 BaseSlide getParent()
          Returns the parent slide.
 Placeholder getPlaceholder()
          Returns the Placeholder object for a shape in case of shape is a placeholder.
 int getProtection()
          Returns the bit flags which determine how the shape is protected.
 int getRotation()
          Returns the number of degrees the specified shape is rotated around the z-axis.
 ShadowFormat getShadowFormat()
          Returns the ShadowFormat object that contains shadow decoration properties of a shape.
 int getShapeId()
          Returns the unique Id of a shape.
 java.awt.geom.Rectangle2D.Float getShapeRectangle()
          Returns shape rectangle in presentation coordinates.
 Tags getTags()
          Returns the tags for a shape.
 TextFrame getTextFrame()
          Returns the TextFrame object for a Shape.
 ThreeDFormat getThreeDFormat()
          Returns the ThreeDFormat object that contains 3D decoration properties of a shape.
 int getWidth()
          Returns the width of a shape.
 int getX()
          Returns the x-coordinate of the upper-left corner of a shape.
 int getY()
          Returns the y-coordinate of the upper-left corner of a shape.
 int getZOrderPosition()
          Returns the position of a shape in the z-order.
 boolean hasExternalData()
          Determines whether the shape has external referenced data e.g.
 boolean isFlipHorizontal()
          Determines whether the shape is flipped horizontally.
 boolean isFlipVertical()
          Determines whether the shape is flipped vertically.
 boolean isHidden()
          Determines whether the shape is hidden.
 boolean isMasterTextHolder()
          True if shape is a master text holder.
 boolean isTextHolder()
          Returns true if shape is a TextHolder.
 void serialize(java.io.OutputStream stream)
          Serializes a Shape object to the stream.
 void setAlternativeText(java.lang.String value)
          Sets the alternative text associated with a shape in a Web presentation.
 void setFlipHorizontal(boolean value)
          Flips the shape horizontally.
 void setFlipVertical(boolean value)
          Flips the shape vertically.
 void setHeight(int value)
          Sets the height of a shape.
 void setHidden(boolean value)
          Sets whether the shape is hidden.
 void setName(java.lang.String value)
          Sets the name of a shape.
 void setProtection(int type)
          Sets the bit flags which determine how the shape is protected.
 void setRotation(int value)
          Sets the number of degrees the specified shape is rotated around the z-axis.
 void setWidth(int value)
          Sets the width of a shape.
 void setX(int value)
          Sets the x-coordinate of the upper-left corner of a shape.
 void setY(int value)
          Sets the y-coordinate of the upper-left corner of a shape.
 void zOrder(int cmd)
          Moves the shape in front of or behind other shapes in the collection (that is, changes the shape's position in the z-order).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isTextHolder

public boolean isTextHolder()
Returns true if shape is a TextHolder.

Returns:
True if shape is a TextHolder.

getPlaceholder

public Placeholder getPlaceholder()
Returns the Placeholder object for a shape in case of shape is a placeholder.

Returns:
The Placeholder object.

isMasterTextHolder

public boolean isMasterTextHolder()
True if shape is a master text holder.

Returns:
True if shape is a master text holder.

getLineFormat

public LineFormat getLineFormat()
Returns the LineFormat object that contains line formatting properties of a shape.

Specified by:
getLineFormat in interface IShapeFormat
Returns:
The LineFormat object.

getFillFormat

public FillFormat getFillFormat()
Returns the FillFormat object that contains fill formatting properties of a shape.

Specified by:
getFillFormat in interface IShapeFormat
Returns:
The FillFormat object.

getShadowFormat

public ShadowFormat getShadowFormat()
Returns the ShadowFormat object that contains shadow decoration properties of a shape.

Specified by:
getShadowFormat in interface IShapeFormat
Returns:
The ShadowFormat object.

getThreeDFormat

public ThreeDFormat getThreeDFormat()
Returns the ThreeDFormat object that contains 3D decoration properties of a shape.

Specified by:
getThreeDFormat in interface IShapeFormat
Returns:
The ThreeDFormat object.

getAnimationSettings

public AnimationSettings getAnimationSettings()
Returns the AnimationSettings object that contains animation properties of a shape.

Returns:
The AnimationSettings object.

getLink

public Link getLink()
Return the Link object for a shape.

Returns:
The Link object.

addLink

public Link addLink()
Adds the new link to a shape.

Returns:
The new Link object.

clearLink

public void clearLink()
Clears the Link.


serialize

public void serialize(java.io.OutputStream stream)
               throws PptException
Serializes a Shape object to the stream.

Parameters:
stream - The stream to which the Shape is to be serialized.
Throws:
PptException

getConnectionSitesRaw

public java.awt.geom.Point2D.Float[] getConnectionSitesRaw()
Returns array of points, where connector can be attached. Coordinates aren't transformed and do not take into account shape's and its parents' FlipH, FlipH, FlipV and Rotation properties. Use getConnectionSites() instead.

Returns:
Array of points, where connector can be attached.

getConnectionSites

public java.awt.geom.Point2D.Float[] getConnectionSites()
Returns array of points, where connector can be attached. Returned coordinates are in the document's coordinate system.

Returns:
Array of points, where connector can be attached.

createShapeElements

public ShapeElement[] createShapeElements()
Creates and returns array of shape elements.

Returns:
Array of shape elements.

getShapeRectangle

public java.awt.geom.Rectangle2D.Float getShapeRectangle()
Returns shape rectangle in presentation coordinates. Note: It is not guaranteed actual shape will fit this rectangle, some autoshapes won't.

Returns:
Shape rectangle.

createShapeElements

public ShapeElement[] createShapeElements(ShapeDrawingOptions shapeDrawingOptions)
Creates array of shape's elements.

Parameters:
shapeDrawingOptions -
Returns:
Array of ShapeElement objects.

getParent

public BaseSlide getParent()
Returns the parent slide.

Specified by:
getParent in interface IShape
Returns:
The parent slide.

getZOrderPosition

public int getZOrderPosition()
Returns the position of a shape in the z-order. Shapes[0] returns the shape at the back of the z-order, and Shapes[Shapes.Count - 1] returns the shape at the front of the z-order.

Returns:
The z-order position.

zOrder

public void zOrder(int cmd)
Moves the shape in front of or behind other shapes in the collection (that is, changes the shape's position in the z-order).

Parameters:
cmd - specifies where to move the specified shape relative to the other shapes.

getAlternativeText

public java.lang.String getAlternativeText()
Returns the alternative text associated with a shape in a Web presentation.

Specified by:
getAlternativeText in interface IShape
Returns:
The alternative text.

setAlternativeText

public void setAlternativeText(java.lang.String value)
Sets the alternative text associated with a shape in a Web presentation.

Specified by:
setAlternativeText in interface IShape
Parameters:
value - the alternative text.

getName

public java.lang.String getName()
Returns the name of a shape. Returns real name value only if name was explicitly set.

Returns:
The name of a shape.

setName

public void setName(java.lang.String value)
Sets the name of a shape.

Parameters:
value - the name of a shape.

isHidden

public boolean isHidden()
Determines whether the shape is hidden.

Returns:
true if the shape is hidden.

setHidden

public void setHidden(boolean value)
Sets whether the shape is hidden.

Parameters:
value - true if the shape is hidden.

getProtection

public int getProtection()
Returns the bit flags which determine how the shape is protected. See ShapeProtectionType.


setProtection

public void setProtection(int type)
Sets the bit flags which determine how the shape is protected.

Parameters:
type - the bit flags. See ShapeProtectionType.

getRotation

public int getRotation()
Returns the number of degrees the specified shape is rotated around the z-axis. A positive value indicates clockwise rotation; a negative value indicates counterclockwise rotation.

Returns:
The rotation angle.

setRotation

public void setRotation(int value)
                 throws java.lang.Exception
Sets the number of degrees the specified shape is rotated around the z-axis. A positive value indicates clockwise rotation; a negative value indicates counterclockwise rotation.

Parameters:
value - new rotation angle.
Throws:
java.lang.Exception

getX

public int getX()
Returns the x-coordinate of the upper-left corner of a shape.

Specified by:
getX in interface IShape
Returns:
The x coordinate.

setX

public void setX(int value)
Sets the x-coordinate of the upper-left corner of a shape.

Specified by:
setX in interface IShape
Parameters:
value - new x coordinate.

getY

public int getY()
Returns the y-coordinate of the upper-left corner of a shape.

Specified by:
getY in interface IShape
Returns:
The y coordinate.

setY

public void setY(int value)
Sets the y-coordinate of the upper-left corner of a shape.

Specified by:
setY in interface IShape
Parameters:
value - new y coordinate.

getWidth

public int getWidth()
Returns the width of a shape.

Specified by:
getWidth in interface IShape
Returns:
The width of a shape.

setWidth

public void setWidth(int value)
Sets the width of a shape.

Specified by:
setWidth in interface IShape
Parameters:
value - new width of a shape.

getHeight

public int getHeight()
Returns the height of a shape.

Specified by:
getHeight in interface IShape
Returns:
The height of a shape.

setHeight

public void setHeight(int value)
Sets the height of a shape.

Specified by:
setHeight in interface IShape
Parameters:
value - new height of a shape.

isFlipHorizontal

public boolean isFlipHorizontal()
Determines whether the shape is flipped horizontally.

Returns:
true if the shape is flipped horizontally.

setFlipHorizontal

public void setFlipHorizontal(boolean value)
Flips the shape horizontally.

Parameters:
value - true to flip the shape horizontally.

isFlipVertical

public boolean isFlipVertical()
Determines whether the shape is flipped vertically.

Returns:
true if the shape is flipped vertically.

setFlipVertical

public void setFlipVertical(boolean value)
Flips the shape vertically.

Parameters:
value - true to flip the shape vertically.

getShapeId

public int getShapeId()
Returns the unique Id of a shape.

Returns:
unique Id of a shape.

getMasterShapeId

public int getMasterShapeId()
Returns the unique Id of a master shape or 0 in case shape is not inherited from any master shapes.

Returns:
unique Id of a master shape or 0 in case shape is not inherited from any master shapes.

getTextFrame

public TextFrame getTextFrame()
Returns the TextFrame object for a Shape.

Returns:
TextFrame object.

addTextFrame

public TextFrame addTextFrame(java.lang.String text)
                       throws PptEditException
Adds a new TextFrame to a shape. If shape already has TextFrame then do nothing.

Parameters:
text - Default text for a new TextFrame.
Throws:
PptEditException

getTags

public Tags getTags()
Returns the tags for a shape.

Returns:
the tags for a shape.

hasExternalData

public boolean hasExternalData()
Determines whether the shape has external referenced data e.g. OLE object or embedded sound.

Returns:
true if shape has external referenced data.