Examples of OdfSlide


Examples of org.odftoolkit.odfdom.doc.presentation.OdfSlide

      return null;
    }
    NodeList slideNodes = contentRoot.getElementsByTagNameNS(OdfDocumentNamespace.DRAW.getUri(), "page");
    for (int i = 0; i < slideNodes.getLength(); i++) {
      DrawPageElement slideElement = (DrawPageElement) slideNodes.item(i);
      OdfSlide slide = OdfSlide.getInstance(slideElement);
      String slideName = slide.getSlideName();
      if (slideName.equals(name)) {
        return slide;
      }
    }
    return null;
View Full Code Here

Examples of org.odftoolkit.odfdom.doc.presentation.OdfSlide

    } catch (Exception e) {
      Logger.getLogger(OdfPresentationDocument.class.getName()).log(Level.SEVERE, null, e);
      success = false;
      return success;
    }
    OdfSlide slide = getSlideByName(name);
    DrawPageElement slideElement = slide.getOdfElement();
    //remove all the content of the current page
    //1. the reference of the path that contained in this slide is 1, then remove its
    success &= deleteLinkRef(slideElement);
    //2.the reference of the style is 1, then remove it
    //in order to save time, do not delete style here
View Full Code Here

Examples of org.odftoolkit.odfdom.doc.presentation.OdfSlide

    NodeList slideList = contentRoot.getElementsByTagNameNS(OdfDocumentNamespace.DRAW.getUri(), "page");
    int slideCount = slideList.getLength();
    if ((destIndex < 0) || (destIndex > slideCount)) {
      throw new IndexOutOfBoundsException("the specified Index is out of slide count when call copyForeignSlide method.");
    }
    OdfSlide sourceSlide = srcDoc.getSlideByIndex(srcIndex);
    DrawPageElement sourceSlideElement = sourceSlide.getOdfElement();
    //clone the sourceSlideEle, and make a modification on this clone node.
    DrawPageElement sourceCloneSlideElement = (DrawPageElement) sourceSlideElement.cloneNode(true);

    //copy all the referred xlink:href here
    copyForeignLinkRef(sourceCloneSlideElement);
View Full Code Here

Examples of org.odftoolkit.odfdom.doc.presentation.OdfSlide

      return null;
    }
    NodeList slideNodes = contentRoot.getElementsByTagNameNS(OdfDocumentNamespace.DRAW.getUri(), "page");
    for (int i = 0; i < slideNodes.getLength(); i++) {
      DrawPageElement slideElement = (DrawPageElement) slideNodes.item(i);
      OdfSlide slide = OdfSlide.getInstance(slideElement);
      String slideName = slide.getSlideName();
      if (slideName.equals(name)) {
        return slide;
      }
    }
    return null;
View Full Code Here

Examples of org.odftoolkit.odfdom.doc.presentation.OdfSlide

    } catch (Exception e) {
      Logger.getLogger(OdfPresentationDocument.class.getName()).log(Level.SEVERE, null, e);
      success = false;
      return success;
    }
    OdfSlide slide = getSlideByName(name);
    DrawPageElement slideElement = slide.getOdfElement();
    //remove all the content of the current page
    //1. the reference of the path that contained in this slide is 1, then remove its
    success &= deleteLinkRef(slideElement);
    //2.the reference of the style is 1, then remove it
    //in order to save time, do not delete style here
View Full Code Here

Examples of org.odftoolkit.odfdom.doc.presentation.OdfSlide

    NodeList slideList = contentRoot.getElementsByTagNameNS(OdfDocumentNamespace.DRAW.getUri(), "page");
    int slideCount = slideList.getLength();
    if ((destIndex < 0) || (destIndex > slideCount)) {
      throw new IndexOutOfBoundsException("the specified Index is out of slide count when call copyForeignSlide method.");
    }
    OdfSlide sourceSlide = srcDoc.getSlideByIndex(srcIndex);
    DrawPageElement sourceSlideElement = sourceSlide.getOdfElement();
    //clone the sourceSlideEle, and make a modification on this clone node.
    DrawPageElement sourceCloneSlideElement = (DrawPageElement) sourceSlideElement.cloneNode(true);

    //copy all the referred xlink:href here
    copyForeignLinkRef(sourceCloneSlideElement);
View Full Code Here

Examples of org.odftoolkit.odfdom.doc.presentation.OdfSlide

  public void testGetSlide() {
    try {
      doc = OdfPresentationDocument.loadDocument(ResourceUtilities.getAbsolutePath(TEST_PRESENTATION_FILE_MAIN));
      int slideCount = doc.getSlideCount();
      Assert.assertTrue(10 == slideCount);
      OdfSlide page2 = doc.getSlideByIndex(2);
      Assert.assertTrue(2 == page2.getSlideIndex());
      OdfSlide slide3 = doc.getSlideByName("Slide 3");
      Assert.assertNull(slide3);
      slide3 = doc.getSlideByName("page3");
      Assert.assertEquals(page2, slide3);
      Iterator<OdfSlide> slideIter = doc.getSlides();
      int i = 0;
      while (slideIter.hasNext()) {
        OdfSlide slide = slideIter.next();
        Assert.assertTrue(i == slide.getSlideIndex());
        String name = "page" + (i + 1);
        Assert.assertTrue(name.equals(slide.getSlideName()));
        i++;
      }
    } catch (Exception e) {
      LOG.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'");
    }

    OdfSlide slidesNoName = doc.getSlideByName(null);
    Assert.assertNull(slidesNoName);
    OdfSlide nullSlide = doc.getSlideByIndex(20);
    Assert.assertNull(nullSlide);
    nullSlide = doc.getSlideByIndex(-1);
    Assert.assertNull(nullSlide);

  }
