Package org.odftoolkit.simple

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


  }

  @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

   *            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

   *            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

TOP

Related Classes of org.odftoolkit.simple.PresentationDocument

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.