Class TextPropCollection

  • All Implemented Interfaces:
    Duplicatable, GenericRecord

    public class TextPropCollection
    extends Object
    implements GenericRecord, Duplicatable
    For a given run of characters, holds the properties (which could be paragraph properties or character properties). Used to hold the number of characters affected, the list of active properties, and the indent level if required.
    • Constructor Detail

      • TextPropCollection

        public TextPropCollection​(int charactersCovered,
                                  TextPropCollection.TextPropType textPropType)
        Create a new collection of text properties (be they paragraph or character) which will be groked via a subsequent call to buildTextPropList().
    • Method Detail

      • getSpecialMask

        public int getSpecialMask()
      • getCharactersCovered

        public int getCharactersCovered()
        Fetch the number of characters this styling applies to
      • getTextPropList

        public List<TextProp> getTextPropList()
        Fetch the TextProps that define this styling in the record order
      • findByName

        public final <T extends TextProp> T findByName​(String textPropName)
        Fetch the TextProp with this name, or null if it isn't present
      • removeByName

        public final <T extends TextProp> T removeByName​(String name)
      • addWithName

        public final <T extends TextProp> T addWithName​(String name)
        Add the TextProp with this name to the list
      • addProp

        public final void addProp​(TextProp textProp)
        Add the property at the correct position. Replaces an existing property with the same name.
        Parameters:
        textProp - the property to be added
      • buildTextPropList

        public int buildTextPropList​(int containsField,
                                     byte[] data,
                                     int dataOffset)
        For an existing set of text properties, build the list of properties coded for in a given run of properties.
        Returns:
        the number of bytes that were used encoding the properties list
      • updateTextSize

        public void updateTextSize​(int textSize)
        Update the size of the text that this set of properties applies to
      • writeOut

        public void writeOut​(OutputStream o,
                             boolean isMasterStyle)
                      throws IOException
        Writes out to disk the header, and then all the properties
        Throws:
        IOException
      • getIndentLevel

        public short getIndentLevel()
      • setIndentLevel

        public void setIndentLevel​(short indentLevel)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public boolean equals​(Object other)
        compares most properties apart of the covered characters length
        Overrides:
        equals in class Object