Class RtfDestinationColorTable


  • public class RtfDestinationColorTable
    extends RtfDestination
    RtfDestinationColorTable handles data destined for the color table destination
    Since:
    2.0.8
    • Field Detail

      • importHeader

        private RtfImportMgr importHeader
        The RtfImportHeader to add color mappings to.
      • colorNr

        private int colorNr
        The number of the current color being parsed.
      • red

        private int red
        The red component of the current color being parsed.
      • green

        private int green
        The green component of the current color being parsed.
      • blue

        private int blue
        The blue component of the current color being parsed.
      • ctint

        private int ctint
        Specifies the tint when specifying a theme color. RTF control word ctint 0 - 255: 0 = full tint(white), 255 = no tint. Default value: 255 If tint is specified and is less than 255, cshade must equal 255. ctint/cshade are mutually exclusive
        See Also:
        cshade, themeColor
      • cshade

        private int cshade
        Specifies the shade when specifying a theme color. RTF control word cshade 0 - 255: 0 = full shade(black), 255 = no shade. Default value: 255 If shade is specified and is less than 255, ctint must equal 255. cshade/ctint are mutually exclusive
        See Also:
        ctint, themeColor
      • colorMap

        private java.util.Map<java.lang.String,​java.awt.Color> colorMap
        Color map object for conversions
    • Constructor Detail

      • RtfDestinationColorTable

        public RtfDestinationColorTable()
        Constructor.
      • RtfDestinationColorTable

        public RtfDestinationColorTable​(RtfParser parser)
        Constructs a new RtfColorTableParser.
        Parameters:
        parser - an RtfParser
    • Method Detail

      • setParser

        public void setParser​(RtfParser parser)
        Description copied from class: RtfDestination
        Set the parser to use with the RtfDestination object.
        Overrides:
        setParser in class RtfDestination
        Parameters:
        parser - The RtfParser object.
      • handleOpeningSubGroup

        public boolean handleOpeningSubGroup()
        Description copied from class: RtfDestination
        Handle a new subgroup contained within this group
        Specified by:
        handleOpeningSubGroup in class RtfDestination
        Returns:
        true if handled, false if not handled
      • closeDestination

        public boolean closeDestination()
        Description copied from class: RtfDestination
        Clean up when destination is closed.
        Specified by:
        closeDestination in class RtfDestination
        Returns:
        true if handled, false if not handled
      • handleCloseGroup

        public boolean handleCloseGroup()
        Description copied from class: RtfDestination
        Clean up when group is closed.
        Specified by:
        handleCloseGroup in class RtfDestination
        Returns:
        true if handled, false if not handled
      • handleOpenGroup

        public boolean handleOpenGroup()
        Description copied from class: RtfDestination
        Setup when group is opened.
        Specified by:
        handleOpenGroup in class RtfDestination
        Returns:
        true if handled, false if not handled
      • handleCharacter

        public boolean handleCharacter​(int ch)
        Description copied from class: RtfDestination
        Handle text for this destination
        Specified by:
        handleCharacter in class RtfDestination
        Returns:
        true if handled, false if not handled
      • handleControlWord

        public boolean handleControlWord​(RtfCtrlWordData ctrlWordData)
        Description copied from class: RtfDestination
        Handle control word for this destination
        Specified by:
        handleControlWord in class RtfDestination
        Parameters:
        ctrlWordData - The control word and parameter information object
        Returns:
        true if handled, false if not handled
      • processColor

        private void processColor()
        Processes the color triplet parsed from the document. Add it to the import mapping so colors can be mapped when encountered in the RTF import or conversion.
      • setRed

        private void setRed​(int value)
        Set the red color to value.
        Parameters:
        value - Value to set red to.
      • setGreen

        private void setGreen​(int value)
        Set the green color value.
        Parameters:
        value - Value to set green to.
      • setBlue

        private void setBlue​(int value)
        Set the blue color value.
        Parameters:
        value - Value to set blue to.
      • setTint

        private void setTint​(int value)
        Set the tint value
        Parameters:
        value - Value to set the tint to
        See Also:
        ctint
      • setShade

        private void setShade​(int value)
        Set the shade value
        Parameters:
        value - Value to set the shade to
        See Also:
        cshade
      • setThemeColor

        private void setThemeColor​(int value)
        Set the theme color value.
        Parameters:
        value - Value to set the theme color to
        See Also:
        RtfColorThemes
      • getColor

        public java.awt.Color getColor​(java.lang.String key)
        Get the Color object that is mapped to the key.
        Parameters:
        key - The map number. *@return Color object from the map. null if key does not exist.