]> source.dussan.org Git - poi.git/commitdiff
SonarCube fix - make members private
authorAndreas Beeker <kiwiwings@apache.org>
Wed, 7 Dec 2016 23:45:38 +0000 (23:45 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Wed, 7 Dec 2016 23:45:38 +0000 (23:45 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1773165 13f79535-47bb-0310-9956-ffa450edef68

21 files changed:
src/examples/src/org/apache/poi/hpsf/examples/CopyCompare.java
src/examples/src/org/apache/poi/hpsf/examples/WriteAuthorAndTitle.java
src/java/org/apache/poi/hpsf/Property.java
src/java/org/apache/poi/hpsf/VariantSupport.java
src/scratchpad/src/org/apache/poi/hslf/blip/EMF.java
src/scratchpad/src/org/apache/poi/hslf/blip/Metafile.java
src/scratchpad/src/org/apache/poi/hslf/blip/PICT.java
src/scratchpad/src/org/apache/poi/hslf/blip/WMF.java
src/scratchpad/src/org/apache/poi/hslf/model/OLEShape.java
src/scratchpad/src/org/apache/poi/hslf/model/PPFont.java
src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java
src/scratchpad/src/org/apache/poi/hslf/model/textproperties/BitMaskTextProp.java
src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextProp.java
src/scratchpad/src/org/apache/poi/hslf/record/EscherPlaceholder.java
src/scratchpad/src/org/apache/poi/hslf/record/ExControl.java
src/scratchpad/src/org/apache/poi/hslf/record/ExEmbed.java
src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java
src/scratchpad/src/org/apache/poi/hslf/record/PositionDependentRecordAtom.java
src/scratchpad/src/org/apache/poi/hslf/record/PositionDependentRecordContainer.java
src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoAtom.java
src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoRun.java

index 43ea2e9d8dccd0a7467b3edbdd8c2eabb5a1a299..d276fa4e7224d7cd9f6aeb504e578cb790837f88 100644 (file)
@@ -288,9 +288,9 @@ public class CopyCompare
      * 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;
 
 
         /**
index d08d778b0a1b9d6e08bd31677a45471991a8e203..4e86030a548b68847be4700b9905c93de9ddf01d 100644 (file)
@@ -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;
 
 
         /**
index b9841dbcc906d59866eea0fe077bfccc92961268..8c81f0b2f800930998b1d7ce418ae5103cbcf0aa 100644 (file)
@@ -65,7 +65,7 @@ public class Property {
     private long type;
 
     /** The property's value. */
-    protected Object value;
+    private Object value;
 
 
     /**
index 61fc30d883f9aa82d1dab9f568741d1c52763fab..25c44dff92569102f744cf60ec3a7524d3f42eee 100644 (file)
@@ -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 List<Long> unsupportedMessage;
+    private static List<Long> unsupportedMessage;
 
     
     /**
index 7eb285dfb7ffc4e3544e0b3eb9d26caa4dd0c1ec..c3f07fa8e7e5ebbe05489334d9cf1259435700d2 100644 (file)
@@ -65,11 +65,11 @@ public final class EMF extends Metafile {
         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();
index 4a6c3839a30c0355e2152345d5b2abf539b5eae2..5c7da5a2c70d481942f4c1a40b699ee18848bee8 100644 (file)
@@ -46,32 +46,32 @@ public abstract class Metafile extends HSLFPictureData {
         /**
          * 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;
@@ -82,11 +82,11 @@ public abstract class Metafile extends HSLFPictureData {
             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;
 
@@ -120,6 +120,26 @@ public abstract class Metafile extends HSLFPictureData {
         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 {
index c79bade3643fcccc94cd77eee861e1748d382b82..4a378c46f9399e02821818bbce65fe3ea6b6ea23 100644 (file)
@@ -94,12 +94,13 @@ public final class PICT extends Metafile {
         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();
index 78aa9f364f473bb848639d611f7bf6ccb13c428c..d54f1384b21fff24bb3b20238dee68a76c25e0ff 100644 (file)
@@ -45,7 +45,7 @@ public final class WMF extends Metafile {
             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 );
@@ -70,11 +70,11 @@ public final class WMF extends Metafile {
         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();
index 32780264f23636263289585e4e1e5c032b7e2f4e..13de06d41c57a7d98f54530fbdb1464a9fcdb9c8 100644 (file)
@@ -38,11 +38,9 @@ import org.apache.poi.util.POILogger;
 
 /**
  * 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>
index e6f7a9ded9e3b38fbce6b98a6335455441909491..7de68dc768bf2500c41fd1a5a65a4b6aa4c3c71c 100644 (file)
@@ -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
index 74047674c005a3b641b98b2971ff8f16592aa5b9..2d4e3aeca841eb4f4e48c80867627eaba2c595d2 100644 (file)
@@ -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");
         }
     }
 
index a8847d07266830887f25f46c5374d89b62678e4c..ec01408930f8d2fd0e65d34d0ee411e7abdd5199 100644 (file)
@@ -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
index c6d1589d07a51963dd91c9a9ab38b27b018bad55..9333968f0766926839745b1734c4688e9e150c41 100644 (file)
@@ -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.
index 6aa09b9364df556690e2f2a37075924274daa14b..2bac1ca22182ea556efd4b6556e71b0fd40d51d9 100644 (file)
@@ -26,13 +26,13 @@ import org.apache.poi.util.*;
  * 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
index 2b0d1e2c37adc313b32a598e89f74b7bbbb54ace..58be5715eeae70b9d17aae36a8e4522ef185eeb5 100644 (file)
@@ -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());
     }
 
     /**
index 7580450cd80f122b660a1e349fe83626bc15d83d..7903bb32d44cabbac1d0c79c5012c1e94081145f 100644 (file)
@@ -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.
index e705d24db0a57756869aeb1a5df4d1622dcdbd45..0ba89d7231b8b70f486a5bc50a28b06ca62b920a 100644 (file)
@@ -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<Integer,Integer> oldToNewReferencesLookup) {
         // nothing to update
     }
-}
+}
\ No newline at end of file
index 76d8f49eb7aead2459f69c3366793240c9796c74..dce90a981dd1599c2d55882ef3da67da509b950a 100644 (file)
@@ -22,14 +22,12 @@ import java.util.Map;
  * 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; }
index 14b1932fbff12d6314d3f837d8c7c73fdb95d9e8..fdd61d9cf21558a103da83a926c46d5dcd2019df 100644 (file)
@@ -22,8 +22,6 @@ import java.util.Map;
  * 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
@@ -43,7 +41,7 @@ public abstract class PositionDependentRecordContainer extends RecordContainer i
 
 
        /** 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; }
@@ -61,6 +59,5 @@ public abstract class PositionDependentRecordContainer extends RecordContainer i
         * If we're told they have, just return straight off.
         */
        public void updateOtherRecordReferences(Map<Integer,Integer> oldToNewReferencesLookup) {
-               return;
        }
 }
index df0b323f2cea2a2051d5121ae7b64e629cb2b129..3dc5948be1971e7b0c45975a412c0a86dea47872 100644 (file)
@@ -155,7 +155,7 @@ public final class TextSpecInfoAtom extends RecordAtom {
      */
     public int getCharactersCovered(){
         int covered = 0;
-        for (TextSpecInfoRun r : getTextSpecInfoRuns()) covered += r.length;
+        for (TextSpecInfoRun r : getTextSpecInfoRuns()) covered += r.getLength();
         return covered;
     }
 
index 7b4150a4fa717b8b9e086efa1935f98b61a5de7b..73ef2bfdf6a66ab8b832df09778806bb8a706192 100644 (file)
@@ -74,10 +74,10 @@ public class TextSpecInfoRun {
     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
@@ -92,7 +92,7 @@ public class TextSpecInfoRun {
      * 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
@@ -103,13 +103,13 @@ public class TextSpecInfoRun {
      * 0x0400 = No proofing is performed on the text.<br>\r
      * &gt; 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
@@ -117,10 +117,10 @@ public class TextSpecInfoRun {
      * 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