mirror of https://github.com/apache/poi.git
fix IntelliJ warnings
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1874338 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fd4410d50b
commit
159ad62a47
|
@ -96,10 +96,10 @@ public class HemfComment {
|
||||||
*
|
*
|
||||||
* @param ctx the graphics context to modify
|
* @param ctx the graphics context to modify
|
||||||
*/
|
*/
|
||||||
default void draw(HemfGraphics ctx) {};
|
default void draw(HemfGraphics ctx) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default Enum getGenericRecordType() {
|
default HemfCommentRecordType getGenericRecordType() {
|
||||||
return getCommentRecordType();
|
return getCommentRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,6 +137,14 @@ public class HemfComment {
|
||||||
public Map<String, Supplier<?>> getGenericProperties() {
|
public Map<String, Supplier<?>> getGenericProperties() {
|
||||||
return GenericRecordUtil.getGenericProperties("data", this::getCommentData);
|
return GenericRecordUtil.getGenericProperties("data", this::getCommentData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void validateCommentType(final LittleEndianInputStream leis, HemfCommentRecordType commentType) {
|
||||||
|
int commentIdentifier = (int)leis.readUInt();
|
||||||
|
if (commentIdentifier == HemfCommentRecordType.emfPublic.id) {
|
||||||
|
commentIdentifier = (int)leis.readUInt();
|
||||||
|
}
|
||||||
|
assert(commentIdentifier == commentType.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EmfCommentDataIterator implements Iterator<EmfCommentData> {
|
public static class EmfCommentDataIterator implements Iterator<EmfCommentData> {
|
||||||
|
@ -172,20 +180,19 @@ public class HemfComment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private EmfCommentData _next() {
|
private EmfCommentData _next() {
|
||||||
long type, recordSize;
|
long recordSize;
|
||||||
if (currentRecord == null && emfParent) {
|
if (currentRecord == null && emfParent) {
|
||||||
type = HemfRecordType.comment.id;
|
|
||||||
recordSize = limit;
|
recordSize = limit;
|
||||||
} else {
|
} else {
|
||||||
// A 32-bit unsigned integer from the RecordType enumeration that identifies this record
|
// A 32-bit unsigned integer from the RecordType enumeration that identifies this record
|
||||||
// as a comment record. This value MUST be 0x00000046.
|
// as a comment record. This value MUST be 0x00000046.
|
||||||
try {
|
try {
|
||||||
type = leis.readUInt();
|
long type = leis.readUInt();
|
||||||
|
assert(type == HemfRecordType.comment.id);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
// EOF
|
// EOF
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
assert(type == HemfRecordType.comment.id);
|
|
||||||
// A 32-bit unsigned integer that specifies the size in bytes of this record in the
|
// A 32-bit unsigned integer that specifies the size in bytes of this record in the
|
||||||
// metafile. This value MUST be a multiple of 4 bytes.
|
// metafile. This value MUST be a multiple of 4 bytes.
|
||||||
recordSize = leis.readUInt();
|
recordSize = leis.readUInt();
|
||||||
|
@ -288,9 +295,8 @@ public class HemfComment {
|
||||||
@Override
|
@Override
|
||||||
public long init(final LittleEndianInputStream leis, final long dataSize)
|
public long init(final LittleEndianInputStream leis, final long dataSize)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
long startIdx = leis.getReadIndex();
|
final int startIdx = leis.getReadIndex();
|
||||||
int commentIdentifier = leis.readInt();
|
EmfComment.validateCommentType(leis, HemfCommentRecordType.emfPlus);
|
||||||
assert (commentIdentifier == HemfCommentRecordType.emfPlus.id);
|
|
||||||
new HemfPlusRecordIterator(leis, (int)dataSize-LittleEndianConsts.INT_SIZE).forEachRemaining(records::add);
|
new HemfPlusRecordIterator(leis, (int)dataSize-LittleEndianConsts.INT_SIZE).forEachRemaining(records::add);
|
||||||
return leis.getReadIndex()-startIdx;
|
return leis.getReadIndex()-startIdx;
|
||||||
}
|
}
|
||||||
|
@ -328,13 +334,9 @@ public class HemfComment {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long init(final LittleEndianInputStream leis, final long dataSize)
|
public long init(final LittleEndianInputStream leis, final long dataSize) throws IOException {
|
||||||
throws IOException {
|
|
||||||
final int startIdx = leis.getReadIndex();
|
final int startIdx = leis.getReadIndex();
|
||||||
final int commentIdentifier = (int)leis.readUInt();
|
EmfComment.validateCommentType(leis, HemfCommentRecordType.emfBeginGroup);
|
||||||
assert(commentIdentifier == HemfCommentRecordType.emfPublic.id);
|
|
||||||
final int publicCommentIdentifier = (int)leis.readUInt();
|
|
||||||
assert(publicCommentIdentifier == HemfCommentRecordType.emfBeginGroup.id);
|
|
||||||
HemfDraw.readRectL(leis, bounds);
|
HemfDraw.readRectL(leis, bounds);
|
||||||
|
|
||||||
// The number of Unicode characters in the optional description string that follows.
|
// The number of Unicode characters in the optional description string that follows.
|
||||||
|
@ -347,6 +349,7 @@ public class HemfComment {
|
||||||
return leis.getReadIndex()-startIdx;
|
return leis.getReadIndex()-startIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Rectangle2D getBounds() {
|
public Rectangle2D getBounds() {
|
||||||
return bounds;
|
return bounds;
|
||||||
}
|
}
|
||||||
|
@ -374,10 +377,7 @@ public class HemfComment {
|
||||||
public long init(final LittleEndianInputStream leis, final long dataSize)
|
public long init(final LittleEndianInputStream leis, final long dataSize)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
final int startIdx = leis.getReadIndex();
|
final int startIdx = leis.getReadIndex();
|
||||||
final int commentIdentifier = (int)leis.readUInt();
|
EmfComment.validateCommentType(leis, HemfCommentRecordType.emfEndGroup);
|
||||||
assert(commentIdentifier == HemfCommentRecordType.emfPublic.id);
|
|
||||||
final int publicCommentIdentifier = (int)leis.readUInt();
|
|
||||||
assert(publicCommentIdentifier == HemfCommentRecordType.emfEndGroup.id);
|
|
||||||
return leis.getReadIndex()-startIdx;
|
return leis.getReadIndex()-startIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,13 +397,9 @@ public class HemfComment {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long init(final LittleEndianInputStream leis, final long dataSize)
|
public long init(final LittleEndianInputStream leis, final long dataSize) throws IOException {
|
||||||
throws IOException {
|
|
||||||
final int startIdx = leis.getReadIndex();
|
final int startIdx = leis.getReadIndex();
|
||||||
final int commentIdentifier = (int)leis.readUInt();
|
EmfComment.validateCommentType(leis, HemfCommentRecordType.emfMultiFormats);
|
||||||
assert(commentIdentifier == HemfCommentRecordType.emfPublic.id);
|
|
||||||
final int publicCommentIdentifier = (int)leis.readUInt();
|
|
||||||
assert(publicCommentIdentifier == HemfCommentRecordType.emfMultiFormats.id);
|
|
||||||
HemfDraw.readRectL(leis, bounds);
|
HemfDraw.readRectL(leis, bounds);
|
||||||
|
|
||||||
// A 32-bit unsigned integer that specifies the number of graphics formats contained in this record.
|
// A 32-bit unsigned integer that specifies the number of graphics formats contained in this record.
|
||||||
|
@ -487,6 +483,7 @@ public class HemfComment {
|
||||||
private int offData;
|
private int offData;
|
||||||
private byte[] rawData;
|
private byte[] rawData;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public long init(final LittleEndianInputStream leis, final long dataSize, long startIdx) throws IOException {
|
public long init(final LittleEndianInputStream leis, final long dataSize, long startIdx) throws IOException {
|
||||||
// A 32-bit unsigned integer that specifies the format of the image data.
|
// A 32-bit unsigned integer that specifies the format of the image data.
|
||||||
signature = EmfFormatSignature.getById(leis.readInt());
|
signature = EmfFormatSignature.getById(leis.readInt());
|
||||||
|
@ -539,13 +536,11 @@ public class HemfComment {
|
||||||
return HemfCommentRecordType.emfWMF;
|
return HemfCommentRecordType.emfWMF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@Override
|
@Override
|
||||||
public long init(final LittleEndianInputStream leis, final long dataSize) throws IOException {
|
public long init(final LittleEndianInputStream leis, final long dataSize) throws IOException {
|
||||||
final int startIdx = leis.getReadIndex();
|
final int startIdx = leis.getReadIndex();
|
||||||
final int commentIdentifier = (int)leis.readUInt();
|
EmfComment.validateCommentType(leis, HemfCommentRecordType.emfWMF);
|
||||||
assert(commentIdentifier == HemfCommentRecordType.emfPublic.id);
|
|
||||||
final int publicCommentIdentifier = (int)leis.readUInt();
|
|
||||||
assert(publicCommentIdentifier == HemfCommentRecordType.emfWMF.id);
|
|
||||||
|
|
||||||
// A 16-bit unsigned integer that specifies the WMF metafile version in terms
|
// A 16-bit unsigned integer that specifies the WMF metafile version in terms
|
||||||
//of support for device-independent bitmaps (DIBs)
|
//of support for device-independent bitmaps (DIBs)
|
||||||
|
|
|
@ -42,7 +42,9 @@ import org.apache.poi.util.GenericRecordUtil;
|
||||||
import org.apache.poi.util.LittleEndianConsts;
|
import org.apache.poi.util.LittleEndianConsts;
|
||||||
import org.apache.poi.util.LittleEndianInputStream;
|
import org.apache.poi.util.LittleEndianInputStream;
|
||||||
|
|
||||||
public class HemfDraw {
|
public final class HemfDraw {
|
||||||
|
private HemfDraw() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The EMR_SELECTOBJECT record adds a graphics object to the current metafile playback device
|
* The EMR_SELECTOBJECT record adds a graphics object to the current metafile playback device
|
||||||
* context. The object is specified either by its index in the EMF Object Table or by its
|
* context. The object is specified either by its index in the EMF Object Table or by its
|
||||||
|
@ -102,7 +104,7 @@ public class HemfDraw {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,7 +214,7 @@ public class HemfDraw {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -313,7 +315,7 @@ public class HemfDraw {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -456,6 +458,7 @@ public class HemfDraw {
|
||||||
return readPointL(leis, point);
|
return readPointL(leis, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@Override
|
@Override
|
||||||
public long init(LittleEndianInputStream leis, long recordSize, long recordId) throws IOException {
|
public long init(LittleEndianInputStream leis, long recordSize, long recordId) throws IOException {
|
||||||
long size = readRectL(leis, bounds);
|
long size = readRectL(leis, bounds);
|
||||||
|
@ -521,7 +524,7 @@ public class HemfDraw {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -593,7 +596,7 @@ public class HemfDraw {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -618,7 +621,7 @@ public class HemfDraw {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -647,7 +650,7 @@ public class HemfDraw {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -677,7 +680,7 @@ public class HemfDraw {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -706,7 +709,7 @@ public class HemfDraw {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -733,7 +736,7 @@ public class HemfDraw {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -759,7 +762,7 @@ public class HemfDraw {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -792,7 +795,7 @@ public class HemfDraw {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -818,7 +821,7 @@ public class HemfDraw {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -848,7 +851,7 @@ public class HemfDraw {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -958,7 +961,7 @@ public class HemfDraw {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1215,8 +1218,6 @@ public class HemfDraw {
|
||||||
* path by using the current pen, and fills its interior by using the current brush.
|
* path by using the current pen, and fills its interior by using the current brush.
|
||||||
*/
|
*/
|
||||||
public static class EmfStrokeAndFillPath extends EmfStrokePath {
|
public static class EmfStrokeAndFillPath extends EmfStrokePath {
|
||||||
protected final Rectangle2D bounds = new Rectangle2D.Double();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HemfRecordType getEmfRecordType() {
|
public HemfRecordType getEmfRecordType() {
|
||||||
return HemfRecordType.strokeAndFillPath;
|
return HemfRecordType.strokeAndFillPath;
|
||||||
|
|
|
@ -53,8 +53,8 @@ import org.apache.poi.util.LittleEndian;
|
||||||
import org.apache.poi.util.LittleEndianConsts;
|
import org.apache.poi.util.LittleEndianConsts;
|
||||||
import org.apache.poi.util.LittleEndianInputStream;
|
import org.apache.poi.util.LittleEndianInputStream;
|
||||||
|
|
||||||
public class HemfFill {
|
public final class HemfFill {
|
||||||
private static final int MAX_RECORD_LENGTH = 10_000_000;
|
private HemfFill() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The EMR_SETPOLYFILLMODE record defines polygon fill mode.
|
* The EMR_SETPOLYFILLMODE record defines polygon fill mode.
|
||||||
|
@ -75,7 +75,7 @@ public class HemfFill {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ public class HemfFill {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,7 @@ public class HemfFill {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -309,7 +309,7 @@ public class HemfFill {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -341,6 +341,7 @@ public class HemfFill {
|
||||||
return HemfRecordType.frameRgn;
|
return HemfRecordType.frameRgn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@Override
|
@Override
|
||||||
public long init(LittleEndianInputStream leis, long recordSize, long recordId) throws IOException {
|
public long init(LittleEndianInputStream leis, long recordSize, long recordId) throws IOException {
|
||||||
long size = readRectL(leis, bounds);
|
long size = readRectL(leis, bounds);
|
||||||
|
@ -386,7 +387,7 @@ public class HemfFill {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -401,6 +402,7 @@ public class HemfFill {
|
||||||
return HemfRecordType.invertRgn;
|
return HemfRecordType.invertRgn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@Override
|
@Override
|
||||||
public long init(LittleEndianInputStream leis, long recordSize, long recordId) throws IOException {
|
public long init(LittleEndianInputStream leis, long recordSize, long recordId) throws IOException {
|
||||||
long size = readRectL(leis, bounds);
|
long size = readRectL(leis, bounds);
|
||||||
|
@ -453,6 +455,7 @@ public class HemfFill {
|
||||||
return HemfRecordType.fillRgn;
|
return HemfRecordType.fillRgn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@Override
|
@Override
|
||||||
public long init(LittleEndianInputStream leis, long recordSize, long recordId) throws IOException {
|
public long init(LittleEndianInputStream leis, long recordSize, long recordId) throws IOException {
|
||||||
long size = readRectL(leis, bounds);
|
long size = readRectL(leis, bounds);
|
||||||
|
@ -486,7 +489,7 @@ public class HemfFill {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -500,6 +503,7 @@ public class HemfFill {
|
||||||
return HemfRecordType.extSelectClipRgn;
|
return HemfRecordType.extSelectClipRgn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@Override
|
@Override
|
||||||
public long init(LittleEndianInputStream leis, long recordSize, long recordId) throws IOException {
|
public long init(LittleEndianInputStream leis, long recordSize, long recordId) throws IOException {
|
||||||
// A 32-bit unsigned integer that specifies the size of region data in bytes
|
// A 32-bit unsigned integer that specifies the size of region data in bytes
|
||||||
|
@ -522,7 +526,6 @@ public class HemfFill {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(HemfGraphics ctx) {
|
public void draw(HemfGraphics ctx) {
|
||||||
HemfDrawProperties prop = ctx.getProperties();
|
|
||||||
ctx.setClip(getShape(), regionMode, true);
|
ctx.setClip(getShape(), regionMode, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -692,6 +695,7 @@ public class HemfFill {
|
||||||
return HemfRecordType.setDiBitsToDevice;
|
return HemfRecordType.setDiBitsToDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@Override
|
@Override
|
||||||
public long init(LittleEndianInputStream leis, long recordSize, long recordId) throws IOException {
|
public long init(LittleEndianInputStream leis, long recordSize, long recordId) throws IOException {
|
||||||
int startIdx = leis.getReadIndex();
|
int startIdx = leis.getReadIndex();
|
||||||
|
@ -804,6 +808,7 @@ public class HemfFill {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
static long readRgnData(final LittleEndianInputStream leis, final List<Rectangle2D> rgnRects) {
|
static long readRgnData(final LittleEndianInputStream leis, final List<Rectangle2D> rgnRects) {
|
||||||
// *** RegionDataHeader ***
|
// *** RegionDataHeader ***
|
||||||
// A 32-bit unsigned integer that specifies the size of this object in bytes. This MUST be 0x00000020.
|
// A 32-bit unsigned integer that specifies the size of this object in bytes. This MUST be 0x00000020.
|
||||||
|
@ -873,7 +878,7 @@ public class HemfFill {
|
||||||
return 6 * LittleEndian.INT_SIZE;
|
return 6 * LittleEndian.INT_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static Shape getRgnShape(List<Rectangle2D> rgnRects) {
|
static Shape getRgnShape(List<Rectangle2D> rgnRects) {
|
||||||
if (rgnRects.size() == 1) {
|
if (rgnRects.size() == 1) {
|
||||||
return rgnRects.get(0);
|
return rgnRects.get(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,6 +237,7 @@ public class HemfFont extends HwmfFont {
|
||||||
|
|
||||||
protected LogFontDetails details;
|
protected LogFontDetails details;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@Override
|
@Override
|
||||||
public int init(LittleEndianInputStream leis, long recordSize) throws IOException {
|
public int init(LittleEndianInputStream leis, long recordSize) throws IOException {
|
||||||
// A 32-bit signed integer that specifies the height, in logical units, of the font's
|
// A 32-bit signed integer that specifies the height, in logical units, of the font's
|
||||||
|
@ -517,7 +518,7 @@ public class HemfFont extends HwmfFont {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int readString(LittleEndianInputStream leis, StringBuilder sb, int limit) throws IOException {
|
protected int readString(LittleEndianInputStream leis, StringBuilder sb, int limit) {
|
||||||
sb.setLength(0);
|
sb.setLength(0);
|
||||||
byte[] buf = new byte[limit * 2];
|
byte[] buf = new byte[limit * 2];
|
||||||
leis.readFully(buf);
|
leis.readFully(buf);
|
||||||
|
|
|
@ -43,9 +43,6 @@ import org.apache.poi.util.LittleEndianInputStream;
|
||||||
@Internal
|
@Internal
|
||||||
public class HemfHeader implements HemfRecord {
|
public class HemfHeader implements HemfRecord {
|
||||||
|
|
||||||
private static final int MAX_RECORD_LENGTH = 1_000_000;
|
|
||||||
|
|
||||||
|
|
||||||
private final Rectangle2D boundsRectangle = new Rectangle2D.Double();
|
private final Rectangle2D boundsRectangle = new Rectangle2D.Double();
|
||||||
private final Rectangle2D frameRectangle = new Rectangle2D.Double();
|
private final Rectangle2D frameRectangle = new Rectangle2D.Double();
|
||||||
private long bytes;
|
private long bytes;
|
||||||
|
@ -131,6 +128,7 @@ public class HemfHeader implements HemfRecord {
|
||||||
return HemfRecordType.header;
|
return HemfRecordType.header;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@Override
|
@Override
|
||||||
public long init(LittleEndianInputStream leis, long recordSize, long recordId) throws IOException {
|
public long init(LittleEndianInputStream leis, long recordSize, long recordId) throws IOException {
|
||||||
if (recordId != HemfRecordType.header.id) {
|
if (recordId != HemfRecordType.header.id) {
|
||||||
|
|
|
@ -100,6 +100,7 @@ public class HemfMisc {
|
||||||
return HemfRecordType.eof;
|
return HemfRecordType.eof;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@Override
|
@Override
|
||||||
public long init(LittleEndianInputStream leis, long recordSize, long recordId) throws IOException {
|
public long init(LittleEndianInputStream leis, long recordSize, long recordId) throws IOException {
|
||||||
final int startIdx = leis.getReadIndex();
|
final int startIdx = leis.getReadIndex();
|
||||||
|
@ -112,7 +113,7 @@ public class HemfMisc {
|
||||||
int size = 2 * LittleEndianConsts.INT_SIZE;
|
int size = 2 * LittleEndianConsts.INT_SIZE;
|
||||||
|
|
||||||
if (nPalEntries > 0 && offPalEntries > 0) {
|
if (nPalEntries > 0 && offPalEntries > 0) {
|
||||||
int undefinedSpace1 = (int) (offPalEntries - (size + HEADER_SIZE));
|
int undefinedSpace1 = offPalEntries - (size + HEADER_SIZE);
|
||||||
assert (undefinedSpace1 >= 0);
|
assert (undefinedSpace1 >= 0);
|
||||||
leis.skipFully(undefinedSpace1);
|
leis.skipFully(undefinedSpace1);
|
||||||
size += undefinedSpace1;
|
size += undefinedSpace1;
|
||||||
|
@ -165,7 +166,7 @@ public class HemfMisc {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,7 +192,7 @@ public class HemfMisc {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,7 +214,7 @@ public class HemfMisc {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -240,7 +241,7 @@ public class HemfMisc {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -260,7 +261,7 @@ public class HemfMisc {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -283,7 +284,7 @@ public class HemfMisc {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -306,7 +307,7 @@ public class HemfMisc {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -331,7 +332,7 @@ public class HemfMisc {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -385,7 +386,7 @@ public class HemfMisc {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -454,7 +455,7 @@ public class HemfMisc {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -477,7 +478,7 @@ public class HemfMisc {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -538,7 +539,7 @@ public class HemfMisc {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -668,7 +669,7 @@ public class HemfMisc {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class HemfPalette {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ public class HemfPalette {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ public class HemfPalette {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ public class HemfPalette {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ public class HemfPalette {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public interface HemfRecord extends GenericRecord {
|
||||||
default void setHeader(HemfHeader header) {}
|
default void setHeader(HemfHeader header) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default Enum getGenericRecordType() {
|
default HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,7 +225,7 @@ public class HemfText {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ public class HemfText {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ public class HemfText {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -338,7 +338,7 @@ public class HemfText {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class HemfWindowing {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ public class HemfWindowing {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ public class HemfWindowing {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ public class HemfWindowing {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ public class HemfWindowing {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ public class HemfWindowing {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ public class HemfWindowing {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ public class HemfWindowing {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ public class HemfWindowing {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public HemfRecordType getGenericRecordType() {
|
||||||
return getEmfRecordType();
|
return getEmfRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,6 +251,7 @@ public class HemfPlusBrush {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public interface EmfPlusBrushData extends GenericRecord {
|
public interface EmfPlusBrushData extends GenericRecord {
|
||||||
/**
|
/**
|
||||||
* This flag is meaningful in EmfPlusPathGradientBrushData objects.
|
* This flag is meaningful in EmfPlusPathGradientBrushData objects.
|
||||||
|
@ -458,7 +459,7 @@ public class HemfPlusBrush {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public EmfPlusBrushType getGenericRecordType() {
|
||||||
return EmfPlusBrushType.SOLID_COLOR;
|
return EmfPlusBrushType.SOLID_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,7 +501,7 @@ public class HemfPlusBrush {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public EmfPlusBrushType getGenericRecordType() {
|
||||||
return EmfPlusBrushType.HATCH_FILL;
|
return EmfPlusBrushType.HATCH_FILL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,7 +601,7 @@ public class HemfPlusBrush {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public EmfPlusBrushType getGenericRecordType() {
|
||||||
return EmfPlusBrushType.LINEAR_GRADIENT;
|
return EmfPlusBrushType.LINEAR_GRADIENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -810,7 +811,7 @@ public class HemfPlusBrush {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public EmfPlusBrushType getGenericRecordType() {
|
||||||
return EmfPlusBrushType.PATH_GRADIENT;
|
return EmfPlusBrushType.PATH_GRADIENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -884,7 +885,7 @@ public class HemfPlusBrush {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getGenericRecordType() {
|
public EmfPlusBrushType getGenericRecordType() {
|
||||||
return EmfPlusBrushType.TEXTURE_FILL;
|
return EmfPlusBrushType.TEXTURE_FILL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,9 +62,11 @@ import org.apache.poi.util.LittleEndianInputStream;
|
||||||
import org.apache.poi.util.StringUtil;
|
import org.apache.poi.util.StringUtil;
|
||||||
|
|
||||||
@SuppressWarnings("WeakerAccess")
|
@SuppressWarnings("WeakerAccess")
|
||||||
public class HemfPlusDraw {
|
public final class HemfPlusDraw {
|
||||||
private static final int MAX_OBJECT_SIZE = 1_000_000;
|
private static final int MAX_OBJECT_SIZE = 1_000_000;
|
||||||
|
|
||||||
|
private HemfPlusDraw() {}
|
||||||
|
|
||||||
public enum EmfPlusUnitType {
|
public enum EmfPlusUnitType {
|
||||||
/** Specifies a unit of logical distance within the world space. */
|
/** Specifies a unit of logical distance within the world space. */
|
||||||
World(0x00),
|
World(0x00),
|
||||||
|
@ -126,9 +128,9 @@ public class HemfPlusDraw {
|
||||||
* If set, each element in PointData specifies a location in the coordinate space that is relative to the
|
* If set, each element in PointData specifies a location in the coordinate space that is relative to the
|
||||||
* location specified by the previous element in the array. In the case of the first element in PointData,
|
* location specified by the previous element in the array. In the case of the first element in PointData,
|
||||||
* a previous location at coordinates (0,0) is assumed.
|
* a previous location at coordinates (0,0) is assumed.
|
||||||
* If clear, PointData specifies absolute locations according to the {@link #isCompressed()} flag.
|
* If clear, PointData specifies absolute locations according to the {@link EmfPlusCompressed#isCompressed()} flag.
|
||||||
*
|
*
|
||||||
* Note If this flag is set, the {@link #isCompressed()} flag (above) is undefined and MUST be ignored.
|
* Note If this flag is set, the {@link EmfPlusCompressed#isCompressed()} flag (above) is undefined and MUST be ignored.
|
||||||
*/
|
*/
|
||||||
BitField POSITION = BitFieldFactory.getInstance(0x0800);
|
BitField POSITION = BitFieldFactory.getInstance(0x0800);
|
||||||
|
|
||||||
|
@ -330,6 +332,7 @@ public class HemfPlusDraw {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The EmfPlusDrawImagePoints record specifies drawing a scaled image inside a parallelogram. */
|
/** The EmfPlusDrawImagePoints record specifies drawing a scaled image inside a parallelogram. */
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public static class EmfPlusDrawImagePoints implements HemfPlusRecord, EmfPlusObjectId, EmfPlusCompressed, EmfPlusRelativePosition {
|
public static class EmfPlusDrawImagePoints implements HemfPlusRecord, EmfPlusObjectId, EmfPlusCompressed, EmfPlusRelativePosition {
|
||||||
/**
|
/**
|
||||||
* This bit indicates that the rendering of the image includes applying an effect.
|
* This bit indicates that the rendering of the image includes applying an effect.
|
||||||
|
@ -625,6 +628,7 @@ public class HemfPlusDraw {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The EmfPlusDrawDriverString record specifies text output with character positions. */
|
/** The EmfPlusDrawDriverString record specifies text output with character positions. */
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public static class EmfPlusDrawDriverString implements HemfPlusRecord, EmfPlusObjectId, EmfPlusSolidColor {
|
public static class EmfPlusDrawDriverString implements HemfPlusRecord, EmfPlusObjectId, EmfPlusSolidColor {
|
||||||
/**
|
/**
|
||||||
* If set, the positions of character glyphs SHOULD be specified in a character map lookup table.
|
* If set, the positions of character glyphs SHOULD be specified in a character map lookup table.
|
||||||
|
|
|
@ -32,6 +32,7 @@ import java.io.InputStream;
|
||||||
import org.apache.poi.sl.draw.BitmapImageRenderer;
|
import org.apache.poi.sl.draw.BitmapImageRenderer;
|
||||||
import org.apache.poi.util.IOUtils;
|
import org.apache.poi.util.IOUtils;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public class HemfPlusGDIImageRenderer extends BitmapImageRenderer {
|
public class HemfPlusGDIImageRenderer extends BitmapImageRenderer {
|
||||||
private int width;
|
private int width;
|
||||||
private int height;
|
private int height;
|
||||||
|
@ -81,7 +82,7 @@ public class HemfPlusGDIImageRenderer extends BitmapImageRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadImage(byte[] data, String contentType) throws IOException {
|
public void loadImage(byte[] data, String contentType) {
|
||||||
img = readGDIImage(data);
|
img = readGDIImage(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,6 +110,7 @@ public class HemfPlusHeader implements HemfPlusRecord {
|
||||||
*
|
*
|
||||||
* @return {@code true} if dual-mode is enabled
|
* @return {@code true} if dual-mode is enabled
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public boolean isEmfPlusDualMode() {
|
public boolean isEmfPlusDualMode() {
|
||||||
return (flags & 1) == 1;
|
return (flags & 1) == 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,9 +52,6 @@ import org.apache.poi.util.LittleEndianConsts;
|
||||||
import org.apache.poi.util.LittleEndianInputStream;
|
import org.apache.poi.util.LittleEndianInputStream;
|
||||||
|
|
||||||
public class HemfPlusImage {
|
public class HemfPlusImage {
|
||||||
/** Maximum image dimension for converting embedded metafiles */
|
|
||||||
private static final int MAX_IMAGE_SIZE = 1500;
|
|
||||||
|
|
||||||
/** The ImageDataType enumeration defines types of image data formats. */
|
/** The ImageDataType enumeration defines types of image data formats. */
|
||||||
public enum EmfPlusImageDataType {
|
public enum EmfPlusImageDataType {
|
||||||
/** The type of image is not known. */
|
/** The type of image is not known. */
|
||||||
|
@ -80,6 +77,7 @@ public class HemfPlusImage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public enum EmfPlusPixelFormat {
|
public enum EmfPlusPixelFormat {
|
||||||
UNDEFINED(0X00000000),
|
UNDEFINED(0X00000000),
|
||||||
INDEXED_1BPP(0X00030101),
|
INDEXED_1BPP(0X00030101),
|
||||||
|
|
|
@ -243,8 +243,6 @@ public class HemfPlusMisc {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(HemfGraphics ctx) {
|
public void draw(HemfGraphics ctx) {
|
||||||
HemfDrawProperties prop = ctx.getProperties();
|
|
||||||
|
|
||||||
AffineTransform tx = ctx.getInitTransform();
|
AffineTransform tx = ctx.getInitTransform();
|
||||||
tx.concatenate(getMatrixData());
|
tx.concatenate(getMatrixData());
|
||||||
ctx.setTransform(tx);
|
ctx.setTransform(tx);
|
||||||
|
@ -318,6 +316,7 @@ public class HemfPlusMisc {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The EmfPlusSetClipRect record combines the current clipping region with a rectangle. */
|
/** The EmfPlusSetClipRect record combines the current clipping region with a rectangle. */
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public static class EmfPlusSetClipRect implements HemfPlusRecord {
|
public static class EmfPlusSetClipRect implements HemfPlusRecord {
|
||||||
private static final BitField COMBINE_MODE = BitFieldFactory.getInstance(0x0F00);
|
private static final BitField COMBINE_MODE = BitFieldFactory.getInstance(0x0F00);
|
||||||
|
|
||||||
|
|
|
@ -117,6 +117,7 @@ public class HemfPlusObject {
|
||||||
* The EmfPlusObject record specifies an object for use in graphics operations. The object definition
|
* The EmfPlusObject record specifies an object for use in graphics operations. The object definition
|
||||||
* can span multiple records), which is indicated by the value of the Flags field.
|
* can span multiple records), which is indicated by the value of the Flags field.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public static class EmfPlusObject implements HemfPlusRecord, EmfPlusObjectId, HwmfObjectTableEntry {
|
public static class EmfPlusObject implements HemfPlusRecord, EmfPlusObjectId, HwmfObjectTableEntry {
|
||||||
/**
|
/**
|
||||||
* Indicates that the object definition continues on in the next EmfPlusObject
|
* Indicates that the object definition continues on in the next EmfPlusObject
|
||||||
|
@ -136,6 +137,7 @@ public class HemfPlusObject {
|
||||||
|
|
||||||
private int flags;
|
private int flags;
|
||||||
// for debugging
|
// for debugging
|
||||||
|
@SuppressWarnings("FieldCanBeLocal")
|
||||||
private int objectId;
|
private int objectId;
|
||||||
private EmfPlusObjectData objectData;
|
private EmfPlusObjectData objectData;
|
||||||
private List<EmfPlusObjectData> continuedObjectData;
|
private List<EmfPlusObjectData> continuedObjectData;
|
||||||
|
@ -155,6 +157,7 @@ public class HemfPlusObject {
|
||||||
return EmfPlusObjectType.valueOf(OBJECT_TYPE.getValue(flags));
|
return EmfPlusObjectType.valueOf(OBJECT_TYPE.getValue(flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public <T extends EmfPlusObjectData> T getObjectData() {
|
public <T extends EmfPlusObjectData> T getObjectData() {
|
||||||
return (T)objectData;
|
return (T)objectData;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,9 +55,10 @@ public class HemfPlusPath {
|
||||||
// not defined
|
// not defined
|
||||||
UNUSED,
|
UNUSED,
|
||||||
/** Specifies that the point is an endpoint or control point of a cubic Bezier curve */
|
/** Specifies that the point is an endpoint or control point of a cubic Bezier curve */
|
||||||
BEZIER;
|
BEZIER
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public static class EmfPlusPath implements EmfPlusObjectData, EmfPlusCompressed, EmfPlusRelativePosition {
|
public static class EmfPlusPath implements EmfPlusObjectData, EmfPlusCompressed, EmfPlusRelativePosition {
|
||||||
/**
|
/**
|
||||||
* If set, the point types in the PathPointTypes array are specified by EmfPlusPathPointTypeRLE objects,
|
* If set, the point types in the PathPointTypes array are specified by EmfPlusPathPointTypeRLE objects,
|
||||||
|
|
|
@ -46,6 +46,7 @@ import org.apache.poi.hwmf.record.HwmfPenStyle.HwmfLineDash;
|
||||||
import org.apache.poi.hwmf.record.HwmfPenStyle.HwmfLineJoin;
|
import org.apache.poi.hwmf.record.HwmfPenStyle.HwmfLineJoin;
|
||||||
import org.apache.poi.util.BitField;
|
import org.apache.poi.util.BitField;
|
||||||
import org.apache.poi.util.BitFieldFactory;
|
import org.apache.poi.util.BitFieldFactory;
|
||||||
|
import org.apache.poi.util.GenericRecordUtil;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
import org.apache.poi.util.LittleEndianConsts;
|
import org.apache.poi.util.LittleEndianConsts;
|
||||||
import org.apache.poi.util.LittleEndianInputStream;
|
import org.apache.poi.util.LittleEndianInputStream;
|
||||||
|
@ -233,14 +234,64 @@ public class HemfPlusPen {
|
||||||
|
|
||||||
|
|
||||||
@Internal
|
@Internal
|
||||||
public interface EmfPlusCustomLineCap extends GenericRecord {
|
public static abstract class EmfPlusCustomLineCap implements GenericRecord {
|
||||||
long init(LittleEndianInputStream leis) throws IOException;
|
private EmfPlusLineCapType startCap;
|
||||||
|
private EmfPlusLineCapType endCap;
|
||||||
|
private EmfPlusLineJoin join;
|
||||||
|
private double miterLimit;
|
||||||
|
private double widthScale;
|
||||||
|
private final Point2D fillHotSpot = new Point2D.Double();
|
||||||
|
private final Point2D lineHotSpot = new Point2D.Double();
|
||||||
|
|
||||||
|
protected long init(LittleEndianInputStream leis) throws IOException {
|
||||||
|
// A 32-bit unsigned integer that specifies the value in the LineCap enumeration that indicates the line
|
||||||
|
// cap used at the start/end of the line to be drawn.
|
||||||
|
startCap = EmfPlusLineCapType.valueOf(leis.readInt());
|
||||||
|
endCap = EmfPlusLineCapType.valueOf(leis.readInt());
|
||||||
|
|
||||||
|
// A 32-bit unsigned integer that specifies the value in the LineJoin enumeration, which specifies how
|
||||||
|
// to join two lines that are drawn by the same pen and whose ends meet. At the intersection of the two
|
||||||
|
// line ends, a line join makes the connection look more continuous.
|
||||||
|
join = EmfPlusLineJoin.valueOf(leis.readInt());
|
||||||
|
|
||||||
|
// A 32-bit floating-point value that contains the limit of the thickness of the join on a mitered corner
|
||||||
|
// by setting the maximum allowed ratio of miter length to line width.
|
||||||
|
miterLimit = leis.readFloat();
|
||||||
|
|
||||||
|
// A 32-bit floating-point value that specifies the amount by which to scale the custom line cap with
|
||||||
|
// respect to the width of the EmfPlusPen object that is used to draw the lines.
|
||||||
|
widthScale = leis.readFloat();
|
||||||
|
|
||||||
|
long size = 5*LittleEndianConsts.INT_SIZE;
|
||||||
|
|
||||||
|
// An EmfPlusPointF object that is not currently used. It MUST be set to {0.0, 0.0}.
|
||||||
|
size += readPointF(leis, fillHotSpot);
|
||||||
|
size += readPointF(leis, lineHotSpot);
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Supplier<?>> getGenericProperties() {
|
||||||
|
final Map<String,Supplier<?>> m = new LinkedHashMap<>();
|
||||||
|
m.put("startCap", () -> startCap);
|
||||||
|
m.put("endCap", () -> endCap);
|
||||||
|
m.put("join", () -> join);
|
||||||
|
m.put("miterLimit", () -> miterLimit);
|
||||||
|
m.put("widthScale", () -> widthScale);
|
||||||
|
m.put("fillHotSpot", () -> fillHotSpot);
|
||||||
|
m.put("lineHotSpot", () -> lineHotSpot);
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final EmfPlusObjectType getGenericRecordType() {
|
||||||
|
return EmfPlusObjectType.CUSTOM_LINE_CAP;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class EmfPlusPen implements EmfPlusObjectData {
|
public static class EmfPlusPen implements EmfPlusObjectData {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If set, a 2x3 transform matrix MUST be specified in the OptionalData field of an EmfPlusPenData object.
|
* If set, a 2x3 transform matrix MUST be specified in the OptionalData field of an EmfPlusPenData object.
|
||||||
*/
|
*/
|
||||||
|
@ -581,7 +632,7 @@ public class HemfPlusPen {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EmfPlusPathArrowCap implements EmfPlusCustomLineCap {
|
public static class EmfPlusPathArrowCap extends EmfPlusCustomLineCap {
|
||||||
/**
|
/**
|
||||||
* If set, an EmfPlusFillPath object MUST be specified in the OptionalData field of the
|
* If set, an EmfPlusFillPath object MUST be specified in the OptionalData field of the
|
||||||
* EmfPlusCustomLineCapData object for filling the custom line cap.
|
* EmfPlusCustomLineCapData object for filling the custom line cap.
|
||||||
|
@ -600,13 +651,6 @@ public class HemfPlusPen {
|
||||||
private int dataFlags;
|
private int dataFlags;
|
||||||
private EmfPlusLineCapType baseCap;
|
private EmfPlusLineCapType baseCap;
|
||||||
private double baseInset;
|
private double baseInset;
|
||||||
private EmfPlusLineCapType startCap;
|
|
||||||
private EmfPlusLineCapType endCap;
|
|
||||||
private EmfPlusLineJoin join;
|
|
||||||
private double miterLimit;
|
|
||||||
private double widthScale;
|
|
||||||
private final Point2D fillHotSpot = new Point2D.Double();
|
|
||||||
private final Point2D lineHotSpot = new Point2D.Double();
|
|
||||||
private EmfPlusPath fillPath;
|
private EmfPlusPath fillPath;
|
||||||
private EmfPlusPath outlinePath;
|
private EmfPlusPath outlinePath;
|
||||||
|
|
||||||
|
@ -624,78 +668,44 @@ public class HemfPlusPen {
|
||||||
// beginning of the line cap and the end of the line.
|
// beginning of the line cap and the end of the line.
|
||||||
baseInset = leis.readFloat();
|
baseInset = leis.readFloat();
|
||||||
|
|
||||||
// A 32-bit unsigned integer that specifies the value in the LineCap enumeration that indicates the line
|
long size = 3*LittleEndianConsts.INT_SIZE;
|
||||||
// cap used at the start/end of the line to be drawn.
|
|
||||||
startCap = EmfPlusLineCapType.valueOf(leis.readInt());
|
|
||||||
endCap = EmfPlusLineCapType.valueOf(leis.readInt());
|
|
||||||
|
|
||||||
// A 32-bit unsigned integer that specifies the value in the LineJoin enumeration, which specifies how
|
size += super.init(leis);
|
||||||
// to join two lines that are drawn by the same pen and whose ends meet. At the intersection of the two
|
|
||||||
// line ends, a line join makes the connection look more continuous.
|
|
||||||
join = EmfPlusLineJoin.valueOf(leis.readInt());
|
|
||||||
|
|
||||||
// A 32-bit floating-point value that contains the limit of the thickness of the join on a mitered corner
|
size += initPath(leis, FILL_PATH, p -> fillPath = p);
|
||||||
// by setting the maximum allowed ratio of miter length to line width.
|
size += initPath(leis, LINE_PATH, p -> outlinePath = p);
|
||||||
miterLimit = leis.readFloat();
|
|
||||||
|
|
||||||
// A 32-bit floating-point value that specifies the amount by which to scale the custom line cap with
|
|
||||||
// respect to the width of the EmfPlusPen object that is used to draw the lines.
|
|
||||||
widthScale = leis.readFloat();
|
|
||||||
|
|
||||||
int size = 8* LittleEndianConsts.INT_SIZE;
|
|
||||||
|
|
||||||
// An EmfPlusPointF object that is not currently used. It MUST be set to {0.0, 0.0}.
|
|
||||||
size += readPointF(leis, fillHotSpot);
|
|
||||||
size += readPointF(leis, lineHotSpot);
|
|
||||||
|
|
||||||
if (FILL_PATH.isSet(dataFlags)) {
|
|
||||||
int fillSize = leis.readInt();
|
|
||||||
size += LittleEndianConsts.INT_SIZE;
|
|
||||||
fillPath = new EmfPlusPath();
|
|
||||||
size += fillPath.init(leis, fillSize, EmfPlusObjectType.PATH, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (LINE_PATH.isSet(dataFlags)) {
|
|
||||||
int pathSize = leis.readInt();
|
|
||||||
size += LittleEndianConsts.INT_SIZE;
|
|
||||||
outlinePath = new EmfPlusPath();
|
|
||||||
size += outlinePath.init(leis, pathSize, EmfPlusObjectType.PATH, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private long initPath(LittleEndianInputStream leis, BitField bitField, Consumer<EmfPlusPath> setter) throws IOException {
|
||||||
|
if (!bitField.isSet(dataFlags)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int pathSize = leis.readInt();
|
||||||
|
EmfPlusPath path = new EmfPlusPath();
|
||||||
|
setter.accept(path);
|
||||||
|
return LittleEndianConsts.INT_SIZE + path.init(leis, pathSize, EmfPlusObjectType.PATH, -1);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Supplier<?>> getGenericProperties() {
|
public Map<String, Supplier<?>> getGenericProperties() {
|
||||||
final Map<String,Supplier<?>> m = new LinkedHashMap<>();
|
return GenericRecordUtil.getGenericProperties(
|
||||||
m.put("flags", getBitsAsString(() -> dataFlags, FLAGS_MASKS, FLAGS_NAMES));
|
"flags", getBitsAsString(() -> dataFlags, FLAGS_MASKS, FLAGS_NAMES),
|
||||||
m.put("baseCap", () -> baseCap);
|
"baseCap", () -> baseCap,
|
||||||
m.put("baseInset", () -> baseInset);
|
"baseInset", () -> baseInset,
|
||||||
m.put("startCap", () -> startCap);
|
"base", super::getGenericProperties,
|
||||||
m.put("endCap", () -> endCap);
|
"fillPath", () -> fillPath,
|
||||||
m.put("join", () -> join);
|
"outlinePath", () -> outlinePath
|
||||||
m.put("miterLimit", () -> miterLimit);
|
);
|
||||||
m.put("widthScale", () -> widthScale);
|
|
||||||
m.put("fillHotSpot", () -> fillHotSpot);
|
|
||||||
m.put("lineHotSpot", () -> lineHotSpot);
|
|
||||||
m.put("fillPath", () -> fillPath);
|
|
||||||
m.put("outlinePath", () -> outlinePath);
|
|
||||||
return Collections.unmodifiableMap(m);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EmfPlusAdjustableArrowCap implements EmfPlusCustomLineCap {
|
public static class EmfPlusAdjustableArrowCap extends EmfPlusCustomLineCap {
|
||||||
private double width;
|
private double width;
|
||||||
private double height;
|
private double height;
|
||||||
private double middleInset;
|
private double middleInset;
|
||||||
private boolean isFilled;
|
private boolean isFilled;
|
||||||
private EmfPlusLineCapType startCap;
|
|
||||||
private EmfPlusLineCapType endCap;
|
|
||||||
private EmfPlusLineJoin join;
|
|
||||||
private double miterLimit;
|
|
||||||
private double widthScale;
|
|
||||||
private final Point2D fillHotSpot = new Point2D.Double();
|
|
||||||
private final Point2D lineHotSpot = new Point2D.Double();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long init(LittleEndianInputStream leis) throws IOException {
|
public long init(LittleEndianInputStream leis) throws IOException {
|
||||||
|
@ -719,51 +729,19 @@ public class HemfPlusPen {
|
||||||
// If the arrow cap is not filled, only the outline is drawn.
|
// If the arrow cap is not filled, only the outline is drawn.
|
||||||
isFilled = (leis.readInt() != 0);
|
isFilled = (leis.readInt() != 0);
|
||||||
|
|
||||||
// A 32-bit unsigned integer that specifies the value in the LineCap enumeration that indicates
|
return 4*LittleEndianConsts.INT_SIZE + super.init(leis);
|
||||||
// the line cap to be used at the start/end of the line to be drawn.
|
|
||||||
startCap = EmfPlusLineCapType.valueOf(leis.readInt());
|
|
||||||
endCap = EmfPlusLineCapType.valueOf(leis.readInt());
|
|
||||||
|
|
||||||
// 32-bit unsigned integer that specifies the value in the LineJoin enumeration that specifies how to
|
|
||||||
// join two lines that are drawn by the same pen and whose ends meet. At the intersection of the two
|
|
||||||
// line ends, a line join makes the connection look more continuous.
|
|
||||||
join = EmfPlusLineJoin.valueOf(leis.readInt());
|
|
||||||
|
|
||||||
// A 32-bit floating-point value that specifies the limit of the thickness of the join on a mitered
|
|
||||||
// corner by setting the maximum allowed ratio of miter length to line width.
|
|
||||||
miterLimit = leis.readFloat();
|
|
||||||
|
|
||||||
// A 32-bit floating-point value that specifies the amount by which to scale an EmfPlusCustomLineCap
|
|
||||||
// object with respect to the width of the graphics pen that is used to draw the lines.
|
|
||||||
widthScale = leis.readFloat();
|
|
||||||
|
|
||||||
int size = 9 * LittleEndianConsts.INT_SIZE;
|
|
||||||
|
|
||||||
// An EmfPlusPointF object that is not currently used. It MUST be set to {0.0, 0.0}.
|
|
||||||
size += readPointF(leis, fillHotSpot);
|
|
||||||
|
|
||||||
// An EmfPlusPointF object that is not currently used. It MUST be set to {0.0, 0.0}.
|
|
||||||
size += readPointF(leis, lineHotSpot);
|
|
||||||
|
|
||||||
return size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Supplier<?>> getGenericProperties() {
|
public Map<String, Supplier<?>> getGenericProperties() {
|
||||||
final Map<String,Supplier<?>> m = new LinkedHashMap<>();
|
return GenericRecordUtil.getGenericProperties(
|
||||||
m.put("width", () -> width);
|
"width", () -> width,
|
||||||
m.put("height", () -> height);
|
"height", () -> height,
|
||||||
m.put("middleInset", () -> middleInset);
|
"middleInset", () -> middleInset,
|
||||||
m.put("isFilled", () -> isFilled);
|
"isFilled", () -> isFilled,
|
||||||
m.put("startCap", () -> startCap);
|
"base", super::getGenericProperties
|
||||||
m.put("endCap", () -> endCap);
|
);
|
||||||
m.put("join", () -> join);
|
|
||||||
m.put("miterLimit", () -> miterLimit);
|
|
||||||
m.put("widthScale", () -> widthScale);
|
|
||||||
m.put("fillHotSpot", () -> fillHotSpot);
|
|
||||||
m.put("lineHotSpot", () -> lineHotSpot);
|
|
||||||
return Collections.unmodifiableMap(m);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ public interface HemfPlusRecord extends GenericRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default Enum getGenericRecordType() {
|
default HemfPlusRecordType getGenericRecordType() {
|
||||||
return getEmfPlusRecordType();
|
return getEmfPlusRecordType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,6 +108,7 @@ public class HemfPlusRegion {
|
||||||
private final EmfPlusGraphicsVersion graphicsVersion = new EmfPlusGraphicsVersion();
|
private final EmfPlusGraphicsVersion graphicsVersion = new EmfPlusGraphicsVersion();
|
||||||
private EmfPlusRegionNodeData regionNode;
|
private EmfPlusRegionNodeData regionNode;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@Override
|
@Override
|
||||||
public long init(LittleEndianInputStream leis, long dataSize, EmfPlusObjectType objectType, int flags) throws IOException {
|
public long init(LittleEndianInputStream leis, long dataSize, EmfPlusObjectType objectType, int flags) throws IOException {
|
||||||
long size = graphicsVersion.init(leis);
|
long size = graphicsVersion.init(leis);
|
||||||
|
|
|
@ -30,11 +30,8 @@ import org.apache.poi.util.LittleEndianInputStream;
|
||||||
@Internal
|
@Internal
|
||||||
public class UnimplementedHemfPlusRecord implements HemfPlusRecord {
|
public class UnimplementedHemfPlusRecord implements HemfPlusRecord {
|
||||||
|
|
||||||
private static final int MAX_RECORD_LENGTH = 1_000_000;
|
|
||||||
|
|
||||||
private HemfPlusRecordType recordType;
|
private HemfPlusRecordType recordType;
|
||||||
private int flags;
|
private int flags;
|
||||||
private byte[] recordBytes;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HemfPlusRecordType getEmfPlusRecordType() {
|
public HemfPlusRecordType getEmfPlusRecordType() {
|
||||||
|
@ -50,21 +47,17 @@ public class UnimplementedHemfPlusRecord implements HemfPlusRecord {
|
||||||
public long init(LittleEndianInputStream leis, long dataSize, long recordId, int flags) throws IOException {
|
public long init(LittleEndianInputStream leis, long dataSize, long recordId, int flags) throws IOException {
|
||||||
recordType = HemfPlusRecordType.getById(recordId);
|
recordType = HemfPlusRecordType.getById(recordId);
|
||||||
this.flags = flags;
|
this.flags = flags;
|
||||||
recordBytes = IOUtils.safelyAllocate(dataSize, MAX_RECORD_LENGTH);
|
long skipped = IOUtils.skipFully(leis, dataSize);
|
||||||
leis.readFully(recordBytes);
|
if (skipped < dataSize) {
|
||||||
return recordBytes.length;
|
throw new IOException("End of stream reached before record read");
|
||||||
}
|
}
|
||||||
|
return skipped;
|
||||||
public byte[] getRecordBytes() {
|
|
||||||
//should probably defensively return a copy.
|
|
||||||
return recordBytes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Supplier<?>> getGenericProperties() {
|
public Map<String, Supplier<?>> getGenericProperties() {
|
||||||
return GenericRecordUtil.getGenericProperties(
|
return GenericRecordUtil.getGenericProperties(
|
||||||
"flags", this::getFlags,
|
"flags", this::getFlags
|
||||||
"recordBytes", () -> recordBytes
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue