Examples of TextPropCollection


Examples of org.apache.poi.hslf.model.textproperties.TextPropCollection

        // Set empty paragraph and character styles
        paragraphStyles = new LinkedList<TextPropCollection>();
        charStyles = new LinkedList<TextPropCollection>();

        TextPropCollection defaultParagraphTextProps =
                new TextPropCollection(parentTextSize, (short)0);
        paragraphStyles.add(defaultParagraphTextProps);

        TextPropCollection defaultCharacterTextProps =
                new TextPropCollection(parentTextSize);
        charStyles.add(defaultCharacterTextProps);

        // Set us as now initialised
        initialised = true;
    }
View Full Code Here

Examples of org.apache.poi.hslf.model.textproperties.TextPropCollection

            // Grab the 4 byte value that tells us what properties follow
            int paraFlags = LittleEndian.getInt(rawContents,pos);
            pos += 4;

            // Now make sense of those properties
            TextPropCollection thisCollection = new TextPropCollection(textLen, indent);
            int plSize = thisCollection.buildTextPropList(
                    paraFlags, paragraphTextPropTypes, rawContents, pos);
            pos += plSize;

            // Save this properties set
            paragraphStyles.add(thisCollection);

            // Handle extra 1 paragraph styles at the end
            if(pos < rawContents.length && textHandled == size) {
                prsize++;
            }

        }
        if (rawContents.length > 0 && textHandled != (size+1)){
            logger.log(POILogger.WARN, "Problem reading paragraph style runs: textHandled = " + textHandled + ", text.size+1 = " + (size+1));
        }

        // Now do the character stylings
        textHandled = 0;
        int chsize = size;
        while(pos < rawContents.length && textHandled < chsize) {
            // First up, fetch the number of characters this applies to
            int textLen = LittleEndian.getInt(rawContents,pos);
            textLen = checkTextLength(textLen, textHandled, size);
            textHandled += textLen;
            pos += 4;

            // There is no 2 byte value
            short no_val = -1;

            // Grab the 4 byte value that tells us what properties follow
            int charFlags = LittleEndian.getInt(rawContents,pos);
            pos += 4;

            // Now make sense of those properties
            // (Assuming we actually have some)
            TextPropCollection thisCollection = new TextPropCollection(textLen, no_val);
            int chSize = thisCollection.buildTextPropList(
                               charFlags, characterTextPropTypes, rawContents, pos);
            pos += chSize;

            // Save this properties set
            charStyles.add(thisCollection);
View Full Code Here

Examples of org.apache.poi.hslf.model.textproperties.TextPropCollection

        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        // First up, we need to serialise the paragraph properties
        for(int i=0; i<paragraphStyles.size(); i++) {
            TextPropCollection tpc = paragraphStyles.get(i);
            tpc.writeOut(baos);
        }

        // Now, we do the character ones
        for(int i=0; i<charStyles.size(); i++) {
            TextPropCollection tpc = charStyles.get(i);
            tpc.writeOut(baos);
        }

        rawContents = baos.toByteArray();
    }
View Full Code Here

Examples of org.apache.poi.hslf.model.textproperties.TextPropCollection

     * Create a new Paragraph TextPropCollection, and add it to the list
     * @param charactersCovered The number of characters this TextPropCollection will cover
     * @return the new TextPropCollection, which will then be in the list
     */
    public TextPropCollection addParagraphTextPropCollection(int charactersCovered) {
        TextPropCollection tpc = new TextPropCollection(charactersCovered, (short)0);
        paragraphStyles.add(tpc);
        return tpc;
    }
View Full Code Here

Examples of org.apache.poi.hslf.model.textproperties.TextPropCollection

     * Create a new Character TextPropCollection, and add it to the list
     * @param charactersCovered The number of characters this TextPropCollection will cover
     * @return the new TextPropCollection, which will then be in the list
     */
    public TextPropCollection addCharacterTextPropCollection(int charactersCovered) {
        TextPropCollection tpc = new TextPropCollection(charactersCovered);
        charStyles.add(tpc);
        return tpc;
    }
View Full Code Here

