Slide extends Component implements ListContainer, TableContainer, TextboxContainer, ChartContainer { public int getSlideIndex() { OdfFileDom contentDom = (OdfFileDom) maSlideElement.getOwnerDocument(); NodeList slideNodes = contentDom.getElementsByTagNameNS(OdfDocumentNamespace.DRAW.getUri(), "page"); for (int i = 0; i < slideNodes.getLength(); i++) { DrawPageElement slideEle = (DrawPageElement) slideNodes.item(i); if (slideEle == maSlideElement) { return i; } } return -1; } private  Slide(DrawPageElement pageElement); static Slide getInstance(DrawPageElement pageElement); DrawPageElement getOdfElement(); int getSlideIndex(); String getSlideName(); void setSlideName(String name); Notes getNotesPage(); OdfElement getListContainerElement(); List addList(); List addList(ListDecorator decorator); void clearList(); Iterator<List> getListIterator(); boolean removeList(List list); Table addTable(); Table addTable(int numRows, int numCols); Table getTableByName(String name); java.util.List<Table> getTableList(); TableBuilder getTableBuilder(); OdfElement getTableContainerElement(); Textbox addTextbox(); Iterator<Textbox> getTextboxIterator(); boolean removeTextbox(Textbox box); OdfElement getFrameContainerElement(); Textbox addTextbox(FrameRectangle position); Textbox getTextboxByName(String name); java.util.List<Textbox> getTextboxByUsage(PresentationDocument.PresentationClass usage); Chart createChart(String title, DataSet dataset, Rectangle rect); Chart createChart(String title, SpreadsheetDocument document, CellRangeAddressList cellRangeAddr, boolean firstRowAsLabel,
			boolean firstColumnAsLabel, boolean rowAsDataSeries, Rectangle rect); Chart createChart(String title, String[] labels, String[] legends, double[][] data, Rectangle rect); void deleteChartById(String chartId); void deleteChartByTitle(String title); Chart getChartById(String chartId); java.util.List<Chart> getChartByTitle(String title); int getChartCount();  }
@Test public void testDeleteSlide() { try { doc = PresentationDocument.loadDocument(ResourceUtilities .getTestResourceAsStream(TEST_PRESENTATION_FILE_MAIN)); Slide slide2 = doc.getSlideByIndex(2); Slide slide3 = doc.getSlideByIndex(3); int nEmbedDoc = doc.getEmbeddedDocuments().size(); Assert.assertTrue(doc.deleteSlideByIndex(2)); Assert.assertTrue(-1 == slide2.getSlideIndex()); Assert.assertTrue(2 == slide3.getSlideIndex()); Assert.assertTrue(doc.getEmbeddedDocuments().size() == (nEmbedDoc - 1)); Assert.assertTrue(doc.deleteSlideByName("page5")); int count = doc.getSlideCount(); Assert.assertTrue(8 == count); String IMAGE_NAME_1 = "Pictures/10000000000002580000018FB151A5C8.jpg"; String IMAGE_NAME_2 = "Pictures/1000000000000C80000004009305DCA3.jpg"; String IMAGE_NAME_3 = "ObjectReplacements/Object 13"; int nImageCnt = OdfDrawImage.getImageCount(doc); InputStream imageStream1 = doc.getPackage().getInputStream(IMAGE_NAME_1); Assert.assertNotNull(imageStream1); Assert.assertTrue(doc.deleteSlideByIndex(doc.getSlideCount() - 2)); Assert.assertTrue(OdfDrawImage.getImageCount(doc) == (nImageCnt - 3)); imageStream1 = doc.getPackage().getInputStream(IMAGE_NAME_1); Assert.assertNull(imageStream1); InputStream imageStream2 = doc.getPackage().getInputStream(IMAGE_NAME_2); Assert.assertNull(imageStream2); InputStream imageStream3 = doc.getPackage().getInputStream(IMAGE_NAME_3); Assert.assertNull(imageStream3); doc2 = PresentationDocument.loadDocument(ResourceUtilities .getTestResourceAsStream(TEST_PRESENTATION_FILE_ANOTHER)); nImageCnt = OdfDrawImage.getImageCount(doc2); Assert.assertTrue(doc2.deleteSlideByIndex(2)); Assert.assertTrue(OdfDrawImage.getImageCount(doc2) == (nImageCnt - 1)); imageStream1 = doc2.getPackage().getInputStream(IMAGE_NAME_1); Assert.assertNotNull(imageStream1); } catch (Exception e) { LOG.log(Level.SEVERE, e.getMessage(), e); Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'"); } try { Assert.assertTrue(doc.deleteSlideByIndex(20)); Assert.assertTrue(false); } catch (IndexOutOfBoundsException iobe) { Assert.assertTrue("slide index is out of bounds", true); } try { doc.save(ResourceUtilities.newTestOutputFile(TEST_PRESENTATION_FILE_OUT_PREFIX + "Delete.odp")); doc2.save(ResourceUtilities.newTestOutputFile(TEST_PRESENTATION_FILE_OUT_PREFIX + "Delete2.odp")); } catch (Exception e) { LOG.log(Level.SEVERE, e.getMessage(), e); Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'"); } }