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

## Class RtfHyperLink

- 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.RtfHyperLink

- All Implemented Interfaces:
    IRtfTextContainer, IRtfTextrunContainer

      public class RtfHyperLink
      extends RtfContainer
      implements IRtfTextContainer, IRtfTextrunContainer

  Creates an hyperlink. This class belongs to the fo:basic-link tag processing. This work was originally authored by Andreas Putz

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected RtfText` | `mText` RtfText
    `protected String` | `url` The url of the image

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

      `attrib, parent, writer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RtfHyperLink(IRtfTextContainer parent, Writer writer, String str, RtfAttributes attr)` A constructor.
    `RtfHyperLink(RtfTextrun parent, Writer writer, RtfAttributes attr)` A constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `RtfAttributes` | `getTextContainerAttributes()` IRtfTextContainer requirement:
    `RtfTextrun` | `getTextrun()` Returns the current RtfTextrun object.
    `boolean` | `isEmpty()`
    `void` | `newLineBreak()` add a line break
    `RtfText` | `newText(String str)` close current text run if any and start a new one with default attributes
    `RtfText` | `newText(String str, RtfAttributes attr)` close current text run if any and start a new one
    `void` | `setExternalURL(String url)` Sets the url of the external link.
    `void` | `setInternalURL(String jumpTo)` Sets the url of the external link.
    `void` | `writeRtfPrefix()` Writes the RTF content to m_writer.
    `void` | `writeRtfSuffix()` Writes the RTF content to m_writer.

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

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

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

      `close, getParentOfClass, getRtfAttributes, newLine, 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`

- - ### Field Detail

    - #### url

          protected String url

      The url of the image

    - #### mText

          protected RtfText mText

      RtfText

  - ### Constructor Detail

    - #### RtfHyperLink

          public RtfHyperLink(IRtfTextContainer parent,
                              Writer writer,
                              String str,
                              RtfAttributes attr)
                       throws IOException

      A constructor.
      Parameters:
        `parent` - a `RtfContainer` value
        `writer` - a `Writer` value
        `str` - text of the link
        `attr` - a `RtfAttributes` value
      Throws:
        `IOException` - for I/O problems

    - #### RtfHyperLink

          public RtfHyperLink(RtfTextrun parent,
                              Writer writer,
                              RtfAttributes attr)
                       throws IOException

      A constructor.
      Parameters:
        `parent` - a `RtfContainer` value
        `writer` - a `Writer` value
        `attr` - a `RtfAttributes` value
      Throws:
        `IOException` - for I/O problems

  - ### Method Detail

    - #### writeRtfPrefix

          public void writeRtfPrefix()
                              throws IOException

      Writes the RTF content to m_writer.
      Overrides:
        `writeRtfPrefix` in class `RtfElement`
      Throws:
        `IOException` - On error

    - #### writeRtfSuffix

          public void writeRtfSuffix()
                              throws IOException

      Writes the RTF content to m_writer.
      Overrides:
        `writeRtfSuffix` in class `RtfElement`
      Throws:
        `IOException` - On error

    - #### 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:
        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 text to add
      Returns:
        the new RtfText object
      Throws:
        `IOException` - for I/O problems

    - #### getTextContainerAttributes

          public RtfAttributes getTextContainerAttributes()
                                                   throws FOPException

      IRtfTextContainer requirement:
      Specified by:
        `getTextContainerAttributes` in interface `IRtfTextContainer`
      Returns:
        a copy of our attributes
      Throws:
        `FOPException` - if attributes cannot be cloned

    - #### newLineBreak

          public void newLineBreak()
                            throws IOException

      add a line break
      Specified by:
        `newLineBreak` in interface `IRtfTextContainer`
      Throws:
        `IOException` - for I/O problems

    - #### setExternalURL

          public void setExternalURL(String url)

      Sets the url of the external link.
      Parameters:
        `url` - Link url like "http://..."

    - #### setInternalURL

          public void setInternalURL(String jumpTo)

      Sets the url of the external link.
      Parameters:
        `jumpTo` - Name of the text mark

    - #### isEmpty

          public boolean isEmpty()

      Overrides:
        `isEmpty` in class `RtfContainer`
      Returns:
        false (always)

    - #### getTextrun

          public RtfTextrun getTextrun()
                                throws IOException

      Description copied from interface: `IRtfTextrunContainer`
      Returns the current RtfTextrun object. Opens a new one if necessary.
      Specified by:
        `getTextrun` in interface `IRtfTextrunContainer`
      Returns:
        a text run
      Throws:
        `IOException` - if not caught

Copyright © 2025 Apache Software Foundation. All rights reserved.