* MutablePropertySet#MutablePropertySet(PropertySet)} constructor.</p>
*/
static class CopyFile implements POIFSReaderListener {
- String dstName;
- OutputStream out;
- POIFSFileSystem poiFs;
+ private String dstName;
+ private OutputStream out;
+ private POIFSFileSystem poiFs;
/**
*/
static class ModifySICopyTheRest implements POIFSReaderListener
{
- String dstName;
- OutputStream out;
- POIFSFileSystem poiFs;
+ private String dstName;
+ private OutputStream out;
+ private POIFSFileSystem poiFs;
/**
private long type;
/** The property's value. */
- protected Object value;
+ private Object value;
/**
* Keeps a list of the variant types an "unsupported" message has already
* been issued for.
*/
- protected static List<Long> unsupportedMessage;
+ private static List<Long> unsupportedMessage;
/**
ImageHeaderEMF nHeader = new ImageHeaderEMF(data, 0);
Header header = new Header();
- header.wmfsize = data.length;
- header.bounds = nHeader.getBounds();
+ header.setWmfSize(data.length);
+ header.setBounds(nHeader.getBounds());
Dimension nDim = nHeader.getSize();
- header.size = new Dimension(Units.toEMU(nDim.getWidth()), Units.toEMU(nDim.getHeight()));
- header.zipsize = compressed.length;
+ header.setDimension(new Dimension(Units.toEMU(nDim.getWidth()), Units.toEMU(nDim.getHeight())));
+ header.setZipSize(compressed.length);
byte[] checksum = getChecksum(data);
ByteArrayOutputStream out = new ByteArrayOutputStream();
/**
* size of the original file
*/
- public int wmfsize;
+ private int wmfsize;
/**
* Boundary of the metafile drawing commands
*/
- public Rectangle bounds;
+ private final Rectangle bounds = new Rectangle();
/**
* Size of the metafile in EMUs
*/
- public Dimension size;
+ private final Dimension size = new Dimension();
/**
* size of the compressed metafile data
*/
- public int zipsize;
+ private int zipsize;
/**
* Reserved. Always 0.
*/
- public int compression = 0;
+ private int compression = 0;
/**
* Reserved. Always 254.
*/
- public int filter = 254;
+ private int filter = 254;
public void read(byte[] data, int offset){
int pos = offset;
int right = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
int bottom = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
- bounds = new Rectangle(left, top, right-left, bottom-top);
+ bounds.setBounds(left, top, right-left, bottom-top);
int width = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
int height = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
- size = new Dimension(width, height);
+ size.setSize(width, height);
zipsize = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
public int getWmfSize() {
return wmfsize;
}
+
+ protected void setWmfSize(int wmfSize) {
+ this.wmfsize = wmfSize;
+ }
+
+ protected void setZipSize(int zipSize) {
+ this.zipsize = zipSize;
+ }
+
+ public Rectangle getBounds() {
+ return (Rectangle)bounds.clone();
+ }
+
+ protected void setBounds(Rectangle bounds) {
+ this.bounds.setBounds(bounds);
+ }
+
+ protected void setDimension(Dimension size) {
+ this.size.setSize(size);
+ }
}
protected static byte[] compress(byte[] bytes, int offset, int length) throws IOException {
ImageHeaderPICT nHeader = new ImageHeaderPICT(data, nOffset);
Header header = new Header();
- header.wmfsize = data.length - nOffset;
- byte[] compressed = compress(data, nOffset, header.wmfsize);
- header.zipsize = compressed.length;
- header.bounds = nHeader.getBounds();
+ int wmfSize = data.length - nOffset;
+ header.setWmfSize(wmfSize);
+ byte[] compressed = compress(data, nOffset, wmfSize);
+ header.setZipSize(compressed.length);
+ header.setBounds(nHeader.getBounds());
Dimension nDim = nHeader.getSize();
- header.size = new Dimension(Units.toEMU(nDim.getWidth()), Units.toEMU(nDim.getHeight()));
+ header.setDimension(new Dimension(Units.toEMU(nDim.getWidth()), Units.toEMU(nDim.getHeight())));
byte[] checksum = getChecksum(data);
ByteArrayOutputStream out = new ByteArrayOutputStream();
long len = is.skip(header.getSize() + CHECKSUM_SIZE*uidInstanceCount);
assert(len == header.getSize() + CHECKSUM_SIZE*uidInstanceCount);
- ImageHeaderWMF aldus = new ImageHeaderWMF(header.bounds);
+ ImageHeaderWMF aldus = new ImageHeaderWMF(header.getBounds());
aldus.write(out);
InflaterInputStream inflater = new InflaterInputStream( is );
byte[] compressed = compress(data, pos, data.length-pos);
Header header = new Header();
- header.wmfsize = data.length - nHeader.getLength();
- header.bounds = nHeader.getBounds();
+ header.setWmfSize(data.length - nHeader.getLength());
+ header.setBounds(nHeader.getBounds());
Dimension nDim = nHeader.getSize();
- header.size = new Dimension(Units.toEMU(nDim.getWidth()), Units.toEMU(nDim.getHeight()));
- header.zipsize = compressed.length;
+ header.setDimension(new Dimension(Units.toEMU(nDim.getWidth()), Units.toEMU(nDim.getHeight())));
+ header.setZipSize(compressed.length);
byte[] checksum = getChecksum(data);
ByteArrayOutputStream out = new ByteArrayOutputStream();
/**
* A shape representing embedded OLE obejct.
- *
- * @author Yegor Kozlov
*/
public final class OLEShape extends HSLFPictureShape {
- protected ExEmbed _exEmbed;
+ private ExEmbed _exEmbed;
/**
* Create a new <code>OLEShape</code>
public final static byte FF_DECORATIVE = 80;
- protected int charset;
- protected int type;
- protected int flags;
- protected int pitch;
- protected String name;
+ private int charset;
+ private int type;
+ private int flags;
+ private int pitch;
+ private String name;
/**
* Creates a new instance of PPFont
/**
* Translates Graphics2D calls into PowerPoint.
- *
- * @author Yegor Kozlov
*/
public final class PPGraphics2D extends Graphics2D implements Cloneable {
- protected POILogger log = POILogFactory.getLogger(this.getClass());
+ private static final POILogger LOG = POILogFactory.getLogger(PPGraphics2D.class);
//The ppt object to write into.
private HSLFGroupShape _group;
*/
@NotImplemented
public void clip(Shape s){
- if (log.check(POILogger.WARN)) {
- log.log(POILogger.WARN, "Not implemented");
+ if (LOG.check(POILogger.WARN)) {
+ LOG.log(POILogger.WARN, "Not implemented");
}
}
*/
@NotImplemented
public Shape getClip(){
- if (log.check(POILogger.WARN)) {
- log.log(POILogger.WARN, "Not implemented");
+ if (LOG.check(POILogger.WARN)) {
+ LOG.log(POILogger.WARN, "Not implemented");
}
return null;
}
public boolean drawImage(Image img, int x, int y,
Color bgcolor,
ImageObserver observer){
- if (log.check(POILogger.WARN)) {
- log.log(POILogger.WARN, "Not implemented");
+ if (LOG.check(POILogger.WARN)) {
+ LOG.log(POILogger.WARN, "Not implemented");
}
return false;
int width, int height,
Color bgcolor,
ImageObserver observer){
- if (log.check(POILogger.WARN)) {
- log.log(POILogger.WARN, "Not implemented");
+ if (LOG.check(POILogger.WARN)) {
+ LOG.log(POILogger.WARN, "Not implemented");
}
return false;
int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2,
ImageObserver observer){
- if (log.check(POILogger.WARN)) {
- log.log(POILogger.WARN, "Not implemented");
+ if (LOG.check(POILogger.WARN)) {
+ LOG.log(POILogger.WARN, "Not implemented");
}
return false;
}
int sx1, int sy1, int sx2, int sy2,
Color bgcolor,
ImageObserver observer){
- if (log.check(POILogger.WARN)) {
- log.log(POILogger.WARN, "Not implemented");
+ if (LOG.check(POILogger.WARN)) {
+ LOG.log(POILogger.WARN, "Not implemented");
}
return false;
}
@NotImplemented
public boolean drawImage(Image img, int x, int y,
ImageObserver observer) {
- if (log.check(POILogger.WARN)) {
- log.log(POILogger.WARN, "Not implemented");
+ if (LOG.check(POILogger.WARN)) {
+ LOG.log(POILogger.WARN, "Not implemented");
}
return false;
}
*/
@NotImplemented
public void setClip(Shape clip) {
- if (log.check(POILogger.WARN)) {
- log.log(POILogger.WARN, "Not implemented");
+ if (LOG.check(POILogger.WARN)) {
+ LOG.log(POILogger.WARN, "Not implemented");
}
}
*/
@NotImplemented
public void setComposite(Composite comp){
- if (log.check(POILogger.WARN)) {
- log.log(POILogger.WARN, "Not implemented");
+ if (LOG.check(POILogger.WARN)) {
+ LOG.log(POILogger.WARN, "Not implemented");
}
}
*/
@NotImplemented
public Composite getComposite(){
- if (log.check(POILogger.WARN)) {
- log.log(POILogger.WARN, "Not implemented");
+ if (LOG.check(POILogger.WARN)) {
+ LOG.log(POILogger.WARN, "Not implemented");
}
return null;
}
*/
@NotImplemented
public void drawString(AttributedCharacterIterator iterator, float x, float y) {
- if (log.check(POILogger.WARN)) {
- log.log(POILogger.WARN, "Not implemented");
+ if (LOG.check(POILogger.WARN)) {
+ LOG.log(POILogger.WARN, "Not implemented");
}
}
*/
@NotImplemented
public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs) {
- if (log.check(POILogger.WARN)) {
- log.log(POILogger.WARN, "Not implemented");
+ if (LOG.check(POILogger.WARN)) {
+ LOG.log(POILogger.WARN, "Not implemented");
}
return false;
}
public boolean drawImage(Image img, int x, int y,
int width, int height,
ImageObserver observer) {
- if (log.check(POILogger.WARN)) {
- log.log(POILogger.WARN, "Not implemented");
+ if (LOG.check(POILogger.WARN)) {
+ LOG.log(POILogger.WARN, "Not implemented");
}
return false;
}
*/
@NotImplemented
public void setXORMode(Color c1) {
- if (log.check(POILogger.WARN)) {
- log.log(POILogger.WARN, "Not implemented");
+ if (LOG.check(POILogger.WARN)) {
+ LOG.log(POILogger.WARN, "Not implemented");
}
}
*/
@NotImplemented
public void setPaintMode() {
- if (log.check(POILogger.WARN)) {
- log.log(POILogger.WARN, "Not implemented");
+ if (LOG.check(POILogger.WARN)) {
+ LOG.log(POILogger.WARN, "Not implemented");
}
}
*/
@NotImplemented
public void drawRenderedImage(RenderedImage img, AffineTransform xform) {
- if (log.check(POILogger.WARN)) {
- log.log(POILogger.WARN, "Not implemented");
+ if (LOG.check(POILogger.WARN)) {
+ LOG.log(POILogger.WARN, "Not implemented");
}
}
*/
@NotImplemented
public void drawRenderableImage(RenderableImage img, AffineTransform xform) {
- if (log.check(POILogger.WARN)) {
- log.log(POILogger.WARN, "Not implemented");
+ if (LOG.check(POILogger.WARN)) {
+ LOG.log(POILogger.WARN, "Not implemented");
}
}
public boolean[] getSubPropMatches() { return subPropMatches; }
protected BitMaskTextProp(int sizeOfDataBlock, int maskInHeader, String overallName, String... subPropNames) {
- super(sizeOfDataBlock,maskInHeader,"bitmask");
+ super(sizeOfDataBlock,maskInHeader,overallName);
this.subPropNames = subPropNames;
- this.propName = overallName;
subPropMasks = new int[subPropNames.length];
subPropMatches = new boolean[subPropNames.length];
*/
@Override
public int getValue() {
- return maskValue(dataValue);
+ return maskValue(super.getValue());
}
private int maskValue(int pVal) {
*/
@Override
public void setValue(int val) {
- dataValue = val;
+ super.setValue(val);
// Figure out the values of the sub properties
int i = 0;
*/
public void setValueWithMask(int val, int writeMask) {
setWriteMask(writeMask);
- dataValue = maskValue(val);
- if (val != dataValue) {
+ super.setValue(maskValue(val));
+ if (val != super.getValue()) {
logger.log(POILogger.WARN, "Style properties of '"+getName()+"' don't match mask - output will be sanitized");
if (logger.check(POILogger.DEBUG)) {
StringBuilder sb = new StringBuilder("The following style attributes of the '"+getName()+"' property will be ignored:\n");
* Fetch the true/false status of the subproperty with the given index
*/
public boolean getSubValue(int idx) {
- return subPropMatches[idx] && ((dataValue & subPropMasks[idx]) != 0);
+ return subPropMatches[idx] && ((super.getValue() & subPropMasks[idx]) != 0);
}
/**
*/
public void setSubValue(boolean value, int idx) {
subPropMatches[idx] = true;
+ int newVal = super.getValue();
if (value) {
- dataValue |= subPropMasks[idx];
+ newVal |= subPropMasks[idx];
} else {
- dataValue &= ~subPropMasks[idx];
+ newVal &= ~subPropMasks[idx];
}
+ super.setValue(newVal);
}
@Override
* TextProps is stored in the different record classes
*/
public class TextProp implements Cloneable {
- protected int sizeOfDataBlock; // Number of bytes the data part uses
- protected String propName;
- protected int dataValue;
- protected int maskInHeader;
+ private int sizeOfDataBlock; // Number of bytes the data part uses
+ private String propName;
+ private int dataValue;
+ private int maskInHeader;
/**
* Generate the definition of a given type of text property.
* the slide layout as specified in the SlideAtom record.\r
*/\r
public class EscherPlaceholder extends EscherRecord {\r
- public static final short RECORD_ID = (short)RecordTypes.OEPlaceholderAtom.typeID;\r
+ public static final short RECORD_ID = RecordTypes.OEPlaceholderAtom.typeID;\r
public static final String RECORD_DESCRIPTION = "msofbtClientTextboxPlaceholder";\r
\r
- int position = -1;\r
- byte placementId = 0;\r
- byte size = 0;\r
- short unused = 0;\r
+ private int position = -1;\r
+ private byte placementId = 0;\r
+ private byte size = 0;\r
+ private short unused = 0;\r
\r
public EscherPlaceholder() {}\r
\r
* Create a new ExEmbed, with blank fields
*/
public ExControl() {
- super();
-
- _children[0] = embedAtom = new ExControlAtom();
+ super(new ExControlAtom());
}
/**
/**
* This data represents an embedded object in the document.
- *
- * @author Daniel Noll
*/
public class ExEmbed extends RecordContainer {
private byte[] _header;
// Links to our more interesting children
- protected RecordAtom embedAtom;
+ private RecordAtom embedAtom;
private ExOleObjAtom oleObjAtom;
private CString menuName;
private CString progId;
findInterestingChildren();
}
+ /**
+ * Constructor for derived classes
+ *
+ * @param embedAtom the new embedAtom
+ */
+ protected ExEmbed(RecordAtom embedAtom) {
+ this();
+ _children[0] = this.embedAtom = embedAtom;
+ }
+
+
+
/**
* Create a new ExEmbed, with blank fields
*/
{
if(clipboardName != null) clipboardName.setText(s);
}
+
/**
* Returns the type (held as a little endian in bytes 3 and 4)
* that this class handles.
/**
* Storage for embedded OLE objects.
- *
- * @author Daniel Noll
*/
-public class ExOleObjStg extends RecordAtom implements PositionDependentRecord, PersistRecord {
+public class ExOleObjStg extends PositionDependentRecordAtom implements PersistRecord {
private int _persistId; // Found from PersistPtrHolder
* Record data.
*/
private byte[] _data;
-
+
/**
* Constructs a new empty storage container.
*/
_persistId = id;
}
- /** Our location on the disk, as of the last write out */
- protected int myLastOnDiskOffset;
-
- /** Fetch our location on the disk, as of the last write out */
- public int getLastOnDiskOffset() { return myLastOnDiskOffset; }
-
- /**
- * Update the Record's idea of where on disk it lives, after a write out.
- * Use with care...
- */
- public void setLastOnDiskOffset(int offset) {
- myLastOnDiskOffset = offset;
- }
-
@Override
public void updateOtherRecordReferences(Map<Integer,Integer> oldToNewReferencesLookup) {
// nothing to update
}
-}
+}
\ No newline at end of file
* A special (and dangerous) kind of Record Atom that cares about where
* it lives on the disk, or who has other Atoms that care about where
* this is on the disk.
- *
- * @author Nick Burch
*/
public abstract class PositionDependentRecordAtom extends RecordAtom implements PositionDependentRecord
{
/** Our location on the disk, as of the last write out */
- protected int myLastOnDiskOffset;
+ private int myLastOnDiskOffset;
/** Fetch our location on the disk, as of the last write out */
public int getLastOnDiskOffset() { return myLastOnDiskOffset; }
* A special (and dangerous) kind of Record Container, for which other
* Atoms care about where this one lives on disk.
* Will track its position on disk.
- *
- * @author Nick Burch
*/
public abstract class PositionDependentRecordContainer extends RecordContainer implements PositionDependentRecord
/** Our location on the disk, as of the last write out */
- protected int myLastOnDiskOffset;
+ private int myLastOnDiskOffset;
/** Fetch our location on the disk, as of the last write out */
public int getLastOnDiskOffset() { return myLastOnDiskOffset; }
* If we're told they have, just return straight off.
*/
public void updateOtherRecordReferences(Map<Integer,Integer> oldToNewReferencesLookup) {
- return;
}
}
*/
public int getCharactersCovered(){
int covered = 0;
- for (TextSpecInfoRun r : getTextSpecInfoRuns()) covered += r.length;
+ for (TextSpecInfoRun r : getTextSpecInfoRuns()) covered += r.getLength();
return covered;
}
private static final BitField grammarErrorFld = new BitField(0X80000000);\r
\r
//Length of special info run.\r
- protected int length;\r
+ private int length;\r
\r
//Special info mask of this run;\r
- protected int mask;\r
+ private int mask;\r
\r
// info fields as indicated by the mask.\r
// -1 means the bit is not set\r
* grammar (1 bit): A bit that specifies whether the text has a grammar error.<br>\r
* reserved (13 bits): MUST be zero and MUST be ignored.\r
*/\r
- protected short spellInfo = -1;\r
+ private short spellInfo = -1;\r
\r
/**\r
* An optional TxLCID that specifies the language identifier of this text.\r
* 0x0400 = No proofing is performed on the text.<br>\r
* > 0x0400 = A valid LCID as specified by [MS-LCID].\r
*/\r
- protected short langId = -1;\r
+ private short langId = -1;\r
\r
/**\r
* An optional TxLCID that specifies the alternate language identifier of this text.\r
* It MUST exist if and only if altLang is TRUE.\r
*/\r
- protected short altLangId = -1;\r
+ private short altLangId = -1;\r
\r
/**\r
* An optional signed integer that specifies whether the text contains bidirectional\r
* 0x0000 = Contains no bidirectional characters,\r
* 0x0001 = Contains bidirectional characters.\r
*/\r
- protected short bidi = -1;\r
+ private short bidi = -1;\r
\r
- protected int pp10extMask = -1;\r
- protected byte[] smartTagsBytes = null;\r
+ private int pp10extMask = -1;\r
+ private byte[] smartTagsBytes = null;\r
\r
/**\r
* Inits a TextSpecInfoRun with default values\r