Package org.apache.poi.hslf.record

Examples of org.apache.poi.hslf.record.RecordContainer


   *  who their parent is
   */
  private void handleParentAwareRecords(Record baseRecord) {
    // Only need to do something if this is a container record
    if(baseRecord instanceof RecordContainer) {
    RecordContainer br = (RecordContainer)baseRecord;
    Record[] childRecords = br.getChildRecords();
   
    // Loop over child records, looking for interesting ones
    for(int i=0; i<childRecords.length; i++) {
      Record record = childRecords[i];
      // Tell parent aware records of their parent
View Full Code Here


      if(r instanceof ParentAwareRecord) {
        ParentAwareRecord pr = (ParentAwareRecord)r;
        assertEquals(parent, pr.getParentRecord());
      }
      if(r instanceof RecordContainer) {
        RecordContainer rc = (RecordContainer)r;
        Record[] children = rc.getChildRecords();
        for(int i=0; i<children.length; i++) {
          ensureParentAware(children[i], rc);
        }
      }
    }
View Full Code Here

   *  who their parent is
   */
  private void handleParentAwareRecords(Record baseRecord) {
    // Only need to do something if this is a container record
    if(baseRecord instanceof RecordContainer) {
    RecordContainer br = (RecordContainer)baseRecord;
    Record[] childRecords = br.getChildRecords();
   
    // Loop over child records, looking for interesting ones
    for(int i=0; i<childRecords.length; i++) {
      Record record = childRecords[i];
      // Tell parent aware records of their parent
View Full Code Here

      if(r instanceof ParentAwareRecord) {
        ParentAwareRecord pr = (ParentAwareRecord)r;
        assertEquals(parent, pr.getParentRecord());
      }
      if(r instanceof RecordContainer) {
        RecordContainer rc = (RecordContainer)r;
        Record[] children = rc.getChildRecords();
        for(int i=0; i<children.length; i++) {
          ensureParentAware(children[i], rc);
        }
      }
    }
View Full Code Here

     *  ones, as they do their comments oddly.
     */
    public Comment[] getComments() {
      // If there are any, they're in
      //  ProgTags -> ProgBinaryTag -> BinaryTagData
      RecordContainer progTags = (RecordContainer)
          getSheetContainer().findFirstOfType(
                RecordTypes.ProgTags.typeID
      );
      if(progTags != null) {
        RecordContainer progBinaryTag = (RecordContainer)
          progTags.findFirstOfType(
              RecordTypes.ProgBinaryTag.typeID
        );
        if(progBinaryTag != null) {
          RecordContainer binaryTags = (RecordContainer)
            progBinaryTag.findFirstOfType(
                RecordTypes.BinaryTagData.typeID
          );
          if(binaryTags != null) {
            // This is where they'll be
            int count = 0;
            for(int i=0; i<binaryTags.getChildRecords().length; i++) {
              if(binaryTags.getChildRecords()[i] instanceof Comment2000) {
                count++;
              }
            }

            // Now build
            Comment[] comments = new Comment[count];
            count = 0;
            for(int i=0; i<binaryTags.getChildRecords().length; i++) {
              if(binaryTags.getChildRecords()[i] instanceof Comment2000) {
                comments[i] = new Comment(
                    (Comment2000)binaryTags.getChildRecords()[i]
                );
                count++;
              }
            }

View Full Code Here

     *
     * @return programmable tag associated with this sheet.
     */
    public String getProgrammableTag(){
        String tag = null;
        RecordContainer progTags = (RecordContainer)
                getSheetContainer().findFirstOfType(
                            RecordTypes.ProgTags.typeID
        );
        if(progTags != null) {
            RecordContainer progBinaryTag = (RecordContainer)
                progTags.findFirstOfType(
                        RecordTypes.ProgBinaryTag.typeID
            );
            if(progBinaryTag != null) {
                CString binaryTag = (CString)
                    progBinaryTag.findFirstOfType(
                            RecordTypes.CString.typeID
                );
                if(binaryTag != null) tag = binaryTag.getText();
            }
        }
View Full Code Here

        // Build the new TextCharsAtom
        _charAtom = new TextCharsAtom();
        _charAtom.setText(s);

        // Use the TextHeaderAtom to do the swap on the parent
        RecordContainer parent = _headerAtom.getParentRecord();
        Record[] cr = parent.getChildRecords();
        for(int i=0; i<cr.length; i++) {
          // Look for TextBytesAtom
          if(cr[i].equals(_byteAtom)) {
            // Found it, so replace, then all done
            cr[i] = _charAtom;
View Full Code Here

    // Create a new one at the right size
    _styleAtom = new StyleTextPropAtom(getRawText().length() + 1);

    // Use the TextHeader atom to get at the parent
    RecordContainer runAtomsParent = _headerAtom.getParentRecord();

    // Add the new StyleTextPropAtom after the TextCharsAtom / TextBytesAtom
    Record addAfter = _byteAtom;
    if(_byteAtom == null) { addAfter = _charAtom; }
    runAtomsParent.addChildAfter(_styleAtom, addAfter);

    // Feed this to our sole rich text run
    if(_rtRuns.length != 1) {
      throw new IllegalStateException("Needed to add StyleTextPropAtom when had many rich text runs");
    }
View Full Code Here

      if(r instanceof ParentAwareRecord) {
        ParentAwareRecord pr = (ParentAwareRecord)r;
        assertEquals(parent, pr.getParentRecord());
      }
      if(r instanceof RecordContainer) {
        RecordContainer rc = (RecordContainer)r;
        Record[] children = rc.getChildRecords();
        for(int i=0; i<children.length; i++) {
          ensureParentAware(children[i], rc);
        }
      }
    }
View Full Code Here

     *  ones, as they do their comments oddly.
     */
    public Comment[] getComments() {
      // If there are any, they're in
      //  ProgTags -> ProgBinaryTag -> BinaryTagData
      RecordContainer progTags = (RecordContainer)
          getSheetContainer().findFirstOfType(
                RecordTypes.ProgTags.typeID
      );
      if(progTags != null) {
        RecordContainer progBinaryTag = (RecordContainer)
          progTags.findFirstOfType(
              RecordTypes.ProgBinaryTag.typeID
        );
        if(progBinaryTag != null) {
          RecordContainer binaryTags = (RecordContainer)
            progBinaryTag.findFirstOfType(
                RecordTypes.BinaryTagData.typeID
          );
          if(binaryTags != null) {
            // This is where they'll be
            int count = 0;
            for(int i=0; i<binaryTags.getChildRecords().length; i++) {
              if(binaryTags.getChildRecords()[i] instanceof Comment2000) {
                count++;
              }
            }

            // Now build
            Comment[] comments = new Comment[count];
            count = 0;
            for(int i=0; i<binaryTags.getChildRecords().length; i++) {
              if(binaryTags.getChildRecords()[i] instanceof Comment2000) {
                comments[i] = new Comment(
                    (Comment2000)binaryTags.getChildRecords()[i]
                );
                count++;
              }
            }

View Full Code Here

TOP

Related Classes of org.apache.poi.hslf.record.RecordContainer

Copyright © 2018 www.massapicom. 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.