diff options
author | Marius Volkhart <mariusvolkhart@apache.org> | 2021-02-28 19:18:13 +0000 |
---|---|---|
committer | Marius Volkhart <mariusvolkhart@apache.org> | 2021-02-28 19:18:13 +0000 |
commit | e7b9a5af131035551d5cea375b3927d085ff966a (patch) | |
tree | 0d3bc6928bcece492a76902ab9fadd5fbfb26796 /src | |
parent | 9c88bb220136cdeb1355c6f98d788271d701f718 (diff) | |
download | poi-e7b9a5af131035551d5cea375b3927d085ff966a.tar.gz poi-e7b9a5af131035551d5cea375b3927d085ff966a.zip |
Rename EscherRecordHolder to OfficeArtContent
While the class does indeed hold EscherRecords, due to recent refactoring it is much more structured now than it was before. The contents of the class now closely resemble the OfficeArtContent structure referenced in the MS-DOC spec. Naming the class after the specification structure makes it easier to find and understand.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1887009 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java | 18 | ||||
-rw-r--r-- | src/scratchpad/src/org/apache/poi/hwpf/dev/HWPFLister.java | 3 | ||||
-rw-r--r-- | src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java | 6 | ||||
-rw-r--r-- | src/scratchpad/src/org/apache/poi/hwpf/model/OfficeArtContent.java (renamed from src/scratchpad/src/org/apache/poi/hwpf/model/EscherRecordHolder.java) | 12 | ||||
-rw-r--r-- | src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java | 4 | ||||
-rw-r--r-- | src/scratchpad/src/org/apache/poi/hwpf/usermodel/OfficeDrawingsImpl.java | 14 |
6 files changed, 29 insertions, 28 deletions
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java b/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java index 3e1de7c0a7..6571c650af 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java @@ -31,7 +31,6 @@ import org.apache.poi.hwpf.model.BookmarksTables; import org.apache.poi.hwpf.model.CHPBinTable; import org.apache.poi.hwpf.model.ComplexFileTable; import org.apache.poi.hwpf.model.DocumentProperties; -import org.apache.poi.hwpf.model.EscherRecordHolder; import org.apache.poi.hwpf.model.FSPADocumentPart; import org.apache.poi.hwpf.model.FSPATable; import org.apache.poi.hwpf.model.FieldsTables; @@ -39,6 +38,7 @@ import org.apache.poi.hwpf.model.FontTable; import org.apache.poi.hwpf.model.ListTables; import org.apache.poi.hwpf.model.NoteType; import org.apache.poi.hwpf.model.NotesTables; +import org.apache.poi.hwpf.model.OfficeArtContent; import org.apache.poi.hwpf.model.PAPBinTable; import org.apache.poi.hwpf.model.PicturesTable; import org.apache.poi.hwpf.model.RevisionMarkAuthorTable; @@ -134,9 +134,9 @@ public final class HWPFDocument extends HWPFDocumentCore { private FSPATable _fspaMain; /** - * Escher Drawing Group information + * Office Art (Escher records) information */ - private EscherRecordHolder _escherRecordHolder; + private final OfficeArtContent officeArtContent; /** * Holds pictures table @@ -309,14 +309,14 @@ public final class HWPFDocument extends HWPFDocumentCore { FSPADocumentPart.HEADER); _fspaMain = new FSPATable(_tableStream, _fib, FSPADocumentPart.MAIN); - _escherRecordHolder = new EscherRecordHolder(_tableStream, _fib.getFcDggInfo(), _fib.getLcbDggInfo()); + officeArtContent = new OfficeArtContent(_tableStream, _fib.getFcDggInfo(), _fib.getLcbDggInfo()); // read in the pictures stream - _pictures = new PicturesTable(this, _dataStream, _mainStream, _fspaMain, _escherRecordHolder); + _pictures = new PicturesTable(this, _dataStream, _mainStream, _fspaMain, officeArtContent); // And escher pictures - _officeDrawingsHeaders = new OfficeDrawingsImpl(_fspaHeaders, _escherRecordHolder, _mainStream); - _officeDrawingsMain = new OfficeDrawingsImpl(_fspaMain, _escherRecordHolder, _mainStream); + _officeDrawingsHeaders = new OfficeDrawingsImpl(_fspaHeaders, officeArtContent, _mainStream); + _officeDrawingsMain = new OfficeDrawingsImpl(_fspaMain, officeArtContent, _mainStream); _st = new SectionTable(_mainStream, _tableStream, _fib.getFcPlcfsed(), _fib.getLcbPlcfsed(), fcMin, _tpt, _fib.getSubdocumentTextStreamLength(SubdocumentType.MAIN)); _ss = new StyleSheet(_tableStream, _fib.getFcStshf()); @@ -513,8 +513,8 @@ public final class HWPFDocument extends HWPFDocumentCore { } @Internal - public EscherRecordHolder getEscherRecordHolder() { - return _escherRecordHolder; + public OfficeArtContent getOfficeArtContent() { + return officeArtContent; } public OfficeDrawings getOfficeDrawingsHeaders() { diff --git a/src/scratchpad/src/org/apache/poi/hwpf/dev/HWPFLister.java b/src/scratchpad/src/org/apache/poi/hwpf/dev/HWPFLister.java index 0c8bcf5003..6d487487bc 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/dev/HWPFLister.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/dev/HWPFLister.java @@ -64,7 +64,6 @@ import org.apache.poi.poifs.filesystem.DirectoryEntry; import org.apache.poi.poifs.filesystem.Entry; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.util.Beta; -import org.apache.poi.util.IOUtils; import org.apache.poi.util.LittleEndian; /** @@ -367,7 +366,7 @@ public final class HWPFLister { return; } - System.out.println( ( (HWPFDocument) _doc ).getEscherRecordHolder() ); + System.out.println( ( (HWPFDocument) _doc ).getOfficeArtContent() ); } public void dumpFIB() { diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java b/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java index f002f3b0b9..e03c2962fa 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java @@ -1005,7 +1005,7 @@ public final class FileInformationBlock { } /** - * @return Offset in the Table Stream at which the {@link EscherRecordHolder} exists. + * @return Offset in the Table Stream at which the {@link OfficeArtContent} exists. */ public int getFcDggInfo() { @@ -1013,11 +1013,11 @@ public final class FileInformationBlock { } /** - * Returns the size, in bytes, of the {@link EscherRecordHolder} at the offset {@link #getFcDggInfo()}. + * Returns the size, in bytes, of the {@link OfficeArtContent} at the offset {@link #getFcDggInfo()}. * <p> * If {@code 0}, there MUST NOT be any drawings in the document. * - * @return Size, in bytes, of the {@link EscherRecordHolder} at the offset {@link #getFcDggInfo()}. + * @return Size, in bytes, of the {@link OfficeArtContent} at the offset {@link #getFcDggInfo()}. */ public int getLcbDggInfo() { diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/EscherRecordHolder.java b/src/scratchpad/src/org/apache/poi/hwpf/model/OfficeArtContent.java index 8d5c392860..4967c54518 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/EscherRecordHolder.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/OfficeArtContent.java @@ -31,12 +31,14 @@ import org.apache.poi.util.Internal; import static org.apache.logging.log4j.util.Unbox.box; /** - * Based on AbstractEscherRecordHolder from HSSF. + * Information about drawings in the document. + * <p> + * The {@code delay stream} referenced in {@code [MS-ODRAW]} is the {@code WordDocument} stream. * * @author Squeeself */ @Internal -public final class EscherRecordHolder { +public final class OfficeArtContent { /** * {@link EscherRecordTypes#DGG_CONTAINER} containing drawing group information for the document. @@ -59,7 +61,7 @@ public final class EscherRecordHolder { */ private EscherContainerRecord headerDocumentDgContainer; - public EscherRecordHolder(byte[] data, int offset, int size) { + public OfficeArtContent(byte[] data, int offset, int size) { fillEscherRecords(data, offset, size); } @@ -107,7 +109,7 @@ public final class EscherRecordHolder { headerDocumentDgContainer = dgContainer; break; default: - LogManager.getLogger(EscherRecordHolder.class).atWarn() + LogManager.getLogger(OfficeArtContent.class).atWarn() .log("dgglbl {} for OfficeArtWordDrawing is out of bounds [0, 1]", box(dgglbl)); } } @@ -180,7 +182,7 @@ public final class EscherRecordHolder { @Override public String toString() { - return "EscherRecordHolder{" + + return "OfficeArtContent{" + "drawingGroupData=" + drawingGroupData + ", mainDocumentDgContainer=" + mainDocumentDgContainer + ", headerDocumentDgContainer=" + headerDocumentDgContainer + 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 c5e8e0da78..b74c155806 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java @@ -72,7 +72,7 @@ public final class PicturesTable { @Deprecated private FSPATable _fspa; @Deprecated - private EscherRecordHolder _dgg; + private OfficeArtContent _dgg; /** @link dependency * @stereotype instantiate*/ @@ -84,7 +84,7 @@ public final class PicturesTable { * @param _dataStream */ @Deprecated - public PicturesTable(HWPFDocument _document, byte[] _dataStream, byte[] _mainStream, FSPATable fspa, EscherRecordHolder dgg) + public PicturesTable(HWPFDocument _document, byte[] _dataStream, byte[] _mainStream, FSPATable fspa, OfficeArtContent dgg) { this._document = _document; this._dataStream = _dataStream; 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 c71ed6cc7f..0dcb38861b 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/OfficeDrawingsImpl.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/OfficeDrawingsImpl.java @@ -32,27 +32,27 @@ import org.apache.poi.ddf.EscherRecordFactory; import org.apache.poi.ddf.EscherSimpleProperty; import org.apache.poi.ddf.EscherSpRecord; import org.apache.poi.ddf.EscherTertiaryOptRecord; -import org.apache.poi.hwpf.model.EscherRecordHolder; import org.apache.poi.hwpf.model.FSPA; import org.apache.poi.hwpf.model.FSPATable; +import org.apache.poi.hwpf.model.OfficeArtContent; public class OfficeDrawingsImpl implements OfficeDrawings { - private final EscherRecordHolder _escherRecordHolder; + private final OfficeArtContent officeArtContent; private final FSPATable _fspaTable; private final byte[] _mainStream; - public OfficeDrawingsImpl( FSPATable fspaTable, - EscherRecordHolder escherRecordHolder, byte[] mainStream ) + public OfficeDrawingsImpl(FSPATable fspaTable, + OfficeArtContent officeArtContent, byte[] mainStream ) { this._fspaTable = fspaTable; - this._escherRecordHolder = escherRecordHolder; + this.officeArtContent = officeArtContent; this._mainStream = mainStream; } private EscherBlipRecord getBitmapRecord( int bitmapIndex ) { - List<? extends EscherContainerRecord> bContainers = _escherRecordHolder + List<? extends EscherContainerRecord> bContainers = officeArtContent .getBStoreContainers(); if ( bContainers == null || bContainers.size() != 1 ) return null; @@ -105,7 +105,7 @@ public class OfficeDrawingsImpl implements OfficeDrawings private EscherContainerRecord getEscherShapeRecordContainer( final int shapeId ) { - for ( EscherContainerRecord spContainer : _escherRecordHolder + for ( EscherContainerRecord spContainer : officeArtContent .getSpContainers() ) { EscherSpRecord escherSpRecord = spContainer |