diff --git a/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java b/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java
index 79e28bf5a..f12896a14 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java
@@ -36,6 +36,7 @@ import org.apache.poi.hpsf.DocumentSummaryInformation;
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,34 @@ public class HSLFSlideShow
* 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()]);
+ }
}
diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/Picture.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/Picture.java
new file mode 100644
index 000000000..64caff7fa
--- /dev/null
+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/Picture.java
@@ -0,0 +1,140 @@
+/* ====================================================================
+ Copyright 2002-2004 Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+package org.apache.poi.hslf.usermodel;
+
+import org.apache.poi.util.LittleEndian;
+
+/**
+ * Represents a picture in a PowerPoint document.
+ *
+ * The information about an image in PowerPoint document is stored in + * two places: + *
+ * Data in the "Pictures" OLE stream is organized as follows:
+ * For each image there is an entry: 25 byte header + image data.
+ * Image data is the exact content of the JPEG file, i.e. PowerPoint
+ * puts the whole jpeg file there without any modifications.
+ * Header format:
+ *