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
This commit is contained in:
Marius Volkhart 2021-02-28 19:40:23 +00:00
parent b02866c2a7
commit 5350121bfe
2 changed files with 8 additions and 17 deletions

View File

@ -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()

View File

@ -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 )