diff options
author | Marius Volkhart <mariusvolkhart@apache.org> | 2021-02-28 19:40:23 +0000 |
---|---|---|
committer | Marius Volkhart <mariusvolkhart@apache.org> | 2021-02-28 19:40:23 +0000 |
commit | 5350121bfebfbca43b257761710afed233214116 (patch) | |
tree | 8061003fdf30d8919879c9ae067ff868ecb8445f /src | |
parent | b02866c2a7ec411d6fe05d3695415ef7000cdd86 (diff) | |
download | poi-5350121bfebfbca43b257761710afed233214116.tar.gz poi-5350121bfebfbca43b257761710afed233214116.zip |
Simplify OfficeArtContent#getBStoreContainer method
Due to the new structure of the class, we can be more specific about how we load the BStore.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1887011 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/scratchpad/src/org/apache/poi/hwpf/model/OfficeArtContent.java | 19 | ||||
-rw-r--r-- | src/scratchpad/src/org/apache/poi/hwpf/usermodel/OfficeDrawingsImpl.java | 6 |
2 files changed, 8 insertions, 17 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 4967c54518..59a61596a7 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/OfficeArtContent.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/OfficeArtContent.java @@ -121,7 +121,7 @@ public final class OfficeArtContent { return drawingGroupData.getChildRecords(); } - public List<? extends EscherContainerRecord> getDgContainers() { + private List<? extends EscherContainerRecord> getDgContainers() { List<EscherContainerRecord> dgContainers = new ArrayList<>(2); if (mainDocumentDgContainer != null) { dgContainers.add(mainDocumentDgContainer); @@ -132,18 +132,11 @@ public final class OfficeArtContent { return dgContainers; } - public List<? extends EscherContainerRecord> getBStoreContainers() - { - List<EscherContainerRecord> bStoreContainers = new ArrayList<>( - 1); - for ( EscherRecord escherRecord : drawingGroupData.getChildRecords() ) - { - if ( escherRecord.getRecordId() == (short) 0xF001 ) - { - bStoreContainers.add( (EscherContainerRecord) escherRecord ); - } - } - return bStoreContainers; + /** + * @return The {@link EscherRecordTypes#BSTORE_CONTAINER} or {@code null} if the document doesn't have one. + */ + public EscherContainerRecord getBStoreContainer() { + return drawingGroupData.getChildById(EscherRecordTypes.BSTORE_CONTAINER.typeID); } public List<? extends EscherContainerRecord> getSpgrContainers() diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/OfficeDrawingsImpl.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/OfficeDrawingsImpl.java index 0dcb38861b..253cc07536 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/OfficeDrawingsImpl.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/OfficeDrawingsImpl.java @@ -52,12 +52,10 @@ public class OfficeDrawingsImpl implements OfficeDrawings private EscherBlipRecord getBitmapRecord( int bitmapIndex ) { - List<? extends EscherContainerRecord> bContainers = officeArtContent - .getBStoreContainers(); - if ( bContainers == null || bContainers.size() != 1 ) + EscherContainerRecord bContainer = officeArtContent.getBStoreContainer(); + if (bContainer == null) return null; - EscherContainerRecord bContainer = bContainers.get( 0 ); final List<EscherRecord> bitmapRecords = bContainer.getChildRecords(); if ( bitmapRecords.size() < bitmapIndex ) |