Examples of Slide


Examples of org.apache.poi.hslf.model.Slide

    }

    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()) {
View Full Code Here

Examples of org.apache.poi.hslf.model.Slide

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

    // Add in to the list of Slides
    Slide[] s = new Slide[_slides.length + 1];
    System.arraycopy(_slides, 0, s, 0, _slides.length);
    s[_slides.length] = slide;
    _slides = s;
    logger.log(POILogger.INFO, "Added slide " + _slides.length + " with ref " + sp.getRefID()
        + " and identifier " + sp.getSlideIdentifier());

    // Add the core records for this new Slide to the record tree
    org.apache.poi.hslf.record.Slide slideRecord = slide.getSlideRecord();
    int psrId = addPersistentObject(slideRecord);
    sp.setRefID(psrId);
    slideRecord.setSheetId(psrId);
   
    slide.setMasterSheet(_masters[0]);
    // All done and added
    return slide;
  }
View Full Code Here

Examples of org.apache.poi.hslf.model.Slide

     * Test read/write Macintosh PICT
     */
    public void testPICT() throws Exception {
        SlideShow ppt = new SlideShow();

        Slide slide = ppt.createSlide();
        byte[] src_bytes = slTests.readFile("cow.pict");
        int idx = ppt.addPicture(src_bytes, Picture.PICT);
        Picture pict = new Picture(idx);
        assertEquals(idx, pict.getPictureIndex());
        slide.addShape(pict);

        //serialize and read again
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ppt.write(out);
        out.close();
View Full Code Here

Examples of org.apache.poi.hslf.model.Slide

     * Test read/write WMF
     */
    public void testWMF() throws Exception {
        SlideShow ppt = new SlideShow();

        Slide slide = ppt.createSlide();
        byte[] src_bytes = slTests.readFile("santa.wmf");
        int idx = ppt.addPicture(src_bytes, Picture.WMF);
        Picture pict = new Picture(idx);
        assertEquals(idx, pict.getPictureIndex());
        slide.addShape(pict);

        //serialize and read again
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ppt.write(out);
        out.close();
View Full Code Here

Examples of org.apache.poi.hslf.model.Slide

     * Test read/write EMF
     */
    public void testEMF() throws Exception {
        SlideShow ppt = new SlideShow();

        Slide slide = ppt.createSlide();
        byte[] src_bytes = slTests.readFile("wrench.emf");
        int idx = ppt.addPicture(src_bytes, Picture.EMF);

        Picture pict = new Picture(idx);
        assertEquals(idx, pict.getPictureIndex());
        slide.addShape(pict);

        //serialize and read again
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ppt.write(out);
        out.close();
View Full Code Here

Examples of org.apache.poi.hslf.model.Slide

     * Test read/write PNG
     */
    public void testPNG() throws Exception {
        SlideShow ppt = new SlideShow();

        Slide slide = ppt.createSlide();
        byte[] src_bytes = slTests.readFile("tomcat.png");
        int idx = ppt.addPicture(src_bytes, Picture.PNG);
        Picture pict = new Picture(idx);
        assertEquals(idx, pict.getPictureIndex());
        slide.addShape(pict);

        //serialize and read again
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ppt.write(out);
        out.close();
View Full Code Here

Examples of org.apache.poi.hslf.model.Slide

     * Test read/write JPEG
     */
    public void testJPEG() throws Exception {
        SlideShow ppt = new SlideShow();

        Slide slide = ppt.createSlide();
        byte[] src_bytes = slTests.readFile("clock.jpg");
        int idx = ppt.addPicture(src_bytes, Picture.JPEG);

        Picture pict = new Picture(idx);
        assertEquals(idx, pict.getPictureIndex());
        slide.addShape(pict);

        //serialize and read again
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ppt.write(out);
        out.close();
View Full Code Here

Examples of org.apache.poi.hslf.model.Slide

     * Test read/write DIB
     */
    public void testDIB() throws Exception {
        SlideShow ppt = new SlideShow();

        Slide slide = ppt.createSlide();
        byte[] src_bytes = slTests.readFile("clock.dib");
        int idx = ppt.addPicture(src_bytes, Picture.DIB);
        Picture pict = new Picture(idx);
        assertEquals(idx, pict.getPictureIndex());
        slide.addShape(pict);

        //serialize and read again
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ppt.write(out);
        out.close();
View Full Code Here

Examples of org.apache.poi.hslf.model.Slide

    }

    public void testGetPictureName() throws Exception {
        SlideShow ppt = new SlideShow(slTests.openResourceAsStream("ppt_with_png.ppt"));
        Slide slide = ppt.getSlides()[0];

        Picture p = (Picture)slide.getShapes()[0]; //the first slide contains JPEG
        assertEquals("test", p.getPictureName());
    }
View Full Code Here

Examples of org.apache.poi.hslf.model.Slide

    }

    public void testSetPictureName() throws Exception {
        SlideShow ppt = new SlideShow();

        Slide slide = ppt.createSlide();
        byte[] img = slTests.readFile("tomcat.png");
        int idx = ppt.addPicture(img, Picture.PNG);
        Picture pict = new Picture(idx);
        pict.setPictureName("tomcat.png");
        slide.addShape(pict);

        //serialize and read again
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ppt.write(out);
        out.close();
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.