diff --git a/src/examples/src/org/apache/poi/hpsf/examples/CopyCompare.java b/src/examples/src/org/apache/poi/hpsf/examples/CopyCompare.java index 43ea2e9d8..d276fa4e7 100644 --- a/src/examples/src/org/apache/poi/hpsf/examples/CopyCompare.java +++ b/src/examples/src/org/apache/poi/hpsf/examples/CopyCompare.java @@ -288,9 +288,9 @@ public class CopyCompare * MutablePropertySet#MutablePropertySet(PropertySet)} constructor.
*/ static class CopyFile implements POIFSReaderListener { - String dstName; - OutputStream out; - POIFSFileSystem poiFs; + private String dstName; + private OutputStream out; + private POIFSFileSystem poiFs; /** diff --git a/src/examples/src/org/apache/poi/hpsf/examples/WriteAuthorAndTitle.java b/src/examples/src/org/apache/poi/hpsf/examples/WriteAuthorAndTitle.java index d08d778b0..4e86030a5 100644 --- a/src/examples/src/org/apache/poi/hpsf/examples/WriteAuthorAndTitle.java +++ b/src/examples/src/org/apache/poi/hpsf/examples/WriteAuthorAndTitle.java @@ -131,9 +131,9 @@ public class WriteAuthorAndTitle */ static class ModifySICopyTheRest implements POIFSReaderListener { - String dstName; - OutputStream out; - POIFSFileSystem poiFs; + private String dstName; + private OutputStream out; + private POIFSFileSystem poiFs; /** diff --git a/src/java/org/apache/poi/hpsf/Property.java b/src/java/org/apache/poi/hpsf/Property.java index b9841dbcc..8c81f0b2f 100644 --- a/src/java/org/apache/poi/hpsf/Property.java +++ b/src/java/org/apache/poi/hpsf/Property.java @@ -65,7 +65,7 @@ public class Property { private long type; /** The property's value. */ - protected Object value; + private Object value; /** diff --git a/src/java/org/apache/poi/hpsf/VariantSupport.java b/src/java/org/apache/poi/hpsf/VariantSupport.java index 61fc30d88..25c44dff9 100644 --- a/src/java/org/apache/poi/hpsf/VariantSupport.java +++ b/src/java/org/apache/poi/hpsf/VariantSupport.java @@ -62,7 +62,7 @@ public class VariantSupport extends Variant { * Keeps a list of the variant types an "unsupported" message has already * been issued for. */ - protected static ListOLEShape
diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/PPFont.java b/src/scratchpad/src/org/apache/poi/hslf/model/PPFont.java
index e6f7a9ded..7de68dc76 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/model/PPFont.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/model/PPFont.java
@@ -80,11 +80,11 @@ public final class PPFont {
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
diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java b/src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java
index 74047674c..2d4e3aeca 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java
@@ -68,12 +68,10 @@ import org.apache.poi.util.SuppressForbidden;
/**
* 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;
@@ -392,8 +390,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
*/
@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");
}
}
@@ -415,8 +413,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
*/
@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;
}
@@ -686,8 +684,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
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;
@@ -736,8 +734,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
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;
@@ -796,8 +794,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
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;
}
@@ -861,8 +859,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
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;
}
@@ -902,8 +900,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
@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;
}
@@ -1089,8 +1087,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
*/
@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");
}
}
@@ -1389,8 +1387,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
*/
@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");
}
}
@@ -1403,8 +1401,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
*/
@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;
}
@@ -1547,8 +1545,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
*/
@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");
}
}
@@ -1654,8 +1652,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
*/
@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;
}
@@ -1700,8 +1698,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
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;
}
@@ -1751,8 +1749,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
*/
@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");
}
}
@@ -1765,8 +1763,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
*/
@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");
}
}
@@ -1803,8 +1801,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
*/
@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");
}
}
@@ -1831,8 +1829,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
*/
@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");
}
}
diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/BitMaskTextProp.java b/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/BitMaskTextProp.java
index a8847d072..ec0140893 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/BitMaskTextProp.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/BitMaskTextProp.java
@@ -40,9 +40,8 @@ public abstract class BitMaskTextProp extends TextProp implements Cloneable {
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];
@@ -91,7 +90,7 @@ public abstract class BitMaskTextProp extends TextProp implements Cloneable {
*/
@Override
public int getValue() {
- return maskValue(dataValue);
+ return maskValue(super.getValue());
}
private int maskValue(int pVal) {
@@ -111,7 +110,7 @@ public abstract class BitMaskTextProp extends TextProp implements Cloneable {
*/
@Override
public void setValue(int val) {
- dataValue = val;
+ super.setValue(val);
// Figure out the values of the sub properties
int i = 0;
@@ -128,8 +127,8 @@ public abstract class BitMaskTextProp extends TextProp implements Cloneable {
*/
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");
@@ -149,7 +148,7 @@ public abstract class BitMaskTextProp extends TextProp implements Cloneable {
* 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);
}
/**
@@ -157,11 +156,13 @@ public abstract class BitMaskTextProp extends TextProp implements Cloneable {
*/
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
diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextProp.java b/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextProp.java
index c6d1589d0..9333968f0 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextProp.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextProp.java
@@ -31,10 +31,10 @@ import java.util.Locale;
* 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.
diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/EscherPlaceholder.java b/src/scratchpad/src/org/apache/poi/hslf/record/EscherPlaceholder.java
index 6aa09b936..2bac1ca22 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/record/EscherPlaceholder.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/record/EscherPlaceholder.java
@@ -26,13 +26,13 @@ import org.apache.poi.util.*;
* the slide layout as specified in the SlideAtom record.
*/
public class EscherPlaceholder extends EscherRecord {
- public static final short RECORD_ID = (short)RecordTypes.OEPlaceholderAtom.typeID;
+ public static final short RECORD_ID = RecordTypes.OEPlaceholderAtom.typeID;
public static final String RECORD_DESCRIPTION = "msofbtClientTextboxPlaceholder";
- int position = -1;
- byte placementId = 0;
- byte size = 0;
- short unused = 0;
+ private int position = -1;
+ private byte placementId = 0;
+ private byte size = 0;
+ private short unused = 0;
public EscherPlaceholder() {}
diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/ExControl.java b/src/scratchpad/src/org/apache/poi/hslf/record/ExControl.java
index 2b0d1e2c3..58be5715e 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/record/ExControl.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/record/ExControl.java
@@ -50,9 +50,7 @@ public final class ExControl extends ExEmbed {
* Create a new ExEmbed, with blank fields
*/
public ExControl() {
- super();
-
- _children[0] = embedAtom = new ExControlAtom();
+ super(new ExControlAtom());
}
/**
diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/ExEmbed.java b/src/scratchpad/src/org/apache/poi/hslf/record/ExEmbed.java
index 7580450cd..7903bb32d 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/record/ExEmbed.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/record/ExEmbed.java
@@ -25,8 +25,6 @@ import org.apache.poi.util.POILogger;
/**
* This data represents an embedded object in the document.
- *
- * @author Daniel Noll
*/
public class ExEmbed extends RecordContainer {
@@ -36,7 +34,7 @@ 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;
@@ -59,6 +57,18 @@ public class ExEmbed extends RecordContainer {
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
*/
@@ -182,6 +192,7 @@ public class ExEmbed extends RecordContainer {
{
if(clipboardName != null) clipboardName.setText(s);
}
+
/**
* Returns the type (held as a little endian in bytes 3 and 4)
* that this class handles.
diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java b/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java
index e705d24db..0ba89d723 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java
@@ -31,10 +31,8 @@ import org.apache.poi.util.LittleEndian;
/**
* 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
@@ -47,7 +45,7 @@ public class ExOleObjStg extends RecordAtom implements PositionDependentRecord,
* Record data.
*/
private byte[] _data;
-
+
/**
* Constructs a new empty storage container.
*/
@@ -179,22 +177,8 @@ public class ExOleObjStg extends RecordAtom implements PositionDependentRecord,
_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