? bin ? ppt_pictures.patch ? src/scratchpad/src/org/apache/poi/hslf/usermodel/Picture.java ? src/scratchpad/testcases/org/apache/poi/hslf/data/ppt_with_png.ppt ? src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPictures.java Index: src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java =================================================================== RCS file: /home/cvspublic/jakarta-poi/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java,v retrieving revision 1.3 diff -u -r1.3 HSLFSlideShow.java --- src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java 9 Jun 2005 18:20:28 -0000 1.3 +++ src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java 16 Jan 2006 15:38:13 -0000 @@ -36,6 +36,7 @@ import org.apache.poi.util.LittleEndian; import org.apache.poi.hslf.record.*; +import org.apache.poi.hslf.usermodel.Picture; /** * This class contains the main functionality for the Powerpoint file @@ -337,4 +338,35 @@ * Fetch the Current User Atom of the document */ public CurrentUserAtom getCurrentUserAtom() { return currentUser; } + + /** + * Read pictures contained in this presentation + * + * @return array with the read pictures ot null if the + * presentation doesn't contain pictures. + */ + public Picture[] getPictures() throws IOException { + byte[] pictstream; + + try { + DocumentEntry entry = (DocumentEntry)filesystem.getRoot().getEntry("Pictures"); + pictstream = new byte[entry.getSize()]; + DocumentInputStream is = filesystem.createDocumentInputStream("Pictures"); + is.read(pictstream); + + } catch (FileNotFoundException e){ + //silently catch exceptions if the presentation doesn't contain pictures + return null; + } + + ArrayList p = new ArrayList(); + int pos = 0; + while (pos < pictstream.length) { + Picture pict = new Picture(pictstream, pos); + p.add(pict); + pos += Picture.HEADER_SIZE + pict.getSize(); + } + return (Picture[])p.toArray(new Picture[p.size()]); + } + } Index: src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java =================================================================== RCS file: /home/cvspublic/jakarta-poi/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java,v retrieving revision 1.6 diff -u -r1.6 SlideShow.java --- src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java 24 Nov 2005 10:46:45 -0000 1.6 +++ src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java 16 Jan 2006 15:38:14 -0000 @@ -390,4 +390,8 @@ * found in the slideshow */ //public MetaSheet[] getMetaSheets() { return _msheets; } + + public Picture[] getPictures() throws IOException { + return _hslfSlideShow.getPictures(); + } }