Package org.apache.poi.hslf.record

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


    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];
    if (masterSLWT != null){
        masterSets = masterSLWT.getSlideAtomsSets();

    ArrayList mmr = new ArrayList();
        ArrayList tmr = new ArrayList();

    for(int i=0; i<masterSets.length; i++) {
      Record r = getCoreRecordForSAS(masterSets[i]);
            SlideAtomsSet sas = masterSets[i];
            int sheetNo = sas.getSlidePersistAtom().getSlideIdentifier();
      if(r instanceof org.apache.poi.hslf.record.Slide) {
                TitleMaster master = new TitleMaster((org.apache.poi.hslf.record.Slide)r, sheetNo);
                master.setSlideShow(this);
                tmr.add(master);
      } else if(r instanceof org.apache.poi.hslf.record.MainMaster) {
                SlideMaster master = new SlideMaster((org.apache.poi.hslf.record.MainMaster)r, sheetNo);
                master.setSlideShow(this);
                mmr.add(master);
            }
    }

        _masters = new SlideMaster[mmr.size()];
        mmr.toArray(_masters);

        _titleMasters = new TitleMaster[tmr.size()];
        tmr.toArray(_titleMasters);

    }


  // 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();

      // 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);
        slide.setSlideShow(this);
View Full Code Here

  private void assertMatchesSLTWC(SlideShow s) throws Exception {
    // Grab a new copy of slideshow C
    SlideShow refC = new SlideShow(_slTests.openResourceAsStream(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
  // 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];
    if (masterSLWT != null){
        masterSets = masterSLWT.getSlideAtomsSets();

    ArrayList mmr = new ArrayList();
        ArrayList tmr = new ArrayList();

    for(int i=0; i<masterSets.length; i++) {
      Record r = getCoreRecordForSAS(masterSets[i]);
            SlideAtomsSet sas = masterSets[i];
            int sheetNo = sas.getSlidePersistAtom().getSlideIdentifier();
      if(r instanceof org.apache.poi.hslf.record.Slide) {
                TitleMaster master = new TitleMaster((org.apache.poi.hslf.record.Slide)r, sheetNo);
                master.setSlideShow(this);
                tmr.add(master);
      } else if(r instanceof org.apache.poi.hslf.record.MainMaster) {
                SlideMaster master = new SlideMaster((org.apache.poi.hslf.record.MainMaster)r, sheetNo);
                master.setSlideShow(this);
                mmr.add(master);
            }
    }

        _masters = new SlideMaster[mmr.size()];
        mmr.toArray(_masters);

        _titleMasters = new TitleMaster[tmr.size()];
        tmr.toArray(_titleMasters);

    }


  // 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];
    if (masterSLWT != null){
        masterSets = masterSLWT.getSlideAtomsSets();

    ArrayList mmr = new ArrayList();
        ArrayList tmr = new ArrayList();

    for(int i=0; i<masterSets.length; i++) {
      Record r = getCoreRecordForSAS(masterSets[i]);
            SlideAtomsSet sas = masterSets[i];
            int sheetNo = sas.getSlidePersistAtom().getSlideIdentifier();
      if(r instanceof org.apache.poi.hslf.record.Slide) {
                TitleMaster master = new TitleMaster((org.apache.poi.hslf.record.Slide)r, sheetNo);
                master.setSlideShow(this);
                tmr.add(master);
      } else if(r instanceof org.apache.poi.hslf.record.MainMaster) {
                SlideMaster master = new SlideMaster((org.apache.poi.hslf.record.MainMaster)r, sheetNo);
                master.setSlideShow(this);
                mmr.add(master);
            }
    }

        _masters = new SlideMaster[mmr.size()];
        mmr.toArray(_masters);

        _titleMasters = new TitleMaster[tmr.size()];
        tmr.toArray(_titleMasters);

    }


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

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.