Package org.apache.poi.hslf.record

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


    //  first PersistPrtHolder, if there is one
   
    CurrentUserAtom cua = hss.getCurrentUserAtom();
    if(cua.getCurrentEditOffset() != 0) {
      // Grab the details of the UserEditAtom there
      Record r = Record.buildRecordAtOffset(
          hss.getUnderlyingBytes(),
          (int)cua.getCurrentEditOffset()
      );
      if(! (r instanceof UserEditAtom)) { return null; }
      UserEditAtom uea = (UserEditAtom)r;
     
      // Now get the PersistPtrHolder
      Record r2 = Record.buildRecordAtOffset(
          hss.getUnderlyingBytes(),
          uea.getPersistPointersOffset()
      );
      if(! (r2 instanceof PersistPtrHolder)) { return null; }
      PersistPtrHolder pph = (PersistPtrHolder)r2;
     
      // Now get the last record
      int[] slideIds = pph.getKnownSlideIDs();
      int maxSlideId = -1;
      for(int i=0; i<slideIds.length; i++) {
        if(slideIds[i] > maxSlideId) { maxSlideId = slideIds[i]; }
      }
      if(maxSlideId == -1) { return null; }
     
      int offset = (
          (Integer)pph.getSlideLocationsLookup().get(
              new Integer(maxSlideId)
          ) ).intValue();
      Record r3 = Record.buildRecordAtOffset(
          hss.getUnderlyingBytes(),
          offset
      );
     
      // If we have a DocumentEncryptionAtom, it'll be this one
View Full Code Here


    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
      if(record instanceof ParentAwareRecord) {
        ((ParentAwareRecord)record).setParentRecord(br);
      }
      // Walk on down for the case of container records
View Full Code Here

   */
  private Record getCoreRecordForRefID(int refID) {
    Integer coreRecordId = (Integer)
      _sheetIdToCoreRecordsLookup.get(new Integer(refID));
    if(coreRecordId != null) {
      Record r = _mostRecentCoreRecords[coreRecordId.intValue()];
      return r;
    } else {
      logger.log(POILogger.ERROR, "We tried to look up a reference to a core record, but there was no core ID for reference ID " + refID);
      return null;
    }
View Full Code Here

    // For now, we only care about the records which are MainMasters
    // (In future, we might want to know about the other too)
    ArrayList mmr = new ArrayList();

    for(int i=0; i<masterSets.length; i++) {
      Record r = getCoreRecordForSAS(masterSets[i]);
      if(r instanceof org.apache.poi.hslf.record.Slide) {
        // Slide master, skip
      } else if(r instanceof org.apache.poi.hslf.record.MainMaster) {
        mmr.add(r);
      }
    }

    mainMasterRecords = new org.apache.poi.hslf.record.MainMaster[mmr.size()];
    mmr.toArray(mainMasterRecords);
    }


  // Having sorted out the masters, that leaves the notes and slides


  // Start by finding the notes records to go with the entries in
  //  notesSLWT
  org.apache.poi.hslf.record.Notes[] notesRecords;
  SlideAtomsSet[] notesSets = new SlideAtomsSet[0];
  Hashtable slideIdToNotes = new Hashtable();
  if(notesSLWT == null) {
    // None
    notesRecords = new org.apache.poi.hslf.record.Notes[0];
  } else {
    // Match up the records and the SlideAtomSets
    notesSets = notesSLWT.getSlideAtomsSets();
    ArrayList notesRecordsL = new ArrayList();
    for(int i=0; i<notesSets.length; i++) {
      // Get the right core record
      Record r = getCoreRecordForSAS(notesSets[i]);
     
      // Ensure it really is a notes record
      if(r != null && r instanceof org.apache.poi.hslf.record.Notes) {
        notesRecordsL.add( (org.apache.poi.hslf.record.Notes)r );
       
        // Record the match between slide id and these notes
        SlidePersistAtom spa = notesSets[i].getSlidePersistAtom();
        Integer slideId = new Integer(spa.getSlideIdentifier());
        slideIdToNotes.put(slideId, new Integer(i));
      } else {
        logger.log(POILogger.ERROR, "A Notes SlideAtomSet at " + i + " said its record was at refID " + notesSets[i].getSlidePersistAtom().getRefID() + ", but that was actually a " + r);
      }
    }
    notesRecords = new org.apache.poi.hslf.record.Notes[notesRecordsL.size()];
    notesRecords = (org.apache.poi.hslf.record.Notes[])
      notesRecordsL.toArray(notesRecords);
  }
 
  // Now, do the same thing for our slides
  org.apache.poi.hslf.record.Slide[] slidesRecords;
  SlideAtomsSet[] slidesSets = new SlideAtomsSet[0];
  if(slidesSLWT == null) {
    // None
    slidesRecords = new org.apache.poi.hslf.record.Slide[0];
  } else {
    // Match up the records and the SlideAtomSets
    slidesSets = slidesSLWT.getSlideAtomsSets();
    slidesRecords = new org.apache.poi.hslf.record.Slide[slidesSets.length];
    for(int i=0; i<slidesSets.length; i++) {
      // Get the right core record
      Record r = getCoreRecordForSAS(slidesSets[i]);
     
      // Ensure it really is a slide record
      if(r instanceof org.apache.poi.hslf.record.Slide) {
        slidesRecords[i] = (org.apache.poi.hslf.record.Slide)r;
      } else {
View Full Code Here

      int offset = 0;
      int slideOffset = 0;
      PersistPtrHolder ptr = null;
      UserEditAtom usr = null;
      for (int i = 0; i < _records.length; i++) {
        Record record = _records[i];
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        record.writeOut(out);
       
        // Grab interesting records as they come past
        if(_records[i].getRecordType() == RecordTypes.PersistPtrIncrementalBlock.typeID){
          ptr = (PersistPtrHolder)_records[i];
        }
View Full Code Here

    byte[] s_slwt = writeRecord(s_SLWT);
   
    // Check the records are the same
    assertEquals(refSLWT.getChildRecords().length, s_SLWT.getChildRecords().length);
    for(int i=0; i<refSLWT.getChildRecords().length; i++) {
      Record ref_r = refSLWT.getChildRecords()[i];
      Record s_r = s_SLWT.getChildRecords()[i];
     
      byte[] r_rb = writeRecord(ref_r);
      byte[] s_rb = writeRecord(s_r);
      assertEquals(r_rb.length, s_rb.length);
      for(int j=0; j<r_rb.length; j++) {
View Full Code Here

         
          // Report the first 5 children, to give a flavour
          int upTo = 5;
          if(children.length < 5) { upTo = children.length; }
          for(int k=0; k<upTo; k++) {
            Record r = children[k];
            int typeID = (int)r.getRecordType();
            String typeName = RecordTypes.recordName(typeID);
            System.out.println("   - " + typeID + " (" + typeName + ")");
          }
        }
      }
View Full Code Here

  // For holding the Meta Sheet Records
  Vector metaSheetsV = new Vector(10);
  // For holding SlideListWithText Records
  Vector slwtV = new Vector(10);
  // For holding the Document record we're going to use
  Record documentRecord = null;

  // Look for Notes, Slides and Documents
  for(int i=0; i<_mostRecentCoreRecords.length; i++) {
    if(_mostRecentCoreRecords[i] instanceof org.apache.poi.hslf.record.Notes) {
      notesV.add(_mostRecentCoreRecords[i]);
    }
    if(_mostRecentCoreRecords[i] instanceof org.apache.poi.hslf.record.Slide) {
      slidesV.add(_mostRecentCoreRecords[i]);
    }
    if(_records[i].getRecordType() == 1000l) {
      documentRecord = _mostRecentCoreRecords[i];
    }
  }


  // Now look for SlideListWithTexts in the most up-to-date Document Record
  //
  // Need to get the SlideAtomsSets for all of these. Then, query the
  //  SlidePersistAtom, and group stuff together between SLWT blocks
  //  based on the refID/slideID
  //
  // If a notes sheet exists, can normally match the Notes sheet ID
  //  to the slide ID in the SlidePersistAtom. Since there isn't always,
  //  and we can't find the ID in the slide, just order on the slide ID,
  //  and hand off to the Slides in turn.
  // (Based on output from dev.SLWTTextListing and dev.SlideAndNotesAtomListing)
  //
  // We're trusting that the ordering of slides from the persistence
  //  layer will match the ordering found here. However, we should
  //  really find a PPT file with random sheets inserted to check with
  //
  // There shouldn't be any text duplication - only using the most
  //  record Document record's SLWTs should see to that

  Record[] docChildren = documentRecord.getChildRecords();
  for(int i=0; i<docChildren.length; i++) {
    if(docChildren[i] instanceof SlideListWithText) {
      slwtV.add(docChildren[i]);
    }
  }
View Full Code Here

    byte[] s_slwt = writeRecord(s_SLWT);

    // Check the records are the same
    assertEquals(refSLWT.getChildRecords().length, s_SLWT.getChildRecords().length);
    for(int i=0; i<refSLWT.getChildRecords().length; i++) {
      Record ref_r = refSLWT.getChildRecords()[i];
      Record s_r = s_SLWT.getChildRecords()[i];

      byte[] r_rb = writeRecord(ref_r);
      byte[] s_rb = writeRecord(s_r);
      assertEquals(r_rb.length, s_rb.length);
      for(int j=0; j<r_rb.length; j++) {
View Full Code Here

        //grab UserEditAtom
        UserEditAtom usredit = null;
        Record[] _records = hss_empty.getRecords();
        for (int i = 0; i < _records.length; i++) {
            Record record = _records[i];
            if(record.getRecordType() == RecordTypes.UserEditAtom.typeID) {
                usredit = (UserEditAtom)record;
            }
       }
       assertNotNull(usredit);
View Full Code Here

TOP

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

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.