You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2019/09/11 21:24:08 UTC
svn commit: r1866808 [4/7] - in /poi: site/src/documentation/content/xdocs/
trunk/src/java/org/apache/poi/common/usermodel/
trunk/src/java/org/apache/poi/common/usermodel/fonts/
trunk/src/java/org/apache/poi/ddf/ trunk/src/java/org/apache/poi/hssf/user...
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hemf/record/emfplus/HemfPlusRegion.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hemf/record/emfplus/HemfPlusRegion.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hemf/record/emfplus/HemfPlusRegion.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hemf/record/emfplus/HemfPlusRegion.java Wed Sep 11 21:24:06 2019
@@ -22,14 +22,17 @@ import static org.apache.poi.hemf.record
import java.awt.geom.Rectangle2D;
import java.io.IOException;
import java.util.List;
+import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Supplier;
+import org.apache.poi.common.usermodel.GenericRecord;
import org.apache.poi.hemf.draw.HemfGraphics;
import org.apache.poi.hemf.record.emfplus.HemfPlusHeader.EmfPlusGraphicsVersion;
import org.apache.poi.hemf.record.emfplus.HemfPlusObject.EmfPlusObjectData;
import org.apache.poi.hemf.record.emfplus.HemfPlusObject.EmfPlusObjectType;
import org.apache.poi.hemf.record.emfplus.HemfPlusPath.EmfPlusPath;
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.LittleEndianInputStream;
@@ -122,10 +125,23 @@ public class HemfPlusRegion {
public EmfPlusGraphicsVersion getGraphicsVersion() {
return graphicsVersion;
}
+
+ @Override
+ public EmfPlusObjectType getGenericRecordType() {
+ return EmfPlusObjectType.REGION;
+ }
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "graphicsVersion", this::getGraphicsVersion,
+ "regionNode", () -> regionNode
+ );
+ }
}
- public interface EmfPlusRegionNodeData {
+ public interface EmfPlusRegionNodeData extends GenericRecord {
long init(LittleEndianInputStream leis) throws IOException;
}
@@ -141,6 +157,11 @@ public class HemfPlusRegion {
public long init(LittleEndianInputStream leis) throws IOException {
return 0;
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return null;
+ }
}
public static class EmfPlusRegionEmpty implements EmfPlusRegionNodeData {
@@ -148,6 +169,11 @@ public class HemfPlusRegion {
public long init(LittleEndianInputStream leis) throws IOException {
return 0;
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return null;
+ }
}
public static class EmfPlusRegionRect implements EmfPlusRegionNodeData {
@@ -157,6 +183,11 @@ public class HemfPlusRegion {
public long init(LittleEndianInputStream leis) {
return readRectF(leis, rect);
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties("rect", () -> rect);
+ }
}
public static class EmfPlusRegionNode implements EmfPlusRegionNodeData {
@@ -168,8 +199,15 @@ public class HemfPlusRegion {
size += readNode(leis, n -> right = n);
return size;
}
- }
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "left", () -> left,
+ "right", () -> right
+ );
+ }
+ }
private static long readNode(LittleEndianInputStream leis, Consumer<EmfPlusRegionNodeData> con) throws IOException {
// A 32-bit unsigned integer that specifies the type of data in the RegionNodeData field.
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hemf/record/emfplus/UnimplementedHemfPlusRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hemf/record/emfplus/UnimplementedHemfPlusRecord.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hemf/record/emfplus/UnimplementedHemfPlusRecord.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hemf/record/emfplus/UnimplementedHemfPlusRecord.java Wed Sep 11 21:24:06 2019
@@ -19,7 +19,10 @@ package org.apache.poi.hemf.record.emfpl
import java.io.IOException;
+import java.util.Map;
+import java.util.function.Supplier;
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndianInputStream;
@@ -56,4 +59,12 @@ public class UnimplementedHemfPlusRecord
//should probably defensively return a copy.
return recordBytes;
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "flags", this::getFlags,
+ "recordBytes", () -> recordBytes
+ );
+ }
}
\ No newline at end of file
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hemf/usermodel/HemfPicture.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hemf/usermodel/HemfPicture.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hemf/usermodel/HemfPicture.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hemf/usermodel/HemfPicture.java Wed Sep 11 21:24:06 2019
@@ -30,9 +30,12 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Spliterator;
import java.util.function.Consumer;
+import java.util.function.Supplier;
+import org.apache.poi.common.usermodel.GenericRecord;
import org.apache.poi.hemf.draw.HemfDrawProperties;
import org.apache.poi.hemf.draw.HemfGraphics;
import org.apache.poi.hemf.record.emf.HemfHeader;
@@ -49,7 +52,7 @@ import org.apache.poi.util.Units;
* Read-only EMF extractor. Lots remain
*/
@Internal
-public class HemfPicture implements Iterable<HemfRecord> {
+public class HemfPicture implements Iterable<HemfRecord>, GenericRecord {
private final LittleEndianInputStream stream;
private final List<HemfRecord> records = new ArrayList<>();
private boolean isParsed = false;
@@ -179,4 +182,14 @@ public class HemfPicture implements Iter
public Iterable<HwmfEmbedded> getEmbeddings() {
return () -> new HemfEmbeddedIterator(HemfPicture.this);
}
+
+ @Override
+ public List<? extends GenericRecord> getGenericChildren() {
+ return getRecords();
+ }
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return null;
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/BitMaskTextProp.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/BitMaskTextProp.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/BitMaskTextProp.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/BitMaskTextProp.java Wed Sep 11 21:24:06 2019
@@ -17,6 +17,12 @@
package org.apache.poi.hslf.model.textproperties;
+import static org.apache.poi.util.GenericRecordUtil.getBitsAsString;
+
+import java.util.Map;
+import java.util.function.Supplier;
+
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
@@ -178,5 +184,13 @@ public abstract class BitMaskTextProp ex
public BitMaskTextProp cloneAll(){
return (BitMaskTextProp)super.clone();
- }
+ }
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "base", super::getGenericProperties,
+ "flags", getBitsAsString(this::getValue, subPropMasks, subPropNames)
+ );
+ }
}
\ No newline at end of file
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/FontAlignmentProp.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/FontAlignmentProp.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/FontAlignmentProp.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/FontAlignmentProp.java Wed Sep 11 21:24:06 2019
@@ -17,6 +17,12 @@
package org.apache.poi.hslf.model.textproperties;
+import java.util.Map;
+import java.util.function.Supplier;
+
+import org.apache.poi.sl.usermodel.TextParagraph.FontAlign;
+import org.apache.poi.util.GenericRecordUtil;
+
/**
* Definition for the font alignment property.
*/
@@ -30,4 +36,27 @@ public class FontAlignmentProp extends T
public FontAlignmentProp() {
super(2, 0x10000, NAME);
}
+
+ public FontAlign getFontAlign() {
+ switch (getValue()) {
+ default:
+ return FontAlign.AUTO;
+ case BASELINE:
+ return FontAlign.BASELINE;
+ case TOP:
+ return FontAlign.TOP;
+ case CENTER:
+ return FontAlign.CENTER;
+ case BOTTOM:
+ return FontAlign.BOTTOM;
+ }
+ }
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "base", super::getGenericProperties,
+ "fontAlign", this::getFontAlign
+ );
+ }
}
\ No newline at end of file
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStop.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStop.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStop.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStop.java Wed Sep 11 21:24:06 2019
@@ -17,12 +17,17 @@
package org.apache.poi.hslf.model.textproperties;
+import java.util.Map;
+import java.util.function.Supplier;
+
+import org.apache.poi.common.usermodel.GenericRecord;
import org.apache.poi.sl.usermodel.TabStop;
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.Internal;
import org.apache.poi.util.Units;
@Internal
-public class HSLFTabStop implements TabStop, Cloneable {
+public class HSLFTabStop implements TabStop, Cloneable, GenericRecord {
/**
* A signed integer that specifies an offset, in master units, of the tab stop.
*
@@ -113,4 +118,12 @@ public class HSLFTabStop implements TabS
public String toString() {
return type + " @ " + position;
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "type", this::getType,
+ "position", this::getPosition
+ );
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStopPropCollection.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStopPropCollection.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStopPropCollection.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStopPropCollection.java Wed Sep 11 21:24:06 2019
@@ -20,8 +20,11 @@ package org.apache.poi.hslf.model.textpr
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
+import java.util.function.Supplier;
import org.apache.poi.sl.usermodel.TabStop.TabStopType;
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndianByteArrayInputStream;
import org.apache.poi.util.LittleEndianConsts;
@@ -150,5 +153,13 @@ public class HSLFTabStopPropCollection e
return sb.toString();
}
-
+
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "base", super::getGenericProperties,
+ "tabStops", this::getTabStops
+ );
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/IndentProp.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/IndentProp.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/IndentProp.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/IndentProp.java Wed Sep 11 21:24:06 2019
@@ -17,7 +17,12 @@
package org.apache.poi.hslf.model.textproperties;
+import java.util.Map;
+import java.util.function.Supplier;
+
+import org.apache.poi.common.usermodel.GenericRecord;
import org.apache.poi.hslf.record.TxMasterStyleAtom;
+import org.apache.poi.util.GenericRecordUtil;
/**
* Definition of the indent level of some text. Defines how many
@@ -25,7 +30,7 @@ import org.apache.poi.hslf.record.TxMast
*
* This is defined by the slightly confusingly named MasterTextPropRun
*/
-public class IndentProp {
+public class IndentProp implements GenericRecord {
private int charactersCovered;
private short indentLevel;
@@ -62,4 +67,12 @@ public class IndentProp {
public void updateTextSize(int textSize) {
charactersCovered = textSize;
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "charactersCovered", this::getCharactersCovered,
+ "indentLevel", this::getIndentLevel
+ );
+ }
}
\ No newline at end of file
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextAlignmentProp.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextAlignmentProp.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextAlignmentProp.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextAlignmentProp.java Wed Sep 11 21:24:06 2019
@@ -17,6 +17,12 @@
package org.apache.poi.hslf.model.textproperties;
+import java.util.Map;
+import java.util.function.Supplier;
+
+import org.apache.poi.sl.usermodel.TextParagraph.TextAlign;
+import org.apache.poi.util.GenericRecordUtil;
+
/**
* Definition for the text alignment property.
*/
@@ -63,4 +69,30 @@ public class TextAlignmentProp extends T
public TextAlignmentProp() {
super(2, 0x800, "alignment");
}
+
+ public TextAlign getTextAlign() {
+ switch (getValue()) {
+ default:
+ case LEFT:
+ return TextAlign.LEFT;
+ case CENTER:
+ return TextAlign.CENTER;
+ case RIGHT:
+ return TextAlign.RIGHT;
+ case JUSTIFY:
+ return TextAlign.JUSTIFY;
+ case DISTRIBUTED:
+ return TextAlign.DIST;
+ case THAIDISTRIBUTED:
+ return TextAlign.THAI_DIST;
+ }
+ }
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "base", super::getGenericProperties,
+ "textAlign", this::getTextAlign
+ );
+ }
}
\ No newline at end of file
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPFException9.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPFException9.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPFException9.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPFException9.java Wed Sep 11 21:24:06 2019
@@ -21,7 +21,12 @@
*/
package org.apache.poi.hslf.model.textproperties;
+import java.util.Map;
+import java.util.function.Supplier;
+
+import org.apache.poi.common.usermodel.GenericRecord;
import org.apache.poi.sl.usermodel.AutoNumberingScheme;
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.LittleEndian;
/**
@@ -34,7 +39,11 @@ import org.apache.poi.util.LittleEndian;
* @author Alex Nikiforov [mailto:anikif@gmail.com]
*
*/
-public class TextPFException9 {
+public class TextPFException9 implements GenericRecord {
+
+ private final static AutoNumberingScheme DEFAULT_AUTONUMBER_SCHEME = AutoNumberingScheme.arabicPeriod;
+ private final static Short DEFAULT_START_NUMBER = 1;
+
//private final byte mask1;
//private final byte mask2;
private final byte mask3;
@@ -42,9 +51,7 @@ public class TextPFException9 {
private final Short bulletBlipRef;
private final Short fBulletHasAutoNumber;
private final AutoNumberingScheme autoNumberScheme;
- private final static AutoNumberingScheme DEFAULT_AUTONUMBER_SHEME = AutoNumberingScheme.arabicPeriod;
private final Short autoNumberStartNumber;
- private final static Short DEFAULT_START_NUMBER = 1;
private final int recordLength;
public TextPFException9(final byte[] source, final int startIndex) { // NOSONAR
//this.mask1 = source[startIndex];
@@ -86,23 +93,24 @@ public class TextPFException9 {
return fBulletHasAutoNumber;
}
public AutoNumberingScheme getAutoNumberScheme() {
- if (null != this.autoNumberScheme) {
- return this.autoNumberScheme;
- }
- if (null != this.fBulletHasAutoNumber && 1 == this.fBulletHasAutoNumber.shortValue()) {
- return DEFAULT_AUTONUMBER_SHEME;
+ if (autoNumberScheme != null) {
+ return autoNumberScheme;
}
- return null;
+ return hasBulletAutoNumber() ? DEFAULT_AUTONUMBER_SCHEME : null;
}
+
public Short getAutoNumberStartNumber() {
- if (null != this.autoNumberStartNumber) {
- return this.autoNumberStartNumber;
+ if (autoNumberStartNumber != null) {
+ return autoNumberStartNumber;
}
- if (null != this.fBulletHasAutoNumber && 1 == this.fBulletHasAutoNumber.shortValue()) {
- return DEFAULT_START_NUMBER;
- }
- return null;
+ return hasBulletAutoNumber() ? DEFAULT_START_NUMBER : null;
+ }
+
+ private boolean hasBulletAutoNumber() {
+ final Short one = 1;
+ return one.equals(fBulletHasAutoNumber);
}
+
public int getRecordLength() {
return recordLength;
}
@@ -115,4 +123,14 @@ public class TextPFException9 {
sb.append("autoNumberStartNumber: ").append(this.autoNumberStartNumber).append("\n");
return sb.toString();
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "bulletBlipRef", this::getBulletBlipRef,
+ "bulletHasAutoNumber", this::hasBulletAutoNumber,
+ "autoNumberScheme", this::getAutoNumberScheme,
+ "autoNumberStartNumber", this::getAutoNumberStartNumber
+ );
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextProp.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextProp.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextProp.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextProp.java Wed Sep 11 21:24:06 2019
@@ -18,6 +18,11 @@
package org.apache.poi.hslf.model.textproperties;
import java.util.Locale;
+import java.util.Map;
+import java.util.function.Supplier;
+
+import org.apache.poi.common.usermodel.GenericRecord;
+import org.apache.poi.util.GenericRecordUtil;
/**
* Definition of a property of some text, or its paragraph. Defines
@@ -30,7 +35,7 @@ import java.util.Locale;
* TxMasterTextProps, the definitions of the standard
* TextProps is stored in the different record classes
*/
-public class TextProp implements Cloneable {
+public class TextProp implements Cloneable, GenericRecord {
private int sizeOfDataBlock; // Number of bytes the data part uses
private String propName;
private int dataValue;
@@ -152,4 +157,14 @@ public class TextProp implements Cloneab
}
return String.format(Locale.ROOT, "%s = %d (%0#"+len+"X mask / %d bytes)", getName(), getValue(), getMask(), getSize());
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "sizeOfDataBlock", this::getSize,
+ "propName", this::getName,
+ "dataValue", this::getValue,
+ "maskInHeader", this::getMask
+ );
+ }
}
\ No newline at end of file
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPropCollection.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPropCollection.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPropCollection.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPropCollection.java Wed Sep 11 21:24:06 2019
@@ -21,10 +21,14 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.function.Supplier;
+import org.apache.poi.common.usermodel.GenericRecord;
import org.apache.poi.hslf.exceptions.HSLFException;
import org.apache.poi.hslf.record.StyleTextPropAtom;
import org.apache.poi.util.HexDump;
@@ -38,7 +42,7 @@ import org.apache.poi.util.POILogger;
* Used to hold the number of characters affected, the list of active
* properties, and the indent level if required.
*/
-public class TextPropCollection {
+public class TextPropCollection implements GenericRecord {
private static final POILogger LOG = POILogFactory.getLogger(TextPropCollection.class);
/** All the different kinds of paragraph properties we might handle */
@@ -393,4 +397,15 @@ public class TextPropCollection {
return out.toString();
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ Map<String,Supplier<?>> m = new LinkedHashMap<>();
+ m.put("charactersCovered", this::getCharactersCovered);
+ m.put("indentLevel", this::getIndentLevel);
+ textProps.forEach((s,t) -> m.put(s, () -> t));
+ m.put("maskSpecial", this::getSpecialMask);
+ m.put("textPropType", this::getTextPropType);
+ return Collections.unmodifiableMap(m);
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/AnimationInfoAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/AnimationInfoAtom.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/AnimationInfoAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/AnimationInfoAtom.java Wed Sep 11 21:24:06 2019
@@ -17,9 +17,14 @@
package org.apache.poi.hslf.record;
+import static org.apache.poi.util.GenericRecordUtil.getBitsAsString;
+
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Map;
+import java.util.function.Supplier;
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndian;
@@ -36,35 +41,57 @@ public final class AnimationInfoAtom ext
/**
* whether the animation plays in the reverse direction
*/
- public static final int Reverse = 1;
+ public static final int Reverse = 0x0001;
/**
* whether the animation starts automatically
*/
- public static final int Automatic = 4;
+ public static final int Automatic = 0x0004;
/**
* whether the animation has an associated sound
*/
- public static final int Sound = 16;
+ public static final int Sound = 0x0010;
/**
* whether all playing sounds are stopped when this animation begins
*/
- public static final int StopSound = 64;
+ public static final int StopSound = 0x0040;
/**
* whether an associated sound, media or action verb is activated when the shape is clicked.
*/
- public static final int Play = 256;
+ public static final int Play = 0x0100;
/**
* specifies that the animation, while playing, stops other slide show actions.
*/
- public static final int Synchronous = 1024;
+ public static final int Synchronous = 0x0400;
/**
* whether the shape is hidden while the animation is not playing
*/
- public static final int Hide = 4096;
+ public static final int Hide = 0x1000;
/**
* whether the background of the shape is animated
*/
- public static final int AnimateBg = 16384;
+ public static final int AnimateBg = 0x4000;
+
+ private static final int[] FLAGS_MASKS = {
+ Reverse,
+ Automatic,
+ Sound,
+ StopSound,
+ Play,
+ Synchronous,
+ Hide,
+ AnimateBg
+ };
+
+ private static final String[] FLAGS_NAMES = {
+ "REVERSE",
+ "AUTOMATIC",
+ "SOUND",
+ "STOP_SOUND",
+ "PLAY",
+ "SYNCHRONOUS",
+ "HIDE",
+ "ANIMATE_BG"
+ };
/**
* Record header.
@@ -275,4 +302,15 @@ public final class AnimationInfoAtom ext
return buf.toString();
}
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "dimColor", this::getDimColor,
+ "flags", getBitsAsString(this::getMask, FLAGS_MASKS, FLAGS_NAMES),
+ "soundIdRef", this::getSoundIdRef,
+ "delayTime", this::getDelayTime,
+ "orderID", this::getOrderID,
+ "slideCount", this::getSlideCount
+ );
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/CString.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/CString.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/CString.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/CString.java Wed Sep 11 21:24:06 2019
@@ -19,7 +19,10 @@ package org.apache.poi.hslf.record;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Map;
+import java.util.function.Supplier;
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.StringUtil;
@@ -38,7 +41,6 @@ public final class CString extends Recor
private static final int MAX_RECORD_LENGTH = 1_000_000;
private byte[] _header;
- private static long _type = 4026l;
/** The bytes that make up the text */
private byte[] _text;
@@ -104,7 +106,9 @@ public final class CString extends Recor
/**
* We are of type 4026
*/
- public long getRecordType() { return _type; }
+ public long getRecordType() {
+ return RecordTypes.CString.typeID;
+ }
/**
* Write the contents of the record back, so it can be written
@@ -125,4 +129,9 @@ public final class CString extends Recor
public String toString() {
return getText();
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties("text", this::getText);
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ColorSchemeAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ColorSchemeAtom.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ColorSchemeAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ColorSchemeAtom.java Wed Sep 11 21:24:06 2019
@@ -20,6 +20,10 @@ package org.apache.poi.hslf.record;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.function.Supplier;
import org.apache.poi.hslf.exceptions.HSLFException;
import org.apache.poi.util.LittleEndian;
@@ -217,4 +221,18 @@ public final class ColorSchemeAtom exten
fillsColourRGB, accentColourRGB, accentAndHyperlinkColourRGB, accentAndFollowingHyperlinkColourRGB};
return clr[idx];
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ final Map<String, Supplier<?>> m = new LinkedHashMap<>();
+ m.put("backgroundColourRGB", this::getBackgroundColourRGB);
+ m.put("textAndLinesColourRGB", this::getTextAndLinesColourRGB);
+ m.put("shadowsColourRGB", this::getShadowsColourRGB);
+ m.put("titleTextColourRGB", this::getTitleTextColourRGB);
+ m.put("fillsColourRGB", this::getFillsColourRGB);
+ m.put("accentColourRGB", this::getAccentColourRGB);
+ m.put("accentAndHyperlinkColourRGB", this::getAccentAndHyperlinkColourRGB);
+ m.put("accentAndFollowingHyperlinkColourRGB", this::getAccentAndFollowingHyperlinkColourRGB);
+ return Collections.unmodifiableMap(m);
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000.java Wed Sep 11 21:24:06 2019
@@ -30,7 +30,7 @@ import org.apache.poi.util.POILogger;
*/
public final class Comment2000 extends RecordContainer {
private byte[] _header;
- private static long _type = 12000;
+ private static final long _type = RecordTypes.Comment2000.typeID;
// Links to our more interesting children
@@ -172,5 +172,4 @@ public final class Comment2000 extends R
public void writeOut(OutputStream out) throws IOException {
writeOut(_header[0],_header[1],_type,_children,out);
}
-
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000Atom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000Atom.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000Atom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000Atom.java Wed Sep 11 21:24:06 2019
@@ -20,8 +20,11 @@ package org.apache.poi.hslf.record;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Date;
+import java.util.Map;
+import java.util.function.Supplier;
import org.apache.poi.hslf.util.SystemTimeUtils;
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndian;
@@ -158,4 +161,14 @@ public final class Comment2000Atom exten
out.write(_header);
out.write(_data);
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "number", this::getNumber,
+ "date", this::getDate,
+ "xOffset", this::getXOffset,
+ "yOffset", this::getYOffset
+ );
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DocInfoListContainer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DocInfoListContainer.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DocInfoListContainer.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DocInfoListContainer.java Wed Sep 11 21:24:06 2019
@@ -19,6 +19,8 @@ package org.apache.poi.hslf.record;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Map;
+import java.util.function.Supplier;
import org.apache.poi.util.LittleEndian;
@@ -27,7 +29,7 @@ import org.apache.poi.util.LittleEndian;
*/
public final class DocInfoListContainer extends RecordContainer {
private byte[] _header;
- private static long _type = RecordTypes.List.typeID;
+ private static final long _type = RecordTypes.List.typeID;
// Links to our more interesting children
@@ -81,4 +83,8 @@ public final class DocInfoListContainer
writeOut(_header[0],_header[1],_type,_children,out);
}
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return null;
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DocumentAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DocumentAtom.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DocumentAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DocumentAtom.java Wed Sep 11 21:24:06 2019
@@ -19,9 +19,14 @@ package org.apache.poi.hslf.record;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.function.Supplier;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndianByteArrayInputStream;
+import org.apache.poi.util.Removal;
/**
* A Document Atom (type 1001). Holds misc information on the PowerPoint
@@ -29,11 +34,37 @@ import org.apache.poi.util.LittleEndianB
*/
@SuppressWarnings({"WeakerAccess", "unused"})
-public final class DocumentAtom extends RecordAtom
-{
+public final class DocumentAtom extends RecordAtom {
+
+ /**
+ * Holds the different Slide Size values
+ */
+ public enum SlideSize {
+ /** Slide size ratio is consistent with a computer screen. */
+ ON_SCREEN,
+ /** Slide size ratio is consistent with letter paper. */
+ LETTER_SIZED_PAPER,
+ /** Slide size ratio is consistent with A4 paper. */
+ A4_SIZED_PAPER,
+ /** Slide size ratio is consistent with 35mm photo slides. */
+ ON_35MM,
+ /** Slide size ratio is consistent with overhead projector slides. */
+ OVERHEAD,
+ /** Slide size ratio is consistent with a banner. */
+ BANNER,
+ /**
+ * Slide size ratio that is not consistent with any of the other specified slide sizes in
+ * this enumeration.
+ */
+ CUSTOM
+ }
+
+
//arbitrarily selected; may need to increase
private static final int MAX_RECORD_LENGTH = 1_000_000;
+
+
private final byte[] _header = new byte[8];
private static long _type = RecordTypes.DocumentAtom.typeID;
@@ -79,9 +110,22 @@ public final class DocumentAtom extends
public int getFirstSlideNum() { return firstSlideNum; }
- /** The Size of the Document's slides, @see DocumentAtom.SlideSize for values */
+ /**
+ * The Size of the Document's slides, @see DocumentAtom.SlideSize for values
+ * @deprecated to be replaced by enum
+ */
+ @Deprecated
+ @Removal(version = "5.0.0")
public int getSlideSizeType() { return slideSizeType; }
+ public SlideSize getSlideSizeTypeEnum() {
+ return SlideSize.values()[slideSizeType];
+ }
+
+ public void setSlideSize(SlideSize size) {
+ slideSizeType = size.ordinal();
+ }
+
/** Was the document saved with True Type fonts embeded? */
public boolean getSaveWithFonts() {
return saveWithFonts != 0;
@@ -191,16 +235,23 @@ public final class DocumentAtom extends
out.write(reserved);
}
- /**
- * Holds the different Slide Size values
- */
- public static final class SlideSize {
- public static final int ON_SCREEN = 0;
- public static final int LETTER_SIZED_PAPER = 1;
- public static final int A4_SIZED_PAPER = 2;
- public static final int ON_35MM = 3;
- public static final int OVERHEAD = 4;
- public static final int BANNER = 5;
- public static final int CUSTOM = 6;
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ final Map<String, Supplier<?>> m = new LinkedHashMap<>();
+ m.put("slideSizeX", this::getSlideSizeX);
+ m.put("slideSizeY", this::getSlideSizeY);
+ m.put("notesSizeX", this::getNotesSizeX);
+ m.put("notesSizeY", this::getNotesSizeY);
+ m.put("serverZoomFrom", this::getServerZoomFrom);
+ m.put("serverZoomTo", this::getServerZoomTo);
+ m.put("notesMasterPersist", this::getNotesMasterPersist);
+ m.put("handoutMasterPersist", this::getHandoutMasterPersist);
+ m.put("firstSlideNum", this::getFirstSlideNum);
+ m.put("slideSize", this::getSlideSizeTypeEnum);
+ m.put("saveWithFonts", this::getSaveWithFonts);
+ m.put("omitTitlePlace", this::getOmitTitlePlace);
+ m.put("rightToLeft", this::getRightToLeft);
+ m.put("showComments", this::getShowComments);
+ return Collections.unmodifiableMap(m);
}
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DocumentEncryptionAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DocumentEncryptionAtom.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DocumentEncryptionAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DocumentEncryptionAtom.java Wed Sep 11 21:24:06 2019
@@ -21,6 +21,7 @@ import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Map;
+import java.util.function.Supplier;
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.poifs.crypt.CipherAlgorithm;
@@ -29,6 +30,7 @@ import org.apache.poi.poifs.crypt.Encryp
import org.apache.poi.poifs.crypt.HashAlgorithm;
import org.apache.poi.poifs.crypt.cryptoapi.CryptoAPIEncryptionHeader;
import org.apache.poi.poifs.crypt.cryptoapi.CryptoAPIEncryptionVerifier;
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianByteArrayOutputStream;
import org.apache.poi.util.LittleEndianInputStream;
@@ -40,7 +42,7 @@ import org.apache.poi.util.LittleEndianI
* @author Nick Burch
*/
public final class DocumentEncryptionAtom extends PositionDependentRecordAtom {
- private static final long _type = 12052l;
+ private static final long _type = RecordTypes.DocumentEncryptionAtom.typeID;
private final byte[] _header;
private EncryptionInfo ei;
@@ -132,4 +134,11 @@ public final class DocumentEncryptionAto
public void updateOtherRecordReferences(Map<Integer,Integer> oldToNewReferencesLookup) {
// nothing to update
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "encryptionInfo", this::getEncryptionInfo
+ );
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/EscherPlaceholder.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/EscherPlaceholder.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/EscherPlaceholder.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/EscherPlaceholder.java Wed Sep 11 21:24:06 2019
@@ -17,9 +17,13 @@
package org.apache.poi.hslf.record;
+import java.util.Map;
+import java.util.function.Supplier;
+
import org.apache.poi.ddf.EscherRecord;
import org.apache.poi.ddf.EscherRecordFactory;
import org.apache.poi.ddf.EscherSerializationListener;
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.LittleEndian;
/**
@@ -77,6 +81,18 @@ public class EscherPlaceholder extends E
return "ClientTextboxPlaceholder";
}
+ public int getPosition() {
+ return position;
+ }
+
+ public byte getPlacementId() {
+ return placementId;
+ }
+
+ public byte getSize() {
+ return size;
+ }
+
@Override
protected Object[][] getAttributeMap() {
return new Object[][] {
@@ -86,4 +102,19 @@ public class EscherPlaceholder extends E
{ "unused", unused }
};
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "base", super::getGenericProperties,
+ "position", this::getPosition,
+ "placementId", this::getPlacementId,
+ "size", this::getSize
+ );
+ }
+
+ @Override
+ public Enum getGenericRecordType() {
+ return RecordTypes.OEPlaceholderAtom;
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/EscherTextboxWrapper.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/EscherTextboxWrapper.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/EscherTextboxWrapper.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/EscherTextboxWrapper.java Wed Sep 11 21:24:06 2019
@@ -17,11 +17,14 @@
package org.apache.poi.hslf.record;
-import org.apache.poi.ddf.*;
-
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
-import java.io.ByteArrayOutputStream;
+import java.util.Map;
+import java.util.function.Supplier;
+
+import org.apache.poi.ddf.EscherTextboxRecord;
+import org.apache.poi.util.GenericRecordUtil;
/**
* A wrapper around a DDF (Escher) EscherTextbox Record. Causes the DDF
@@ -118,4 +121,12 @@ public final class EscherTextboxWrapper
public StyleTextProp9Atom getStyleTextProp9Atom() {
return this.styleTextProp9Atom;
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "shapeId", this::getShapeId,
+ "escherRecord", this::getEscherRecord
+ );
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExControlAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExControlAtom.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExControlAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExControlAtom.java Wed Sep 11 21:24:06 2019
@@ -19,7 +19,10 @@ package org.apache.poi.hslf.record;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Map;
+import java.util.function.Supplier;
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.LittleEndian;
/**
@@ -114,4 +117,8 @@ public final class ExControlAtom extends
out.write(data);
}
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties("slideId", this::getSlideId);
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExEmbedAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExEmbedAtom.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExEmbedAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExEmbedAtom.java Wed Sep 11 21:24:06 2019
@@ -19,7 +19,10 @@ package org.apache.poi.hslf.record;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Map;
+import java.util.function.Supplier;
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndian;
@@ -166,4 +169,25 @@ public class ExEmbedAtom extends RecordA
out.write(_data);
}
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "followColorScheme", this::getFollowColorSchemeString,
+ "cantLockServer", this::getCantLockServerB,
+ "noSizeToServer", this::getNoSizeToServerB,
+ "isTable", this::getIsTable
+ );
+ }
+
+ private String getFollowColorSchemeString() {
+ switch (getFollowColorScheme()) {
+ default:
+ case DOES_NOT_FOLLOW_COLOR_SCHEME:
+ return "DOES_NOT_FOLLOW_COLOR_SCHEME";
+ case FOLLOWS_ENTIRE_COLOR_SCHEME:
+ return "FOLLOWS_ENTIRE_COLOR_SCHEME";
+ case FOLLOWS_TEXT_AND_BACKGROUND_SCHEME:
+ return "FOLLOWS_TEXT_AND_BACKGROUND_SCHEME";
+ }
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlink.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlink.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlink.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlink.java Wed Sep 11 21:24:06 2019
@@ -27,9 +27,10 @@ import org.apache.poi.util.POILogger;
* @author Nick Burch
*/
public class ExHyperlink extends RecordContainer {
+ private static final long _type = RecordTypes.ExHyperlink.typeID;
+
private byte[] _header;
- private static long _type = 4055;
-
+
// Links to our more interesting children
private ExHyperlinkAtom linkAtom;
private CString linkDetailsA;
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlinkAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlinkAtom.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlinkAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlinkAtom.java Wed Sep 11 21:24:06 2019
@@ -19,7 +19,10 @@ package org.apache.poi.hslf.record;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Map;
+import java.util.function.Supplier;
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndian;
@@ -114,4 +117,9 @@ public final class ExHyperlinkAtom exten
out.write(_header);
out.write(_data);
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties("number", this::getNumber);
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExMediaAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExMediaAtom.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExMediaAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExMediaAtom.java Wed Sep 11 21:24:06 2019
@@ -17,9 +17,14 @@
package org.apache.poi.hslf.record;
+import static org.apache.poi.util.GenericRecordUtil.getBitsAsString;
+
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Map;
+import java.util.function.Supplier;
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndian;
@@ -46,6 +51,12 @@ public final class ExMediaAtom extends R
*/
public static final int fNarration = 4;
+
+ private static final int[] FLAG_MASKS = { fLoop, fRewind, fNarration };
+
+ private static final String[] FLAG_NAMES = { "LOOP", "REWIND", "NARRATION" };
+
+
/**
* Record header.
*/
@@ -169,4 +180,11 @@ public final class ExMediaAtom extends R
return buf.toString();
}
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "objectId", this::getObjectId,
+ "flags", getBitsAsString(this::getMask, FLAG_MASKS, FLAG_NAMES)
+ );
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjList.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjList.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjList.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjList.java Wed Sep 11 21:24:06 2019
@@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndian;
*/
public class ExObjList extends RecordContainer {
private byte[] _header;
- private static long _type = 1033;
+ private static final long _type = RecordTypes.ExObjList.typeID;
// Links to our more interesting children
private ExObjListAtom exObjListAtom;
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjListAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjListAtom.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjListAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjListAtom.java Wed Sep 11 21:24:06 2019
@@ -20,7 +20,10 @@ package org.apache.poi.hslf.record;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Map;
+import java.util.function.Supplier;
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndian;
@@ -116,4 +119,11 @@ public class ExObjListAtom extends Recor
out.write(_header);
out.write(_data);
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "objectIDSeed", this::getObjectIDSeed
+ );
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjRefAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjRefAtom.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjRefAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjRefAtom.java Wed Sep 11 21:24:06 2019
@@ -17,9 +17,13 @@
package org.apache.poi.hslf.record;
-import org.apache.poi.util.LittleEndian;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Map;
+import java.util.function.Supplier;
+
+import org.apache.poi.util.GenericRecordUtil;
+import org.apache.poi.util.LittleEndian;
/**
* ExObjRefAtom (3009).
@@ -91,4 +95,9 @@ public final class ExObjRefAtom extends
out.write(recdata);
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties("exObjIdRef", this::getExObjIdRef);
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjAtom.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjAtom.java Wed Sep 11 21:24:06 2019
@@ -17,16 +17,21 @@
package org.apache.poi.hslf.record;
+import static org.apache.poi.util.GenericRecordUtil.getBitsAsString;
+import static org.apache.poi.util.GenericRecordUtil.safeEnum;
+
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Map;
+import java.util.function.Supplier;
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndian;
/**
* Atom storing information for an OLE object.
*
- * <!--
* offset type name description
*
* 0 uint4 drawAspect Stores whether the object can be completely seen
@@ -60,12 +65,45 @@ import org.apache.poi.util.LittleEndian;
*
* 20 bool1 isBlank Set if the object's image is blank
* (note: KOffice has this as an int.)
- * -->
- *
- * @author Daniel Noll
*/
public class ExOleObjAtom extends RecordAtom {
+ public enum OleType {
+ /** An embedded OLE object; the object is serialized and saved within the file. */
+ EMBEDDED,
+ /** A linked OLE object; the object is saved outside of the file. */
+ LINKED,
+ /** The OLE object is an ActiveX control. */
+ CONTROL
+ }
+
+ public enum Subtype {
+ DEFAULT,
+ CLIPART_GALLERY,
+ WORD_TABLE,
+ EXCEL,
+ GRAPH,
+ ORGANIZATION_CHART,
+ EQUATION,
+ WORDART,
+ SOUND,
+ IMAGE,
+ POWERPOINT_PRESENTATION,
+ POWERPOINT_SLIDE,
+ PROJECT,
+ NOTEIT,
+ EXCEL_CHART,
+ MEDIA_PLAYER
+ }
+
+ private static final int[] DRAWASPECT_MASKS = {
+ 0x0001, 0x0002, 0x0004, 0x0008
+ };
+
+ private static final String[] DRAWASPECT_NAMES = {
+ "CONTENT", "THUMBNAIL", "ICON", "DOCPRINT"
+ };
+
//arbitrarily selected; may need to increase
private static final int MAX_RECORD_LENGTH = 10_485_760;
@@ -314,4 +352,16 @@ public class ExOleObjAtom extends Record
buf.append(" options: " + getOptions() + "\n");
return buf.toString();
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "drawAspect", getBitsAsString(this::getDrawAspect, DRAWASPECT_MASKS, DRAWASPECT_NAMES),
+ "type", safeEnum(OleType.values(), this::getType),
+ "objID", this::getObjID,
+ "subType", safeEnum(Subtype.values(), this::getSubType),
+ "objStgDataRef", this::getObjStgDataRef,
+ "options", this::getOptions
+ );
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java Wed Sep 11 21:24:06 2019
@@ -23,10 +23,12 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
+import java.util.function.Supplier;
import java.util.zip.DeflaterOutputStream;
import java.util.zip.InflaterInputStream;
import org.apache.poi.util.BoundedInputStream;
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndian;
@@ -185,4 +187,14 @@ public class ExOleObjStg extends Positio
public void updateOtherRecordReferences(Map<Integer,Integer> oldToNewReferencesLookup) {
// nothing to update
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "compressed", this::isCompressed,
+ "persistId", this::getPersistId,
+ "dataLength", this::getDataLength,
+ "data", this::getData
+ );
+ }
}
\ No newline at end of file
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java Wed Sep 11 21:24:06 2019
@@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.function.Supplier;
import org.apache.poi.common.usermodel.fonts.FontHeader;
import org.apache.poi.common.usermodel.fonts.FontInfo;
@@ -200,4 +201,9 @@ public final class FontCollection extend
public List<HSLFFontInfo> getFonts() {
return new ArrayList<>(fonts.values());
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return null;
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontEmbeddedData.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontEmbeddedData.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontEmbeddedData.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontEmbeddedData.java Wed Sep 11 21:24:06 2019
@@ -19,9 +19,12 @@ package org.apache.poi.hslf.record;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Map;
+import java.util.function.Supplier;
import org.apache.poi.common.usermodel.fonts.FontFacet;
import org.apache.poi.common.usermodel.fonts.FontHeader;
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndian;
@@ -113,4 +116,9 @@ public class FontEmbeddedData extends Re
public Object getFontData() {
return this;
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties("fontHeader", this::getFontHeader);
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontEntityAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontEntityAtom.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontEntityAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontEntityAtom.java Wed Sep 11 21:24:06 2019
@@ -17,11 +17,18 @@
package org.apache.poi.hslf.record;
+import static org.apache.poi.util.GenericRecordUtil.getBitsAsString;
+
import java.io.IOException;
import java.io.OutputStream;
import java.util.Arrays;
+import java.util.Map;
+import java.util.function.Supplier;
+import org.apache.poi.common.usermodel.fonts.FontFamily;
+import org.apache.poi.common.usermodel.fonts.FontPitch;
import org.apache.poi.hslf.exceptions.HSLFException;
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.StringUtil;
@@ -40,6 +47,18 @@ public final class FontEntityAtom extend
//arbitrarily selected; may need to increase
private static final int MAX_RECORD_LENGTH = 1_000_000;
+ private static final int[] FLAGS_MASKS = {
+ 0x0001, 0x0100, 0x0200, 0x0400, 0x0800
+ };
+
+ private static final String[] FLAGS_NAMES = {
+ "EMBED_SUBSETTED",
+ "RASTER_FONT",
+ "DEVICE_FONT",
+ "TRUETYPE_FONT",
+ "NO_FONT_SUBSTITUTION"
+ };
+
/**
* record header
*/
@@ -210,4 +229,16 @@ public final class FontEntityAtom extend
out.write(_header);
out.write(_recdata);
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "fontName", this::getFontName,
+ "fontIndex", this::getFontIndex,
+ "charset", this::getCharSet,
+ "fontFlags", getBitsAsString(this::getFontFlags, FLAGS_MASKS, FLAGS_NAMES),
+ "fontPitch", () -> FontPitch.valueOfPitchFamily((byte)getPitchAndFamily()),
+ "fontFamily", () -> FontFamily.valueOfPitchFamily((byte)getPitchAndFamily())
+ );
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersAtom.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersAtom.java Wed Sep 11 21:24:06 2019
@@ -17,10 +17,17 @@
package org.apache.poi.hslf.record;
-import org.apache.poi.util.IOUtils;
-import org.apache.poi.util.LittleEndian;
+import static org.apache.poi.util.GenericRecordUtil.getBitsAsString;
+import static org.apache.poi.util.GenericRecordUtil.safeEnum;
+
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Map;
+import java.util.function.Supplier;
+
+import org.apache.poi.util.GenericRecordUtil;
+import org.apache.poi.util.IOUtils;
+import org.apache.poi.util.LittleEndian;
/**
* An atom record that specifies options for displaying headers and footers
@@ -31,10 +38,33 @@ import java.io.OutputStream;
public final class HeadersFootersAtom extends RecordAtom {
+ /** FormatIndex enum without LCID mapping */
+ public enum FormatIndex {
+ SHORT_DATE,
+ LONG_DATE,
+ LONG_DATE_WITHOUT_WEEKDAY,
+ ALTERNATE_SHORT_DATE,
+ ISO_STANDARD_DATE,
+ SHORT_DATE_WITH_ABBREVIATED_MONTH,
+ SHORT_DATE_WITH_SLASHES,
+ ALTERNATE_SHORT_DATE_WITH_ABBREVIATED_MONTH,
+ ENGLISH_DATE,
+ MONTH_AND_YEAR,
+ ABBREVIATED_MONTH_AND_YEAR,
+ DATE_AND_HOUR12_TIME,
+ DATE_AND_HOUR12_TIME_WITH_SECONDS,
+ HOUR12_TIME,
+ HOUR12_TIME_WITH_SECONDS,
+ HOUR24_TIME,
+ HOUR24_TIME_WITH_SECONDS,
+ CHINESE1,
+ CHINESE2,
+ CHINESE3
+ }
+
//arbitrarily selected; may need to increase
private static final int MAX_RECORD_LENGTH = 100_000;
-
/**
* A bit that specifies whether the date is displayed in the footer.
* @see #getMask()
@@ -82,6 +112,21 @@ public final class HeadersFootersAtom ex
*/
public static final int fHasFooter = 32;
+ private static final int[] PLACEHOLDER_MASKS = {
+ fHasDate,
+ fHasTodayDate,
+ fHasUserDate,
+ fHasSlideNumber,
+ fHasHeader,
+ fHasFooter
+ };
+
+ private static final String[] PLACEHOLDER_NAMES = {
+ "DATE", "TODAY_DATE", "USER_DATE", "SLIDE_NUMBER", "HEADER", "FOOTER"
+ };
+
+
+
/**
* record header
*/
@@ -213,4 +258,12 @@ public final class HeadersFootersAtom ex
buf.append("\t fHasFooter : " + getFlag(fHasFooter) + "\n");
return buf.toString();
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "formatIndex", safeEnum(FormatIndex.values(), this::getFormatId),
+ "flags", getBitsAsString(this::getMask, PLACEHOLDER_MASKS, PLACEHOLDER_NAMES)
+ );
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersContainer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersContainer.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersContainer.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersContainer.java Wed Sep 11 21:24:06 2019
@@ -17,12 +17,12 @@
package org.apache.poi.hslf.record;
+import java.io.IOException;
+import java.io.OutputStream;
+
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.POILogger;
-import java.io.OutputStream;
-import java.io.IOException;
-
/**
* A container record that specifies information about the footers on a presentation slide.
* <p>
@@ -63,24 +63,39 @@ public final class HeadersFootersContain
System.arraycopy(source,start,_header,0,8);
_children = Record.findChildRecords(source,start+8,len-8);
- for(int i=0; i < _children.length; i++){
- if(_children[i] instanceof HeadersFootersAtom) hdAtom = (HeadersFootersAtom)_children[i];
- else if(_children[i] instanceof CString) {
- CString cs = (CString)_children[i];
+ findInterestingChildren();
+ }
+
+ /**
+ * Go through our child records, picking out the ones that are
+ * interesting, and saving those for use by the easy helper
+ * methods.
+ */
+ private void findInterestingChildren() {
+ for (Record child : _children) {
+ if (child instanceof HeadersFootersAtom) {
+ hdAtom = (HeadersFootersAtom) child;
+ } else if (child instanceof CString) {
+ CString cs = (CString) child;
int opts = cs.getOptions() >> 4;
- switch(opts){
- case USERDATEATOM: csDate = cs; break;
- case HEADERATOM: csHeader = cs; break;
- case FOOTERATOM: csFooter = cs; break;
+ switch (opts) {
+ case USERDATEATOM:
+ csDate = cs;
+ break;
+ case HEADERATOM:
+ csHeader = cs;
+ break;
+ case FOOTERATOM:
+ csFooter = cs;
+ break;
default:
logger.log(POILogger.WARN, "Unexpected CString.Options in HeadersFootersContainer: " + opts);
break;
}
} else {
- logger.log(POILogger.WARN, "Unexpected record in HeadersFootersContainer: " + _children[i]);
+ logger.log(POILogger.WARN, "Unexpected record in HeadersFootersContainer: " + child);
}
}
-
}
public HeadersFootersContainer(short options) {
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfo.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfo.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfo.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfo.java Wed Sep 11 21:24:06 2019
@@ -30,7 +30,7 @@ import org.apache.poi.util.POILogger;
*/
public class InteractiveInfo extends RecordContainer {
private byte[] _header;
- private static long _type = 4082;
+ private static final long _type = RecordTypes.InteractiveInfo.typeID;
// Links to our more interesting children
private InteractiveInfoAtom infoAtom;
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfoAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfoAtom.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfoAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfoAtom.java Wed Sep 11 21:24:06 2019
@@ -17,9 +17,15 @@
package org.apache.poi.hslf.record;
+import static org.apache.poi.util.GenericRecordUtil.getBitsAsString;
+import static org.apache.poi.util.GenericRecordUtil.safeEnum;
+
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Map;
+import java.util.function.Supplier;
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndian;
@@ -35,6 +41,39 @@ public class InteractiveInfoAtom extends
//arbitrarily selected; may need to increase
private static final int MAX_RECORD_LENGTH = 100_000;
+ public enum Action {
+ NONE,
+ MACRO,
+ RUN_PROGRAM,
+ JUMP,
+ HYPERLINK,
+ OLE,
+ MEDIA,
+ CUSTOM_SHOW
+ }
+
+ public enum Jump {
+ NONE,
+ NEXT_SLIDE,
+ PREVIOUS_SLIDE,
+ FIRST_SLIDE,
+ LAST_SLIDE,
+ LAST_SLIDE_VIEWED,
+ END_SHOW
+ }
+
+ public enum Link {
+ NEXT_SLIDE,
+ PREVIOUS_SLIDE,
+ FIRST_SLIDE,
+ LAST_SLIDE,
+ CUSTOM_SHOW,
+ SLIDE_NUMBER,
+ URL,
+ OTHER_PRESENTATION,
+ OTHER_FILE,
+ NULL
+ }
/**
* Action Table
@@ -73,6 +112,14 @@ public class InteractiveInfoAtom extends
public static final byte LINK_OtherFile = 0x0A;
public static final byte LINK_NULL = (byte)0xFF;
+ private static final int[] FLAGS_MASKS = {
+ 0x0001, 0x0002, 0x0004, 0x0008
+ };
+
+ private static final String[] FLAGS_NAMES = {
+ "ANIMATED", "STOP_SOUND", "CUSTOM_SHOW_RETURN", "VISITED"
+ };
+
/**
* Record header.
*/
@@ -280,4 +327,16 @@ public class InteractiveInfoAtom extends
out.write(_header);
out.write(_data);
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "hyperlinkID", this::getHyperlinkID,
+ "soundRef", this::getSoundRef,
+ "action", safeEnum(Action.values(), this::getAction),
+ "jump", safeEnum(Jump.values(), this::getJump),
+ "hyperlinkType", safeEnum(Link.values(), this::getHyperlinkType, Link.NULL),
+ "flags", getBitsAsString(this::getFlags, FLAGS_MASKS, FLAGS_NAMES)
+ );
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/MasterTextPropAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/MasterTextPropAtom.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/MasterTextPropAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/MasterTextPropAtom.java Wed Sep 11 21:24:06 2019
@@ -22,9 +22,12 @@ import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
+import java.util.function.Supplier;
import org.apache.commons.math3.util.ArithmeticUtils;
import org.apache.poi.hslf.model.textproperties.IndentProp;
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.POILogger;
@@ -157,4 +160,11 @@ public final class MasterTextPropAtom ex
public List<IndentProp> getIndents() {
return Collections.unmodifiableList(indents);
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "indents", this::getIndents
+ );
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/NotesAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/NotesAtom.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/NotesAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/NotesAtom.java Wed Sep 11 21:24:06 2019
@@ -17,10 +17,14 @@
package org.apache.poi.hslf.record;
-import org.apache.poi.util.IOUtils;
-import org.apache.poi.util.LittleEndian;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Map;
+import java.util.function.Supplier;
+
+import org.apache.poi.util.GenericRecordUtil;
+import org.apache.poi.util.IOUtils;
+import org.apache.poi.util.LittleEndian;
/**
* A Notes Atom (type 1009). Holds information on the parent Notes, such
@@ -121,4 +125,14 @@ public final class NotesAtom extends Rec
// Reserved fields
out.write(reserved);
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "slideId", this::getSlideID,
+ "followMasterObjects", this::getFollowMasterObjects,
+ "followMasterScheme", this::getFollowMasterScheme,
+ "followMasterBackground", this::getFollowMasterBackground
+ );
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OEPlaceholderAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OEPlaceholderAtom.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OEPlaceholderAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OEPlaceholderAtom.java Wed Sep 11 21:24:06 2019
@@ -19,8 +19,11 @@ package org.apache.poi.hslf.record;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Map;
+import java.util.function.Supplier;
import org.apache.poi.sl.usermodel.Placeholder;
+import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.LittleEndian;
/**
@@ -176,4 +179,13 @@ public final class OEPlaceholderAtom ext
out.write(recdata);
}
+
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "placementId", this::getPlacementId,
+ "placeholderId", this::getPlaceholderId,
+ "placeholderSize", this::getPlaceholderSize
+ );
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OutlineTextRefAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OutlineTextRefAtom.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OutlineTextRefAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OutlineTextRefAtom.java Wed Sep 11 21:24:06 2019
@@ -17,10 +17,13 @@
package org.apache.poi.hslf.record;
-import org.apache.poi.util.LittleEndian;
-
-import java.io.OutputStream;
import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Map;
+import java.util.function.Supplier;
+
+import org.apache.poi.util.GenericRecordUtil;
+import org.apache.poi.util.LittleEndian;
/**
* OEPlaceholderAtom (3998).
@@ -106,4 +109,10 @@ public final class OutlineTextRefAtom ex
return _index;
}
+ @Override
+ public Map<String, Supplier<?>> getGenericProperties() {
+ return GenericRecordUtil.getGenericProperties(
+ "textIndex", this::getTextIndex
+ );
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org