## com.lowagie.text.rtf.graphic
Class RtfShape

    java.lang.Object
      com.lowagie.text.Chunk
          com.lowagie.text.rtf.RtfAddableElement
              com.lowagie.text.rtf.graphic.RtfShape

All Implemented Interfaces:
  Element, MarkupAttributes, RtfBasicElement

    public class RtfShape

extends RtfAddableElement

The RtfShape provides the interface for adding shapes to the RTF document. This will only work for Word 97+, older Word versions are not supported by this class.
Only very simple shapes are directly supported by the RtfShape. For more complex shapes you will have to read the RTF specification (iText follows the 1.6 specification) and add the desired properties via the RtfShapeProperty.
One thing to keep in mind is that distances are not expressed in the standard iText point, but in EMU where 1 inch = 914400 EMU or 1 cm = 360000 EMU.

Version:
  $Revision: 1.2 $
Author:
  Mark Hall (mhall@edu.uni-klu.ac.at)

Field Summary
`private RtfShapePosition` `position` The RtfShapePosition that defines position settings for this RtfShape.
`private java.util.HashMap` `properties` A HashMap with RtfShapePropertys that define further shape properties.
`static int` `SHAPE_ARC` Constant for an arc shape.
`static int` `SHAPE_ARROR_THICK` Constant for a thick arrow.
`static int` `SHAPE_ARROW` Constant for an arrow.
`static int` `SHAPE_BALLOON` Constant for a balloon shape.
`static int` `SHAPE_CAN` Constant for a can shape.
`static int` `SHAPE_CUBE` Constant for a cube shape.
`static int` `SHAPE_DIAMOND` Constant for a diamond.
`static int` `SHAPE_DONUT` Constant for a donut shape.
`static int` `SHAPE_ELLIPSE` Constant for an ellipse.
`static int` `SHAPE_FREEFORM` Constant for a free form shape.
`static int` `SHAPE_HEXAGON` Constant for a hexagon.
`static int` `SHAPE_HOME_PLATE` Constant for a home plate style shape.
`static int` `SHAPE_LINE` Constant for a line shape.
`static int` `SHAPE_OCTAGON` Constant for an ocatagon.
`static int` `SHAPE_PARALLELOGRAM` Constant for a parallelogram.
`static int` `SHAPE_RECTANGLE` Constant for a rectangle.
`static int` `SHAPE_ROUND_RECTANGLE` Constant for a rounded rectangle.
`static int` `SHAPE_SEAL` Constant for a seal shape.
`static int` `SHAPE_STAR` Constant for a star.
`static int` `SHAPE_TRAPEZOID` Constant for a trapezoid.
`static int` `SHAPE_TRIANGLE_ISOSCELES` Constant for a isoscelle triangle.
`static int` `SHAPE_TRIANGLE_RIGHT` Constant for a right triangle.
`static int` `SHAPE_WRAP_BOTH` Text is wrapped on the left and right side.
`static int` `SHAPE_WRAP_LARGEST` Text is wrapped on the largest side.
`static int` `SHAPE_WRAP_LEFT` Text is wrapped on the left side.
`static int` `SHAPE_WRAP_NONE` Text is not wrapped around the shape.
`static int` `SHAPE_WRAP_RIGHT` Text is wrapped on the right side.
`static int` `SHAPE_WRAP_THROUGH` Text is wrapped through the shape.
`static int` `SHAPE_WRAP_TIGHT_BOTH` Text is tightly wrapped on the left and right side.
`static int` `SHAPE_WRAP_TIGHT_LARGEST` Text is tightly wrapped on the largest side.
`static int` `SHAPE_WRAP_TIGHT_LEFT` Text is tightly wrapped on the left side.
`static int` `SHAPE_WRAP_TIGHT_RIGHT` Text is tightly wrapped on the right side.
`static int` `SHAPE_WRAP_TOP_BOTTOM` Text is wrapped to the top and bottom.
`private int` `shapeNr` The shape nr is a random unique id.
`private java.lang.String` `shapeText` Text that is contained in the shape.
`private int` `type` The shape type.
`private int` `wrapping` The wrapping mode.

Fields inherited from class com.lowagie.text.rtf.RtfAddableElement
`doc, inHeader, inTable`

Fields inherited from class com.lowagie.text.Chunk
`ACTION, attributes, BACKGROUND, COLOR, content, ENCODING, font, GENERICTAG, HSCALE, HYPHENATION, IMAGE, LOCALDESTINATION, LOCALGOTO, markupAttributes, NEWLINE, NEWPAGE, NEXTPAGE, OBJECT_REPLACEMENT_CHARACTER, PDFANNOTATION, REMOTEGOTO, SKEW, SPLITCHARACTER, SUBSUPSCRIPT, TEXTRENDERMODE, UNDERLINE`

