]> source.dussan.org Git - poi.git/commitdiff
HSLF: support for uncompressed OLE embeddings
authorMaxim Valyanskiy <maxcom@apache.org>
Mon, 19 Sep 2011 12:06:58 +0000 (12:06 +0000)
committerMaxim Valyanskiy <maxcom@apache.org>
Mon, 19 Sep 2011 12:06:58 +0000 (12:06 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1172583 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/status.xml
src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java

index 69291355a91fcf5b6af2b8b4f0209ac4133799d8..bfcdf5aa4562c14175f583bc46844c283c1a0841 100644 (file)
@@ -47,6 +47,7 @@
            <action dev="poi-developers" type="add">XSLFPowerPointExtractor support for including comment authors with comment text</action>
            <action dev="poi-developers" type="fix">Converted XSLFPowerPointExtractor to use UserModel for all text extraction</action>
            <action dev="poi-developers" type="add">XSLF initial UserModel support for Notes and Comments for Slides</action>
+           <action dev="poi-developers" type="add">HSLF: support for uncompressed OLE embeddings</action>
         </release>
         <release version="3.8-beta4" date="2011-08-26">
            <action dev="poi-developers" type="fix">51678 - Extracting text from Bug51524.zip is slow</action>
index 4fee85ead1b784c16a97e1d7b76bf910bff82238..7e6a7593baffaff79001dd62b8b06d7e8d9f4627 100644 (file)
@@ -73,13 +73,21 @@ public class ExOleObjStg extends RecordAtom implements PositionDependentRecord,
         System.arraycopy(source,start+8,_data,0,len-8);
     }
 
+    public boolean isCompressed() {
+        return LittleEndian.getShort(_header, 0)!=0;
+    }
+
     /**
      * Gets the uncompressed length of the data.
      *
      * @return the uncompressed length of the data.
      */
     public int getDataLength() {
-        return LittleEndian.getInt(_data, 0);
+        if (isCompressed()) {
+            return LittleEndian.getInt(_data, 0);
+        } else {
+            return _data.length;
+        }
     }
 
     /**
@@ -88,8 +96,12 @@ public class ExOleObjStg extends RecordAtom implements PositionDependentRecord,
      * @return the data input stream.
      */
     public InputStream getData() {
-        InputStream compressedStream = new ByteArrayInputStream(_data, 4, _data.length);
-        return new InflaterInputStream(compressedStream);
+        if (isCompressed()) {
+            InputStream compressedStream = new ByteArrayInputStream(_data, 4, _data.length);
+            return new InflaterInputStream(compressedStream);
+        } else {
+            return new ByteArrayInputStream(_data, 0, _data.length);
+        }
     }
 
     public byte[] getRawData() {