ru.novosoft.dc.rtf.dom.objects
Class Position

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

public final class Position
extends java.lang.Object
implements java.lang.Cloneable

Specification of absolutely positioned paragraphs (frames or objects).


Field Summary
static byte ALLOW_WRAP
          Allow text wrapping (gaps around the frame are specified in this case).
static byte BOTTOM
          Position vertically at the bottom of the reference frame.
static byte CAP_INTEXT
          In-text drop cap.
static byte CAP_MARGIN
          Margin drop cap.
static byte CAP_NONE
          No drop cap (default).
static byte CENTER
          Center horizontally or vertically within the reference frame.
static byte FRAME_DISTANCE
          Index of the frame distance parameter.
static byte FRAME_POSITION
          Index of the frame position parameter.
static byte FRAME_REFERENCE
          Index of the frame reference parameter.
static byte FRAME_SIZE
          Index of the frame size parameter.
static byte INLINE
          Position vertically in-line.
static byte INSIDE
          Position horizontally or vertically inside the reference frame.
static byte LEFT
          Position horizontally to the left within the reference frame.
static byte NO_WRAP
          No text wrapping around the frame.
static byte OUTSIDE
          Position horizontally or vertically outside the reference frame.
static byte OVERLAY
          Text flows underneath frame.
static byte REF_COLUMN
          Horizontal reference frame is the column (the default).
static byte REF_MARGIN
          Horizontal or vertical reference frame is the margin.
static byte REF_PAGE
          Horizontal or vertical reference frame is the page.
static byte REF_PAR
          Vertical reference frame is the next unframed paragraph.
static byte RIGHT
          Position horizontally to the right within the reference frame.
static byte TOP
          Position vertically at the top of the reference frame.
static byte WRAP_BOTTOM
          Index of the bottom wrap distance parameter.
static byte WRAP_LEFT
          Index of the left wrap distance parameter.
static byte WRAP_RIGHT
          Index of the right wrap distance parameter.
static byte WRAP_TOP
          Index of the top wrap distance parameter.
static byte WRAP_TYPE
          Index of the wrap type parameter.
 
Constructor Summary
Position()
           
 
Method Summary
 boolean allowsOverlap()
          Return true if overlapping is allowed.
 java.lang.Object clone()
          Creates a deep copy of this object.
 boolean equals(java.lang.Object obj)
          Compare this frame with another frame and return true if frames coinside.
 void exportTo(org.w3c.dom.Element elem, java.lang.String tagName)
          Export the contents of this object to the specified DOM element.
 int getDropCapLines()
          Return the number of lines drop cap is to occupy.
 int getDropCapType()
          Return the drop cap type.
 int getHorizontalPosition(int index)
          Return the value of the horizontal position parameter of the specified index.
 int getVerticalPosition(int index)
          Return the value of the vertical position parameter of the specified index.
 int getWrapping(int index)
          Return the value of the text wrapping parameter of the specified index.
 boolean hasLockAnchor()
          Return true if the frame has the lock anchor.
 void setDropCapLines(int value)
          Set a number of lines drop cap is to occupy.
 void setDropCapType(int value)
          Set a type of the drop cap.
 void setHorizontalPosition(int index, int value)
          Set a value for the horizontal position parameter of the specified index.
 void setLockAnchor(boolean value)
          Set a value of the lock anchor.
 void setOverlap(boolean value)
          Set a value for the overlap flag.
 void setVerticalPosition(int index, int value)
          Set a value for the vertical position parameter of the specified index.
 void setWrapping(int index, int value)
          Set a value for the text wrapping parameter of the specified index.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FRAME_SIZE

public static final byte FRAME_SIZE
Index of the frame size parameter.

FRAME_REFERENCE

public static final byte FRAME_REFERENCE
Index of the frame reference parameter.

FRAME_POSITION

public static final byte FRAME_POSITION
Index of the frame position parameter.

FRAME_DISTANCE

public static final byte FRAME_DISTANCE
Index of the frame distance parameter.

REF_MARGIN

public static final byte REF_MARGIN
Horizontal or vertical reference frame is the margin.

REF_PAGE

public static final byte REF_PAGE
Horizontal or vertical reference frame is the page.

REF_COLUMN

public static final byte REF_COLUMN
Horizontal reference frame is the column (the default).

REF_PAR

public static final byte REF_PAR
Vertical reference frame is the next unframed paragraph.

LEFT

public static final byte LEFT
Position horizontally to the left within the reference frame.

TOP

public static final byte TOP
Position vertically at the top of the reference frame.

RIGHT

public static final byte RIGHT
Position horizontally to the right within the reference frame.

BOTTOM

public static final byte BOTTOM
Position vertically at the bottom of the reference frame.

CENTER

public static final byte CENTER
Center horizontally or vertically within the reference frame.

INSIDE

public static final byte INSIDE
Position horizontally or vertically inside the reference frame.

