ru.novosoft.dc.rtf.dom
Class RTFShape

java.lang.Object
  |
  +--ru.novosoft.dc.rtf.dom.RTFShape

public final class RTFShape
extends java.lang.Object
implements RTFInline

Word 97-2000 Drawing Object (shape). The representation of shape in this class is the following:


Field Summary
static byte BOTTOM
          Index of the bottom position parameter.
static byte LEFT
          Index of the left position parameter.
static byte REF_COLUMN
          The shape is positioned relative to the column in the horizontal direction.
static byte REF_IGNORE
          The shape position is specified in shape-entry parameters.
static byte REF_MARGIN
          The shape is positioned relative to the margin.
static byte REF_PAGE
          The shape is positioned relative to the page.
static byte REF_PAR
          The shape is positioned relative to the paragraph in the vertical direction.
static byte RIGHT
          Index of the right position parameter.
static byte SIDES_BOTH
          Wrap both sides of shape.
static byte SIDES_LARGEST
          Wrap only on largest side.
static byte SIDES_LEFT
          Wrap left side only.
static byte SIDES_RIGHT
          Wrap right side only.
static byte TOP
          Index of the top position parameter.
static byte TYPE_OF_SIDES
          Index of the sides-wrapping parameter.
static byte TYPE_OF_WRAP
          Index of the wrap-type parameter.
static byte WRAP_AROUND
          Wrap around shape.
