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 19:18:13 UTC

svn commit: r1887009 - in /poi/trunk/src/scratchpad/src/org/apache/poi/hwpf: ./ dev/ model/ usermodel/

Author: mariusvolkhart
Date: Sun Feb 28 19:18:13 2021
New Revision: 1887009

URL: http://svn.apache.org/viewvc?rev=1887009&view=rev
Log:
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.

Added:
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OfficeArtContent.java
      - copied, changed from r1887008, poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/EscherRecordHolder.java
Removed:
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/EscherRecordHolder.java
Modified:
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/dev/HWPFLister.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/OfficeDrawingsImpl.java

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java?rev=1887009&r1=1887008&r2=1887009&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java Sun Feb 28 19:18:13 2021
@@ -31,7 +31,6 @@ import org.apache.poi.hwpf.model.Bookmar
 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.FontTab
 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
     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
                 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
     }
 
     @Internal
-    public EscherRecordHolder getEscherRecordHolder() {
-        return _escherRecordHolder;
+    public OfficeArtContent getOfficeArtContent() {
+        return officeArtContent;
     }
 
     public OfficeDrawings getOfficeDrawingsHeaders() {

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/dev/HWPFLister.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/dev/HWPFLister.java?rev=1887009&r1=1887008&r2=1887009&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/dev/HWPFLister.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/dev/HWPFLister.java Sun Feb 28 19:18:13 2021
@@ -64,7 +64,6 @@ import org.apache.poi.poifs.filesystem.D
 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() {

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java?rev=1887009&r1=1887008&r2=1887009&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java Sun Feb 28 19:18:13 2021
@@ -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()
     {

Copied: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OfficeArtContent.java (from r1887008, poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/EscherRecordHolder.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OfficeArtContent.java?p2=poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OfficeArtContent.java&p1=poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/EscherRecordHolder.java&r1=1887008&r2=1887009&rev=1887009&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/EscherRecordHolder.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OfficeArtContent.java Sun Feb 28 19:18:13 2021
@@ -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 +

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=1887009&r1=1887008&r2=1887009&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 19:18:13 2021
@@ -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;

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/OfficeDrawingsImpl.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/OfficeDrawingsImpl.java?rev=1887009&r1=1887008&r2=1887009&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/OfficeDrawingsImpl.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/OfficeDrawingsImpl.java Sun Feb 28 19:18:13 2021
@@ -32,27 +32,27 @@ import org.apache.poi.ddf.EscherRecordFa
 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 implemen
     private EscherContainerRecord getEscherShapeRecordContainer(
             final int shapeId )
     {
-        for ( EscherContainerRecord spContainer : _escherRecordHolder
+        for ( EscherContainerRecord spContainer : officeArtContent
                 .getSpContainers() )
         {
             EscherSpRecord escherSpRecord = spContainer



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