OUTSIDE

public static final byte OUTSIDE
Position horizontally or vertically outside the reference frame.

INLINE

public static final byte INLINE
Position vertically in-line.

WRAP_TYPE

public static final byte WRAP_TYPE
Index of the wrap type parameter.

WRAP_LEFT

public static final byte WRAP_LEFT
Index of the left wrap distance parameter.

WRAP_RIGHT

public static final byte WRAP_RIGHT
Index of the right wrap distance parameter.

WRAP_TOP

public static final byte WRAP_TOP
Index of the top wrap distance parameter.

WRAP_BOTTOM

public static final byte WRAP_BOTTOM
Index of the bottom wrap distance parameter.

NO_WRAP

public static final byte NO_WRAP
No text wrapping around the frame.

ALLOW_WRAP

public static final byte ALLOW_WRAP
Allow text wrapping (gaps around the frame are specified in this case).

OVERLAY

public static final byte OVERLAY
Text flows underneath frame.

CAP_NONE

public static final byte CAP_NONE
No drop cap (default).

CAP_INTEXT

public static final byte CAP_INTEXT
In-text drop cap.

CAP_MARGIN

public static final byte CAP_MARGIN
Margin drop cap.
Constructor Detail

Position

public Position()
Method Detail

setHorizontalPosition

public final void setHorizontalPosition(int index,
                                        int value)
Set a value for the horizontal position parameter of the specified index.
Parameters:
index - an index of the parameter to be set (FRAME_SIZE, FRAME_REFERENCE, FRAME_POSITION, or FRAME_DISTANCE)
value - a value to set. For FRAME_SIZE, it is a frame width in twips. For FRAME_REFERENCE, the value REF_COLUMN, REF_PAGE, or REF_MARGIN is allowed. For FRAME_POSITION, the value LEFT, RIGHT, CENTER, INSIDE, or OUTSIDE is allowed. The FRAME_DISTANCE parameter makes sence for the LEFT positioning only. It is a distance in twips from the left edge of the reference frame.

getHorizontalPosition

public final int getHorizontalPosition(int index)
Return the value of the horizontal position parameter of the specified index.

setVerticalPosition

public final void setVerticalPosition(int index,
                                      int value)
Set a value for the vertical position parameter of the specified index.
Parameters:
index - an index of the parameter to be set (FRAME_SIZE, FRAME_REFERENCE, FRAME_POSITION, or FRAME_DISTANCE)
value - a value to set. For FRAME_SIZE, it is a frame height in twips. A positive value indicates the minimum height of the frame and a negative number indicates the exact height of the frame. For FRAME_REFERENCE, the value REF_PAR, REF_PAGE, or REF_MARGIN is allowed. For FRAME_POSITION, the value TOP, BOTTOM, CENTER, INSIDE, OUTSIDE, or INLINE is allowed. The FRAME_DISTANCE parameter makes sence for the TOP positioning only. It is a distance in twips from the top edge of the reference frame.

getVerticalPosition

public final int getVerticalPosition(int index)
Return the value of the vertical position parameter of the specified index.

setWrapping

public final void setWrapping(int index,
                              int value)
Set a value for the text wrapping parameter of the specified index.
Parameters:
index - an index of the parameter to be set (WRAP_TYPE, WRAP_LEFT, WRAP_RIGHT, WRAP_TOP, or WRAP_BOTTOM)
value - a value to set. For WRAP_TYPE, the value NO_WRAP, ALLOW_WRAP, or OVERLAY is allowed. Setting of other wrap parameters automatically selects the ALLOW_WRAP type. They specify the distance of the wrapped text from the corresponding side of the frame.

getWrapping

public final int getWrapping(int index)
Return the value of the text wrapping parameter of the specified index.

setDropCapType

public final void setDropCapType(int value)
Set a type of the drop cap. Allowed values are CAP_NONE (default), CAP_INTEXT, and CAP_MARGIN.

getDropCapType

public final int getDropCapType()
Return the drop cap type.

setDropCapLines

public final void setDropCapLines(int value)
Set a number of lines drop cap is to occupy. The range is 1 through 10.

getDropCapLines

public final int getDropCapLines()
Return the number of lines drop cap is to occupy.

setLockAnchor

public final void setLockAnchor(boolean value)
Set a value of the lock anchor. If true, the frame anchor is locked to the current paragraph that it is associated with.

hasLockAnchor

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

setOverlap

public final void setOverlap(boolean value)
Set a value for the overlap flag. If true, the overlapping with other frames or objects with similar wrapping is allowed.

allowsOverlap

public final boolean allowsOverlap()
Return true if overlapping is allowed.

clone

public java.lang.Object clone()
Creates a deep copy of this object.
Overrides:
clone in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Compare this frame with another frame and return true if frames coinside.
Overrides:
equals in class java.lang.Object

exportTo

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