org.jfor.jfor.rtflib.rtfdoc
Class RtfParagraph

java.lang.Object
  extended by org.jfor.jfor.rtflib.rtfdoc.RtfElement
      extended by org.jfor.jfor.rtflib.rtfdoc.RtfContainer
          extended by org.jfor.jfor.rtflib.rtfdoc.RtfBookmarkContainerImpl
              extended by org.jfor.jfor.rtflib.rtfdoc.RtfParagraph
All Implemented Interfaces:
IRtfBookmarkContainer, IRtfExternalGraphicContainer, IRtfHyperLinkContainer, IRtfPageBreakContainer, IRtfPageNumberCitationContainer, IRtfPageNumberContainer, IRtfTextContainer

public class RtfParagraph
extends RtfBookmarkContainerImpl
implements IRtfTextContainer, IRtfPageBreakContainer, IRtfHyperLinkContainer, IRtfExternalGraphicContainer, IRtfPageNumberContainer, IRtfPageNumberCitationContainer

Model of an RTF paragraph, which can contain RTF text elements.

Author:
Bertrand Delacretaz bdelacretaz@codeconsult.ch, Andreas Putz a.putz@skynamics.com

Field Summary
 
Fields inherited from class org.jfor.jfor.rtflib.rtfdoc.RtfBookmarkContainerImpl
mBookmark
 
Fields inherited from class org.jfor.jfor.rtflib.rtfdoc.RtfElement
m_attrib, m_parent, m_writer
 
Constructor Summary
RtfParagraph(IRtfParagraphContainer parent, java.io.Writer w)
          Create an RTF paragraph as a child of given container with default attributes
RtfParagraph(IRtfParagraphContainer parent, java.io.Writer w, RtfAttributes attr)
          Create an RTF paragraph as a child of given container with given attributes
 
Method Summary
 java.lang.String getText()
           
 RtfAttributes getTextAttributes()
          get the attributes of our text
 RtfAttributes getTextContainerAttributes()
          IRtfTextContainer requirement: return a copy of our attributes
 RtfHyperLink newHyperLink(java.lang.String str, RtfAttributes attr)
          Creates a new hyperlink.
 RtfExternalGraphic newImage()
          start a new external graphic after closing all other elements
 void newLineBreak()
          add a line break
 void newPageBreak()
          add a page break
 RtfPageNumber newPageNumber()
           
 RtfPageNumberCitation newPageNumberCitation(java.lang.String id)
          Added by Boris POUDEROUS on 2002/07/09
 RtfText newText(java.lang.String str)
          close current text run if any and start a new one with default attributes
 RtfText newText(java.lang.String str, RtfAttributes attr)
          close current text run if any and start a new one
protected  boolean okToWriteRtf()
          depending on RtfOptions, do not emit any RTF for empty paragraphs
 void setKeepn()
          Set the keepn attribute for this paragraph
 void setResetProperties()
          Force reset properties
protected  void writeRtfPrefix()
          overridden to write our attributes before our content
protected  void writeRtfSuffix()
          overridden to close paragraph
 
Methods inherited from class org.jfor.jfor.rtflib.rtfdoc.RtfBookmarkContainerImpl
newBookmark
 
Methods inherited from class org.jfor.jfor.rtflib.rtfdoc.RtfContainer
addChild, containsText, dump, getChildCount, getChildren, getOptions, isEmpty, setChildren, setOptions, toString, writeRtfContent
 
Methods inherited from class org.jfor.jfor.rtflib.rtfdoc.RtfElement
close, getParentOfClass, getRtfAttributes, getRtfFile, isClosed, writeAttributes, writeControlWord, writeControlWordNS, writeExceptionInRtf, writeGroupMark, writeOneAttribute, writeOneAttributeNS, writeRtf, writeStarControlWord, writeStarControlWordNS
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RtfParagraph

RtfParagraph(IRtfParagraphContainer parent,
             java.io.Writer w)
       throws java.io.IOException
Create an RTF paragraph as a child of given container with default attributes

Throws:
java.io.IOException

RtfParagraph

RtfParagraph(IRtfParagraphContainer parent,
             java.io.Writer w,
             RtfAttributes attr)
       throws java.io.IOException
Create an RTF paragraph as a child of given container with given attributes

Throws:
java.io.IOException
Method Detail

getText

public java.lang.String getText()

setKeepn

public void setKeepn()
Set the keepn attribute for this paragraph


setResetProperties

public void setResetProperties()
Force reset properties


getTextContainerAttributes

public RtfAttributes getTextContainerAttributes()
IRtfTextContainer requirement: return a copy of our attributes

Specified by:
getTextContainerAttributes in interface IRtfTextContainer

writeRtfPrefix

protected void writeRtfPrefix()
                       throws java.io.IOException
overridden to write our attributes before our content

Overrides:
writeRtfPrefix in class RtfElement
Throws:
java.io.IOException

writeRtfSuffix

protected void writeRtfSuffix()
                       throws java.io.IOException
overridden to close paragraph

Overrides:
writeRtfSuffix in class RtfElement
Throws:
java.io.IOException

newText

public RtfText newText(java.lang.String str)
                throws java.io.IOException
close current text run if any and start a new one with default attributes

Specified by:
newText in interface IRtfTextContainer
Parameters:
str - if not null, added to the RtfText created
Throws:
java.io.IOException

newText

public RtfText newText(java.lang.String str,
                       RtfAttributes attr)
                throws java.io.IOException
close current text run if any and start a new one

Specified by:
newText in interface IRtfTextContainer
Parameters:
str - if not null, added to the RtfText created
Throws:
java.io.IOException

newPageBreak

public void newPageBreak()
                  throws java.io.IOException
add a page break

Specified by:
newPageBreak in interface IRtfPageBreakContainer
Throws:
java.io.IOException

newLineBreak

public void newLineBreak()
                  throws java.io.IOException
add a line break

Specified by:
newLineBreak in interface IRtfTextContainer
Throws:
java.io.IOException

newPageNumber

public RtfPageNumber newPageNumber()
                            throws java.io.IOException
Specified by:
newPageNumber in interface IRtfPageNumberContainer
Throws:
java.io.IOException

newPageNumberCitation

public RtfPageNumberCitation newPageNumberCitation(java.lang.String id)
                                            throws java.io.IOException
Added by Boris POUDEROUS on 2002/07/09

Specified by:
newPageNumberCitation in interface IRtfPageNumberCitationContainer
Throws:
java.io.IOException

newHyperLink

public RtfHyperLink newHyperLink(java.lang.String str,
                                 RtfAttributes attr)
                          throws java.io.IOException
Creates a new hyperlink.

Specified by:
newHyperLink in interface IRtfHyperLinkContainer
Throws:
java.io.IOException - on error

newImage

public RtfExternalGraphic newImage()
                            throws java.io.IOException
start a new external graphic after closing all other elements

Specified by:
newImage in interface IRtfExternalGraphicContainer
Throws:
java.io.IOException - On error

okToWriteRtf

protected boolean okToWriteRtf()
depending on RtfOptions, do not emit any RTF for empty paragraphs

Overrides:
okToWriteRtf in class RtfContainer

getTextAttributes

public RtfAttributes getTextAttributes()
get the attributes of our text