SonarCube fix - make members private

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1773165 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2016-12-07 23:45:38 +00:00
parent 87b75a8fad
commit 3cdf699add
21 changed files with 140 additions and 134 deletions

View File

@ -288,9 +288,9 @@ public class CopyCompare
* MutablePropertySet#MutablePropertySet(PropertySet)} constructor.</p> * MutablePropertySet#MutablePropertySet(PropertySet)} constructor.</p>
*/ */
static class CopyFile implements POIFSReaderListener { static class CopyFile implements POIFSReaderListener {
String dstName; private String dstName;
OutputStream out; private OutputStream out;
POIFSFileSystem poiFs; private POIFSFileSystem poiFs;
/** /**

View File

@ -131,9 +131,9 @@ public class WriteAuthorAndTitle
*/ */
static class ModifySICopyTheRest implements POIFSReaderListener static class ModifySICopyTheRest implements POIFSReaderListener
{ {
String dstName; private String dstName;
OutputStream out; private OutputStream out;
POIFSFileSystem poiFs; private POIFSFileSystem poiFs;
/** /**

View File

@ -65,7 +65,7 @@ public class Property {
private long type; private long type;
/** The property's value. */ /** The property's value. */
protected Object value; private Object value;
/** /**

View File

@ -62,7 +62,7 @@ public class VariantSupport extends Variant {
* Keeps a list of the variant types an "unsupported" message has already * Keeps a list of the variant types an "unsupported" message has already
* been issued for. * been issued for.
*/ */
protected static List<Long> unsupportedMessage; private static List<Long> unsupportedMessage;
/** /**

View File

@ -65,11 +65,11 @@ public final class EMF extends Metafile {
ImageHeaderEMF nHeader = new ImageHeaderEMF(data, 0); ImageHeaderEMF nHeader = new ImageHeaderEMF(data, 0);
Header header = new Header(); Header header = new Header();
header.wmfsize = data.length; header.setWmfSize(data.length);
header.bounds = nHeader.getBounds(); header.setBounds(nHeader.getBounds());
Dimension nDim = nHeader.getSize(); 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())));
header.zipsize = compressed.length; header.setZipSize(compressed.length);
byte[] checksum = getChecksum(data); byte[] checksum = getChecksum(data);
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();

View File

@ -46,32 +46,32 @@ public abstract class Metafile extends HSLFPictureData {
/** /**
* size of the original file * size of the original file
*/ */
public int wmfsize; private int wmfsize;
/** /**
* Boundary of the metafile drawing commands * Boundary of the metafile drawing commands
*/ */
public Rectangle bounds; private final Rectangle bounds = new Rectangle();
/** /**
* Size of the metafile in EMUs * Size of the metafile in EMUs
*/ */
public Dimension size; private final Dimension size = new Dimension();
/** /**
* size of the compressed metafile data * size of the compressed metafile data
*/ */
public int zipsize; private int zipsize;
/** /**
* Reserved. Always 0. * Reserved. Always 0.
*/ */
public int compression = 0; private int compression = 0;
/** /**
* Reserved. Always 254. * Reserved. Always 254.
*/ */
public int filter = 254; private int filter = 254;
public void read(byte[] data, int offset){ public void read(byte[] data, int offset){
int pos = 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 right = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
int bottom = 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 width = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
int height = 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; zipsize = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
@ -120,6 +120,26 @@ public abstract class Metafile extends HSLFPictureData {
public int getWmfSize() { public int getWmfSize() {
return wmfsize; 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 { protected static byte[] compress(byte[] bytes, int offset, int length) throws IOException {

View File

@ -94,12 +94,13 @@ public final class PICT extends Metafile {
ImageHeaderPICT nHeader = new ImageHeaderPICT(data, nOffset); ImageHeaderPICT nHeader = new ImageHeaderPICT(data, nOffset);
Header header = new Header(); Header header = new Header();
header.wmfsize = data.length - nOffset; int wmfSize = data.length - nOffset;
byte[] compressed = compress(data, nOffset, header.wmfsize); header.setWmfSize(wmfSize);
header.zipsize = compressed.length; byte[] compressed = compress(data, nOffset, wmfSize);
header.bounds = nHeader.getBounds(); header.setZipSize(compressed.length);
header.setBounds(nHeader.getBounds());
Dimension nDim = nHeader.getSize(); 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); byte[] checksum = getChecksum(data);
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();

View File

@ -45,7 +45,7 @@ public final class WMF extends Metafile {
long len = is.skip(header.getSize() + CHECKSUM_SIZE*uidInstanceCount); long len = is.skip(header.getSize() + CHECKSUM_SIZE*uidInstanceCount);
assert(len == 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); aldus.write(out);
InflaterInputStream inflater = new InflaterInputStream( is ); InflaterInputStream inflater = new InflaterInputStream( is );
@ -70,11 +70,11 @@ public final class WMF extends Metafile {
byte[] compressed = compress(data, pos, data.length-pos); byte[] compressed = compress(data, pos, data.length-pos);
Header header = new Header(); Header header = new Header();
header.wmfsize = data.length - nHeader.getLength(); header.setWmfSize(data.length - nHeader.getLength());
header.bounds = nHeader.getBounds(); header.setBounds(nHeader.getBounds());
Dimension nDim = nHeader.getSize(); 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())));
header.zipsize = compressed.length; header.setZipSize(compressed.length);
byte[] checksum = getChecksum(data); byte[] checksum = getChecksum(data);
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();

View File

@ -38,11 +38,9 @@ import org.apache.poi.util.POILogger;
/** /**
* A shape representing embedded OLE obejct. * A shape representing embedded OLE obejct.
*
* @author Yegor Kozlov
*/ */
public final class OLEShape extends HSLFPictureShape { public final class OLEShape extends HSLFPictureShape {
protected ExEmbed _exEmbed; private ExEmbed _exEmbed;
/** /**
* Create a new <code>OLEShape</code> * Create a new <code>OLEShape</code>

View File

@ -80,11 +80,11 @@ public final class PPFont {
public final static byte FF_DECORATIVE = 80; public final static byte FF_DECORATIVE = 80;
protected int charset; private int charset;
protected int type; private int type;
protected int flags; private int flags;
protected int pitch; private int pitch;
protected String name; private String name;
/** /**
* Creates a new instance of PPFont * Creates a new instance of PPFont

View File

@ -68,12 +68,10 @@ import org.apache.poi.util.SuppressForbidden;
/** /**
* Translates Graphics2D calls into PowerPoint. * Translates Graphics2D calls into PowerPoint.
*
* @author Yegor Kozlov
*/ */
public final class PPGraphics2D extends Graphics2D implements Cloneable { 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. //The ppt object to write into.
private HSLFGroupShape _group; private HSLFGroupShape _group;
@ -392,8 +390,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
*/ */
@NotImplemented @NotImplemented
public void clip(Shape s){ public void clip(Shape s){
if (log.check(POILogger.WARN)) { if (LOG.check(POILogger.WARN)) {
log.log(POILogger.WARN, "Not implemented"); LOG.log(POILogger.WARN, "Not implemented");
} }
} }
@ -415,8 +413,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
*/ */
@NotImplemented @NotImplemented
public Shape getClip(){ public Shape getClip(){
if (log.check(POILogger.WARN)) { if (LOG.check(POILogger.WARN)) {
log.log(POILogger.WARN, "Not implemented"); LOG.log(POILogger.WARN, "Not implemented");
} }
return null; return null;
} }
@ -686,8 +684,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
public boolean drawImage(Image img, int x, int y, public boolean drawImage(Image img, int x, int y,
Color bgcolor, Color bgcolor,
ImageObserver observer){ ImageObserver observer){
if (log.check(POILogger.WARN)) { if (LOG.check(POILogger.WARN)) {
log.log(POILogger.WARN, "Not implemented"); LOG.log(POILogger.WARN, "Not implemented");
} }
return false; return false;
@ -736,8 +734,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
int width, int height, int width, int height,
Color bgcolor, Color bgcolor,
ImageObserver observer){ ImageObserver observer){
if (log.check(POILogger.WARN)) { if (LOG.check(POILogger.WARN)) {
log.log(POILogger.WARN, "Not implemented"); LOG.log(POILogger.WARN, "Not implemented");
} }
return false; return false;
@ -796,8 +794,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
int dx1, int dy1, int dx2, int dy2, int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2, int sx1, int sy1, int sx2, int sy2,
ImageObserver observer){ ImageObserver observer){
if (log.check(POILogger.WARN)) { if (LOG.check(POILogger.WARN)) {
log.log(POILogger.WARN, "Not implemented"); LOG.log(POILogger.WARN, "Not implemented");
} }
return false; return false;
} }
@ -861,8 +859,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
int sx1, int sy1, int sx2, int sy2, int sx1, int sy1, int sx2, int sy2,
Color bgcolor, Color bgcolor,
ImageObserver observer){ ImageObserver observer){
if (log.check(POILogger.WARN)) { if (LOG.check(POILogger.WARN)) {
log.log(POILogger.WARN, "Not implemented"); LOG.log(POILogger.WARN, "Not implemented");
} }
return false; return false;
} }
@ -902,8 +900,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
@NotImplemented @NotImplemented
public boolean drawImage(Image img, int x, int y, public boolean drawImage(Image img, int x, int y,
ImageObserver observer) { ImageObserver observer) {
if (log.check(POILogger.WARN)) { if (LOG.check(POILogger.WARN)) {
log.log(POILogger.WARN, "Not implemented"); LOG.log(POILogger.WARN, "Not implemented");
} }
return false; return false;
} }
@ -1089,8 +1087,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
*/ */
@NotImplemented @NotImplemented
public void setClip(Shape clip) { public void setClip(Shape clip) {
if (log.check(POILogger.WARN)) { if (LOG.check(POILogger.WARN)) {
log.log(POILogger.WARN, "Not implemented"); LOG.log(POILogger.WARN, "Not implemented");
} }
} }
@ -1389,8 +1387,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
*/ */
@NotImplemented @NotImplemented
public void setComposite(Composite comp){ public void setComposite(Composite comp){
if (log.check(POILogger.WARN)) { if (LOG.check(POILogger.WARN)) {
log.log(POILogger.WARN, "Not implemented"); LOG.log(POILogger.WARN, "Not implemented");
} }
} }
@ -1403,8 +1401,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
*/ */
@NotImplemented @NotImplemented
public Composite getComposite(){ public Composite getComposite(){
if (log.check(POILogger.WARN)) { if (LOG.check(POILogger.WARN)) {
log.log(POILogger.WARN, "Not implemented"); LOG.log(POILogger.WARN, "Not implemented");
} }
return null; return null;
} }
@ -1547,8 +1545,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
*/ */
@NotImplemented @NotImplemented
public void drawString(AttributedCharacterIterator iterator, float x, float y) { public void drawString(AttributedCharacterIterator iterator, float x, float y) {
if (log.check(POILogger.WARN)) { if (LOG.check(POILogger.WARN)) {
log.log(POILogger.WARN, "Not implemented"); LOG.log(POILogger.WARN, "Not implemented");
} }
} }
@ -1654,8 +1652,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
*/ */
@NotImplemented @NotImplemented
public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs) { public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs) {
if (log.check(POILogger.WARN)) { if (LOG.check(POILogger.WARN)) {
log.log(POILogger.WARN, "Not implemented"); LOG.log(POILogger.WARN, "Not implemented");
} }
return false; return false;
} }
@ -1700,8 +1698,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
public boolean drawImage(Image img, int x, int y, public boolean drawImage(Image img, int x, int y,
int width, int height, int width, int height,
ImageObserver observer) { ImageObserver observer) {
if (log.check(POILogger.WARN)) { if (LOG.check(POILogger.WARN)) {
log.log(POILogger.WARN, "Not implemented"); LOG.log(POILogger.WARN, "Not implemented");
} }
return false; return false;
} }
@ -1751,8 +1749,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
*/ */
@NotImplemented @NotImplemented
public void setXORMode(Color c1) { public void setXORMode(Color c1) {
if (log.check(POILogger.WARN)) { if (LOG.check(POILogger.WARN)) {
log.log(POILogger.WARN, "Not implemented"); LOG.log(POILogger.WARN, "Not implemented");
} }
} }
@ -1765,8 +1763,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
*/ */
@NotImplemented @NotImplemented
public void setPaintMode() { public void setPaintMode() {
if (log.check(POILogger.WARN)) { if (LOG.check(POILogger.WARN)) {
log.log(POILogger.WARN, "Not implemented"); LOG.log(POILogger.WARN, "Not implemented");
} }
} }
@ -1803,8 +1801,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
*/ */
@NotImplemented @NotImplemented
public void drawRenderedImage(RenderedImage img, AffineTransform xform) { public void drawRenderedImage(RenderedImage img, AffineTransform xform) {
if (log.check(POILogger.WARN)) { if (LOG.check(POILogger.WARN)) {
log.log(POILogger.WARN, "Not implemented"); LOG.log(POILogger.WARN, "Not implemented");
} }
} }
@ -1831,8 +1829,8 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
*/ */
@NotImplemented @NotImplemented
public void drawRenderableImage(RenderableImage img, AffineTransform xform) { public void drawRenderableImage(RenderableImage img, AffineTransform xform) {
if (log.check(POILogger.WARN)) { if (LOG.check(POILogger.WARN)) {
log.log(POILogger.WARN, "Not implemented"); LOG.log(POILogger.WARN, "Not implemented");
} }
} }

View File

@ -40,9 +40,8 @@ public abstract class BitMaskTextProp extends TextProp implements Cloneable {
public boolean[] getSubPropMatches() { return subPropMatches; } public boolean[] getSubPropMatches() { return subPropMatches; }
protected BitMaskTextProp(int sizeOfDataBlock, int maskInHeader, String overallName, String... subPropNames) { protected BitMaskTextProp(int sizeOfDataBlock, int maskInHeader, String overallName, String... subPropNames) {
super(sizeOfDataBlock,maskInHeader,"bitmask"); super(sizeOfDataBlock,maskInHeader,overallName);
this.subPropNames = subPropNames; this.subPropNames = subPropNames;
this.propName = overallName;
subPropMasks = new int[subPropNames.length]; subPropMasks = new int[subPropNames.length];
subPropMatches = new boolean[subPropNames.length]; subPropMatches = new boolean[subPropNames.length];
@ -91,7 +90,7 @@ public abstract class BitMaskTextProp extends TextProp implements Cloneable {
*/ */
@Override @Override
public int getValue() { public int getValue() {
return maskValue(dataValue); return maskValue(super.getValue());
} }
private int maskValue(int pVal) { private int maskValue(int pVal) {
@ -111,7 +110,7 @@ public abstract class BitMaskTextProp extends TextProp implements Cloneable {
*/ */
@Override @Override
public void setValue(int val) { public void setValue(int val) {
dataValue = val; super.setValue(val);
// Figure out the values of the sub properties // Figure out the values of the sub properties
int i = 0; int i = 0;
@ -128,8 +127,8 @@ public abstract class BitMaskTextProp extends TextProp implements Cloneable {
*/ */
public void setValueWithMask(int val, int writeMask) { public void setValueWithMask(int val, int writeMask) {
setWriteMask(writeMask); setWriteMask(writeMask);
dataValue = maskValue(val); super.setValue(maskValue(val));
if (val != dataValue) { if (val != super.getValue()) {
logger.log(POILogger.WARN, "Style properties of '"+getName()+"' don't match mask - output will be sanitized"); logger.log(POILogger.WARN, "Style properties of '"+getName()+"' don't match mask - output will be sanitized");
if (logger.check(POILogger.DEBUG)) { if (logger.check(POILogger.DEBUG)) {
StringBuilder sb = new StringBuilder("The following style attributes of the '"+getName()+"' property will be ignored:\n"); 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 * Fetch the true/false status of the subproperty with the given index
*/ */
public boolean getSubValue(int idx) { 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) { public void setSubValue(boolean value, int idx) {
subPropMatches[idx] = true; subPropMatches[idx] = true;
int newVal = super.getValue();
if (value) { if (value) {
dataValue |= subPropMasks[idx]; newVal |= subPropMasks[idx];
} else { } else {
dataValue &= ~subPropMasks[idx]; newVal &= ~subPropMasks[idx];
} }
super.setValue(newVal);
} }
@Override @Override

View File

@ -31,10 +31,10 @@ import java.util.Locale;
* TextProps is stored in the different record classes * TextProps is stored in the different record classes
*/ */
public class TextProp implements Cloneable { public class TextProp implements Cloneable {
protected int sizeOfDataBlock; // Number of bytes the data part uses private int sizeOfDataBlock; // Number of bytes the data part uses
protected String propName; private String propName;
protected int dataValue; private int dataValue;
protected int maskInHeader; private int maskInHeader;
/** /**
* Generate the definition of a given type of text property. * Generate the definition of a given type of text property.

View File

@ -26,13 +26,13 @@ import org.apache.poi.util.*;
* the slide layout as specified in the SlideAtom record. * the slide layout as specified in the SlideAtom record.
*/ */
public class EscherPlaceholder extends EscherRecord { 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"; public static final String RECORD_DESCRIPTION = "msofbtClientTextboxPlaceholder";
int position = -1; private int position = -1;
byte placementId = 0; private byte placementId = 0;
byte size = 0; private byte size = 0;
short unused = 0; private short unused = 0;
public EscherPlaceholder() {} public EscherPlaceholder() {}

View File

@ -50,9 +50,7 @@ public final class ExControl extends ExEmbed {
* Create a new ExEmbed, with blank fields * Create a new ExEmbed, with blank fields
*/ */
public ExControl() { public ExControl() {
super(); super(new ExControlAtom());
_children[0] = embedAtom = new ExControlAtom();
} }
/** /**

View File

@ -25,8 +25,6 @@ import org.apache.poi.util.POILogger;
/** /**
* This data represents an embedded object in the document. * This data represents an embedded object in the document.
*
* @author Daniel Noll
*/ */
public class ExEmbed extends RecordContainer { public class ExEmbed extends RecordContainer {
@ -36,7 +34,7 @@ public class ExEmbed extends RecordContainer {
private byte[] _header; private byte[] _header;
// Links to our more interesting children // Links to our more interesting children
protected RecordAtom embedAtom; private RecordAtom embedAtom;
private ExOleObjAtom oleObjAtom; private ExOleObjAtom oleObjAtom;
private CString menuName; private CString menuName;
private CString progId; private CString progId;
@ -59,6 +57,18 @@ public class ExEmbed extends RecordContainer {
findInterestingChildren(); 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 * Create a new ExEmbed, with blank fields
*/ */
@ -182,6 +192,7 @@ public class ExEmbed extends RecordContainer {
{ {
if(clipboardName != null) clipboardName.setText(s); if(clipboardName != null) clipboardName.setText(s);
} }
/** /**
* Returns the type (held as a little endian in bytes 3 and 4) * Returns the type (held as a little endian in bytes 3 and 4)
* that this class handles. * that this class handles.

View File

@ -31,10 +31,8 @@ import org.apache.poi.util.LittleEndian;
/** /**
* Storage for embedded OLE objects. * 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 private int _persistId; // Found from PersistPtrHolder
@ -47,7 +45,7 @@ public class ExOleObjStg extends RecordAtom implements PositionDependentRecord,
* Record data. * Record data.
*/ */
private byte[] _data; private byte[] _data;
/** /**
* Constructs a new empty storage container. * Constructs a new empty storage container.
*/ */
@ -179,22 +177,8 @@ public class ExOleObjStg extends RecordAtom implements PositionDependentRecord,
_persistId = id; _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 @Override
public void updateOtherRecordReferences(Map<Integer,Integer> oldToNewReferencesLookup) { public void updateOtherRecordReferences(Map<Integer,Integer> oldToNewReferencesLookup) {
// nothing to update // nothing to update
} }
} }

View File

@ -22,14 +22,12 @@ import java.util.Map;
* A special (and dangerous) kind of Record Atom that cares about where * 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 * it lives on the disk, or who has other Atoms that care about where
* this is on the disk. * this is on the disk.
*
* @author Nick Burch
*/ */
public abstract class PositionDependentRecordAtom extends RecordAtom implements PositionDependentRecord public abstract class PositionDependentRecordAtom extends RecordAtom implements PositionDependentRecord
{ {
/** Our location on the disk, as of the last write out */ /** 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 */ /** Fetch our location on the disk, as of the last write out */
public int getLastOnDiskOffset() { return myLastOnDiskOffset; } public int getLastOnDiskOffset() { return myLastOnDiskOffset; }

View File

@ -22,8 +22,6 @@ import java.util.Map;
* A special (and dangerous) kind of Record Container, for which other * A special (and dangerous) kind of Record Container, for which other
* Atoms care about where this one lives on disk. * Atoms care about where this one lives on disk.
* Will track its position on disk. * Will track its position on disk.
*
* @author Nick Burch
*/ */
public abstract class PositionDependentRecordContainer extends RecordContainer implements PositionDependentRecord 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 */ /** 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 */ /** Fetch our location on the disk, as of the last write out */
public int getLastOnDiskOffset() { return myLastOnDiskOffset; } 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. * If we're told they have, just return straight off.
*/ */
public void updateOtherRecordReferences(Map<Integer,Integer> oldToNewReferencesLookup) { public void updateOtherRecordReferences(Map<Integer,Integer> oldToNewReferencesLookup) {
return;
} }
} }

View File

@ -155,7 +155,7 @@ public final class TextSpecInfoAtom extends RecordAtom {
*/ */
public int getCharactersCovered(){ public int getCharactersCovered(){
int covered = 0; int covered = 0;
for (TextSpecInfoRun r : getTextSpecInfoRuns()) covered += r.length; for (TextSpecInfoRun r : getTextSpecInfoRuns()) covered += r.getLength();
return covered; return covered;
} }

View File

@ -74,10 +74,10 @@ public class TextSpecInfoRun {
private static final BitField grammarErrorFld = new BitField(0X80000000); private static final BitField grammarErrorFld = new BitField(0X80000000);
//Length of special info run. //Length of special info run.
protected int length; private int length;
//Special info mask of this run; //Special info mask of this run;
protected int mask; private int mask;
// info fields as indicated by the mask. // info fields as indicated by the mask.
// -1 means the bit is not set // -1 means the bit is not set
@ -92,7 +92,7 @@ public class TextSpecInfoRun {
* grammar (1 bit): A bit that specifies whether the text has a grammar error.<br> * grammar (1 bit): A bit that specifies whether the text has a grammar error.<br>
* reserved (13 bits): MUST be zero and MUST be ignored. * reserved (13 bits): MUST be zero and MUST be ignored.
*/ */
protected short spellInfo = -1; private short spellInfo = -1;
/** /**
* An optional TxLCID that specifies the language identifier of this text. * An optional TxLCID that specifies the language identifier of this text.
@ -103,13 +103,13 @@ public class TextSpecInfoRun {
* 0x0400 = No proofing is performed on the text.<br> * 0x0400 = No proofing is performed on the text.<br>
* &gt; 0x0400 = A valid LCID as specified by [MS-LCID]. * &gt; 0x0400 = A valid LCID as specified by [MS-LCID].
*/ */
protected short langId = -1; private short langId = -1;
/** /**
* An optional TxLCID that specifies the alternate language identifier of this text. * An optional TxLCID that specifies the alternate language identifier of this text.
* It MUST exist if and only if altLang is TRUE. * It MUST exist if and only if altLang is TRUE.
*/ */
protected short altLangId = -1; private short altLangId = -1;
/** /**
* An optional signed integer that specifies whether the text contains bidirectional * An optional signed integer that specifies whether the text contains bidirectional
@ -117,10 +117,10 @@ public class TextSpecInfoRun {
* 0x0000 = Contains no bidirectional characters, * 0x0000 = Contains no bidirectional characters,
* 0x0001 = Contains bidirectional characters. * 0x0001 = Contains bidirectional characters.
*/ */
protected short bidi = -1; private short bidi = -1;
protected int pp10extMask = -1; private int pp10extMask = -1;
protected byte[] smartTagsBytes = null; private byte[] smartTagsBytes = null;
/** /**
* Inits a TextSpecInfoRun with default values * Inits a TextSpecInfoRun with default values