Package org.apache.poi.hslf.record

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


  // Having indentified the masters, slides and notes + their orders,
  //  we have to go and find their matching records
  // We always use the latest versions of these records, and use the
  //  SlideAtom/NotesAtom to match them with the StyleAtomSet

  SlideListWithText masterSLWT = _documentRecord.getMasterSlideListWithText();
  SlideListWithText slidesSLWT = _documentRecord.getSlideSlideListWithText();
  SlideListWithText notesSLWT  = _documentRecord.getNotesSlideListWithText();

    // Find master slides
  // These can be MainMaster records, but oddly they can also be
  //  Slides or Notes, and possibly even other odd stuff....
  // About the only thing you can say is that the master details are in
  //  the first SLWT.
    SlideAtomsSet[] masterSets = new SlideAtomsSet[0];
    org.apache.poi.hslf.record.MainMaster[] mainMasterRecords = null;
    if (masterSLWT != null){
        masterSets = masterSLWT.getSlideAtomsSets();

    // 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]);
     
View Full Code Here


    if(oldSlideNumer > _slides.length || newSlideNumber > _slides.length) {
      throw new IllegalArgumentException("Old and new slide numbers must not exceed the number of slides (" + _slides.length + ")");
    }
   
    // Shift the SlideAtomsSet
    SlideListWithText slwt = _documentRecord.getSlideSlideListWithText();
    slwt.repositionSlideAtomsSet(
        slwt.getSlideAtomsSets()[(oldSlideNumer-1)],
        (newSlideNumber-1)
    );
   
    // Re-order the slides
    ArrayUtil.arrayMoveWithin(_slides, (oldSlideNumer-1), (newSlideNumber-1), 1);
View Full Code Here

   *
   * @return  the created <code>Slide</code>
   * @throws IOException
   */
    public Slide createSlide() throws IOException {
      SlideListWithText slist = null;

      // We need to add the records to the SLWT that deals
      //  with Slides.
      // Add it, if it doesn't exist
      slist = _documentRecord.getSlideSlideListWithText();
      if(slist == null) {
        // Need to add a new one
        slist = new SlideListWithText();
        _documentRecord.addSlideListWithText(slist);
      }

      // Grab the SlidePersistAtom with the highest Slide Number.
      // (Will stay as null if no SlidePersistAtom exists yet in
      //  the slide, or only master slide's ones do)
      SlidePersistAtom prev = null;
    SlideAtomsSet[] sas = slist.getSlideAtomsSets();
      for(int j=0; j<sas.length; j++) {
        SlidePersistAtom spa = sas[j].getSlidePersistAtom();
        if(spa.getSlideIdentifier() < 0) {
          // This is for a master slide
          // Odd, since we only deal with the Slide SLWT
        } else {
        // Must be for a real slide
          if(prev == null) { prev = spa; }
          if(prev.getSlideIdentifier() < spa.getSlideIdentifier()) {
            prev = spa;
          }
        }
      }
     
      // Set up a new  SlidePersistAtom for this slide
      SlidePersistAtom sp = new SlidePersistAtom();

      // Reference is the 1-based index of the slide container in
      //  the PersistPtr root.
      // It always starts with 3 (1 is Document, 2 is MainMaster, 3 is
      //  the first slide), but quicksaves etc can leave gaps
      _highestSheetId++;
      sp.setRefID(_highestSheetId);
      // First slideId is always 256
      sp.setSlideIdentifier(prev == null ? 256 : (prev.getSlideIdentifier() + 1));
     
      // Add this new SlidePersistAtom to the SlideListWithText
      slist.addSlidePersistAtom(sp);
     
     
      // Create a new Slide
      Slide slide = new Slide(sp.getSlideIdentifier(), sp.getRefID(), _slides.length+1);
      // Add in to the list of Slides
View Full Code Here

  // Having indentified the masters, slides and notes + their orders,
  //  we have to go and find their matching records
  // We always use the latest versions of these records, and use the
  //  SlideAtom/NotesAtom to match them with the StyleAtomSet

  SlideListWithText masterSLWT = _documentRecord.getMasterSlideListWithText();
  SlideListWithText slidesSLWT = _documentRecord.getSlideSlideListWithText();
  SlideListWithText notesSLWT  = _documentRecord.getNotesSlideListWithText();

    // Find master slides
  // These can be MainMaster records, but oddly they can also be
  //  Slides or Notes, and possibly even other odd stuff....
  // About the only thing you can say is that the master details are in
  //  the first SLWT.
    SlideAtomsSet[] masterSets = new SlideAtomsSet[0];
    org.apache.poi.hslf.record.MainMaster[] mainMasterRecords = null;
    if (masterSLWT != null){
        masterSets = masterSLWT.getSlideAtomsSets();

    // 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]);
     
View Full Code Here

    if(oldSlideNumer > _slides.length || newSlideNumber > _slides.length) {
      throw new IllegalArgumentException("Old and new slide numbers must not exceed the number of slides (" + _slides.length + ")");
    }
   
    // Shift the SlideAtomsSet
    SlideListWithText slwt = _documentRecord.getSlideSlideListWithText();
    slwt.repositionSlideAtomsSet(
        slwt.getSlideAtomsSets()[(oldSlideNumer-1)],
        (newSlideNumber-1)
    );
   
    // Re-order the slides
    ArrayUtil.arrayMoveWithin(_slides, (oldSlideNumer-1), (newSlideNumber-1), 1);
View Full Code Here

   *
   * @return  the created <code>Slide</code>
   * @throws IOException
   */
    public Slide createSlide() throws IOException {
      SlideListWithText slist = null;

      // We need to add the records to the SLWT that deals
      //  with Slides.
      // Add it, if it doesn't exist
      slist = _documentRecord.getSlideSlideListWithText();
      if(slist == null) {
        // Need to add a new one
        slist = new SlideListWithText();
        _documentRecord.addSlideListWithText(slist);
      }

      // Grab the SlidePersistAtom with the highest Slide Number.
      // (Will stay as null if no SlidePersistAtom exists yet in
      //  the slide, or only master slide's ones do)
      SlidePersistAtom prev = null;
    SlideAtomsSet[] sas = slist.getSlideAtomsSets();
      for(int j=0; j<sas.length; j++) {
        SlidePersistAtom spa = sas[j].getSlidePersistAtom();
        if(spa.getSlideIdentifier() < 0) {
          // This is for a master slide
          // Odd, since we only deal with the Slide SLWT
        } else {
        // Must be for a real slide
          if(prev == null) { prev = spa; }
          if(prev.getSlideIdentifier() < spa.getSlideIdentifier()) {
            prev = spa;
          }
        }
      }
     
      // Set up a new  SlidePersistAtom for this slide
      SlidePersistAtom sp = new SlidePersistAtom();

      // Reference is the 1-based index of the slide container in
      //  the PersistPtr root.
      // It always starts with 3 (1 is Document, 2 is MainMaster, 3 is
      //  the first slide), but quicksaves etc can leave gaps
      _highestSheetId++;
      sp.setRefID(_highestSheetId);
      // First slideId is always 256
      sp.setSlideIdentifier(prev == null ? 256 : (prev.getSlideIdentifier() + 1));
     
      // Add this new SlidePersistAtom to the SlideListWithText
      slist.addSlidePersistAtom(sp);
     
     
      // Create a new Slide
      Slide slide = new Slide(sp.getSlideIdentifier(), sp.getRefID(), _slides.length+1);
      // Add in to the list of Slides
View Full Code Here

  private void assertMatchesSLTWC(SlideShow s) throws Exception {
    // Grab a new copy of slideshow C
    SlideShow refC = new SlideShow(new HSLFSlideShow(filenameC));

    // Write out the 2nd SLWT in the active document
    SlideListWithText refSLWT = refC.getDocumentRecord().getSlideListWithTexts()[1];
    byte[] raw_slwt = writeRecord(refSLWT);
   
    // Write out the same for the supplied slideshow
    SlideListWithText s_SLWT = s.getDocumentRecord().getSlideListWithTexts()[1];
    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

  // Having indentified the masters, slides and notes + their orders,
  //  we have to go and find their matching records
  // We always use the latest versions of these records, and use the
  //  SlideAtom/NotesAtom to match them with the StyleAtomSet

  SlideListWithText masterSLWT = _documentRecord.getMasterSlideListWithText();
  SlideListWithText slidesSLWT = _documentRecord.getSlideSlideListWithText();
  SlideListWithText notesSLWT  = _documentRecord.getNotesSlideListWithText();
 
    //find master slides
    SlideAtomsSet[] masterSets = new SlideAtomsSet[0];
    org.apache.poi.hslf.record.MainMaster[] masterRecords = null;
    if (masterSLWT != null){

        masterSets = masterSLWT.getSlideAtomsSets();
        masterRecords = new org.apache.poi.hslf.record.MainMaster[masterSets.length];
        for(int i=0; i<masterRecords.length; i++) {
            masterRecords[i] = (org.apache.poi.hslf.record.MainMaster)getCoreRecordForSAS(masterSets[i]);
        }
    }

  // 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();
    notesRecords = new org.apache.poi.hslf.record.Notes[notesSets.length];
    for(int i=0; i<notesSets.length; i++) {
      // Get the right core record
      Record r = getCoreRecordForSAS(notesSets[i]);
     
View Full Code Here

          System.err.println("** Warning: Shouldn't have more than 3!");
        }
       
        // Check the SLWTs contain what we'd expect
        for(int j=0; j<slwts.length; j++) {
          SlideListWithText slwt = slwts[j];
          Record[] children = slwt.getChildRecords();
         
          System.out.println(" - SLWT at " + j + " had " + children.length + " children:");
         
          // Should only have SlideAtomSets if the second one
          int numSAS = slwt.getSlideAtomsSets().length;
          if(j == 1) {
            if(numSAS == 0) {
              System.err.println("  ** 2nd SLWT didn't have any SlideAtomSets!");
            } else {
              System.out.println("  - Contains " + numSAS + " SlideAtomSets");
View Full Code Here

    if(oldSlideNumer > _slides.length || newSlideNumber > _slides.length) {
      throw new IllegalArgumentException("Old and new slide numbers must not exceed the number of slides (" + _slides.length + ")");
    }
   
    // Shift the SlideAtomsSet
    SlideListWithText slwt = _documentRecord.getSlideSlideListWithText();
    slwt.repositionSlideAtomsSet(
        slwt.getSlideAtomsSets()[(oldSlideNumer-1)],
        (newSlideNumber-1)
    );
   
    // Re-order the slides
    ArrayUtil.arrayMoveWithin(_slides, (oldSlideNumer-1), (newSlideNumber-1), 1);
View Full Code Here

TOP

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

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.