Fields inherited from interface com.lowagie.text.rtf.RtfBasicElement
`CLOSE_GROUP, COMMA_DELIMITER, DELIMITER, OPEN_GROUP, TWIPS_FACTOR`

Constructor Summary
`RtfShape(int type, RtfShapePosition position)` Constructs a new RtfShape of a given shape at the given RtfShapePosition.

Method Summary
`void` `setProperty(RtfShapeProperty property)` Sets a property.
`void` `setShapeText(java.lang.String shapeText)` Sets the text to display in this RtfShape.
`void` `setWrapping(int wrapping)` Set the wrapping mode.
`byte[]` `write()` Writes the RtfShape.

Methods inherited from class com.lowagie.text.rtf.RtfAddableElement
`intToByteArray, setInHeader, setInTable, setRtfDocument`

Methods inherited from class com.lowagie.text.Chunk

`addToArray, append, content, font, getAttributes, getChunks, getHorizontalScaling, getImage, getKeySet, getMarkupAttribute, getMarkupAttributeNames, getMarkupAttributes, getTextRise, getWidthPoint, hasAttributes, isEmpty, isTag, process, setAction, setAnchor, setAnchor, setAnnotation, setBackground, setBackground, setFont, setGenericTag, setHorizontalScaling, setHyphenation, setLocalDestination, setLocalGoto, setMarkupAttribute, setMarkupAttributes, setNewPage, setRemoteGoto, setRemoteGoto, setSkew, setSplitCharacter, setTextRenderMode, setTextRise, setUnderline, setUnderline, toString, type`

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

Field Detail

### SHAPE_FREEFORM

    public static final int SHAPE_FREEFORM

  Constant for a free form shape. The shape verticies must be specified with an array of Point objects in a RtfShapeProperty with the name PROPERTY_VERTICIES.

  See Also:
    Constant Field Values

### SHAPE_RECTANGLE

    public static final int SHAPE_RECTANGLE

  Constant for a rectangle.

  See Also:
    Constant Field Values

### SHAPE_ROUND_RECTANGLE

    public static final int SHAPE_ROUND_RECTANGLE

  Constant for a rounded rectangle. The roundness is set via a RtfShapeProperty with the name PROPERTY_ADJUST_VALUE.

  See Also:
    Constant Field Values

### SHAPE_ELLIPSE

    public static final int SHAPE_ELLIPSE

  Constant for an ellipse. Use this to create circles.

  See Also:
    Constant Field Values

### SHAPE_DIAMOND

    public static final int SHAPE_DIAMOND

  Constant for a diamond.

  See Also:
    Constant Field Values

### SHAPE_TRIANGLE_ISOSCELES

    public static final int SHAPE_TRIANGLE_ISOSCELES

  Constant for a isoscelle triangle.

  See Also:
    Constant Field Values

### SHAPE_TRIANGLE_RIGHT

    public static final int SHAPE_TRIANGLE_RIGHT

  Constant for a right triangle.

  See Also:
    Constant Field Values

### SHAPE_PARALLELOGRAM

    public static final int SHAPE_PARALLELOGRAM

  Constant for a parallelogram.

  See Also:
    Constant Field Values

### SHAPE_TRAPEZOID

    public static final int SHAPE_TRAPEZOID

  Constant for a trapezoid.

  See Also:
    Constant Field Values

### SHAPE_HEXAGON

    public static final int SHAPE_HEXAGON

  Constant for a hexagon.

  See Also:
    Constant Field Values

### SHAPE_OCTAGON

    public static final int SHAPE_OCTAGON

  Constant for an ocatagon.

  See Also:
    Constant Field Values

### SHAPE_STAR

    public static final int SHAPE_STAR

  Constant for a star.

  See Also:
    Constant Field Values

### SHAPE_ARROW

    public static final int SHAPE_ARROW

  Constant for an arrow.

  See Also:
    Constant Field Values

### SHAPE_ARROR_THICK

    public static final int SHAPE_ARROR_THICK

  Constant for a thick arrow.

  See Also:
    Constant Field Values

### SHAPE_HOME_PLATE

    public static final int SHAPE_HOME_PLATE

  Constant for a home plate style shape.

  See Also:
    Constant Field Values

### SHAPE_CUBE

    public static final int SHAPE_CUBE

  Constant for a cube shape.

  See Also:
    Constant Field Values

