Class RtfParagraph

All Implemented Interfaces:
IRtfBookmarkContainer, IRtfExternalGraphicContainer, IRtfHyperLinkContainer, IRtfPageBreakContainer, IRtfPageNumberCitationContainer, IRtfPageNumberContainer, IRtfTextContainer
Direct Known Subclasses:
RtfListItem.RtfListItemParagraph

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

This work was authored by Bertrand Delacretaz (bdelacretaz@codeconsult.ch), Andreas Putz (a.putz@skynamics.com), and Boris Poudérous (boris.pouderous@free.fr).

  • Field Details

    • text

      private RtfText text
    • externalGraphic

      private RtfExternalGraphic externalGraphic
    • pageNumber

      private RtfPageNumber pageNumber
    • pageNumberCitation

      private RtfPageNumberCitation pageNumberCitation
    • keepn

      private boolean keepn
    • resetProperties

      private boolean resetProperties
    • writeForBreak

      private boolean writeForBreak
    • PARA_ATTRIBUTES

      private static final String[] PARA_ATTRIBUTES
      Set of attributes that must be copied at the start of a paragraph
  • Constructor Details

  • Method Details

    • getText

      public String getText()
      Accessor for the paragraph text
      Returns:
      the paragraph text
    • setKeepn

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

      public void setResetProperties()
      Force reset properties
    • getTextContainerAttributes

      public RtfAttributes getTextContainerAttributes() throws FOPException
      IRtfTextContainer requirement: return a copy of our attributes
      Specified by:
      getTextContainerAttributes in interface IRtfTextContainer
      Returns:
      a copy of this paragraphs attributes
      Throws:
      FOPException - if attributes cannot be cloned
    • writeRtfPrefix

      protected void writeRtfPrefix() throws IOException
      Overridden to write our attributes before our content
      Overrides:
      writeRtfPrefix in class RtfElement
      Throws:
      IOException - for I/O problems
    • writeRtfSuffix

      protected void writeRtfSuffix() throws IOException
      Overridden to close paragraph
      Overrides:
      writeRtfSuffix in class RtfElement
      Throws:
      IOException - for I/O problems
    • newText

      public RtfText newText(String str) throws 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
      Returns:
      the new RtfText object
      Throws:
      IOException - for I/O problems
    • newText

      public RtfText newText(String str, RtfAttributes attr) throws 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
      attr - attributes of the text
      Returns:
      the new RtfText object
      Throws:
      IOException - for I/O problems
    • newPageBreak

      public void newPageBreak() throws IOException
      add a page break
      Specified by:
      newPageBreak in interface IRtfPageBreakContainer
      Throws:
      IOException - for I/O problems
    • newLineBreak

      public void newLineBreak() throws IOException
      add a line break
      Specified by:
      newLineBreak in interface IRtfTextContainer
      Throws:
      IOException - for I/O problems
    • newPageNumber

      public RtfPageNumber newPageNumber() throws IOException
      Add a page number
      Specified by:
      newPageNumber in interface IRtfPageNumberContainer
      Returns:
      new RtfPageNumber object
      Throws:
      IOException - for I/O problems
    • newPageNumberCitation

      public RtfPageNumberCitation newPageNumberCitation(String id) throws IOException
      Added by Boris POUDEROUS on 2002/07/09
      Specified by:
      newPageNumberCitation in interface IRtfPageNumberCitationContainer
      Parameters:
      id - string containing the citation text
      Returns:
      the new RtfPageNumberCitation object
      Throws:
      IOException - for I/O problems
    • newHyperLink

      public RtfHyperLink newHyperLink(String str, RtfAttributes attr) throws IOException
      Creates a new hyperlink.
      Specified by:
      newHyperLink in interface IRtfHyperLinkContainer
      Parameters:
      str - string containing the hyperlink text
      attr - attributes of new hyperlink
      Returns:
      the new RtfHyperLink object
      Throws:
      IOException - for I/O problems
    • newImage

      public RtfExternalGraphic newImage() throws IOException
      Start a new external graphic after closing all other elements
      Specified by:
      newImage in interface IRtfExternalGraphicContainer
      Returns:
      the new RtfExternalGraphic
      Throws:
      IOException - for I/O problems
    • closeCurrentText

      private void closeCurrentText() throws IOException
      Throws:
      IOException
    • closeCurrentHyperLink

      private void closeCurrentHyperLink() throws IOException
      Throws:
      IOException
    • closeAll

      private void closeAll() throws IOException
      Throws:
      IOException
    • okToWriteRtf

      protected boolean okToWriteRtf()
      Depending on RtfOptions, do not emit any RTF for empty paragraphs
      Overrides:
      okToWriteRtf in class RtfContainer
      Returns:
      true if RTF should be written
    • mustWriteAttributes

      private boolean mustWriteAttributes()
      true if we must write our own (non-text) attributes in the RTF
    • mustWriteGroupMark

      private boolean mustWriteGroupMark()
      true if we must write a group mark around this paragraph TODO is this correct, study interaction with mustWriteAttributes() invalid input: '<'-- On implementation i have noticed if the groupmark set, the format attributes are only for this content, i think this implementation is ok
    • getTextAttributes

      public RtfAttributes getTextAttributes()
      accessor for text attributes
      Returns:
      attributes of the text