Examples of SlideListWithText


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

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

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

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

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

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

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

  // Only store those which aren't empty
  // Also, get the list of IDs while we're at it
  HashSet uniqueSlideIDs = new HashSet();
  Vector setsV = new Vector();
  for(int i=0; i<slwtV.size(); i++) {
    SlideListWithText slwt = (SlideListWithText)slwtV.get(i);
    SlideAtomsSet[] thisSets = slwt.getSlideAtomsSets();
    for(int j=0; j<thisSets.length; j++) {
      SlideAtomsSet thisSet = thisSets[j];
      setsV.add(thisSet);

      int id = thisSet.getSlidePersistAtom().getSlideIdentifier();
View Full Code Here

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

  // Only store those which aren't empty
  // Also, get the list of IDs while we're at it
  HashSet uniqueSlideIDs = new HashSet();
  Vector setsV = new Vector();
  for(int i=0; i<slwtV.size(); i++) {
    SlideListWithText slwt = (SlideListWithText)slwtV.get(i);
    SlideAtomsSet[] thisSets = slwt.getSlideAtomsSets();
    for(int j=0; j<thisSets.length; j++) {
      SlideAtomsSet thisSet = thisSets[j];
      setsV.add(thisSet);

      int id = thisSet.getSlidePersistAtom().getSlideIdentifier();
View Full Code Here

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

  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

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

      ArrayList<SlideMaster> mmr = new ArrayList<SlideMaster>();
      ArrayList<TitleMaster> tmr = new ArrayList<TitleMaster>();

      for (SlideAtomsSet sas : masterSets) {
        Record r = getCoreRecordForSAS(sas);
        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 = mmr.toArray(new SlideMaster[mmr.size()]);
      _titleMasters = tmr.toArray(new TitleMaster[tmr.size()]);
    }

    // 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];
    Map<Integer,Integer> slideIdToNotes = new HashMap<Integer,Integer>();
    if (notesSLWT == null) {
      // None
      notesRecords = new org.apache.poi.hslf.record.Notes[0];
    } else {
      // Match up the records and the SlideAtomSets
      notesSets = notesSLWT.getSlideAtomsSets();
      List<org.apache.poi.hslf.record.Notes> notesRecordsL =
         new ArrayList<org.apache.poi.hslf.record.Notes>();
      for (int i = 0; i < notesSets.length; i++) {
        // Get the right core record
        Record r = getCoreRecordForSAS(notesSets[i]);
View Full Code Here

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

              + _slides.length + ")");
    }

    // The order of slides is defined by the order of slide atom sets in the
    // SlideListWithText container.
    SlideListWithText slwt = _documentRecord.getSlideSlideListWithText();
    SlideAtomsSet[] sas = slwt.getSlideAtomsSets();

    SlideAtomsSet tmp = sas[oldSlideNumber - 1];
    sas[oldSlideNumber - 1] = sas[newSlideNumber - 1];
    sas[newSlideNumber - 1] = tmp;

    ArrayList<Record> lst = new ArrayList<Record>();
    for (int i = 0; i < sas.length; i++) {
      lst.add(sas[i].getSlidePersistAtom());
      Record[] r = sas[i].getSlideRecords();
      for (int j = 0; j < r.length; j++) {
        lst.add(r[j]);
      }
      _slides[i].setSlideNumber(i + 1);
    }
    Record[] r = lst.toArray(new Record[lst.size()]);
    slwt.setChildRecord(r);
  }
View Full Code Here

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

    if (index < 0 || index > lastSlideIdx) {
      throw new IllegalArgumentException("Slide index (" + index + ") is out of range (0.."
          + lastSlideIdx + ")");
    }

    SlideListWithText slwt = _documentRecord.getSlideSlideListWithText();
    SlideAtomsSet[] sas = slwt.getSlideAtomsSets();

    Slide removedSlide = null;
    ArrayList<Record> records = new ArrayList<Record>();
    ArrayList<SlideAtomsSet> sa = new ArrayList<SlideAtomsSet>();
    ArrayList<Slide> sl = new ArrayList<Slide>();

    ArrayList<Notes> nt = new ArrayList<Notes>();
    for (Notes notes : getNotes())
      nt.add(notes);

    for (int i = 0, num = 0; i < _slides.length; i++) {
      if (i != index) {
        sl.add(_slides[i]);
        sa.add(sas[i]);
        _slides[i].setSlideNumber(num++);
        records.add(sas[i].getSlidePersistAtom());
        records.addAll(Arrays.asList(sas[i].getSlideRecords()));
      } else {
        removedSlide = _slides[i];
        nt.remove(_slides[i].getNotesSheet());
      }
    }
    if (sa.size() == 0) {
      _documentRecord.removeSlideListWithText(slwt);
    } else {
      slwt.setSlideAtomsSets(sa.toArray(new SlideAtomsSet[sa.size()]));
      slwt.setChildRecord(records.toArray(new Record[records.size()]));
    }
    _slides = sl.toArray(new Slide[sl.size()]);

    // if the removed slide had notes - remove references to them too

    if (removedSlide != null) {
      int notesId = removedSlide.getSlideRecord().getSlideAtom().getNotesID();
      if (notesId != 0) {
        SlideListWithText nslwt = _documentRecord.getNotesSlideListWithText();
        records = new ArrayList<Record>();
        ArrayList<SlideAtomsSet> na = new ArrayList<SlideAtomsSet>();
        for (SlideAtomsSet ns : nslwt.getSlideAtomsSets()) {
          if (ns.getSlidePersistAtom().getSlideIdentifier() != notesId) {
            na.add(ns);
            records.add(ns.getSlidePersistAtom());
            if (ns.getSlideRecords() != null)
              records.addAll(Arrays.asList(ns.getSlideRecords()));
          }
        }
        if (na.size() == 0) {
          _documentRecord.removeSlideListWithText(nslwt);
        } else {
          nslwt.setSlideAtomsSets(na.toArray(new SlideAtomsSet[na.size()]));
          nslwt.setChildRecord(records.toArray(new Record[records.size()]));
        }

      }
    }
    _notes = nt.toArray(new Notes[nt.size()]);
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.