Examples of org.apache.poi.hslf.model.textproperties.TextPropCollection

  private boolean isCharFlagsTextPropVal(int index) {
    return getFlag(true, index);
  }

  private boolean getFlag(boolean isCharacter, int index) {
    TextPropCollection props;
    String propname;
    if (isCharacter){
      props = characterStyle;
      propname = CharFlagsTextProp.NAME;
    } else {
      props = paragraphStyle;
      propname = ParagraphFlagsTextProp.NAME;
    }

    BitMaskTextProp prop = null;
    if (props != null){
      prop = (BitMaskTextProp)props.findByName(propname);
    }
    if (prop == null){
      Sheet sheet = parentRun.getSheet();
      if(sheet != null){
        int txtype = parentRun.getRunType();
View Full Code Here

Examples of org.apache.poi.hslf.model.textproperties.TextPropCollection

  private void setCharFlagsTextPropVal(int index, boolean value) {
    if(getFlag(true, index) != value) setFlag(true, index, value);
  }

  public void setFlag(boolean isCharacter, int index, boolean value) {
    TextPropCollection props;
    String propname;
    if (isCharacter){
      props = characterStyle;
      propname = CharFlagsTextProp.NAME;
    } else {
View Full Code Here

Examples of org.apache.poi.hslf.model.textproperties.TextPropCollection

            int cLenRemain = -1;

            // Build one for each run with the same style
            while(pos <= runRawText.length() && curP < pStyles.size() && curC < cStyles.size()) {
                // Get the Props to use
                TextPropCollection pProps = (TextPropCollection)pStyles.get(curP);
                TextPropCollection cProps = (TextPropCollection)cStyles.get(curC);

                int pLen = pProps.getCharactersCovered();
                int cLen = cProps.getCharactersCovered();

                // Handle new pass
                boolean freshSet = false;
                if(pLenRemain == -1 && cLenRemain == -1) { freshSet = true; }
                if(pLenRemain == -1) { pLenRemain = pLen; }
View Full Code Here

Examples of org.apache.poi.hslf.model.textproperties.TextPropCollection

    //  the text by one, we need to shuffle that
    //  extra character onto the new ones
    int pOverRun = _styleAtom.getParagraphTextLengthCovered() - oldSize;
    int cOverRun = _styleAtom.getCharacterTextLengthCovered() - oldSize;
    if(pOverRun > 0) {
      TextPropCollection tpc = (TextPropCollection)
        _styleAtom.getParagraphStyles().getLast();
      tpc.updateTextSize(
          tpc.getCharactersCovered() - pOverRun
      );
    }
    if(cOverRun > 0) {
      TextPropCollection tpc = (TextPropCollection)
        _styleAtom.getCharacterStyles().getLast();
      tpc.updateTextSize(
          tpc.getCharactersCovered() - cOverRun
      );
    }

    // Next, add the styles for its paragraph and characters
    TextPropCollection newPTP =
      _styleAtom.addParagraphTextPropCollection(s.length()+pOverRun);
    TextPropCollection newCTP =
      _styleAtom.addCharacterTextPropCollection(s.length()+cOverRun);

    // Now, create the new RichTextRun
    RichTextRun nr = new RichTextRun(
        this, oldSize, s.length(),
View Full Code Here

Examples of org.apache.poi.hslf.model.textproperties.TextPropCollection

    //   * reset the length, to the new string's length
    //   * add on +1 if the last block
    // The last run needs its stylings to be 1 longer than the raw
    //  text is. This is to define the stylings that any new text
    //  that is added will inherit
    TextPropCollection pCol = run._getRawParagraphStyle();
    TextPropCollection cCol = run._getRawCharacterStyle();
    int newSize = s.length();
    if(runID == _rtRuns.length-1) {
      newSize++;
    }

    if(run._isParagraphStyleShared()) {
      pCol.updateTextSize( pCol.getCharactersCovered() - run.getLength() + s.length() );
    } else {
      pCol.updateTextSize(newSize);
    }
    if(run._isCharacterStyleShared()) {
      cCol.updateTextSize( cCol.getCharactersCovered() - run.getLength() + s.length() );
    } else {
      cCol.updateTextSize(newSize);
    }

    // Build up the new text
    // As we go through, update the start position for all subsequent runs
    // The building relies on the old text still being present
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.