From f27507244c52b28c4d5715d5146fec7149a73884 Mon Sep 17 00:00:00 2001
From: Andreas Beeker
Date: Sat, 10 Dec 2016 00:40:37 +0000
Subject: [PATCH] SonarCube fix - make members private
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1773495 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/poi/hslf/model/ActiveXShape.java | 11 ++---
.../org/apache/poi/hslf/model/MovieShape.java | 5 +-
.../org/apache/poi/hslf/model/OLEShape.java | 7 ++-
.../org/apache/poi/hslf/model/Polygon.java | 2 +-
.../poi/hslf/usermodel/HSLFAutoShape.java | 7 +--
.../hslf/usermodel/HSLFConnectorShape.java | 2 +-
.../poi/hslf/usermodel/HSLFFreeformShape.java | 14 +++---
.../poi/hslf/usermodel/HSLFGroupShape.java | 32 ++++++++-----
.../apache/poi/hslf/usermodel/HSLFLine.java | 9 ++--
.../poi/hslf/usermodel/HSLFPictureShape.java | 22 ++++-----
.../poi/hslf/usermodel/HSLFPlaceholder.java | 5 +-
.../apache/poi/hslf/usermodel/HSLFShape.java | 32 ++++++++-----
.../poi/hslf/usermodel/HSLFSimpleShape.java | 47 ++++++++++++++-----
.../apache/poi/hslf/usermodel/HSLFTable.java | 2 +
.../poi/hslf/usermodel/HSLFTableCell.java | 11 ++++-
.../poi/hslf/usermodel/HSLFTextBox.java | 6 ++-
.../poi/hslf/usermodel/HSLFTextShape.java | 14 ++++--
17 files changed, 145 insertions(+), 83 deletions(-)
diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java b/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java
index 3ba8f6f2d..d82555a80 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java
@@ -41,9 +41,6 @@ import org.apache.poi.util.StringUtil;
/**
* Represents an ActiveX control in a PowerPoint document.
- *
- * TODO: finish
- * @author Yegor Kozlov
*/
public final class ActiveXShape extends HSLFPictureShape {
public static final int DEFAULT_ACTIVEX_THUMBNAIL = -1;
@@ -74,10 +71,11 @@ public final class ActiveXShape extends HSLFPictureShape {
*
* @return the created EscherContainerRecord
which holds shape data
*/
+ @Override
protected EscherContainerRecord createSpContainer(int idx, boolean isChild) {
- _escherContainer = super.createSpContainer(idx, isChild);
+ EscherContainerRecord ecr = super.createSpContainer(idx, isChild);
- EscherSpRecord spRecord = _escherContainer.getChildById(EscherSpRecord.RECORD_ID);
+ EscherSpRecord spRecord = ecr.getChildById(EscherSpRecord.RECORD_ID);
spRecord.setFlags(EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE | EscherSpRecord.FLAG_OLESHAPE);
setShapeType(ShapeType.HOST_CONTROL);
@@ -90,7 +88,7 @@ public final class ActiveXShape extends HSLFPictureShape {
HSLFEscherClientDataRecord cldata = getClientData(true);
cldata.addChild(new ExObjRefAtom());
- return _escherContainer;
+ return ecr;
}
/**
@@ -148,6 +146,7 @@ public final class ActiveXShape extends HSLFPictureShape {
return ctrl;
}
+ @Override
protected void afterInsert(HSLFSheet sheet){
ExControl ctrl = getExControl();
ctrl.getExControlAtom().setSlideId(sheet._getSheetNumber());
diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/MovieShape.java b/src/scratchpad/src/org/apache/poi/hslf/model/MovieShape.java
index 5650b2b2d..4452e758c 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/model/MovieShape.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/model/MovieShape.java
@@ -86,8 +86,9 @@ public final class MovieShape extends HSLFPictureShape {
*
* @return the created EscherContainerRecord
which holds shape data
*/
+ @Override
protected EscherContainerRecord createSpContainer(int idx, boolean isChild) {
- _escherContainer = super.createSpContainer(idx, isChild);
+ EscherContainerRecord ecr = super.createSpContainer(idx, isChild);
setEscherProperty(EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 0x1000100);
setEscherProperty(EscherProperties.FILL__NOFILLHITTEST, 0x10001);
@@ -107,7 +108,7 @@ public final class MovieShape extends HSLFPictureShape {
cldata.addChild(an);
cldata.addChild(info);
- return _escherContainer;
+ return ecr;
}
/**
diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/OLEShape.java b/src/scratchpad/src/org/apache/poi/hslf/model/OLEShape.java
index 13de06d41..4a473ae73 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/model/OLEShape.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/model/OLEShape.java
@@ -33,6 +33,7 @@ import org.apache.poi.hslf.usermodel.HSLFShape;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.hslf.usermodel.HSLFTextParagraph;
import org.apache.poi.sl.usermodel.ShapeContainer;
+import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
@@ -40,6 +41,8 @@ import org.apache.poi.util.POILogger;
* A shape representing embedded OLE obejct.
*/
public final class OLEShape extends HSLFPictureShape {
+ private static final POILogger LOG = POILogFactory.getLogger(OLEShape.class);
+
private ExEmbed _exEmbed;
/**
@@ -133,7 +136,7 @@ public final class OLEShape extends HSLFPictureShape {
}
}
if (data==null) {
- logger.log(POILogger.WARN, "OLE data not found");
+ LOG.log(POILogger.WARN, "OLE data not found");
}
return data;
@@ -160,7 +163,7 @@ public final class OLEShape extends HSLFPictureShape {
ExObjList lst = ppt.getDocumentRecord().getExObjList(false);
if(lst == null){
- logger.log(POILogger.WARN, "ExObjList not found");
+ LOG.log(POILogger.WARN, "ExObjList not found");
return null;
}
diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/Polygon.java b/src/scratchpad/src/org/apache/poi/hslf/model/Polygon.java
index 9c2cb24ed..5a0b4bff1 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/model/Polygon.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/model/Polygon.java
@@ -51,7 +51,7 @@ public final class Polygon extends HSLFAutoShape {
*/
public Polygon(ShapeContainer parent){
super((EscherContainerRecord)null, parent);
- _escherContainer = createSpContainer(ShapeType.NOT_PRIMITIVE, parent instanceof HSLFGroupShape);
+ createSpContainer(ShapeType.NOT_PRIMITIVE, parent instanceof HSLFGroupShape);
}
/**
diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFAutoShape.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFAutoShape.java
index 329f78f42..910c8a0ad 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFAutoShape.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFAutoShape.java
@@ -39,7 +39,7 @@ public class HSLFAutoShape extends HSLFTextShape implements AutoShape parent){
super(null, parent);
- _escherContainer = createSpContainer(type, parent instanceof HSLFGroupShape);
+ createSpContainer(type, parent instanceof HSLFGroupShape);
}
public HSLFAutoShape(ShapeType type){
@@ -47,7 +47,7 @@ public class HSLFAutoShape extends HSLFTextShape implements AutoShape {
*/
public HSLFConnectorShape(ShapeContainer parent){
super(null, parent);
- _escherContainer = createSpContainer(parent instanceof HSLFGroupShape);
+ createSpContainer(parent instanceof HSLFGroupShape);
}
/**
diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFreeformShape.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFreeformShape.java
index 0e8437ae1..ee8c50a71 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFreeformShape.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFreeformShape.java
@@ -38,6 +38,7 @@ import org.apache.poi.sl.usermodel.ShapeType;
import org.apache.poi.util.BitField;
import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
import org.apache.poi.util.Units;
@@ -50,6 +51,7 @@ import org.apache.poi.util.Units;
*
*/
public final class HSLFFreeformShape extends HSLFAutoShape implements FreeformShape {
+ private static final POILogger LOG = POILogFactory.getLogger(HSLFFreeformShape.class);
public static final byte[] SEGMENTINFO_MOVETO = new byte[]{0x00, 0x40};
public static final byte[] SEGMENTINFO_LINETO = new byte[]{0x00, (byte)0xAC};
@@ -167,7 +169,7 @@ public final class HSLFFreeformShape extends HSLFAutoShape implements FreeformSh
*/
public HSLFFreeformShape(ShapeContainer parent){
super((EscherContainerRecord)null, parent);
- _escherContainer = createSpContainer(ShapeType.NOT_PRIMITIVE, parent instanceof HSLFGroupShape);
+ createSpContainer(ShapeType.NOT_PRIMITIVE, parent instanceof HSLFGroupShape);
}
/**
@@ -212,7 +214,7 @@ public final class HSLFFreeformShape extends HSLFAutoShape implements FreeformSh
break;
case PathIterator.SEG_QUADTO:
//TODO: figure out how to convert SEG_QUADTO into SEG_CUBICTO
- logger.log(POILogger.WARN, "SEG_QUADTO is not supported");
+ LOG.log(POILogger.WARN, "SEG_QUADTO is not supported");
break;
case PathIterator.SEG_CLOSE:
pntInfo.add(pntInfo.get(0));
@@ -224,7 +226,7 @@ public final class HSLFFreeformShape extends HSLFAutoShape implements FreeformSh
numPoints++;
break;
default:
- logger.log(POILogger.WARN, "Ignoring invalid segment type "+type);
+ LOG.log(POILogger.WARN, "Ignoring invalid segment type "+type);
break;
}
@@ -281,11 +283,11 @@ public final class HSLFFreeformShape extends HSLFAutoShape implements FreeformSh
//sanity check
if(verticesProp == null) {
- logger.log(POILogger.WARN, "Freeform is missing GEOMETRY__VERTICES ");
+ LOG.log(POILogger.WARN, "Freeform is missing GEOMETRY__VERTICES ");
return path;
}
if(segmentsProp == null) {
- logger.log(POILogger.WARN, "Freeform is missing GEOMETRY__SEGMENTINFO ");
+ LOG.log(POILogger.WARN, "Freeform is missing GEOMETRY__SEGMENTINFO ");
return path;
}
@@ -358,7 +360,7 @@ public final class HSLFFreeformShape extends HSLFAutoShape implements FreeformSh
int masterCnt = (xyMaster == null) ? 0 : xyMaster.length;
int pointCnt = (xyPoints == null) ? 0 : xyPoints.length;
if ((masterCnt != 4 && masterCnt != 8) || pointCnt != 2) {
- logger.log(POILogger.WARN, "Invalid number of master bytes for a single point - ignore point");
+ LOG.log(POILogger.WARN, "Invalid number of master bytes for a single point - ignore point");
return;
}
diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java
index bae325a0f..bd90edfec 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java
@@ -33,6 +33,7 @@ import org.apache.poi.sl.usermodel.PictureData;
import org.apache.poi.sl.usermodel.ShapeContainer;
import org.apache.poi.sl.usermodel.ShapeType;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
import org.apache.poi.util.Units;
@@ -43,13 +44,15 @@ import org.apache.poi.util.Units;
*/
public class HSLFGroupShape extends HSLFShape
implements HSLFShapeContainer, GroupShape {
+ private static final POILogger LOG = POILogFactory.getLogger(HSLFGroupShape.class);
+
/**
* Create a new ShapeGroup. This constructor is used when a new shape is created.
*
*/
public HSLFGroupShape(){
this(null, null);
- _escherContainer = createSpContainer(false);
+ createSpContainer(false);
}
/**
@@ -59,7 +62,7 @@ implements HSLFShapeContainer, GroupShape {
*/
public HSLFGroupShape(ShapeContainer parent){
this(null, parent);
- _escherContainer = createSpContainer(parent instanceof HSLFGroupShape);
+ createSpContainer(parent instanceof HSLFGroupShape);
}
/**
@@ -133,10 +136,10 @@ implements HSLFShapeContainer, GroupShape {
/**
* Create a new ShapeGroup and create an instance of EscherSpgrContainer
which represents a group of shapes
*/
+ @Override
protected EscherContainerRecord createSpContainer(boolean isChild) {
- EscherContainerRecord spgr = new EscherContainerRecord();
- spgr.setRecordId(EscherContainerRecord.SPGR_CONTAINER);
- spgr.setOptions((short)15);
+ EscherContainerRecord ecr = super.createSpContainer(isChild);
+ ecr.setRecordId(EscherContainerRecord.SPGR_CONTAINER);
//The group itself is a shape, and always appears as the first EscherSpContainer in the group container.
EscherContainerRecord spcont = new EscherContainerRecord();
@@ -156,8 +159,8 @@ implements HSLFShapeContainer, GroupShape {
EscherClientAnchorRecord anchor = new EscherClientAnchorRecord();
spcont.addChildRecord(anchor);
- spgr.addChildRecord(spcont);
- return spgr;
+ ecr.addChildRecord(spcont);
+ return ecr;
}
/**
@@ -165,8 +168,9 @@ implements HSLFShapeContainer, GroupShape {
*
* @param shape - the Shape to add
*/
+ @Override
public void addShape(HSLFShape shape){
- _escherContainer.addChildRecord(shape.getSpContainer());
+ getSpContainer().addChildRecord(shape.getSpContainer());
HSLFSheet sheet = getSheet();
shape.setSheet(sheet);
@@ -200,11 +204,12 @@ implements HSLFShapeContainer, GroupShape {
*
* @return the anchor of this shape group
*/
+ @Override
public Rectangle2D getAnchor(){
EscherClientAnchorRecord clientAnchor = getEscherChild(EscherClientAnchorRecord.RECORD_ID);
int x1,y1,x2,y2;
if(clientAnchor == null){
- logger.log(POILogger.INFO, "EscherClientAnchorRecord was not found for shape group. Searching for EscherChildAnchorRecord.");
+ LOG.log(POILogger.INFO, "EscherClientAnchorRecord was not found for shape group. Searching for EscherChildAnchorRecord.");
EscherChildAnchorRecord rec = getEscherChild(EscherChildAnchorRecord.RECORD_ID);
x1 = rec.getDx1();
y1 = rec.getDy1();
@@ -232,6 +237,7 @@ implements HSLFShapeContainer, GroupShape {
*
* @return type of the shape.
*/
+ @Override
public ShapeType getShapeType(){
EscherSpRecord spRecord = getEscherChild(EscherSpRecord.RECORD_ID);
int nativeId = spRecord.getOptions() >> 4;
@@ -249,14 +255,16 @@ implements HSLFShapeContainer, GroupShape {
@Override
public T getEscherChild(int recordId){
- EscherContainerRecord groupInfoContainer = (EscherContainerRecord)_escherContainer.getChild(0);
+ EscherContainerRecord groupInfoContainer = (EscherContainerRecord)getSpContainer().getChild(0);
return groupInfoContainer.getChildById((short)recordId);
}
+ @Override
public Iterator iterator() {
return getShapes().iterator();
}
+ @Override
public boolean removeShape(HSLFShape shape) {
// TODO: implement!
throw new UnsupportedOperationException();
@@ -266,7 +274,7 @@ implements HSLFShapeContainer, GroupShape {
public List getShapes() {
// Out escher container record should contain several
// SpContainers, the first of which is the group shape itself
- Iterator iter = _escherContainer.getChildIterator();
+ Iterator iter = getSpContainer().getChildIterator();
// Don't include the first SpContainer, it is always NotPrimitive
if (iter.hasNext()) {
@@ -284,7 +292,7 @@ implements HSLFShapeContainer, GroupShape {
} else {
// Should we do anything special with these non
// Container records?
- logger.log(POILogger.ERROR, "Shape contained non container escher record, was " + r.getClass().getName());
+ LOG.log(POILogger.ERROR, "Shape contained non container escher record, was " + r.getClass().getName());
}
}
diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFLine.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFLine.java
index 21706db40..668b3e88e 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFLine.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFLine.java
@@ -37,19 +37,20 @@ public final class HSLFLine extends HSLFTextShape implements Line parent){
super(null, parent);
- _escherContainer = createSpContainer(parent instanceof HSLFGroupShape);
+ createSpContainer(parent instanceof HSLFGroupShape);
}
public HSLFLine(){
this(null);
}
+ @Override
protected EscherContainerRecord createSpContainer(boolean isChild){
- _escherContainer = super.createSpContainer(isChild);
+ EscherContainerRecord ecr = super.createSpContainer(isChild);
setShapeType(ShapeType.LINE);
- EscherSpRecord spRecord = _escherContainer.getChildById(EscherSpRecord.RECORD_ID);
+ EscherSpRecord spRecord = ecr.getChildById(EscherSpRecord.RECORD_ID);
short type = (short)((ShapeType.LINE.nativeId << 4) | 0x2);
spRecord.setOptions(type);
@@ -64,7 +65,7 @@ public final class HSLFLine extends HSLFTextShape implements Line {
+ private static final POILogger LOG = POILogFactory.getLogger(HSLFPictureShape.class);
/**
* Create a new Picture
@@ -63,7 +63,7 @@ public class HSLFPictureShape extends HSLFSimpleShape implements PictureShape parent) {
super(null, parent);
- _escherContainer = createSpContainer(data.getIndex(), parent instanceof HSLFGroupShape);
+ createSpContainer(data.getIndex(), parent instanceof HSLFGroupShape);
}
/**
@@ -97,10 +97,9 @@ public class HSLFPictureShape extends HSLFSimpleShape implements PictureShape lst = bstore.getChildRecords();
int idx = getPictureIndex();
if (idx == 0){
- logger.log(POILogger.DEBUG, "picture index was not found, returning ");
+ LOG.log(POILogger.DEBUG, "picture index was not found, returning ");
return null;
}
return (EscherBSERecord)lst.get(idx-1);
@@ -180,6 +179,7 @@ public class HSLFPictureShape extends HSLFSimpleShape implements PictureShapeEscherContainerRecord which holds shape data
*/
+ @Override
protected EscherContainerRecord createSpContainer(boolean isChild){
- _escherContainer = super.createSpContainer(isChild);
+ EscherContainerRecord ecr = super.createSpContainer(isChild);
setPlaceholder(Placeholder.BODY);
- return _escherContainer;
+ return ecr;
}
}
diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShape.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShape.java
index 51fc33b70..49b7ca567 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShape.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShape.java
@@ -26,6 +26,7 @@ import java.util.List;
import org.apache.poi.ddf.AbstractEscherOptRecord;
import org.apache.poi.ddf.EscherChildAnchorRecord;
import org.apache.poi.ddf.EscherClientAnchorRecord;
+import org.apache.poi.ddf.EscherClientDataRecord;
import org.apache.poi.ddf.EscherColorRef;
import org.apache.poi.ddf.EscherColorRef.SysIndexProcedure;
import org.apache.poi.ddf.EscherColorRef.SysIndexSource;
@@ -65,31 +66,29 @@ import org.apache.poi.util.Units;
*
*/
public abstract class HSLFShape implements Shape {
-
- // For logging
- protected POILogger logger = POILogFactory.getLogger(this.getClass());
+ private static final POILogger LOG = POILogFactory.getLogger(HSLFShape.class);
/**
* Either EscherSpContainer or EscheSpgrContainer record
* which holds information about this shape.
*/
- protected EscherContainerRecord _escherContainer;
+ private EscherContainerRecord _escherContainer;
/**
* Parent of this shape.
* null
for the topmost shapes.
*/
- protected ShapeContainer _parent;
+ private ShapeContainer _parent;
/**
* The Sheet
this shape belongs to
*/
- protected HSLFSheet _sheet;
+ private HSLFSheet _sheet;
/**
* Fill
*/
- protected HSLFFill _fill;
+ private HSLFFill _fill;
/**
* Create a Shape object. This constructor is used when an existing Shape is read from from a PowerPoint document.
@@ -103,13 +102,20 @@ public abstract class HSLFShape implements Shape {
}
/**
- * Creates the lowerlevel escher records for this shape.
+ * Create and assign the lower level escher record to this shape
*/
- protected abstract EscherContainerRecord createSpContainer(boolean isChild);
+ protected EscherContainerRecord createSpContainer(boolean isChild) {
+ if (_escherContainer == null) {
+ _escherContainer = new EscherContainerRecord();
+ _escherContainer.setOptions((short)15);
+ }
+ return _escherContainer;
+ }
/**
* @return the parent of this shape
*/
+ @Override
public ShapeContainer getParent(){
return _parent;
}
@@ -138,6 +144,7 @@ public abstract class HSLFShape implements Shape {
*
* @return the anchor of this shape
*/
+ @Override
public Rectangle2D getAnchor() {
EscherSpRecord spRecord = getEscherChild(EscherSpRecord.RECORD_ID);
int flags = spRecord.getFlags();
@@ -151,7 +158,7 @@ public abstract class HSLFShape implements Shape {
y2 = childRec.getDy2();
} else {
if (useChildRec) {
- logger.log(POILogger.WARN, "EscherSpRecord.FLAG_CHILD is set but EscherChildAnchorRecord was not found");
+ LOG.log(POILogger.WARN, "EscherSpRecord.FLAG_CHILD is set but EscherChildAnchorRecord was not found");
}
EscherClientAnchorRecord clientRec = getEscherChild(EscherClientAnchorRecord.RECORD_ID);
x1 = clientRec.getCol1();
@@ -329,6 +336,7 @@ public abstract class HSLFShape implements Shape {
/**
* @return the SlideShow
this shape belongs to
*/
+ @Override
public HSLFSheet getSheet(){
return _sheet;
}
@@ -639,11 +647,11 @@ public abstract class HSLFShape implements Shape {
* @return the client record or null if it was missing and create wasn't activated
*/
protected HSLFEscherClientDataRecord getClientData(boolean create) {
- HSLFEscherClientDataRecord clientData = getEscherChild(HSLFEscherClientDataRecord.RECORD_ID);
+ HSLFEscherClientDataRecord clientData = getEscherChild(EscherClientDataRecord.RECORD_ID);
if (clientData == null && create) {
clientData = new HSLFEscherClientDataRecord();
clientData.setOptions((short)15);
- clientData.setRecordId(HSLFEscherClientDataRecord.RECORD_ID);
+ clientData.setRecordId(EscherClientDataRecord.RECORD_ID);
getSpContainer().addChildBefore(clientData, EscherTextboxRecord.RECORD_ID);
}
return clientData;
diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java
index 8ca4678a2..d8352e5bf 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java
@@ -54,16 +54,16 @@ import org.apache.poi.sl.usermodel.StrokeStyle.LineCap;
import org.apache.poi.sl.usermodel.StrokeStyle.LineCompound;
import org.apache.poi.sl.usermodel.StrokeStyle.LineDash;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
import org.apache.poi.util.Units;
/**
* An abstract simple (non-group) shape.
* This is the parent class for all primitive shapes like Line, Rectangle, etc.
- *
- * @author Yegor Kozlov
*/
public abstract class HSLFSimpleShape extends HSLFShape implements SimpleShape {
+ private static final POILogger LOG = POILogFactory.getLogger(HSLFSimpleShape.class);
public final static double DEFAULT_LINE_WIDTH = 0.75;
@@ -88,20 +88,22 @@ public abstract class HSLFSimpleShape extends HSLFShape implements SimpleShapetrue if the Line is inside a group, false
otherwise
* @return the record container which holds this shape
*/
+ @Override
protected EscherContainerRecord createSpContainer(boolean isChild) {
- _escherContainer = new EscherContainerRecord();
- _escherContainer.setRecordId( EscherContainerRecord.SP_CONTAINER );
- _escherContainer.setOptions((short)15);
+ EscherContainerRecord ecr = super.createSpContainer(isChild);
+ ecr.setRecordId( EscherContainerRecord.SP_CONTAINER );
EscherSpRecord sp = new EscherSpRecord();
int flags = EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE;
- if (isChild) flags |= EscherSpRecord.FLAG_CHILD;
+ if (isChild) {
+ flags |= EscherSpRecord.FLAG_CHILD;
+ }
sp.setFlags(flags);
- _escherContainer.addChildRecord(sp);
+ ecr.addChildRecord(sp);
AbstractEscherOptRecord opt = new EscherOptRecord();
opt.setRecordId(EscherOptRecord.RECORD_ID);
- _escherContainer.addChildRecord(opt);
+ ecr.addChildRecord(opt);
EscherRecord anchor;
if(isChild) {
@@ -117,9 +119,9 @@ public abstract class HSLFSimpleShape extends HSLFShape implements SimpleShape";
}
- logger.log(POILogger.WARN, "No preset shape definition for shapeType: "+name);
+ LOG.log(POILogger.WARN, "No preset shape definition for shapeType: "+name);
}
return geom;
@@ -379,6 +389,7 @@ public abstract class HSLFSimpleShape extends HSLFShape implements SimpleShape getShadow() {
AbstractEscherOptRecord opt = getEscherOptRecord();
if (opt == null) return null;
@@ -386,23 +397,28 @@ public abstract class HSLFSimpleShape extends HSLFShape implements SimpleShape(){
+ @Override
public SimpleShape getShadowParent() {
return HSLFSimpleShape.this;
}
+ @Override
public double getDistance() {
return getShadowDistance();
}
+ @Override
public double getAngle() {
return getShadowAngle();
}
+ @Override
public double getBlur() {
// TODO Auto-generated method stub
return 0;
}
+ @Override
public SolidPaint getFillStyle() {
return DrawPaint.createSolidPaint(getShadowColor());
}
@@ -478,29 +494,36 @@ public abstract class HSLFSimpleShape extends HSLFShape implements SimpleShape {
return cells.length;
}
+ @Override
protected void afterInsert(HSLFSheet sh){
super.afterInsert(sh);
@@ -335,6 +336,7 @@ implements HSLFShapeContainer, TableShape {
*
* @param sheet owner of this shape
*/
+ @Override
public void setSheet(HSLFSheet sheet){
super.setSheet(sheet);
if (cells == null) {
diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTableCell.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTableCell.java
index a8e3294d1..8477cadde 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTableCell.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTableCell.java
@@ -77,8 +77,9 @@ public final class HSLFTableCell extends HSLFTextBox implements TableCellEscherContainerRecord which holds shape data
*/
+ @Override
protected EscherContainerRecord createSpContainer(boolean isChild){
- _escherContainer = super.createSpContainer(isChild);
+ EscherContainerRecord ecr = super.createSpContainer(isChild);
setShapeType(ShapeType.TEXT_BOX);
@@ -85,9 +86,10 @@ public class HSLFTextBox extends HSLFTextShape implements TextBox {
+ private static final POILogger LOG = POILogFactory.getLogger(HSLFTextShape.class);
/**
* How to anchor the text
@@ -161,7 +163,7 @@ implements TextShape {
*/
public HSLFTextShape(ShapeContainer parent){
super(null, parent);
- _escherContainer = createSpContainer(parent instanceof HSLFGroupShape);
+ createSpContainer(parent instanceof HSLFGroupShape);
}
/**
@@ -189,6 +191,7 @@ implements TextShape {
*
* @param sh the sheet we are adding to
*/
+ @Override
protected void afterInsert(HSLFSheet sh){
super.afterInsert(sh);
@@ -196,7 +199,7 @@ implements TextShape {
EscherTextboxWrapper thisTxtbox = getEscherTextboxWrapper();
if(thisTxtbox != null){
- _escherContainer.addChildRecord(thisTxtbox.getEscherRecord());
+ getSpContainer().addChildRecord(thisTxtbox.getEscherRecord());
PPDrawing ppdrawing = sh.getPPDrawing();
ppdrawing.addTextboxWrapper(thisTxtbox);
@@ -253,7 +256,7 @@ implements TextShape {
public Rectangle2D resizeToFitText(){
Rectangle2D anchor = getAnchor();
if(anchor.getWidth() == 0.) {
- logger.log(POILogger.WARN, "Width of shape wasn't set. Defaulting to 200px");
+ LOG.log(POILogger.WARN, "Width of shape wasn't set. Defaulting to 200px");
anchor.setRect(anchor.getX(), anchor.getY(), 200., anchor.getHeight());
setAnchor(anchor);
}
@@ -573,7 +576,7 @@ implements TextShape {
}
if (_paragraphs.isEmpty()) {
- logger.log(POILogger.WARN, "TextRecord didn't contained any text lines");
+ LOG.log(POILogger.WARN, "TextRecord didn't contained any text lines");
}
}
@@ -584,8 +587,9 @@ implements TextShape {
return _paragraphs;
}
+ @Override
public void setSheet(HSLFSheet sheet) {
- _sheet = sheet;
+ super.setSheet(sheet);
// Initialize _txtrun object.
// (We can't do it in the constructor because the sheet