### SHAPE_BALLOON

    public static final int SHAPE_BALLOON

  Constant for a balloon shape.

  See Also:
    Constant Field Values

### SHAPE_SEAL

    public static final int SHAPE_SEAL

  Constant for a seal shape.

  See Also:
    Constant Field Values

### SHAPE_ARC

    public static final int SHAPE_ARC

  Constant for an arc shape.

  See Also:
    Constant Field Values

### SHAPE_LINE

    public static final int SHAPE_LINE

  Constant for a line shape.

  See Also:
    Constant Field Values

### SHAPE_CAN

    public static final int SHAPE_CAN

  Constant for a can shape.

  See Also:
    Constant Field Values

### SHAPE_DONUT

    public static final int SHAPE_DONUT

  Constant for a donut shape.

  See Also:
    Constant Field Values

### SHAPE_WRAP_NONE

    public static final int SHAPE_WRAP_NONE

  Text is not wrapped around the shape.

  See Also:
    Constant Field Values

### SHAPE_WRAP_TOP_BOTTOM

    public static final int SHAPE_WRAP_TOP_BOTTOM

  Text is wrapped to the top and bottom.

  See Also:
    Constant Field Values

### SHAPE_WRAP_BOTH

    public static final int SHAPE_WRAP_BOTH

  Text is wrapped on the left and right side.

  See Also:
    Constant Field Values

### SHAPE_WRAP_LEFT

    public static final int SHAPE_WRAP_LEFT

  Text is wrapped on the left side.

  See Also:
    Constant Field Values

### SHAPE_WRAP_RIGHT

    public static final int SHAPE_WRAP_RIGHT

  Text is wrapped on the right side.

  See Also:
    Constant Field Values

### SHAPE_WRAP_LARGEST

    public static final int SHAPE_WRAP_LARGEST

  Text is wrapped on the largest side.

  See Also:
    Constant Field Values

### SHAPE_WRAP_TIGHT_BOTH

    public static final int SHAPE_WRAP_TIGHT_BOTH

  Text is tightly wrapped on the left and right side.

  See Also:
    Constant Field Values

### SHAPE_WRAP_TIGHT_LEFT

    public static final int SHAPE_WRAP_TIGHT_LEFT

  Text is tightly wrapped on the left side.

  See Also:
    Constant Field Values

### SHAPE_WRAP_TIGHT_RIGHT

    public static final int SHAPE_WRAP_TIGHT_RIGHT

  Text is tightly wrapped on the right side.

  See Also:
    Constant Field Values

### SHAPE_WRAP_TIGHT_LARGEST

    public static final int SHAPE_WRAP_TIGHT_LARGEST

  Text is tightly wrapped on the largest side.

  See Also:
    Constant Field Values

### SHAPE_WRAP_THROUGH

    public static final int SHAPE_WRAP_THROUGH

  Text is wrapped through the shape.

  See Also:
    Constant Field Values

### shapeNr

    private int shapeNr

  The shape nr is a random unique id.

### type

    private int type

  The shape type.

### position

    private RtfShapePosition position

  The RtfShapePosition that defines position settings for this RtfShape.

### properties

    private java.util.HashMap properties

  A HashMap with RtfShapePropertys that define further shape properties.

### wrapping

    private int wrapping

  The wrapping mode. Defaults to SHAPE_WRAP_NONE;

### shapeText

    private java.lang.String shapeText

  Text that is contained in the shape.

Constructor Detail

### RtfShape

    public RtfShape(int type,
                    RtfShapePosition position)

  Constructs a new RtfShape of a given shape at the given RtfShapePosition.

  Parameters:
    `type` - The type of shape to create.
    `position` - The RtfShapePosition to create this RtfShape at.

Method Detail

### setProperty

    public void setProperty(RtfShapeProperty property)

  Sets a property.

  Parameters:
    `property` - The property to set for this RtfShape.

### setShapeText

    public void setShapeText(java.lang.String shapeText)

  Sets the text to display in this RtfShape.

  Parameters:
    `shapeText` - The text to display.

### setWrapping

    public void setWrapping(int wrapping)

  Set the wrapping mode.

  Parameters:
    `wrapping` - The wrapping mode to use for this RtfShape.

### write

    public byte[] write()

  Writes the RtfShape. Some settings are automatically translated into or require other properties and these are set first.

  Specified by:
    `write` in interface `RtfBasicElement`
  Specified by:
    `write` in class `RtfAddableElement`
  Returns:
    The byte array containing the data