org.apache.fop.render.rtf.rtflib.rtfdoc

## Class RtfTextrun

- java.lang.Object
- - org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement
  - - org.apache.fop.render.rtf.rtflib.rtfdoc.RtfContainer
    - - org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTextrun

Direct Known Subclasses:
  RtfListItem.RtfListItemLabel

    public class RtfTextrun
    extends RtfContainer

Class which contains a linear text run. It has methods to add attributes, text, paragraph breaks....

This work was authored by Peter Herweg (pherweg@web.de).

### Field Summary

Fields
`static int` `BREAK_COLUMN` Constant for a column break
`static int` `BREAK_EVEN_PAGE` Constant for a even page break
`static int` `BREAK_NONE` Constant for no page break
`static int` `BREAK_ODD_PAGE` Constant for a odd page break
`static int` `BREAK_PAGE` Constant for a normal page break
`protected static org.apache.commons.logging.Log` `log` logging instance

### Fields inherited from class org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement

`attrib, parent, writer`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `addBookmark(String id)` Inserts a bookmark.
`RtfFootnote` `addFootnote()` Inserts a footnote.
`RtfHyperLink` `addHyperlink(RtfAttributes attr)` Inserts a hyperlink.
`void` `addLeader(RtfAttributes attrs)` Inserts a leader.
`void` `addPageNumber(RtfAttributes attr)` Inserts a page number.
`void` `addPageNumberCitation(String refId)` Inserts a page number citation.
`RtfParagraphBreak` `addParagraphBreak()` Inserts paragraph break before all close group marks.
`void` `addString(String s)` Add string to children list.
`RtfListItem` `getRtfListItem()` Gets the parent list-item of the textrun.
`static RtfTextrun` `getTextrun(RtfContainer container, Writer writer, RtfAttributes attrs)` Adds a new RtfTextrun to the given container if necessary, and returns it.
`RtfExternalGraphic` `newImage()` Inserts an image.
`void` `popBlockAttributes(int breakType)` Pops block attributes, notifies all opened blocks about pushing block attributes, adds `CloseGroupMark` as a child.
`void` `popInlineAttributes()` Pop inline attributes.
`void` `pushBlockAttributes(RtfAttributes attrs)` Pushes block attributes, notifies all opened blocks about pushing block attributes, adds `OpenGroupMark` as a child.
`void` `pushInlineAttributes(RtfAttributes attrs)` Pushes inline attributes.
`void` `setRtfListItem(RtfListItem listItem)` Set the parent list-item of the textrun.
`void` `setSuppressLastPar(boolean bSuppress)` specify, if the last paragraph control word (\par) should be suppressed.
`protected void` `writeRtfContent()` write RTF code of all our children

### Methods inherited from class org.apache.fop.render.rtf.rtflib.rtfdoc.RtfContainer

`addChild, findChildren, getChildCount, getChildren, isEmpty, okToWriteRtf, setChildren, setOptions, toString`

### Methods inherited from class org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement

`close, getParentOfClass, getRtfAttributes, newLine, writeAttributes, writeControlWord, writeControlWordNS, writeExceptionInRtf, writeGroupMark, writeOneAttribute, writeOneAttributeNS, writeRtf, writeRtfPrefix, writeRtfSuffix, writeStarControlWord, writeStarControlWordNS`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### BREAK_NONE

    public static final int BREAK_NONE

Constant for no page break

See Also:
  Constant Field Values

#### BREAK_PAGE

    public static final int BREAK_PAGE

Constant for a normal page break

See Also:
  Constant Field Values

#### BREAK_COLUMN

    public static final int BREAK_COLUMN

Constant for a column break

See Also:
  Constant Field Values

#### BREAK_EVEN_PAGE

    public static final int BREAK_EVEN_PAGE

Constant for a even page break

See Also:
  Constant Field Values

#### BREAK_ODD_PAGE

    public static final int BREAK_ODD_PAGE

Constant for a odd page break

See Also:
  Constant Field Values

#### log

    protected static final org.apache.commons.logging.Log log

logging instance

### Method Detail

#### pushBlockAttributes

    public void pushBlockAttributes(RtfAttributes attrs)
                             throws IOException