View Full Code Here

Examples of org.odftoolkit.odfdom.doc.presentation.OdfSlide

      NodeList slideNodes = contentRoot.getElementsByTagNameNS(OdfDocumentNamespace.DRAW.getUri(), "page");
      DrawPageElement slideEle4 = (DrawPageElement) slideNodes.item(4);
      Assert.assertEquals(slideEle4.getDrawNameAttribute(), "page5");
      DrawPageElement slideEle8 = (DrawPageElement) slideNodes.item(8);
      slideEle8.setDrawNameAttribute("page5");
      OdfSlide slide7 = doc.getSlideByIndex(7);
      DrawPageElement slideEle7 = (DrawPageElement) slideNodes.item(7);
      slideEle7.removeAttributeNS(OdfDocumentNamespace.DRAW.getUri(), "name");

      OdfSlide slide4 = doc.getSlideByIndex(4);
      Assert.assertTrue(slide4.getSlideName().equals("page5"));
      OdfSlide slide8 = doc.getSlideByIndex(8);
      Assert.assertFalse(slide8.getSlideName().equals("page5"));

      Assert.assertTrue(slide7.getSlideName().startsWith("page8"));
      OdfPresentationNotes note7 = slide7.getNotesPage();
      note7.addText("This is slide at index" + slide7.getSlideIndex() + " named " + slide7.getSlideName());

      OdfSlide slide1 = doc.getSlideByIndex(1);
      slide1.setSlideName("haha");
      slide1.setSlideName("page1");

    } catch (IllegalArgumentException ile) {
      OdfSlide slide1 = doc.getSlideByIndex(1);
      Assert.assertTrue("the given name page1 is duplicate with the previous slide", slide1.getSlideName().equals("haha"));
    } catch (Exception e) {
      LOG.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'");
    }
View Full Code Here

Examples of org.odftoolkit.odfdom.doc.presentation.OdfSlide

   */
  @Test
  public void testDeleteSlide() {
    try {
      doc = OdfPresentationDocument.loadDocument(ResourceUtilities.getAbsolutePath(TEST_PRESENTATION_FILE_MAIN));
      OdfSlide slide2 = doc.getSlideByIndex(2);
      OdfSlide slide3 = doc.getSlideByIndex(3);
      //this slide contains an embed document, remove this slide will also remove the embed document
      int nEmbedDoc = doc.loadSubDocuments().size();
      Assert.assertTrue(doc.deleteSlideByIndex(2));
      //slide3 is no longer exist
      Assert.assertTrue(-1 == slide2.getSlideIndex());
      Assert.assertTrue(2 == slide3.getSlideIndex());
      Assert.assertTrue(doc.loadSubDocuments().size() == (nEmbedDoc - 1));
      Assert.assertTrue(doc.deleteSlideByName("page5"));
      int count = doc.getSlideCount();
      Assert.assertTrue(8 == count);
      //slide at index 9 contains two images and one embed document, the embed document aslo have the object replacement image
View Full Code Here

Examples of org.odftoolkit.odfdom.doc.presentation.OdfSlide

   */
  @Test
  public void testNewSlide() {
    try {
      doc = OdfPresentationDocument.loadDocument(ResourceUtilities.getAbsolutePath(TEST_PRESENTATION_FILE_MAIN));
      OdfSlide slide5 = doc.getSlideByIndex(5);
      OdfSlide newSlide1 = doc.newSlide(2, "Slide 2 new", OdfSlide.SlideLayout.BLANK);
      Assert.assertTrue(2 == newSlide1.getSlideIndex());
      OdfSlide newSlide2 = doc.newSlide(0, "", OdfSlide.SlideLayout.TITLE_ONLY);
      Assert.assertTrue(newSlide2.getSlideName().equals(""));
      Assert.assertTrue(7 == slide5.getSlideIndex());
      doc.newSlide(3, OdfSlide.SlideLayout.TITLE_PLUS_TEXT.toString(), OdfSlide.SlideLayout.enumValueOf("title_text"));
      OdfSlide newSlide4 = doc.newSlide(4, null, OdfSlide.SlideLayout.TITLE_PLUS_2_TEXT_BLOCK);
      Assert.assertTrue(newSlide4.getOdfElement().getDrawNameAttribute() != null);
      OdfSlide.SlideLayout outlineType = OdfSlide.SlideLayout.TITLE_OUTLINE;
      doc.newSlide(14, OdfSlide.SlideLayout.toString(outlineType), outlineType);
      doc.newSlide(15, "Default", null);
      int count = doc.getSlideCount();
      Assert.assertTrue(16 == count);
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.