Examples of PresentationDocument


Examples of org.odftoolkit.simple.PresentationDocument

 
 
  @Test
  public void testGetListContainerElement() {
    try {
      PresentationDocument presentDoc = PresentationDocument.newPresentationDocument();
      Slide slide1 = presentDoc.newSlide(1, "slide1", SlideLayout.TITLE_PLUS_2_TEXT_BLOCK);
      //title
      Textbox titleTextbox = slide1.getTextboxByUsage(PresentationDocument.PresentationClass.TITLE).get(0);
      Assert.assertNotNull(titleTextbox);
      titleTextbox.setTextContent("This is Title");
      java.util.List<Textbox> boxList = slide1.getTextboxByUsage(PresentationDocument.PresentationClass.OUTLINE);
      Assert.assertNotNull(boxList);
      Assert.assertEquals(2, boxList.size());
      Textbox leftTextbox = boxList.get(0);
      List list1 = leftTextbox.addList();
      list1.addItem("Test outline1");
      list1.addItem("Test outline2");
      //
      Textbox rightTextbox = boxList.get(1);
      Assert.assertNotNull(rightTextbox);
     
      ListDecorator decorator = new NumberDecorator(presentDoc);
      rightTextbox.setBackgroundColor(Color.RED);
      List list2 = rightTextbox.addList(decorator);
      list2.addItem("test AAA");
      OdfElement odfEle = rightTextbox.getListContainerElement();
      NodeList nodes = odfEle.getChildNodes();
      for(int i=0;i<nodes.getLength();i++){
        Node node = nodes.item(i);
        Assert.assertEquals("test AAA", node.getTextContent());
      }
     
      //save
      presentDoc.save(ResourceUtilities.newTestOutputFile("abc.odp"));
    } catch (Exception e) {
      Logger.getLogger(TextBoxTest.class.getName()).log(Level.SEVERE, null, e);
      Assert.fail();
    }
   
View Full Code Here

Examples of org.odftoolkit.simple.PresentationDocument

 
 
  @Test
  public void testGetListIterator() {
    try {
      PresentationDocument presentDoc = PresentationDocument.newPresentationDocument();
      Slide slide1 = presentDoc.newSlide(1, "slide1", SlideLayout.TITLE_PLUS_2_TEXT_BLOCK);
      //title
      Textbox titleTextbox = slide1.getTextboxByUsage(PresentationDocument.PresentationClass.TITLE).get(0);
      Assert.assertNotNull(titleTextbox);
      titleTextbox.setTextContent("This is Title");
      java.util.List<Textbox> boxList = slide1.getTextboxByUsage(PresentationDocument.PresentationClass.OUTLINE);
      Assert.assertNotNull(boxList);
      Assert.assertEquals(2, boxList.size());
      Textbox leftTextbox = boxList.get(0);
      List list1 = leftTextbox.addList();
      list1.addItem("Test outline1");
      list1.addItem("Test outline2");

      //
      Textbox rightTextbox = boxList.get(1);
      Assert.assertNotNull(rightTextbox);
     
      ListDecorator decorator = new NumberDecorator(presentDoc);
      rightTextbox.setBackgroundColor(Color.RED);
      List list2 = rightTextbox.addList();
      list2.addItem("test AAA");
      list2.addItem("test BBB");
      Iterator iterator = rightTextbox.getListIterator();
      while(iterator.hasNext()){
        List list = (List)iterator.next();
        Assert.assertEquals(2, list.size());
        Assert.assertEquals("test AAA", list.getItem(0).toString());
        Assert.assertEquals("test BBB", list.getItem(1).toString());
      }
     
      //save
      presentDoc.save(ResourceUtilities.newTestOutputFile("abc.odp"));
    } catch (Exception e) {
      Logger.getLogger(TextBoxTest.class.getName()).log(Level.SEVERE, null, e);
      Assert.fail();
    }
   
View Full Code Here

Examples of org.odftoolkit.simple.PresentationDocument

 
 
  @Test
  public void testRemoveList() {
    try {
      PresentationDocument presentDoc = PresentationDocument.newPresentationDocument();
      Slide slide1 = presentDoc.newSlide(1, "slide1", SlideLayout.TITLE_PLUS_2_TEXT_BLOCK);
      //title
      Textbox titleTextbox = slide1.getTextboxByUsage(PresentationDocument.PresentationClass.TITLE).get(0);
      Assert.assertNotNull(titleTextbox);
      titleTextbox.setTextContent("This is Title");
      java.util.List<Textbox> boxList = slide1.getTextboxByUsage(PresentationDocument.PresentationClass.OUTLINE);
      Assert.assertNotNull(boxList);
      Assert.assertEquals(2, boxList.size());
      Textbox leftTextbox = boxList.get(0);
      List list1 = leftTextbox.addList();
      list1.addItem("Test outline1");
      list1.addItem("Test outline2");

      //
      Textbox rightTextbox = boxList.get(1);
      Assert.assertNotNull(rightTextbox);
     
      ListDecorator decorator = new NumberDecorator(presentDoc);
      rightTextbox.setBackgroundColor(Color.RED);
      List list2 = rightTextbox.addList();
      list2.addItem("test AAA");
      list2.addItem("test BBB");
     
      rightTextbox.removeList(list2);
      Iterator iterator = rightTextbox.getListIterator();
      Assert.assertFalse(iterator.hasNext());
     
      //save
      presentDoc.save(ResourceUtilities.newTestOutputFile("abc.odp"));
    } catch (Exception e) {
      Logger.getLogger(TextBoxTest.class.getName()).log(Level.SEVERE, null, e);
      Assert.fail();
    }
   
View Full Code Here

Examples of org.odftoolkit.simple.PresentationDocument

  }

  @Test
  public void testNavigationInOdfElement() {
    try {
      PresentationDocument document = PresentationDocument.loadDocument(ResourceUtilities
          .getAbsolutePath(NAVIGATION_ODFELEMENT_FILE));
      TextNavigation navigation = new TextNavigation("RANDOM COLORED TEXTBOX", document);
      int count = 0;
      while (navigation.hasNext()) {
        navigation.nextSelection();
        count++;
      }
      Assert.assertEquals(3, count);

      Slide slide = document.getSlideByIndex(0);
      navigation = new TextNavigation("RANDOM COLORED TEXTBOX", slide.getOdfElement());
      count = 0;
      while (navigation.hasNext()) {
        navigation.nextSelection();
        count++;
      }
      Assert.assertEquals(1, count);
      document.close();
    } catch (Exception e) {
      Logger.getLogger(TextNavigationTest.class.getName()).log(Level.SEVERE, e.getMessage(), e);
      Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'");
    }
  }
View Full Code Here

Examples of org.odftoolkit.simple.PresentationDocument

   *            an instance of <code>PresentationNotesElement</code>
   * @return an instance of <code>Notes</code> that can represent
   *         <code>PresentationNotesElement</code>
   */
  public static Notes getInstance(PresentationNotesElement noteElement) {
    PresentationDocument ownerDocument = (PresentationDocument) ((OdfFileDom) (noteElement.getOwnerDocument()))
        .getDocument();
    return ownerDocument.getNotesBuilder().getNotesInstance(noteElement);

  }
View Full Code Here

Examples of org.odftoolkit.simple.PresentationDocument

   *            an instance of <code>DrawPageElement</code>
   * @return an instance of <code>Slide</code> that can represent
   *         <code>pageElement</code>
   */
  public static Slide getInstance(DrawPageElement pageElement) {
    PresentationDocument ownerDocument = (PresentationDocument) ((OdfFileDom) (pageElement.getOwnerDocument()))
        .getDocument();
    return ownerDocument.getSlideBuilder().getSlideInstance(pageElement);
  }
View Full Code Here

Examples of org.openxmlformats.schemas.presentationml.x2006.main.PresentationDocument

    }

    @Override
    protected void onDocumentRead() throws IOException {
        try {
            PresentationDocument doc =
                    PresentationDocument.Factory.parse(getCorePart().getInputStream());
            _presentation = doc.getPresentation();
            Map<String, XSLFSlide> shIdMap = new HashMap<String, XSLFSlide>();

            _masters = new HashMap<String, XSLFSlideMaster>();
            for (POIXMLDocumentPart p : getRelations()) {
                if (p instanceof XSLFSlide) {
View Full Code Here

Examples of org.openxmlformats.schemas.presentationml.x2006.main.PresentationDocument

    }

    @Override
    protected void onDocumentRead() throws IOException {
        try {
            PresentationDocument doc =
                    PresentationDocument.Factory.parse(getCorePart().getInputStream());
            _presentation = doc.getPresentation();
            Map<String, XSLFSlide> shIdMap = new HashMap<String, XSLFSlide>();

            _masters = new HashMap<String, XSLFSlideMaster>();
            for (POIXMLDocumentPart p : getRelations()) {
                if (p instanceof XSLFSlide) {
View Full Code Here

Examples of org.openxmlformats.schemas.presentationml.x2006.main.PresentationDocument

    }

    @Override
    protected void onDocumentRead() throws IOException {
        try {
            PresentationDocument doc =
                    PresentationDocument.Factory.parse(getCorePart().getInputStream());
            _presentation = doc.getPresentation();
            Map<String, XSLFSlide> shIdMap = new HashMap<String, XSLFSlide>();

            _masters = new HashMap<String, XSLFSlideMaster>();
            for (POIXMLDocumentPart p : getRelations()) {
                if (p instanceof XSLFSlide) {
View Full Code Here

Examples of org.openxmlformats.schemas.presentationml.x2006.main.PresentationDocument

    @Override
    @SuppressWarnings("deprecation")
    protected void onDocumentRead() throws IOException {
        try {
            PresentationDocument doc =
                    PresentationDocument.Factory.parse(getCorePart().getInputStream());
            _presentation = doc.getPresentation();
            Map<String, XSLFSlide> shIdMap = new HashMap<String, XSLFSlide>();

            _masters = new HashMap<String, XSLFSlideMaster>();
            for (POIXMLDocumentPart p : getRelations()) {
                if (p instanceof XSLFSlide) {
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.