Examples of TextPropCollection


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

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

    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, paraIgn);
      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);
      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 = (TextPropCollection)paragraphStyles.get(i);
      tpc.writeOut(baos);
    }

    // Now, we do the character ones
    for(int i=0; i<charStyles.size(); i++) {
      TextPropCollection tpc = (TextPropCollection)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

     */
    public String toString(){
        StringBuffer out = new StringBuffer();
        out.append("Paragraph properties\n");
        for (Iterator it1 = getParagraphStyles().iterator(); it1.hasNext();) {
            TextPropCollection pr = (TextPropCollection)it1.next();
            out.append("  chars covered: " + pr.getCharactersCovered() + "\n");
            for (Iterator it2 = pr.getTextPropList().iterator(); it2.hasNext(); ) {
                TextProp p = (TextProp)it2.next();
                out.append("    " + p.getName() + " = " + p.getValue() + "\n");
            }
        }

        out.append("Character properties\n");
        for (Iterator it1 = getCharacterStyles().iterator(); it1.hasNext();) {
            TextPropCollection pr = (TextPropCollection)it1.next();
            out.append("  chars covered: " + pr.getCharactersCovered() + "\n");
            for (Iterator it2 = pr.getTextPropList().iterator(); it2.hasNext(); ) {
                TextProp p = (TextProp)it2.next();
                out.append("    " + p.getName() + " = " + p.getValue() + "\n");
            }
        }

View Full Code Here

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

                pos += LittleEndian.SHORT_SIZE;
            }

            head = LittleEndian.getInt(_data, pos);
            pos += LittleEndian.INT_SIZE;
            TextPropCollection prprops = new TextPropCollection(0);
            pos += prprops.buildTextPropList( head, getParagraphProps(type, j), _data, pos);
            prstyles[j] = prprops;

            head = LittleEndian.getInt(_data, pos);
            pos += LittleEndian.INT_SIZE;
            TextPropCollection chprops = new TextPropCollection(0);
            pos += chprops.buildTextPropList( head, getCharacterProps(type, j), _data, pos);
            chstyles[j] = chprops;
        }

    }
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

    //   * 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

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