ru.novosoft.dc.rtf.dom
Class RTFSection

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

public class RTFSection
extends java.lang.Object

A section of the RTF DOM. It contains a section context and a number of flows: up to 8 header and footer flows and the section flow. Headers and footers are stored in the internal array and are accessed by their indices. The use of header and footers depends on the document "two side" mode and the section "title page" mode:

A section context cannot be shared between many sections. It is bound with an only section.


Field Summary
static byte ANY_FOOTER
          Index of the footer of other pages of the section (in one side mode).
static byte ANY_HEADER
          Index of the header of other pages of the section (in one side mode).
static byte FIRST_FOOTER
          Index of the footer on the first page of the section (in title page mode).
static byte FIRST_HEADER
          Index of the header on the first page of the section (in title page mode).
static byte LEFT_FOOTER
          Index of the footer of left pages of the section (in two side mode).
static byte LEFT_HEADER
          Index of the header of left pages of the section (in two side mode).
static byte RIGHT_FOOTER
          Index of the footer of right pages of the section (in two side mode).
static byte RIGHT_HEADER
          Index of the header of right pages of the section (in two side mode).
 
Constructor Summary
RTFSection(SectionContext context)
          Construct a new section with an empty flow and binds the context with the newly created section.
 
Method Summary
 void bindWithContext(SectionContext context)
          Bind this section with a context and establish two-side links between them.
 RTFFlow content()
          Return the section content.
 SectionContext context()
          Return the section context.
 void exportTo(org.w3c.dom.Element elem)
          Export the contents of this object to the specified DOM element.
 RTFFlow getHeaderOrFooter(int index)
          Return the flow of header or footer of the specified index.
 int getPageNumber()
          Return a starting page number.
 boolean hasRestartPageNumber()
          Return true if the section must restart with the specified page number.
 void setHeaderOrFooter(int index, RTFFlow value)
          Set a header or footer of the specified index.
 void setHeadersAndFootersAs(RTFSection section)
          Set headers and footers of this section as headers and footers of the specified section.
 void setPageNumber(int value)
          Set a page number for the first page in the section.
 void setRestartPageNumber(boolean value)
          Set a value of the restart page number flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIRST_HEADER

public static final byte FIRST_HEADER
Index of the header on the first page of the section (in title page mode).

FIRST_FOOTER

public static final byte FIRST_FOOTER
Index of the footer on the first page of the section (in title page mode).

ANY_HEADER

public static final byte ANY_HEADER
Index of the header of other pages of the section (in one side mode).

ANY_FOOTER

public static final byte ANY_FOOTER
Index of the footer of other pages of the section (in one side mode).

LEFT_HEADER

public static final byte LEFT_HEADER
Index of the header of left pages of the section (in two side mode).

LEFT_FOOTER

public static final byte LEFT_FOOTER
Index of the footer of left pages of the section (in two side mode).

RIGHT_HEADER

public static final byte RIGHT_HEADER
Index of the header of right pages of the section (in two side mode).

RIGHT_FOOTER

public static final byte RIGHT_FOOTER
Index of the footer of right pages of the section (in two side mode).
Constructor Detail

RTFSection

public RTFSection(SectionContext context)
Construct a new section with an empty flow and binds the context with the newly created section.
Method Detail

bindWithContext

public final void bindWithContext(SectionContext context)
Bind this section with a context and establish two-side links between them.

context

public final SectionContext context()
Return the section context.

setPageNumber

public final void setPageNumber(int value)
Set a page number for the first page in the section.

getPageNumber

public final int getPageNumber()
Return a starting page number.

setRestartPageNumber

public final void setRestartPageNumber(boolean value)
Set a value of the restart page number flag.

hasRestartPageNumber

public final boolean hasRestartPageNumber()
Return true if the section must restart with the specified page number.

setHeaderOrFooter

public final void setHeaderOrFooter(int index,
                                    RTFFlow value)
Set a header or footer of the specified index. A header or footer consists of an RTFFlow object.

getHeaderOrFooter

public final RTFFlow getHeaderOrFooter(int index)
Return the flow of header or footer of the specified index.

setHeadersAndFootersAs

public final void setHeadersAndFootersAs(RTFSection section)
Set headers and footers of this section as headers and footers of the specified section. Only references on flows are copied.

content

public final RTFFlow content()
Return the section content.

exportTo

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