aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarius Volkhart <mariusvolkhart@apache.org>2021-02-28 21:06:05 +0000
committerMarius Volkhart <mariusvolkhart@apache.org>2021-02-28 21:06:05 +0000
commit77ec895ee01e8213d0b9f36f4c05dc839648294f (patch)
treee2e7df320e2719f4d3555c20acf9232ff5feb2fb /src
parentc08763fad0b6a8d4c26c3f0577fd9553b5e00c2d (diff)
downloadpoi-77ec895ee01e8213d0b9f36f4c05dc839648294f.tar.gz
poi-77ec895ee01e8213d0b9f36f4c05dc839648294f.zip
Make picture loading in HWPF PicturesTable easier to understand
The recursion is no longer necessary due to the more defined structure of OfficeArtContent. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1887016 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/model/OfficeArtContent.java4
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java13
2 files changed, 7 insertions, 10 deletions
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/OfficeArtContent.java b/src/scratchpad/src/org/apache/poi/hwpf/model/OfficeArtContent.java
index 59a61596a7..2ea08f5ed1 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/model/OfficeArtContent.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/model/OfficeArtContent.java
@@ -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) {
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java
index b74c155806..e01f6ff0e1 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java
@@ -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)