static byte WRAP_NONE
          None (wrap as if shape isn't present).
static byte WRAP_THROUGH
          Wrap text through shape.
static byte WRAP_TIGHT
          Wrap tightly around shape.
static byte WRAP_TOP_AND_BOTTOM
          Wrap around top and bottom of shape (no text allowed beside shape).
static byte X_REFERENCE
          Index of the horizontal reference parameter.
static byte Y_REFERENCE
          Index of the vertical reference parameter.
static byte Z_ORDER
          Index of the z-order parameter.
 
Constructor Summary
RTFShape()
           
 
Method Summary
 void exportTo(org.w3c.dom.Element elem)
          Export the contents of this object to the specified DOM element.
 ShapeEntry getEntry()
          Return the shape entry.
 int getPosition(int index)
          Return the value of the shape position parameter of the specified index.
 RTFFlow getResult()
          Return the shape-result field or null if no result specified.
 boolean hasLockAnchor()
          Return true if the shape has the lock anchor.
 boolean isInFrontOfText()
          Return the value of the in-front-of-text flag.
 boolean isInHeader()
          Return the value of the in-header flag.
 void setEntry(ShapeEntry value)
          Set a shape entry.
 void setInFrontOfText(boolean value)
          Set a value of the in-front-of-text flag.
 void setInHeader(boolean value)
          Set a value of the in-header flag.
 void setLockAnchor(boolean value)
          Set a value of the lock anchor.
 void setPosition(int index, int value)
          Set a value for the shape position parameter of the specified index.
 void setResult(RTFFlow value)
          Set the shape-result field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOP

public static final byte TOP
Index of the top position parameter.

BOTTOM

public static final byte BOTTOM
Index of the bottom position parameter.

LEFT

public static final byte LEFT
Index of the left position parameter.

RIGHT

public static final byte RIGHT
Index of the right position parameter.

Z_ORDER

public static final byte Z_ORDER
Index of the z-order parameter.

X_REFERENCE

public static final byte X_REFERENCE
Index of the horizontal reference parameter.

Y_REFERENCE

public static final byte Y_REFERENCE
Index of the vertical reference parameter.

TYPE_OF_WRAP

public static final byte TYPE_OF_WRAP
Index of the wrap-type parameter.

TYPE_OF_SIDES

public static final byte TYPE_OF_SIDES
Index of the sides-wrapping parameter.

REF_MARGIN

public static final byte REF_MARGIN
The shape is positioned relative to the margin.

REF_PAGE

public static final byte REF_PAGE
The shape is positioned relative to the page.

REF_COLUMN

public static final byte REF_COLUMN
The shape is positioned relative to the column in the horizontal direction.

REF_PAR

public static final byte REF_PAR
The shape is positioned relative to the paragraph in the vertical direction.

REF_IGNORE

public static final byte REF_IGNORE
The shape position is specified in shape-entry parameters.

WRAP_TOP_AND_BOTTOM

public static final byte WRAP_TOP_AND_BOTTOM
Wrap around top and bottom of shape (no text allowed beside shape).

WRAP_AROUND

public static final byte WRAP_AROUND
Wrap around shape.

WRAP_NONE

public static final byte WRAP_NONE
None (wrap as if shape isn't present).

WRAP_TIGHT

public static final byte WRAP_TIGHT
Wrap tightly around shape.

WRAP_THROUGH

public static final byte WRAP_THROUGH
Wrap text through shape.

SIDES_BOTH

public static final byte SIDES_BOTH
Wrap both sides of shape.

SIDES_LEFT

public static final byte SIDES_LEFT
Wrap left side only.

SIDES_RIGHT

public static final byte SIDES_RIGHT
Wrap right side only.

SIDES_LARGEST

public static final byte SIDES_LARGEST
Wrap only on largest side.
Constructor Detail

RTFShape

public RTFShape()
Method Detail

setPosition

public final void setPosition(int index,
                              int value)
Set a value for the shape position parameter of the specified index.
Parameters:
index - an index of the parameter to be set (TOP, BOTTOM, LEFT, RIGHT, Z_ORDER, X_REFERENCE, Y_REFERENCE, TYPE_OF_WRAP, or TYPE_OF_SIDES)
value - a value to set. For TOP, BOTTOM, LEFT and RIGHT, it is a shape position from anchor in twips. For Z_ORDER, it is z-ordering index starting from 0 for back-most shape. For X_REFERENCE, the value of REF_IGNORE, REF_COLUMN, REF_PAGE, or REF_MARGIN is allowed. For Y_REFERENCE, the value of REF_IGNORE, REF_PAR, REF_PAGE, or REF_MARGIN is allowed. For TYPE_OF_WRAP, the value of WRAP_TOP_AND_BOTTOM, WRAP_AROUND, WRAP_NONE, WRAP_TIGHT, or WRAP_THROUGH is allowed. The TYPE_OF_SIDES parameter has sence if the TYPE_OF_WRAP is equal to WRAP_AROUND or WRAP_TIGHT. Allowed values are SIDES_BOTH, SIDES_LEFT, SIDES_RIGHT, and SIDES_LARGEST.

getPosition

public final int getPosition(int index)
Return the value of the shape position parameter of the specified index.

setLockAnchor

public final void setLockAnchor(boolean value)
Set a value of the lock anchor. If true, the shape anchor is locked to the position in current paragraph.

hasLockAnchor

public final boolean hasLockAnchor()
Return true if the shape has the lock anchor.

setInHeader

public final void setInHeader(boolean value)
Set a value of the in-header flag. If true, the shape is in the header document. Otherwise, it is in the main document.

isInHeader

public final boolean isInHeader()
Return the value of the in-header flag.

setInFrontOfText

public final void setInFrontOfText(boolean value)
Set a value of the in-front-of-text flag. If true, the shape is positioned in front of other text. Otherwise, the shape is positioned behind other text.

isInFrontOfText

public final boolean isInFrontOfText()
Return the value of the in-front-of-text flag.

setResult

public final void setResult(RTFFlow value)
Set the shape-result field.

getResult

public final RTFFlow getResult()
Return the shape-result field or null if no result specified.

setEntry

public final void setEntry(ShapeEntry value)
Set a shape entry.

getEntry

public final ShapeEntry getEntry()
Return the shape entry.

exportTo

public void exportTo(org.w3c.dom.Element elem)
Export the contents of this object to the specified DOM element.