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

java.lang.Object
  |
  +--ru.novosoft.dc.core.util.Values
        |
        +--ru.novosoft.dc.rtf.dom.objects.Layout

public final class Layout
extends Values

The page layout consists of 7 layout parameters measured in twips and two boolean flags controlling the mirror margin mode and landscape mode. The defaults for layout parameters are set in compliance with the RTF Specification 1.6.


Field Summary
static byte BOTTOM_MARGIN
          Index of the bottom margin.
static byte GUTTER_WIDTH
          Index of the gutter width.
static byte LEFT_MARGIN
          Index of the left margin.
static byte PAGE_HEIGHT
          Index of the paper height.
static byte PAGE_WIDTH
          Index of the page width.
static byte RIGHT_MARGIN
          Index of the right margin.
static byte TOP_MARGIN
          Index of the top margin.
 
Constructor Summary
Layout(boolean oldMargins)
          Constructor.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compare this set of layout parameters with another set and return true if the sets coinside.
 void exportTo(org.w3c.dom.Element elem)
          Export the contents of this object to the specified DOM element.
 boolean hasLandscapeMode()
          Return true if the landscape mode is turned on.
 boolean hasMirrorMargins()
          Return true if the mirror margin mode is turned on.
 void landscapeMode()
          Turn the landscape mode on.
 void mirrorMargins()
          Turn the mirror margin mode on.
 int textHeight(int gutterStyle)
          Calculate the height of text area in the page.
 int textWidth(int gutterStyle)
          Calculate the width of text area in the page.
 
Methods inherited from class ru.novosoft.dc.core.util.Values
add, clone, get, mul, set, size, values
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PAGE_WIDTH

public static final byte PAGE_WIDTH
Index of the page width.

PAGE_HEIGHT

public static final byte PAGE_HEIGHT
Index of the paper height.

LEFT_MARGIN

public static final byte LEFT_MARGIN
Index of the left margin.

RIGHT_MARGIN

public static final byte RIGHT_MARGIN
Index of the right margin.

TOP_MARGIN

public static final byte TOP_MARGIN
Index of the top margin.

BOTTOM_MARGIN

public static final byte BOTTOM_MARGIN
Index of the bottom margin.

GUTTER_WIDTH

public static final byte GUTTER_WIDTH
Index of the gutter width.
Constructor Detail

Layout

public Layout(boolean oldMargins)
Constructor. If oldMargins==true, the old values of margins are used while construction the layout.
Method Detail

landscapeMode

public final void landscapeMode()
Turn the landscape mode on.

mirrorMargins

public final void mirrorMargins()
Turn the mirror margin mode on.

hasLandscapeMode

public final boolean hasLandscapeMode()
Return true if the landscape mode is turned on.

hasMirrorMargins

public final boolean hasMirrorMargins()
Return true if the mirror margin mode is turned on.

textWidth

public final int textWidth(int gutterStyle)
Calculate the width of text area in the page.
Parameters:
gutterStyle - a style of gutter: 0 - left, 1 - right, (-1) - parallel (top).

textHeight

public final int textHeight(int gutterStyle)
Calculate the height of text area in the page.
Parameters:
gutterStyle - a style of gutter: 0 - left, 1 - right, (-1) - parallel (top).

equals

public boolean equals(java.lang.Object obj)
Compare this set of layout parameters with another set and return true if the sets coinside.
Overrides:
equals in class Values

exportTo

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