aboutsummaryrefslogtreecommitdiffstats
path: root/src/scratchpad/src/org/apache/poi/hslf
diff options
context:
space:
mode:
Diffstat (limited to 'src/scratchpad/src/org/apache/poi/hslf')
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/blip/Bitmap.java7
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/blip/Metafile.java2
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java3
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFreeformShape.java6
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java31
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureData.java10
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureShape.java25
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShape.java50
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java4
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java5
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowFactory.java38
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextShape.java14
12 files changed, 118 insertions, 77 deletions
diff --git a/src/scratchpad/src/org/apache/poi/hslf/blip/Bitmap.java b/src/scratchpad/src/org/apache/poi/hslf/blip/Bitmap.java
index c25d7de84f..f584bd8a8b 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/blip/Bitmap.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/blip/Bitmap.java
@@ -26,6 +26,7 @@ import java.io.IOException;
import javax.imageio.ImageIO;
import org.apache.poi.hslf.usermodel.HSLFPictureData;
+import org.apache.poi.util.Units;
/**
* Represents a bitmap picture data: JPEG or PNG.
@@ -55,10 +56,14 @@ public abstract class Bitmap extends HSLFPictureData {
setRawData(out.toByteArray());
}
+ @Override
public Dimension getImageDimension() {
try {
BufferedImage bi = ImageIO.read(new ByteArrayInputStream(getData()));
- return new Dimension(bi.getWidth(), bi.getHeight());
+ return new Dimension(
+ (int)Units.pixelToPoints(bi.getWidth()),
+ (int)Units.pixelToPoints(bi.getHeight())
+ );
} catch (IOException e) {
return new Dimension(200,200);
}
diff --git a/src/scratchpad/src/org/apache/poi/hslf/blip/Metafile.java b/src/scratchpad/src/org/apache/poi/hslf/blip/Metafile.java
index 74a793f5ab..55a62ebffa 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/blip/Metafile.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/blip/Metafile.java
@@ -126,7 +126,7 @@ public abstract class Metafile extends HSLFPictureData {
return out.toByteArray();
}
-
+ @Override
public Dimension getImageDimension() {
int prefixLen = 16*uidInstanceCount;
Header header = new Header();
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 7ba654c02a..834dea5ff0 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java
@@ -42,7 +42,6 @@ import java.awt.geom.Arc2D;
import java.awt.geom.Ellipse2D;
import java.awt.geom.GeneralPath;
import java.awt.geom.Line2D;
-import java.awt.geom.Rectangle2D;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.awt.image.BufferedImageOp;
@@ -327,7 +326,7 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
Java graphics sets string coordinates by the baseline of the first character
so we need to shift down by the height of the textbox
*/
- txt.setAnchor(new Rectangle2D.Float(x, y, width, height));
+ txt.setAnchor(new Rectangle((int)x, (int)y, (int)width, (int)height));
_group.addShape(txt);
}
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 e576cceef4..dbfc6ec1fc 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFreeformShape.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFreeformShape.java
@@ -17,6 +17,7 @@
package org.apache.poi.hslf.usermodel;
+import java.awt.Rectangle;
import java.awt.geom.AffineTransform;
import java.awt.geom.GeneralPath;
import java.awt.geom.PathIterator;
@@ -45,7 +46,6 @@ import org.apache.poi.util.Units;
* Shapes drawn with the "Freeform" tool have cubic bezier curve segments in the smooth sections
* and straight-line segments in the straight sections. This object closely corresponds to <code>java.awt.geom.GeneralPath</code>.
* </p>
- * @author Yegor Kozlov
*/
public final class HSLFFreeformShape extends HSLFAutoShape implements FreeformShape<HSLFShape,HSLFTextParagraph> {
@@ -90,7 +90,7 @@ public final class HSLFFreeformShape extends HSLFAutoShape implements FreeformSh
@Override
public int setPath(GeneralPath path) {
- Rectangle2D bounds = path.getBounds2D();
+ Rectangle bounds = path.getBounds();
PathIterator it = path.getPathIterator(new AffineTransform());
List<byte[]> segInfo = new ArrayList<byte[]>();
@@ -241,7 +241,7 @@ public final class HSLFFreeformShape extends HSLFAutoShape implements FreeformSh
}
}
- Rectangle2D anchor = getAnchor2D();
+ Rectangle2D anchor = getAnchor();
Rectangle2D bounds = path.getBounds2D();
AffineTransform at = new AffineTransform();
at.translate(anchor.getX(), anchor.getY());
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 0ba1d379be..22317fb62a 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java
@@ -18,7 +18,6 @@
package org.apache.poi.hslf.usermodel;
import java.awt.Rectangle;
-import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -105,7 +104,7 @@ implements HSLFShapeContainer, GroupShape<HSLFShape,HSLFTextParagraph> {
}
@Override
- public void setInteriorAnchor(Rectangle2D anchor){
+ public void setInteriorAnchor(Rectangle anchor){
EscherSpgrRecord spgr = getEscherChild(EscherSpgrRecord.RECORD_ID);
int x1 = Units.pointsToMaster(anchor.getX());
@@ -121,13 +120,13 @@ implements HSLFShapeContainer, GroupShape<HSLFShape,HSLFTextParagraph> {
}
@Override
- public Rectangle2D getInteriorAnchor(){
+ public Rectangle getInteriorAnchor(){
EscherSpgrRecord rec = getEscherChild(EscherSpgrRecord.RECORD_ID);
- double x1 = Units.masterToPoints(rec.getRectX1());
- double y1 = Units.masterToPoints(rec.getRectY1());
- double x2 = Units.masterToPoints(rec.getRectX2());
- double y2 = Units.masterToPoints(rec.getRectY2());
- return new Rectangle2D.Double(x1,y1,x2-x1,y2-y1);
+ int x1 = (int)Units.masterToPoints(rec.getRectX1());
+ int y1 = (int)Units.masterToPoints(rec.getRectY1());
+ int x2 = (int)Units.masterToPoints(rec.getRectX2());
+ int y2 = (int)Units.masterToPoints(rec.getRectY2());
+ return new Rectangle(x1,y1,x2-x1,y2-y1);
}
/**
@@ -181,7 +180,7 @@ implements HSLFShapeContainer, GroupShape<HSLFShape,HSLFTextParagraph> {
* @param y the y coordinate of the top left corner of the shape in new location
*/
public void moveTo(int x, int y){
- java.awt.Rectangle anchor = getAnchor();
+ Rectangle anchor = getAnchor();
int dx = x - anchor.x;
int dy = y - anchor.y;
anchor.translate(dx, dy);
@@ -189,7 +188,7 @@ implements HSLFShapeContainer, GroupShape<HSLFShape,HSLFTextParagraph> {
for (HSLFShape shape : getShapes()) {
- java.awt.Rectangle chanchor = shape.getAnchor();
+ Rectangle chanchor = shape.getAnchor();
chanchor.translate(dx, dy);
shape.setAnchor(chanchor);
}
@@ -201,7 +200,7 @@ implements HSLFShapeContainer, GroupShape<HSLFShape,HSLFTextParagraph> {
*
* @return the anchor of this shape group
*/
- public Rectangle2D getAnchor2D(){
+ public Rectangle getAnchor(){
EscherClientAnchorRecord clientAnchor = getEscherChild(EscherClientAnchorRecord.RECORD_ID);
int x1,y1,x2,y2;
if(clientAnchor == null){
@@ -217,11 +216,11 @@ implements HSLFShapeContainer, GroupShape<HSLFShape,HSLFTextParagraph> {
x2 = clientAnchor.getDx1();
y2 = clientAnchor.getRow1();
}
- Rectangle2D anchor= new Rectangle2D.Double(
- (x1 == -1 ? -1 : Units.masterToPoints(x1)),
- (y1 == -1 ? -1 : Units.masterToPoints(y1)),
- (x2 == -1 ? -1 : Units.masterToPoints(x2-x1)),
- (y2 == -1 ? -1 : Units.masterToPoints(y2-y1))
+ Rectangle anchor= new Rectangle(
+ (int)(x1 == -1 ? -1 : Units.masterToPoints(x1)),
+ (int)(y1 == -1 ? -1 : Units.masterToPoints(y1)),
+ (int)(x2 == -1 ? -1 : Units.masterToPoints(x2-x1)),
+ (int)(y2 == -1 ? -1 : Units.masterToPoints(y2-y1))
);
return anchor;
diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureData.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureData.java
index 0100658fe4..7c5fc5179e 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureData.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureData.java
@@ -17,6 +17,7 @@
package org.apache.poi.hslf.usermodel;
+import java.awt.Dimension;
import java.io.IOException;
import java.io.OutputStream;
import java.security.MessageDigest;
@@ -219,4 +220,13 @@ public abstract class HSLFPictureData implements PictureData {
public final String getContentType() {
return getType().contentType;
}
+
+ @Override
+ public Dimension getImageDimensionInPixels() {
+ Dimension dim = getImageDimension();
+ return new Dimension(
+ Units.pointsToPixel(dim.getWidth()),
+ Units.pointsToPixel(dim.getHeight())
+ );
+ }
}
diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureShape.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureShape.java
index 58ce1a1f22..713ecad705 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureShape.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureShape.java
@@ -17,9 +17,8 @@
package org.apache.poi.hslf.usermodel;
-import java.awt.Dimension;
import java.awt.Insets;
-import java.awt.geom.Rectangle2D;
+import java.awt.Rectangle;
import java.util.List;
import org.apache.poi.ddf.AbstractEscherOptRecord;
@@ -31,6 +30,7 @@ import org.apache.poi.ddf.EscherRecord;
import org.apache.poi.ddf.EscherSimpleProperty;
import org.apache.poi.ddf.EscherSpRecord;
import org.apache.poi.hslf.record.Document;
+import org.apache.poi.sl.draw.DrawPictureShape;
import org.apache.poi.sl.usermodel.PictureShape;
import org.apache.poi.sl.usermodel.ShapeContainer;
import org.apache.poi.sl.usermodel.ShapeType;
@@ -113,21 +113,6 @@ public class HSLFPictureShape extends HSLFSimpleShape implements PictureShape<HS
return _escherContainer;
}
- /**
- * Resize this picture to the default size.
- * For PNG and JPEG resizes the image to 100%,
- * for other types, if the size can't be determined it will be 200x200 pixels.
- */
- public void setDefaultSize(){
- Dimension dim = getPictureData().getImageDimension();
- Rectangle2D origRect = getAnchor2D();
- double x = origRect.getX();
- double y = origRect.getY();
- double w = Units.pixelToPoints((int)dim.getWidth());
- double h = Units.pixelToPoints((int)dim.getHeight());
- setAnchor(new Rectangle2D.Double(x, y, w, h));
- }
-
@Override
public HSLFPictureData getPictureData(){
HSLFSlideShow ppt = getSheet().getSlideShow();
@@ -199,9 +184,9 @@ public class HSLFPictureShape extends HSLFSimpleShape implements PictureShape<HS
EscherBSERecord bse = getEscherBSERecord();
bse.setRef(bse.getRef() + 1);
- java.awt.Rectangle anchor = getAnchor();
- if (anchor.equals(new java.awt.Rectangle())){
- setDefaultSize();
+ Rectangle anchor = getAnchor();
+ if (anchor.isEmpty()){
+ new DrawPictureShape(this).resize();
}
}
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 2af2678b20..85f3a906ea 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShape.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShape.java
@@ -19,14 +19,29 @@ package org.apache.poi.hslf.usermodel;
import java.awt.Color;
import java.awt.Graphics2D;
-import java.awt.geom.Rectangle2D;
+import java.awt.Rectangle;
import java.util.Iterator;
-import org.apache.poi.ddf.*;
+import org.apache.poi.ddf.AbstractEscherOptRecord;
+import org.apache.poi.ddf.EscherChildAnchorRecord;
+import org.apache.poi.ddf.EscherClientAnchorRecord;
+import org.apache.poi.ddf.EscherColorRef;
+import org.apache.poi.ddf.EscherContainerRecord;
+import org.apache.poi.ddf.EscherOptRecord;
+import org.apache.poi.ddf.EscherProperties;
+import org.apache.poi.ddf.EscherProperty;
+import org.apache.poi.ddf.EscherRecord;
+import org.apache.poi.ddf.EscherSimpleProperty;
+import org.apache.poi.ddf.EscherSpRecord;
import org.apache.poi.hslf.record.ColorSchemeAtom;
import org.apache.poi.hslf.record.RecordTypes;
-import org.apache.poi.sl.usermodel.*;
-import org.apache.poi.util.*;
+import org.apache.poi.sl.usermodel.FillStyle;
+import org.apache.poi.sl.usermodel.Shape;
+import org.apache.poi.sl.usermodel.ShapeContainer;
+import org.apache.poi.sl.usermodel.ShapeType;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
+import org.apache.poi.util.Units;
/**
* <p>
@@ -126,18 +141,7 @@ public abstract class HSLFShape implements Shape<HSLFShape,HSLFTextParagraph> {
*
* @return the anchor of this shape
*/
- public java.awt.Rectangle getAnchor(){
- Rectangle2D anchor2d = getAnchor2D();
- return anchor2d.getBounds();
- }
-
- /**
- * Returns the anchor (the bounding box rectangle) of this shape.
- * All coordinates are expressed in points (72 dpi).
- *
- * @return the anchor of this shape
- */
- public Rectangle2D getAnchor2D(){
+ public Rectangle getAnchor() {
EscherSpRecord spRecord = getEscherChild(EscherSpRecord.RECORD_ID);
int flags = spRecord.getFlags();
int x1,y1,x2,y2;
@@ -160,11 +164,11 @@ public abstract class HSLFShape implements Shape<HSLFShape,HSLFTextParagraph> {
}
// TODO: find out where this -1 value comes from at #57820 (link to ms docs?)
- Rectangle2D anchor = new Rectangle2D.Double(
- (x1 == -1 ? -1 : Units.masterToPoints(x1)),
- (y1 == -1 ? -1 : Units.masterToPoints(y1)),
- (x2 == -1 ? -1 : Units.masterToPoints(x2-x1)),
- (y2 == -1 ? -1 : Units.masterToPoints(y2-y1))
+ Rectangle anchor = new Rectangle(
+ (int)(x1 == -1 ? -1 : Units.masterToPoints(x1)),
+ (int)(y1 == -1 ? -1 : Units.masterToPoints(y1)),
+ (int)(x2 == -1 ? -1 : Units.masterToPoints(x2-x1)),
+ (int)(y2 == -1 ? -1 : Units.masterToPoints(y2-y1))
);
return anchor;
@@ -176,7 +180,7 @@ public abstract class HSLFShape implements Shape<HSLFShape,HSLFTextParagraph> {
*
* @param anchor new anchor
*/
- public void setAnchor(Rectangle2D anchor){
+ public void setAnchor(Rectangle anchor){
int x = Units.pointsToMaster(anchor.getX());
int y = Units.pointsToMaster(anchor.getY());
int w = Units.pointsToMaster(anchor.getWidth() + anchor.getX());
@@ -206,7 +210,7 @@ public abstract class HSLFShape implements Shape<HSLFShape,HSLFTextParagraph> {
* @param y the y coordinate of the top left corner of the shape
*/
public void moveTo(float x, float y){
- Rectangle2D anchor = getAnchor2D();
+ Rectangle anchor = getAnchor();
anchor.setRect(x, y, anchor.getWidth(), anchor.getHeight());
setAnchor(anchor);
}
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 aeb36beb56..dc5cde23d4 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java
@@ -414,12 +414,12 @@ public abstract class HSLFSimpleShape extends HSLFShape implements SimpleShape<H
return clr == null ? Color.black : clr;
}
- public Shadow getShadow() {
+ public Shadow<HSLFShape,HSLFTextParagraph> getShadow() {
AbstractEscherOptRecord opt = getEscherOptRecord();
EscherProperty shadowType = opt.lookup(EscherProperties.SHADOWSTYLE__TYPE);
if (shadowType == null) return null;
- return new Shadow(){
+ return new Shadow<HSLFShape,HSLFTextParagraph>(){
public SimpleShape<HSLFShape,HSLFTextParagraph> getShadowParent() {
return HSLFSimpleShape.this;
}
diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java
index 697f10521a..c300bd81c2 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java
@@ -69,6 +69,7 @@ import org.apache.poi.hslf.record.SlideListWithText.SlideAtomsSet;
import org.apache.poi.hslf.record.SlidePersistAtom;
import org.apache.poi.hslf.record.UserEditAtom;
import org.apache.poi.poifs.filesystem.DirectoryNode;
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.sl.usermodel.MasterSheet;
import org.apache.poi.sl.usermodel.PictureData.PictureType;
@@ -159,8 +160,8 @@ public final class HSLFSlideShow implements SlideShow<HSLFShape,HSLFTextParagrap
/**
* Constructs a Powerpoint document from an POIFSFileSystem.
*/
- public HSLFSlideShow(POIFSFileSystem inputStream) throws IOException {
- this(new HSLFSlideShowImpl(inputStream));
+ public HSLFSlideShow(NPOIFSFileSystem npoifs) throws IOException {
+ this(new HSLFSlideShowImpl(npoifs));
}
/**
diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowFactory.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowFactory.java
new file mode 100644
index 0000000000..3ae91f775f
--- /dev/null
+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowFactory.java
@@ -0,0 +1,38 @@
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+
+package org.apache.poi.hslf.usermodel;
+
+import java.io.IOException;
+
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.sl.usermodel.SlideShow;
+import org.apache.poi.sl.usermodel.SlideShowFactory;
+import org.apache.poi.util.Internal;
+
+@Internal
+public class HSLFSlideShowFactory extends SlideShowFactory {
+ /**
+ * Creates a HSLFSlideShow from the given NPOIFSFileSystem
+ * <p>Note that in order to properly release resources the
+ * SlideShow should be closed after use.
+ */
+ public static SlideShow<?,?> createSlideShow(NPOIFSFileSystem fs) throws IOException {
+ return new HSLFSlideShow(fs);
+ }
+
+}
diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextShape.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextShape.java
index 5ca39b9919..1b5bbb83fd 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextShape.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextShape.java
@@ -139,15 +139,15 @@ implements TextShape<HSLFShape,HSLFTextParagraph> {
storeText();
- EscherTextboxWrapper _txtbox = getEscherTextboxWrapper();
- if(_txtbox != null){
- _escherContainer.addChildRecord(_txtbox.getEscherRecord());
+ EscherTextboxWrapper thisTxtbox = getEscherTextboxWrapper();
+ if(thisTxtbox != null){
+ _escherContainer.addChildRecord(thisTxtbox.getEscherRecord());
PPDrawing ppdrawing = sh.getPPDrawing();
- ppdrawing.addTextboxWrapper(_txtbox);
+ ppdrawing.addTextboxWrapper(thisTxtbox);
// Ensure the escher layer knows about the added records
try {
- _txtbox.writeOut(null);
+ thisTxtbox.writeOut(null);
} catch (IOException e){
throw new HSLFException(e);
}
@@ -192,10 +192,10 @@ implements TextShape<HSLFShape,HSLFTextParagraph> {
* @return a <code>Rectangle2D</code> that is the bounds of this shape.
*/
public Rectangle2D resizeToFitText(){
- Rectangle2D anchor = getAnchor();
+ Rectangle anchor = getAnchor();
if(anchor.getWidth() == 0.) {
logger.log(POILogger.WARN, "Width of shape wasn't set. Defaulting to 200px");
- anchor = new Rectangle2D.Double(anchor.getX(), anchor.getY(), 200, anchor.getHeight());
+ anchor.setSize(200, (int)anchor.getHeight());
setAnchor(anchor);
}
double height = getTextHeight();