Pushes block attributes, notifies all opened blocks about pushing block attributes, adds `OpenGroupMark` as a child.

Parameters:
  `attrs` - the block attributes to push
Throws:
  `IOException` - for I/O problems

#### popBlockAttributes

    public void popBlockAttributes(int breakType)
                            throws IOException

Pops block attributes, notifies all opened blocks about pushing block attributes, adds `CloseGroupMark` as a child.

Parameters:
  `breakType` - the break type
Throws:
  `IOException` - for I/O problems

#### pushInlineAttributes

    public void pushInlineAttributes(RtfAttributes attrs)
                              throws IOException

Pushes inline attributes.

Parameters:
  `attrs` - the inline attributes to push
Throws:
  `IOException` - for I/O problems

#### addPageNumberCitation

    public void addPageNumberCitation(String refId)
                               throws IOException

Inserts a page number citation.

Parameters:
  `refId` - the identifier being referenced
Throws:
  `IOException` - for I/O problems

#### popInlineAttributes

    public void popInlineAttributes()
                             throws IOException

Pop inline attributes.

Throws:
  `IOException` - for I/O problems

#### addString

    public void addString(String s)
                   throws IOException

Add string to children list.

Parameters:
  `s` - string to add
Throws:
  `IOException` - for I/O problems

#### addFootnote

    public RtfFootnote addFootnote()
                            throws IOException

Inserts a footnote.

Returns:
  inserted footnote
Throws:
  `IOException` - for I/O problems

#### addParagraphBreak

    public RtfParagraphBreak addParagraphBreak()
                                        throws IOException

Inserts paragraph break before all close group marks.

Returns:
  The paragraph break element
Throws:
  `IOException` - for I/O problems

#### addLeader

    public void addLeader(RtfAttributes attrs)
                   throws IOException

Inserts a leader.

Parameters:
  `attrs` - Attributes for the leader
Throws:
  `IOException` - for I/O problems

#### addPageNumber

    public void addPageNumber(RtfAttributes attr)
                       throws IOException

Inserts a page number.

Parameters:
  `attr` - Attributes for the page number to insert.
Throws:
  `IOException` - for I/O problems

#### addHyperlink

    public RtfHyperLink addHyperlink(RtfAttributes attr)
                              throws IOException

Inserts a hyperlink.

Parameters:
  `attr` - Attributes for the hyperlink to insert.
Returns:
  inserted hyperlink
Throws:
  `IOException` - for I/O problems

#### addBookmark

    public void addBookmark(String id)
                     throws IOException

Inserts a bookmark.

Parameters:
  `id` - Id for the inserted bookmark
Throws:
  `IOException` - for I/O problems

#### newImage

    public RtfExternalGraphic newImage()
                                throws IOException

Inserts an image.

Returns:
  inserted image
Throws:
  `IOException` - for I/O problems

#### getTextrun

    public static RtfTextrun getTextrun(RtfContainer container,
                                        Writer writer,
                                        RtfAttributes attrs)
                                 throws IOException

Adds a new RtfTextrun to the given container if necessary, and returns it.

Parameters:
  `container` - RtfContainer, which is the parent of the returned RtfTextrun
  `writer` - Writer of the given RtfContainer
  `attrs` - RtfAttributes which are to write at the beginning of the RtfTextrun
Returns:
  new or existing RtfTextrun object.
Throws:
  `IOException` - for I/O problems

#### setSuppressLastPar

    public void setSuppressLastPar(boolean bSuppress)

specify, if the last paragraph control word (\par) should be suppressed.

Parameters:
  `bSuppress` - true, if the last \par should be suppressed

#### writeRtfContent

    protected void writeRtfContent()
                            throws IOException

write RTF code of all our children

Overrides:
  `writeRtfContent` in class `RtfContainer`
Throws:
  `IOException` - for I/O problems

#### setRtfListItem

    public void setRtfListItem(RtfListItem listItem)

Set the parent list-item of the textrun.

Parameters:
  `listItem` - parent list-item of the textrun

#### getRtfListItem

    public RtfListItem getRtfListItem()

Gets the parent list-item of the textrun.

Returns:
  parent list-item of the textrun