You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ma...@apache.org on 2021/02/28 21:06:05 UTC

svn commit: r1887016 - in /poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model: OfficeArtContent.java PicturesTable.java

Author: mariusvolkhart
Date: Sun Feb 28 21:06:05 2021
New Revision: 1887016

URL: http://svn.apache.org/viewvc?rev=1887016&view=rev
Log:
Make picture loading in HWPF PicturesTable easier to understand

The recursion is no longer necessary due to the more defined structure of OfficeArtContent.

Modified:
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OfficeArtContent.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OfficeArtContent.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OfficeArtContent.java?rev=1887016&r1=1887015&r2=1887016&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OfficeArtContent.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OfficeArtContent.java Sun Feb 28 21:06:05 2021
@@ -117,10 +117,6 @@ public final class OfficeArtContent {
 		assert pos == offset + size;
 	}
 
-	public List<EscherRecord> getEscherRecords() {
-		return drawingGroupData.getChildRecords();
-	}
-
     private List<? extends EscherContainerRecord> getDgContainers() {
         List<EscherContainerRecord> dgContainers = new ArrayList<>(2);
         if (mainDocumentDgContainer != null) {

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java?rev=1887016&r1=1887015&r2=1887016&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java Sun Feb 28 21:06:05 2021
@@ -26,6 +26,7 @@ import org.apache.logging.log4j.Logger;
 import org.apache.poi.ddf.DefaultEscherRecordFactory;
 import org.apache.poi.ddf.EscherBSERecord;
 import org.apache.poi.ddf.EscherBlipRecord;
+import org.apache.poi.ddf.EscherContainerRecord;
 import org.apache.poi.ddf.EscherRecord;
 import org.apache.poi.ddf.EscherRecordFactory;
 import org.apache.poi.hwpf.HWPFDocument;
@@ -166,7 +167,7 @@ public final class PicturesTable {
   }
 
   /**
-     * Performs a recursive search for pictures in the given list of escher records.
+     * Performs a search for pictures in the given list of escher records.
      *
      * @param escherRecords the escher records.
      * @param pictures the list to populate with the pictures.
@@ -205,9 +206,6 @@ public final class PicturesTable {
                     }
                 }
           }
-
-          // Recursive call.
-          searchForPictures(escherRecord.getChildRecords(), pictures);
        }
     }
 
@@ -234,9 +232,12 @@ public final class PicturesTable {
     	}
 	}
 
-    searchForPictures(_dgg.getEscherRecords(), pictures);
+      EscherContainerRecord bStore = _dgg.getBStoreContainer();
+      if (bStore != null) {
+          searchForPictures(bStore.getChildRecords(), pictures);
+      }
 
-    return pictures;
+      return pictures;
   }
 
   private boolean isBlockContainsImage(int i)



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org