You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2015/03/20 00:44:25 UTC
svn commit: r1667902 [2/8] - in /poi/branches/common_sl/src:
examples/src/org/apache/poi/hslf/examples/
examples/src/org/apache/poi/hssf/usermodel/examples/
examples/src/org/apache/poi/xslf/usermodel/
examples/src/org/apache/poi/xssf/usermodel/examples...
Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java Thu Mar 19 23:44:23 2015
@@ -54,7 +54,7 @@ import java.util.Map;
* @author Yegor Kozlov
*/
@Beta
- public class XSLFSlideMaster extends XSLFSheet implements MasterSheet<XSLFShape> {
+ public class XSLFSlideMaster extends XSLFSheet implements MasterSheet<XSLFShape, XMLSlideShow> {
private CTSlideMaster _slide;
private Map<String, XSLFSlideLayout> _layouts;
private XSLFTheme _theme;
@@ -83,7 +83,7 @@ import java.util.Map;
}
@Override
- public MasterSheet getMasterSheet() {
+ public MasterSheet<XSLFShape, XMLSlideShow> getMasterSheet() {
return null;
}
Modified: poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFAutoShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFAutoShape.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFAutoShape.java (original)
+++ poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFAutoShape.java Thu Mar 19 23:44:23 2015
@@ -18,9 +18,10 @@ package org.apache.poi.xslf.usermodel;
import junit.framework.TestCase;
-import org.apache.poi.sl.usermodel.ShapeType;
-import org.apache.poi.sl.usermodel.TextAlign;
-import org.apache.poi.sl.usermodel.VerticalAlignment;
+import org.apache.poi.sl.usermodel.*;
+import org.apache.poi.sl.usermodel.TextParagraph.TextAlign;
+import org.apache.poi.sl.usermodel.TextShape.TextAutofit;
+import org.apache.poi.sl.usermodel.TextShape.TextDirection;
import org.apache.poi.util.Units;
import org.openxmlformats.schemas.drawingml.x2006.main.STTextStrikeType;
import org.openxmlformats.schemas.drawingml.x2006.main.STTextUnderlineType;
Modified: poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFConnectorShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFConnectorShape.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFConnectorShape.java (original)
+++ poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFConnectorShape.java Thu Mar 19 23:44:23 2015
@@ -16,14 +16,17 @@
==================================================================== */
package org.apache.poi.xslf.usermodel;
+import java.awt.Color;
+import java.awt.Rectangle;
+
import junit.framework.TestCase;
-import org.apache.poi.sl.usermodel.ShapeType;
+import org.apache.poi.sl.usermodel.LineDecoration.DecorationShape;
+import org.apache.poi.sl.usermodel.LineDecoration.DecorationSize;
+import org.apache.poi.sl.usermodel.*;
import org.openxmlformats.schemas.drawingml.x2006.main.*;
import org.openxmlformats.schemas.presentationml.x2006.main.CTConnector;
-import java.awt.*;
-
/**
* @author Yegor Kozlov
*/
@@ -40,70 +43,70 @@ public class TestXSLFConnectorShape exte
assertFalse(shape.getSpPr().getLn().isSetTailEnd());
// line decorations
- assertEquals(LineDecoration.NONE, shape.getLineHeadDecoration());
- assertEquals(LineDecoration.NONE, shape.getLineTailDecoration());
+ assertEquals(DecorationShape.NONE, shape.getLineHeadDecoration());
+ assertEquals(DecorationShape.NONE, shape.getLineTailDecoration());
shape.setLineHeadDecoration(null);
shape.setLineTailDecoration(null);
- assertEquals(LineDecoration.NONE, shape.getLineHeadDecoration());
- assertEquals(LineDecoration.NONE, shape.getLineTailDecoration());
+ assertEquals(DecorationShape.NONE, shape.getLineHeadDecoration());
+ assertEquals(DecorationShape.NONE, shape.getLineTailDecoration());
assertFalse(shape.getSpPr().getLn().getHeadEnd().isSetType());
assertFalse(shape.getSpPr().getLn().getTailEnd().isSetType());
- shape.setLineHeadDecoration(LineDecoration.ARROW);
- shape.setLineTailDecoration(LineDecoration.DIAMOND);
- assertEquals(LineDecoration.ARROW, shape.getLineHeadDecoration());
- assertEquals(LineDecoration.DIAMOND, shape.getLineTailDecoration());
+ shape.setLineHeadDecoration(DecorationShape.ARROW);
+ shape.setLineTailDecoration(DecorationShape.DIAMOND);
+ assertEquals(DecorationShape.ARROW, shape.getLineHeadDecoration());
+ assertEquals(DecorationShape.DIAMOND, shape.getLineTailDecoration());
assertEquals(STLineEndType.ARROW, shape.getSpPr().getLn().getHeadEnd().getType());
assertEquals(STLineEndType.DIAMOND, shape.getSpPr().getLn().getTailEnd().getType());
- shape.setLineHeadDecoration(LineDecoration.DIAMOND);
- shape.setLineTailDecoration(LineDecoration.ARROW);
- assertEquals(LineDecoration.DIAMOND, shape.getLineHeadDecoration());
- assertEquals(LineDecoration.ARROW, shape.getLineTailDecoration());
+ shape.setLineHeadDecoration(DecorationShape.DIAMOND);
+ shape.setLineTailDecoration(DecorationShape.ARROW);
+ assertEquals(DecorationShape.DIAMOND, shape.getLineHeadDecoration());
+ assertEquals(DecorationShape.ARROW, shape.getLineTailDecoration());
assertEquals(STLineEndType.DIAMOND, shape.getSpPr().getLn().getHeadEnd().getType());
assertEquals(STLineEndType.ARROW, shape.getSpPr().getLn().getTailEnd().getType());
// line end width
- assertEquals(LineEndWidth.MEDIUM, shape.getLineHeadWidth());
- assertEquals(LineEndWidth.MEDIUM, shape.getLineTailWidth());
+ assertEquals(DecorationSize.MEDIUM, shape.getLineHeadWidth());
+ assertEquals(DecorationSize.MEDIUM, shape.getLineTailWidth());
shape.setLineHeadWidth(null);
shape.setLineHeadWidth(null);
- assertEquals(LineEndWidth.MEDIUM, shape.getLineHeadWidth());
- assertEquals(LineEndWidth.MEDIUM, shape.getLineTailWidth());
+ assertEquals(DecorationSize.MEDIUM, shape.getLineHeadWidth());
+ assertEquals(DecorationSize.MEDIUM, shape.getLineTailWidth());
assertFalse(shape.getSpPr().getLn().getHeadEnd().isSetW());
assertFalse(shape.getSpPr().getLn().getTailEnd().isSetW());
- shape.setLineHeadWidth(LineEndWidth.LARGE);
- shape.setLineTailWidth(LineEndWidth.MEDIUM);
- assertEquals(LineEndWidth.LARGE, shape.getLineHeadWidth());
- assertEquals(LineEndWidth.MEDIUM, shape.getLineTailWidth());
+ shape.setLineHeadWidth(DecorationSize.LARGE);
+ shape.setLineTailWidth(DecorationSize.MEDIUM);
+ assertEquals(DecorationSize.LARGE, shape.getLineHeadWidth());
+ assertEquals(DecorationSize.MEDIUM, shape.getLineTailWidth());
assertEquals(STLineEndWidth.LG, shape.getSpPr().getLn().getHeadEnd().getW());
assertEquals(STLineEndWidth.MED, shape.getSpPr().getLn().getTailEnd().getW());
- shape.setLineHeadWidth(LineEndWidth.MEDIUM);
- shape.setLineTailWidth(LineEndWidth.LARGE);
- assertEquals(LineEndWidth.MEDIUM, shape.getLineHeadWidth());
- assertEquals(LineEndWidth.LARGE, shape.getLineTailWidth());
+ shape.setLineHeadWidth(DecorationSize.MEDIUM);
+ shape.setLineTailWidth(DecorationSize.LARGE);
+ assertEquals(DecorationSize.MEDIUM, shape.getLineHeadWidth());
+ assertEquals(DecorationSize.LARGE, shape.getLineTailWidth());
assertEquals(STLineEndWidth.MED, shape.getSpPr().getLn().getHeadEnd().getW());
assertEquals(STLineEndWidth.LG, shape.getSpPr().getLn().getTailEnd().getW());
// line end length
- assertEquals(LineEndLength.MEDIUM, shape.getLineHeadLength());
- assertEquals(LineEndLength.MEDIUM, shape.getLineTailLength());
+ assertEquals(DecorationSize.MEDIUM, shape.getLineHeadLength());
+ assertEquals(DecorationSize.MEDIUM, shape.getLineTailLength());
shape.setLineHeadLength(null);
shape.setLineTailLength(null);
- assertEquals(LineEndLength.MEDIUM, shape.getLineHeadLength());
- assertEquals(LineEndLength.MEDIUM, shape.getLineTailLength());
+ assertEquals(DecorationSize.MEDIUM, shape.getLineHeadLength());
+ assertEquals(DecorationSize.MEDIUM, shape.getLineTailLength());
assertFalse(shape.getSpPr().getLn().getHeadEnd().isSetLen());
assertFalse(shape.getSpPr().getLn().getTailEnd().isSetLen());
- shape.setLineHeadLength(LineEndLength.LARGE);
- shape.setLineTailLength(LineEndLength.MEDIUM);
- assertEquals(LineEndLength.LARGE, shape.getLineHeadLength());
- assertEquals(LineEndLength.MEDIUM, shape.getLineTailLength());
+ shape.setLineHeadLength(DecorationSize.LARGE);
+ shape.setLineTailLength(DecorationSize.MEDIUM);
+ assertEquals(DecorationSize.LARGE, shape.getLineHeadLength());
+ assertEquals(DecorationSize.MEDIUM, shape.getLineTailLength());
assertEquals(STLineEndLength.LG, shape.getSpPr().getLn().getHeadEnd().getLen());
assertEquals(STLineEndLength.MED, shape.getSpPr().getLn().getTailEnd().getLen());
- shape.setLineHeadLength(LineEndLength.MEDIUM);
- shape.setLineTailLength(LineEndLength.LARGE);
- assertEquals(LineEndLength.MEDIUM, shape.getLineHeadLength());
- assertEquals(LineEndLength.LARGE, shape.getLineTailLength());
+ shape.setLineHeadLength(DecorationSize.MEDIUM);
+ shape.setLineTailLength(DecorationSize.LARGE);
+ assertEquals(DecorationSize.MEDIUM, shape.getLineHeadLength());
+ assertEquals(DecorationSize.LARGE, shape.getLineTailLength());
assertEquals(STLineEndLength.MED, shape.getSpPr().getLn().getHeadEnd().getLen());
assertEquals(STLineEndLength.LG, shape.getSpPr().getLn().getTailEnd().getLen());
Modified: poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSimpleShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSimpleShape.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSimpleShape.java (original)
+++ poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSimpleShape.java Thu Mar 19 23:44:23 2015
@@ -20,17 +20,11 @@ import java.awt.Color;
import junit.framework.TestCase;
-import org.apache.poi.sl.usermodel.LineCap;
-import org.apache.poi.sl.usermodel.LineDash;
+import org.apache.poi.sl.usermodel.StrokeStyle.LineCap;
+import org.apache.poi.sl.usermodel.StrokeStyle.LineDash;
import org.apache.poi.util.Units;
import org.apache.poi.xslf.XSLFTestDataSamples;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTEffectStyleItem;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTEffectStyleList;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTOuterShadowEffect;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTStyleMatrix;
-import org.openxmlformats.schemas.drawingml.x2006.main.STLineCap;
-import org.openxmlformats.schemas.drawingml.x2006.main.STPresetLineDashVal;
+import org.openxmlformats.schemas.drawingml.x2006.main.*;
/**
* @author Yegor Kozlov
Modified: poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java (original)
+++ poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java Thu Mar 19 23:44:23 2015
@@ -20,6 +20,7 @@ import junit.framework.TestCase;
import org.apache.poi.sl.usermodel.VerticalAlignment;
import org.apache.poi.xslf.XSLFTestDataSamples;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTableCell;
import org.openxmlformats.schemas.presentationml.x2006.main.CTGraphicalObjectFrame;
import java.awt.Color;
@@ -99,10 +100,11 @@ public class TestXSLFTable extends TestC
XSLFTableCell cell0 = row0.addCell();
assertNotNull(cell0.getXmlObject());
// by default table cell has no borders
- assertTrue(cell0.getXmlObject().getTcPr().getLnB().isSetNoFill());
- assertTrue(cell0.getXmlObject().getTcPr().getLnT().isSetNoFill());
- assertTrue(cell0.getXmlObject().getTcPr().getLnL().isSetNoFill());
- assertTrue(cell0.getXmlObject().getTcPr().getLnR().isSetNoFill());
+ CTTableCell tc = (CTTableCell)cell0.getXmlObject();
+ assertTrue(tc.getTcPr().getLnB().isSetNoFill());
+ assertTrue(tc.getTcPr().getLnT().isSetNoFill());
+ assertTrue(tc.getTcPr().getLnL().isSetNoFill());
+ assertTrue(tc.getTcPr().getLnR().isSetNoFill());
assertSame(cell0, row0.getCells().get(0));
assertEquals(1, tbl.getNumberOfColumns());
Modified: poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java (original)
+++ poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java Thu Mar 19 23:44:23 2015
@@ -16,25 +16,46 @@
==================================================================== */
package org.apache.poi.xslf.usermodel;
-import junit.framework.TestCase;
-
-import org.apache.poi.sl.draw.TextFragment;
-import org.apache.poi.sl.usermodel.TextAlign;
-import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
-import org.apache.poi.xslf.XSLFTestDataSamples;
+import static org.junit.Assert.*;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.util.List;
+import org.apache.poi.sl.draw.DrawTextFragment;
+import org.apache.poi.sl.draw.DrawTextParagraph;
+import org.apache.poi.sl.usermodel.TextParagraph.TextAlign;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
+import org.apache.poi.xslf.XSLFTestDataSamples;
+import org.junit.Test;
+
/**
* @author Yegor Kozlov
*/
-public class TestXSLFTextParagraph extends TestCase {
+public class TestXSLFTextParagraph {
private static POILogger _logger = POILogFactory.getLogger(XSLFTextParagraph.class);
+ static class DrawTextParagraphProxy extends DrawTextParagraph<XSLFTextRun> {
+ DrawTextParagraphProxy(XSLFTextParagraph p) {
+ super(p);
+ }
+
+ public void breakText(Graphics2D graphics) {
+ super.breakText(graphics);
+ }
+
+ public double getWrappingWidth(boolean firstLine, Graphics2D graphics) {
+ return super.getWrappingWidth(firstLine, graphics);
+ }
+
+ public List<DrawTextFragment> getLines() {
+ return lines;
+ }
+ }
+
+ @Test
public void testWrappingWidth() throws Exception {
XMLSlideShow ppt = new XMLSlideShow();
XSLFSlide slide = ppt.createSlide();
@@ -49,45 +70,47 @@ public class TestXSLFTextParagraph exten
Rectangle2D anchor = new Rectangle(50, 50, 300, 200);
sh.setAnchor(anchor);
+
+ DrawTextParagraphProxy dtp = new DrawTextParagraphProxy(p);
double leftInset = sh.getLeftInset();
double rightInset = sh.getRightInset();
- assertEquals(7.2, leftInset);
- assertEquals(7.2, rightInset);
+ assertEquals(7.2, leftInset, 0);
+ assertEquals(7.2, rightInset, 0);
double leftMargin = p.getLeftMargin();
- assertEquals(0.0, leftMargin);
+ assertEquals(0.0, leftMargin, 0);
double indent = p.getIndent();
- assertEquals(0.0, indent); // default
+ assertEquals(0.0, indent, 0); // default
double expectedWidth;
// Case 1: bullet=false, leftMargin=0, indent=0.
expectedWidth = anchor.getWidth() - leftInset - rightInset - leftMargin;
- assertEquals(285.6, expectedWidth); // 300 - 7.2 - 7.2 - 0
- assertEquals(expectedWidth, p.getWrappingWidth(true, null));
- assertEquals(expectedWidth, p.getWrappingWidth(false, null));
+ assertEquals(285.6, expectedWidth, 0); // 300 - 7.2 - 7.2 - 0
+ assertEquals(expectedWidth, dtp.getWrappingWidth(true, null), 0);
+ assertEquals(expectedWidth, dtp.getWrappingWidth(false, null), 0);
p.setLeftMargin(36); // 0.5"
leftMargin = p.getLeftMargin();
- assertEquals(36.0, leftMargin);
+ assertEquals(36.0, leftMargin, 0);
expectedWidth = anchor.getWidth() - leftInset - rightInset - leftMargin;
assertEquals(249.6, expectedWidth, 1E-5); // 300 - 7.2 - 7.2 - 36
- assertEquals(expectedWidth, p.getWrappingWidth(true, null));
- assertEquals(expectedWidth, p.getWrappingWidth(false, null));
+ assertEquals(expectedWidth, dtp.getWrappingWidth(true, null), 0);
+ assertEquals(expectedWidth, dtp.getWrappingWidth(false, null), 0);
// increase insets, the wrapping width should get smaller
sh.setLeftInset(10);
sh.setRightInset(10);
leftInset = sh.getLeftInset();
rightInset = sh.getRightInset();
- assertEquals(10.0, leftInset);
- assertEquals(10.0, rightInset);
+ assertEquals(10.0, leftInset, 0);
+ assertEquals(10.0, rightInset, 0);
expectedWidth = anchor.getWidth() - leftInset - rightInset - leftMargin;
- assertEquals(244.0, expectedWidth); // 300 - 10 - 10 - 36
- assertEquals(expectedWidth, p.getWrappingWidth(true, null));
- assertEquals(expectedWidth, p.getWrappingWidth(false, null));
+ assertEquals(244.0, expectedWidth, 0); // 300 - 10 - 10 - 36
+ assertEquals(expectedWidth, dtp.getWrappingWidth(true, null), 0);
+ assertEquals(expectedWidth, dtp.getWrappingWidth(false, null), 0);
// set a positive indent of a 0.5 inch. This means "First Line" indentation:
// |<--- indent -->|Here goes first line of the text
@@ -95,34 +118,35 @@ public class TestXSLFTextParagraph exten
p.setIndent(36.0); // 0.5"
indent = p.getIndent();
- assertEquals(36.0, indent);
+ assertEquals(36.0, indent, 0);
expectedWidth = anchor.getWidth() - leftInset - rightInset - leftMargin - indent;
- assertEquals(208.0, expectedWidth); // 300 - 10 - 10 - 36 - 6.4
- assertEquals(expectedWidth, p.getWrappingWidth(true, null)); // first line is indented
+ assertEquals(208.0, expectedWidth, 0); // 300 - 10 - 10 - 36 - 6.4
+ assertEquals(expectedWidth, dtp.getWrappingWidth(true, null), 0); // first line is indented
// other lines are not indented
expectedWidth = anchor.getWidth() - leftInset - rightInset - leftMargin;
- assertEquals(244.0, expectedWidth); // 300 - 10 - 10 - 36
- assertEquals(expectedWidth, p.getWrappingWidth(false, null));
+ assertEquals(244.0, expectedWidth, 0); // 300 - 10 - 10 - 36
+ assertEquals(expectedWidth, dtp.getWrappingWidth(false, null), 0);
// set a negative indent of a 1 inch. This means "Hanging" indentation:
// Here goes first line of the text
// |<--- indent -->|Here go other lines (second and subsequent)
p.setIndent(-72.0); // 1"
indent = p.getIndent();
- assertEquals(-72.0, indent);
+ assertEquals(-72.0, indent, 0);
expectedWidth = anchor.getWidth() - leftInset - rightInset;
- assertEquals(280.0, expectedWidth); // 300 - 10 - 10
- assertEquals(expectedWidth, p.getWrappingWidth(true, null)); // first line is NOT indented
+ assertEquals(280.0, expectedWidth, 0); // 300 - 10 - 10
+ assertEquals(expectedWidth, dtp.getWrappingWidth(true, null), 0); // first line is NOT indented
// other lines are indented by leftMargin (the value of indent is not used)
expectedWidth = anchor.getWidth() - leftInset - rightInset - leftMargin;
- assertEquals(244.0, expectedWidth); // 300 - 10 - 10 - 36
- assertEquals(expectedWidth, p.getWrappingWidth(false, null));
+ assertEquals(244.0, expectedWidth, 0); // 300 - 10 - 10 - 36
+ assertEquals(expectedWidth, dtp.getWrappingWidth(false, null), 0);
}
/**
* test breaking test into lines.
* This test requires that the Arial font is available and will run only on windows
*/
+ @Test
public void testBreakLines(){
String os = System.getProperty("os.name");
if(os == null || !os.contains("Windows")) {
@@ -144,44 +168,52 @@ public class TestXSLFTextParagraph exten
"residing within the corresponding paragraph.");
sh.setAnchor(new Rectangle(50, 50, 300, 200));
+ DrawTextParagraphProxy dtp = new DrawTextParagraphProxy(p);
BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = img.createGraphics();
- List<TextFragment> lines;
- lines = p.breakText(graphics);
+ List<DrawTextFragment> lines;
+ dtp.breakText(graphics);
+ lines = dtp.getLines();
assertEquals(4, lines.size());
// descrease the shape width from 300 pt to 100 pt
sh.setAnchor(new Rectangle(50, 50, 100, 200));
- lines = p.breakText(graphics);
+ dtp.breakText(graphics);
+ lines = dtp.getLines();
assertEquals(12, lines.size());
// descrease the shape width from 300 pt to 100 pt
sh.setAnchor(new Rectangle(50, 50, 600, 200));
- lines = p.breakText(graphics);
+ dtp.breakText(graphics);
+ lines = dtp.getLines();
assertEquals(2, lines.size());
// set left and right margins to 200pt. This leaves 200pt for wrapping text
sh.setLeftInset(200);
sh.setRightInset(200);
- lines = p.breakText(graphics);
+ dtp.breakText(graphics);
+ lines = dtp.getLines();
assertEquals(5, lines.size());
r.setText("Apache POI");
- lines = p.breakText(graphics);
+ dtp.breakText(graphics);
+ lines = dtp.getLines();
assertEquals(1, lines.size());
assertEquals("Apache POI", lines.get(0).getString());
r.setText("Apache\nPOI");
- lines = p.breakText(graphics);
+ dtp.breakText(graphics);
+ lines = dtp.getLines();
assertEquals(2, lines.size());
assertEquals("Apache", lines.get(0).getString());
assertEquals("POI", lines.get(1).getString());
// trailing newlines are ignored
r.setText("Apache\nPOI\n");
- lines = p.breakText(graphics);
+ dtp.breakText(graphics);
+ lines = dtp.getLines();
assertEquals(2, lines.size());
assertEquals("Apache", lines.get(0).getString());
assertEquals("POI", lines.get(1).getString());
@@ -197,7 +229,8 @@ public class TestXSLFTextParagraph exten
r3.setFontFamily("serif"); // this should always be available
r3.setFontSize(10);
r3.setText("POI");
- lines = p2.breakText(graphics);
+ dtp.breakText(graphics);
+ lines = dtp.getLines();
assertEquals(2, lines.size());
assertEquals("Apache", lines.get(0).getString());
assertEquals("POI", lines.get(1).getString());
@@ -206,6 +239,7 @@ public class TestXSLFTextParagraph exten
}
+ @Test
public void testThemeInheritance(){
XMLSlideShow ppt = XSLFTestDataSamples.openSampleDocument("prProps.pptx");
XSLFShape[] shapes = ppt.getSlides()[0].getShapes();
@@ -220,6 +254,7 @@ public class TestXSLFTextParagraph exten
assertEquals(TextAlign.CENTER, sh3.getTextParagraphs().get(0).getTextAlign());
}
+ @Test
public void testParagraphProperties(){
XMLSlideShow ppt = new XMLSlideShow();
XSLFSlide slide = ppt.createSlide();
@@ -242,25 +277,25 @@ public class TestXSLFTextParagraph exten
p.setBulletFontColor(Color.red);
assertEquals(Color.red, p.getBulletFontColor());
- assertEquals(100.0, p.getBulletFontSize());
+ assertEquals(100.0, p.getBulletFontSize(), 0);
p.setBulletFontSize(200.);
- assertEquals(200., p.getBulletFontSize());
+ assertEquals(200., p.getBulletFontSize(), 0);
p.setBulletFontSize(-20.);
- assertEquals(-20.0, p.getBulletFontSize());
+ assertEquals(-20.0, p.getBulletFontSize(), 0);
- assertEquals(72.0, p.getDefaultTabSize());
+ assertEquals(72.0, p.getDefaultTabSize(), 0);
- assertEquals(0.0, p.getIndent());
+ assertEquals(0.0, p.getIndent(), 0);
p.setIndent(72.0);
- assertEquals(72.0, p.getIndent());
+ assertEquals(72.0, p.getIndent(), 0);
p.setIndent(-1.0); // the value of -1.0 resets to the defaults
- assertEquals(0.0, p.getIndent());
+ assertEquals(0.0, p.getIndent(), 0);
- assertEquals(0.0, p.getLeftMargin());
+ assertEquals(0.0, p.getLeftMargin(), 0);
p.setLeftMargin(72.0);
- assertEquals(72.0, p.getLeftMargin());
+ assertEquals(72.0, p.getLeftMargin(), 0);
p.setLeftMargin(-1.0); // the value of -1.0 resets to the defaults
- assertEquals(0.0, p.getLeftMargin());
+ assertEquals(0.0, p.getLeftMargin(), 0);
assertEquals(0, p.getLevel());
p.setLevel(1);
@@ -268,23 +303,23 @@ public class TestXSLFTextParagraph exten
p.setLevel(2);
assertEquals(2, p.getLevel());
- assertEquals(100., p.getLineSpacing());
+ assertEquals(100., p.getLineSpacing(), 0);
p.setLineSpacing(200.);
- assertEquals(200.0, p.getLineSpacing());
+ assertEquals(200.0, p.getLineSpacing(), 0);
p.setLineSpacing(-15.);
- assertEquals(-15.0, p.getLineSpacing());
+ assertEquals(-15.0, p.getLineSpacing(), 0);
- assertEquals(0., p.getSpaceAfter());
+ assertEquals(0., p.getSpaceAfter(), 0);
p.setSpaceAfter(200.);
- assertEquals(200.0, p.getSpaceAfter());
+ assertEquals(200.0, p.getSpaceAfter(), 0);
p.setSpaceAfter(-15.);
- assertEquals(-15.0, p.getSpaceAfter());
+ assertEquals(-15.0, p.getSpaceAfter(), 0);
- assertEquals(0., p.getSpaceBefore());
+ assertEquals(0., p.getSpaceBefore(), 0);
p.setSpaceBefore(200.);
- assertEquals(200.0, p.getSpaceBefore());
+ assertEquals(200.0, p.getSpaceBefore(), 0);
p.setSpaceBefore(-15.);
- assertEquals(-15.0, p.getSpaceBefore());
+ assertEquals(-15.0, p.getSpaceBefore(), 0);
assertEquals(TextAlign.LEFT, p.getTextAlign());
p.setTextAlign(TextAlign.RIGHT);
@@ -296,15 +331,16 @@ public class TestXSLFTextParagraph exten
p.setBulletAutoNumber(ListAutoNumber.ALPHA_LC_PARENT_BOTH, 1);
double tabStop = p.getTabStop(0);
- assertEquals(0.0, tabStop);
+ assertEquals(0.0, tabStop, 0);
p.addTabStop(100.);
- assertEquals(100., p.getTabStop(0));
+ assertEquals(100., p.getTabStop(0), 0);
- assertEquals(72.0, p.getDefaultTabSize());
+ assertEquals(72.0, p.getDefaultTabSize(), 0);
}
+ @Test
public void testLineBreak(){
XMLSlideShow ppt = new XMLSlideShow();
XSLFSlide slide = ppt.createSlide();
@@ -316,12 +352,12 @@ public class TestXSLFTextParagraph exten
XSLFTextRun r2 = p.addLineBreak();
assertEquals("\n", r2.getText());
r2.setFontSize(10.0);
- assertEquals(10.0, r2.getFontSize());
+ assertEquals(10.0, r2.getFontSize(), 0);
XSLFTextRun r3 = p.addNewTextRun();
r3.setText("World!");
r3.setFontSize(20.0);
XSLFTextRun r4 = p.addLineBreak();
- assertEquals(20.0, r4.getFontSize());
+ assertEquals(20.0, r4.getFontSize(), 0);
assertEquals("Hello,\nWorld!\n",sh.getText());
Modified: poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java (original)
+++ poi/branches/common_sl/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java Thu Mar 19 23:44:23 2015
@@ -16,20 +16,17 @@
==================================================================== */
package org.apache.poi.xslf.usermodel;
+import java.awt.Color;
+
import junit.framework.TestCase;
-import org.apache.poi.sl.usermodel.TextAlign;
+import org.apache.poi.sl.usermodel.TextParagraph.TextAlign;
import org.apache.poi.sl.usermodel.VerticalAlignment;
import org.apache.poi.xslf.XSLFTestDataSamples;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBodyProperties;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties;
-import org.openxmlformats.schemas.drawingml.x2006.main.STTextAlignType;
+import org.openxmlformats.schemas.drawingml.x2006.main.*;
import org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder;
import org.openxmlformats.schemas.presentationml.x2006.main.STPlaceholderType;
-import java.awt.Color;
-
/**
* @author Yegor Kozlov
*/
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/Bitmap.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/Bitmap.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/Bitmap.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/Bitmap.java Thu Mar 19 23:44:23 2015
@@ -17,7 +17,7 @@
package org.apache.poi.hslf.blip;
-import org.apache.poi.hslf.usermodel.PictureData;
+import org.apache.poi.hslf.usermodel.HSLFPictureData;
import java.io.IOException;
import java.io.ByteArrayOutputStream;
@@ -28,7 +28,7 @@ import java.io.ByteArrayOutputStream;
*
* @author Yegor Kozlov
*/
-public abstract class Bitmap extends PictureData {
+public abstract class Bitmap extends HSLFPictureData {
public byte[] getData(){
byte[] rawdata = getRawData();
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/BitmapPainter.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/BitmapPainter.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/BitmapPainter.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/BitmapPainter.java Thu Mar 19 23:44:23 2015
@@ -17,8 +17,8 @@
package org.apache.poi.hslf.blip;
-import org.apache.poi.hslf.usermodel.PictureData;
-import org.apache.poi.hslf.model.Picture;
+import org.apache.poi.hslf.usermodel.HSLFPictureData;
+import org.apache.poi.hslf.model.HSLFPictureShape;
import org.apache.poi.util.POILogger;
import org.apache.poi.util.POILogFactory;
@@ -56,7 +56,7 @@ import java.io.ByteArrayInputStream;
public final class BitmapPainter implements ImagePainter {
protected POILogger logger = POILogFactory.getLogger(this.getClass());
- public void paint(Graphics2D graphics, PictureData pict, Picture parent) {
+ public void paint(Graphics2D graphics, HSLFPictureData pict, HSLFPictureShape parent) {
BufferedImage img;
try {
img = ImageIO.read(new ByteArrayInputStream(pict.getData()));
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/DIB.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/DIB.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/DIB.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/DIB.java Thu Mar 19 23:44:23 2015
@@ -17,7 +17,7 @@
package org.apache.poi.hslf.blip;
-import org.apache.poi.hslf.model.Picture;
+import org.apache.poi.hslf.model.HSLFPictureShape;
import org.apache.poi.util.LittleEndian;
import java.io.IOException;
@@ -35,10 +35,10 @@ public final class DIB extends Bitmap {
/**
* @return type of this picture
- * @see org.apache.poi.hslf.model.Picture#DIB
+ * @see org.apache.poi.hslf.model.HSLFPictureShape#DIB
*/
public int getType(){
- return Picture.DIB;
+ return HSLFPictureShape.DIB;
}
/**
@@ -89,4 +89,8 @@ public final class DIB extends Bitmap {
System.arraycopy(data, HEADER_SIZE, dib, 0, dib.length);
super.setData(dib);
}
+
+ public String getContentType() {
+ return "image/bmp";
+ }
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/EMF.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/EMF.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/EMF.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/EMF.java Thu Mar 19 23:44:23 2015
@@ -17,7 +17,7 @@
package org.apache.poi.hslf.blip;
-import org.apache.poi.hslf.model.Picture;
+import org.apache.poi.hslf.model.HSLFPictureShape;
import org.apache.poi.hslf.model.HSLFShape;
import org.apache.poi.hslf.exceptions.HSLFException;
@@ -80,7 +80,7 @@ public final class EMF extends Metafile
}
public int getType(){
- return Picture.EMF;
+ return HSLFPictureShape.EMF;
}
/**
@@ -91,4 +91,8 @@ public final class EMF extends Metafile
public int getSignature(){
return 0x3D40;
}
+
+ public String getContentType() {
+ return "image/x-emf";
+ }
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/ImagePainter.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/ImagePainter.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/ImagePainter.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/ImagePainter.java Thu Mar 19 23:44:23 2015
@@ -17,8 +17,8 @@
package org.apache.poi.hslf.blip;
-import org.apache.poi.hslf.model.Picture;
-import org.apache.poi.hslf.usermodel.PictureData;
+import org.apache.poi.hslf.model.HSLFPictureShape;
+import org.apache.poi.hslf.usermodel.HSLFPictureData;
import java.awt.*;
@@ -68,5 +68,5 @@ public interface ImagePainter {
* @param pict the data to paint
* @param parent the shapes that owns the picture data
*/
- public void paint(Graphics2D graphics, PictureData pict, Picture parent);
+ public void paint(Graphics2D graphics, HSLFPictureData pict, HSLFPictureShape parent);
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/JPEG.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/JPEG.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/JPEG.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/JPEG.java Thu Mar 19 23:44:23 2015
@@ -17,7 +17,7 @@
package org.apache.poi.hslf.blip;
-import org.apache.poi.hslf.model.Picture;
+import org.apache.poi.hslf.model.HSLFPictureShape;
/**
* Represents a JPEG picture data in a PPT file
@@ -28,10 +28,10 @@ public final class JPEG extends Bitmap {
/**
* @return type of this picture
- * @see org.apache.poi.hslf.model.Picture#JPEG
+ * @see org.apache.poi.hslf.model.HSLFPictureShape#JPEG
*/
public int getType(){
- return Picture.JPEG;
+ return HSLFPictureShape.JPEG;
}
/**
@@ -42,4 +42,8 @@ public final class JPEG extends Bitmap {
public int getSignature(){
return 0x46A0;
}
+
+ public String getContentType() {
+ return "image/jpeg";
+ }
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/Metafile.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/Metafile.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/Metafile.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/Metafile.java Thu Mar 19 23:44:23 2015
@@ -18,7 +18,7 @@
package org.apache.poi.hslf.blip;
import org.apache.poi.util.LittleEndian;
-import org.apache.poi.hslf.usermodel.PictureData;
+import org.apache.poi.hslf.usermodel.HSLFPictureData;
import java.awt.*;
import java.io.*;
@@ -30,7 +30,7 @@ import java.util.zip.DeflaterOutputStrea
*
* @author Yegor Kozlov
*/
-public abstract class Metafile extends PictureData {
+public abstract class Metafile extends HSLFPictureData {
/**
* A structure which represents a 34-byte header preceeding the compressed metafile data
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/PICT.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/PICT.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/PICT.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/PICT.java Thu Mar 19 23:44:23 2015
@@ -23,7 +23,7 @@ import java.io.IOException;
import java.util.zip.InflaterInputStream;
import org.apache.poi.hslf.exceptions.HSLFException;
-import org.apache.poi.hslf.model.Picture;
+import org.apache.poi.hslf.model.HSLFPictureShape;
import org.apache.poi.hslf.model.HSLFShape;
/**
@@ -102,10 +102,10 @@ public final class PICT extends Metafile
}
/**
- * @see org.apache.poi.hslf.model.Picture#PICT
+ * @see org.apache.poi.hslf.model.HSLFPictureShape#PICT
*/
public int getType(){
- return Picture.PICT;
+ return HSLFPictureShape.PICT;
}
/**
@@ -117,4 +117,8 @@ public final class PICT extends Metafile
return 0x5430;
}
+ public String getContentType() {
+ return "image/x-pict";
+ }
+
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/PNG.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/PNG.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/PNG.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/PNG.java Thu Mar 19 23:44:23 2015
@@ -17,14 +17,8 @@
package org.apache.poi.hslf.blip;
+import org.apache.poi.hslf.model.HSLFPictureShape;
import org.apache.poi.util.PngUtils;
-import org.apache.poi.hslf.model.Picture;
-import org.apache.poi.hslf.exceptions.HSLFException;
-
-import javax.imageio.ImageIO;
-import java.awt.image.BufferedImage;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
/**
* Represents a PNG picture data in a PPT file
@@ -52,10 +46,10 @@ public final class PNG extends Bitmap {
/**
* @return type of this picture
- * @see org.apache.poi.hslf.model.Picture#PNG
+ * @see org.apache.poi.hslf.model.HSLFPictureShape#PNG
*/
public int getType(){
- return Picture.PNG;
+ return HSLFPictureShape.PNG;
}
/**
@@ -66,4 +60,8 @@ public final class PNG extends Bitmap {
public int getSignature(){
return 0x6E00;
}
+
+ public String getContentType() {
+ return "image/png";
+ }
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/WMF.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/WMF.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/WMF.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/WMF.java Thu Mar 19 23:44:23 2015
@@ -19,7 +19,7 @@ package org.apache.poi.hslf.blip;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.POILogger;
-import org.apache.poi.hslf.model.Picture;
+import org.apache.poi.hslf.model.HSLFPictureShape;
import org.apache.poi.hslf.model.HSLFShape;
import org.apache.poi.hslf.exceptions.HSLFException;
@@ -95,7 +95,7 @@ public final class WMF extends Metafile
* We are of type <code>Picture.WMF</code>
*/
public int getType(){
- return Picture.WMF;
+ return HSLFPictureShape.WMF;
}
/**
@@ -188,4 +188,9 @@ public final class WMF extends Metafile
}
}
+
+ public String getContentType() {
+ return "image/x-wmf";
+ }
+
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/PPDrawingTextListing.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/PPDrawingTextListing.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/PPDrawingTextListing.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/PPDrawingTextListing.java Thu Mar 19 23:44:23 2015
@@ -18,6 +18,7 @@
package org.apache.poi.hslf.dev;
import org.apache.poi.hslf.*;
+import org.apache.poi.hslf.model.HSLFSlideShowImpl;
import org.apache.poi.hslf.record.*;
@@ -33,7 +34,7 @@ public final class PPDrawingTextListing
System.exit(1);
}
- HSLFSlideShow ss = new HSLFSlideShow(args[0]);
+ HSLFSlideShowImpl ss = new HSLFSlideShowImpl(args[0]);
// Find PPDrawings at any second level position
Record[] records = ss.getRecords();
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTListing.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTListing.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTListing.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTListing.java Thu Mar 19 23:44:23 2015
@@ -17,7 +17,7 @@
package org.apache.poi.hslf.dev;
-import org.apache.poi.hslf.HSLFSlideShow;
+import org.apache.poi.hslf.model.HSLFSlideShowImpl;
import org.apache.poi.hslf.record.Document;
import org.apache.poi.hslf.record.Record;
import org.apache.poi.hslf.record.RecordTypes;
@@ -35,7 +35,7 @@ public final class SLWTListing {
System.exit(1);
}
- HSLFSlideShow ss = new HSLFSlideShow(args[0]);
+ HSLFSlideShowImpl ss = new HSLFSlideShowImpl(args[0]);
// Find the documents, and then their SLWT
Record[] records = ss.getRecords();
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTTextListing.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTTextListing.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTTextListing.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTTextListing.java Thu Mar 19 23:44:23 2015
@@ -18,6 +18,7 @@
package org.apache.poi.hslf.dev;
import org.apache.poi.hslf.*;
+import org.apache.poi.hslf.model.HSLFSlideShowImpl;
import org.apache.poi.hslf.record.*;
/**
@@ -32,7 +33,7 @@ public final class SLWTTextListing {
System.exit(1);
}
- HSLFSlideShow ss = new HSLFSlideShow(args[0]);
+ HSLFSlideShowImpl ss = new HSLFSlideShowImpl(args[0]);
// Find the documents, and then their SLWT
Record[] records = ss.getRecords();
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/SlideAndNotesAtomListing.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/SlideAndNotesAtomListing.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/SlideAndNotesAtomListing.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/SlideAndNotesAtomListing.java Thu Mar 19 23:44:23 2015
@@ -18,6 +18,7 @@
package org.apache.poi.hslf.dev;
import org.apache.poi.hslf.*;
+import org.apache.poi.hslf.model.HSLFSlideShowImpl;
import org.apache.poi.hslf.record.*;
@@ -34,7 +35,7 @@ public final class SlideAndNotesAtomList
System.exit(1);
}
- HSLFSlideShow ss = new HSLFSlideShow(args[0]);
+ HSLFSlideShowImpl ss = new HSLFSlideShowImpl(args[0]);
System.out.println("");
// Find either Slides or Notes
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/SlideIdListing.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/SlideIdListing.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/SlideIdListing.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/SlideIdListing.java Thu Mar 19 23:44:23 2015
@@ -20,7 +20,7 @@ package org.apache.poi.hslf.dev;
import java.io.ByteArrayOutputStream;
import java.util.Map;
-import org.apache.poi.hslf.HSLFSlideShow;
+import org.apache.poi.hslf.model.HSLFSlideShowImpl;
import org.apache.poi.hslf.record.Document;
import org.apache.poi.hslf.record.Notes;
import org.apache.poi.hslf.record.NotesAtom;
@@ -31,7 +31,7 @@ import org.apache.poi.hslf.record.Slide;
import org.apache.poi.hslf.record.SlideAtom;
import org.apache.poi.hslf.record.SlideListWithText;
import org.apache.poi.hslf.record.SlidePersistAtom;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.util.LittleEndian;
/**
@@ -50,8 +50,8 @@ public final class SlideIdListing {
// Create the slideshow object, for normal working with
- HSLFSlideShow hss = new HSLFSlideShow(args[0]);
- SlideShow ss = new SlideShow(hss);
+ HSLFSlideShowImpl hss = new HSLFSlideShowImpl(args[0]);
+ HSLFSlideShow ss = new HSLFSlideShow(hss);
// Grab the base contents
fileContents = hss.getUnderlyingBytes();
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowRecordDumper.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowRecordDumper.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowRecordDumper.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowRecordDumper.java Thu Mar 19 23:44:23 2015
@@ -19,10 +19,9 @@ package org.apache.poi.hslf.dev;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-
import java.util.Iterator;
-import org.apache.poi.hslf.HSLFSlideShow;
+import org.apache.poi.hslf.model.HSLFSlideShowImpl;
import org.apache.poi.hslf.record.Record;
import org.apache.poi.util.HexDump;
import org.apache.poi.ddf.DefaultEscherRecordFactory;
@@ -44,7 +43,7 @@ import org.apache.poi.hslf.record.StyleT
public final class SlideShowRecordDumper {
private boolean optVerbose;
private boolean optEscher;
- private HSLFSlideShow doc;
+ private HSLFSlideShowImpl doc;
/**
* right now this function takes one parameter: a ppt file, and outputs
@@ -103,7 +102,7 @@ public final class SlideShowRecordDumper
{
optVerbose = verbose;
optEscher = escher;
- doc = new HSLFSlideShow(fileName);
+ doc = new HSLFSlideShowImpl(fileName);
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/TextStyleListing.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/TextStyleListing.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/TextStyleListing.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/TextStyleListing.java Thu Mar 19 23:44:23 2015
@@ -18,6 +18,7 @@
package org.apache.poi.hslf.dev;
import org.apache.poi.hslf.*;
+import org.apache.poi.hslf.model.HSLFSlideShowImpl;
import org.apache.poi.hslf.model.textproperties.BitMaskTextProp;
import org.apache.poi.hslf.model.textproperties.TextProp;
import org.apache.poi.hslf.model.textproperties.TextPropCollection;
@@ -36,7 +37,7 @@ public final class TextStyleListing {
System.exit(1);
}
- HSLFSlideShow ss = new HSLFSlideShow(args[0]);
+ HSLFSlideShowImpl ss = new HSLFSlideShowImpl(args[0]);
// Find the documents, and then their SLWT
Record[] records = ss.getRecords();
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/UserEditAndPersistListing.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/UserEditAndPersistListing.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/UserEditAndPersistListing.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/dev/UserEditAndPersistListing.java Thu Mar 19 23:44:23 2015
@@ -20,7 +20,7 @@ package org.apache.poi.hslf.dev;
import java.io.ByteArrayOutputStream;
import java.util.Map;
-import org.apache.poi.hslf.HSLFSlideShow;
+import org.apache.poi.hslf.model.HSLFSlideShowImpl;
import org.apache.poi.hslf.record.CurrentUserAtom;
import org.apache.poi.hslf.record.PersistPtrHolder;
import org.apache.poi.hslf.record.PositionDependentRecord;
@@ -44,7 +44,7 @@ public final class UserEditAndPersistLis
// Create the slideshow object, for normal working with
- HSLFSlideShow ss = new HSLFSlideShow(args[0]);
+ HSLFSlideShowImpl ss = new HSLFSlideShowImpl(args[0]);
fileContents = ss.getUnderlyingBytes();
System.out.println("");
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/extractor/ImageExtractor.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/extractor/ImageExtractor.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/extractor/ImageExtractor.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/extractor/ImageExtractor.java Thu Mar 19 23:44:23 2015
@@ -17,10 +17,10 @@
package org.apache.poi.hslf.extractor;
-import org.apache.poi.hslf.usermodel.SlideShow;
-import org.apache.poi.hslf.usermodel.PictureData;
-import org.apache.poi.hslf.HSLFSlideShow;
-import org.apache.poi.hslf.model.Picture;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
+import org.apache.poi.hslf.usermodel.HSLFPictureData;
+import org.apache.poi.hslf.model.HSLFPictureShape;
+import org.apache.poi.hslf.model.HSLFSlideShowImpl;
import java.io.IOException;
import java.io.FileOutputStream;
@@ -37,12 +37,12 @@ public final class ImageExtractor {
System.err.println("\tImageExtractor <file>");
return;
}
- SlideShow ppt = new SlideShow(new HSLFSlideShow(args[0]));
+ HSLFSlideShow ppt = new HSLFSlideShow(new HSLFSlideShowImpl(args[0]));
//extract all pictures contained in the presentation
- PictureData[] pdata = ppt.getPictureData();
+ HSLFPictureData[] pdata = ppt.getPictureData();
for (int i = 0; i < pdata.length; i++) {
- PictureData pict = pdata[i];
+ HSLFPictureData pict = pdata[i];
// picture data
byte[] data = pict.getData();
@@ -50,22 +50,22 @@ public final class ImageExtractor {
int type = pict.getType();
String ext;
switch (type) {
- case Picture.JPEG:
+ case HSLFPictureShape.JPEG:
ext = ".jpg";
break;
- case Picture.PNG:
+ case HSLFPictureShape.PNG:
ext = ".png";
break;
- case Picture.WMF:
+ case HSLFPictureShape.WMF:
ext = ".wmf";
break;
- case Picture.EMF:
+ case HSLFPictureShape.EMF:
ext = ".emf";
break;
- case Picture.PICT:
+ case HSLFPictureShape.PICT:
ext = ".pict";
break;
- case Picture.DIB:
+ case HSLFPictureShape.DIB:
ext = ".dib";
break;
default:
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java Thu Mar 19 23:44:23 2015
@@ -25,9 +25,8 @@ import java.util.List;
import java.util.ArrayList;
import org.apache.poi.POIOLE2TextExtractor;
-import org.apache.poi.hslf.HSLFSlideShow;
import org.apache.poi.hslf.model.*;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
@@ -39,9 +38,9 @@ import org.apache.poi.poifs.filesystem.P
* @author Nick Burch
*/
public final class PowerPointExtractor extends POIOLE2TextExtractor {
- private HSLFSlideShow _hslfshow;
- private SlideShow _show;
- private Slide[] _slides;
+ private HSLFSlideShowImpl _hslfshow;
+ private HSLFSlideShow _show;
+ private HSLFSlide[] _slides;
private boolean _slidesByDefault = true;
private boolean _notesByDefault = false;
@@ -120,7 +119,7 @@ public final class PowerPointExtractor e
* @param dir the POIFS Directory containing the PowerPoint document
*/
public PowerPointExtractor(DirectoryNode dir) throws IOException {
- this(new HSLFSlideShow(dir));
+ this(new HSLFSlideShowImpl(dir));
}
/**
@@ -128,7 +127,7 @@ public final class PowerPointExtractor e
*/
@Deprecated
public PowerPointExtractor(DirectoryNode dir, POIFSFileSystem fs) throws IOException {
- this(new HSLFSlideShow(dir, fs));
+ this(new HSLFSlideShowImpl(dir, fs));
}
/**
@@ -136,10 +135,10 @@ public final class PowerPointExtractor e
*
* @param ss the HSLFSlideShow to extract text from
*/
- public PowerPointExtractor(HSLFSlideShow ss) {
+ public PowerPointExtractor(HSLFSlideShowImpl ss) {
super(ss);
_hslfshow = ss;
- _show = new SlideShow(_hslfshow);
+ _show = new HSLFSlideShow(_hslfshow);
_slides = _show.getSlides();
}
@@ -190,7 +189,7 @@ public final class PowerPointExtractor e
List<OLEShape> list = new ArrayList<OLEShape>();
for (int i = 0; i < _slides.length; i++) {
- Slide slide = _slides[i];
+ HSLFSlide slide = _slides[i];
HSLFShape[] shapes = slide.getShapes();
for (int j = 0; j < shapes.length; j++) {
@@ -222,14 +221,14 @@ public final class PowerPointExtractor e
if (getMasterText) {
for (SlideMaster master : _show.getSlidesMasters()) {
for(HSLFShape sh : master.getShapes()){
- if(sh instanceof TextShape){
- if(MasterSheet.isPlaceholder(sh)) {
+ if(sh instanceof HSLFTextShape){
+ if(HSLFMasterSheet.isPlaceholder(sh)) {
// don't bother about boiler
// plate text on master
// sheets
continue;
}
- TextShape tsh = (TextShape)sh;
+ HSLFTextShape tsh = (HSLFTextShape)sh;
String text = tsh.getText();
if (text != null){
ret.append(text);
@@ -243,7 +242,7 @@ public final class PowerPointExtractor e
}
for (int i = 0; i < _slides.length; i++) {
- Slide slide = _slides[i];
+ HSLFSlide slide = _slides[i];
// Slide header, if set
HeadersFooters hf = slide.getHeadersFooters();
@@ -286,7 +285,7 @@ public final class PowerPointExtractor e
HeadersFooters hf = _show.getNotesHeadersFooters();
for (int i = 0; i < _slides.length; i++) {
- Notes notes = _slides[i].getNotesSheet();
+ HSLFNotes notes = _slides[i].getNotesSheet();
if (notes == null) {
continue;
}
@@ -331,13 +330,13 @@ public final class PowerPointExtractor e
ret.append('\n');
}
}
- private void textRunsToText(StringBuffer ret, TextRun[] runs) {
+ private void textRunsToText(StringBuffer ret, HSLFTextParagraph[] runs) {
if (runs==null) {
return;
}
for (int j = 0; j < runs.length; j++) {
- TextRun run = runs[j];
+ HSLFTextParagraph run = runs[j];
if (run != null) {
String text = run.getText();
ret.append(text);
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java Thu Mar 19 23:44:23 2015
@@ -23,7 +23,7 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
-import org.apache.poi.hslf.model.TextRun;
+import org.apache.poi.hslf.model.HSLFTextParagraph;
import org.apache.poi.hslf.record.CString;
import org.apache.poi.hslf.record.Record;
import org.apache.poi.hslf.record.RecordTypes;
@@ -175,17 +175,17 @@ public final class QuickButCruddyTextExt
// Otherwise, check the type to see if it's text
long type = LittleEndian.getUShort(pptContents,startPos+2);
- TextRun trun = null;
+ HSLFTextParagraph trun = null;
// TextBytesAtom
if(type == RecordTypes.TextBytesAtom.typeID) {
TextBytesAtom tba = (TextBytesAtom)Record.createRecordForType(type, pptContents, startPos, len+8);
- trun = new TextRun((TextHeaderAtom)null,tba,(StyleTextPropAtom)null);
+ trun = new HSLFTextParagraph((TextHeaderAtom)null,tba,(StyleTextPropAtom)null);
}
// TextCharsAtom
if(type == RecordTypes.TextCharsAtom.typeID) {
TextCharsAtom tca = (TextCharsAtom)Record.createRecordForType(type, pptContents, startPos, len+8);
- trun = new TextRun((TextHeaderAtom)null,tca,(StyleTextPropAtom)null);
+ trun = new HSLFTextParagraph((TextHeaderAtom)null,tca,(StyleTextPropAtom)null);
}
// CString (doesn't go via a TextRun)
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java Thu Mar 19 23:44:23 2015
@@ -45,7 +45,7 @@ import org.apache.poi.util.StringUtil;
* TODO: finish
* @author Yegor Kozlov
*/
-public final class ActiveXShape extends Picture {
+public final class ActiveXShape extends HSLFPictureShape {
public static final int DEFAULT_ACTIVEX_THUMBNAIL = -1;
/**
@@ -108,7 +108,7 @@ public final class ActiveXShape extends
/**
* Assign a control to this shape
*
- * @see org.apache.poi.hslf.usermodel.SlideShow#addMovie(String, int)
+ * @see org.apache.poi.hslf.usermodel.HSLFSlideShow#addMovie(String, int)
* @param idx the index of the movie
*/
public void setActiveXIndex(int idx){
@@ -164,7 +164,7 @@ public final class ActiveXShape extends
return ctrl;
}
- protected void afterInsert(Sheet sheet){
+ protected void afterInsert(HSLFSheet sheet){
ExControl ctrl = getExControl();
ctrl.getExControlAtom().setSlideId(sheet._getSheetNumber());
Copied: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFAutoShape.java (from r1664935, poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/AutoShape.java)
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFAutoShape.java?p2=poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFAutoShape.java&p1=poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/AutoShape.java&r1=1664935&r2=1667902&rev=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/AutoShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFAutoShape.java Thu Mar 19 23:44:23 2015
@@ -18,11 +18,13 @@
package org.apache.poi.hslf.model;
import org.apache.poi.ddf.*;
-import org.apache.poi.sl.usermodel.ShapeContainer;
-import org.apache.poi.sl.usermodel.ShapeType;
+import org.apache.poi.sl.draw.geom.CustomGeometry;
+import org.apache.poi.sl.draw.geom.Guide;
+import org.apache.poi.sl.usermodel.*;
import org.apache.poi.util.POILogger;
import java.awt.geom.Rectangle2D;
+import java.util.Iterator;
/**
* Represents an AutoShape.
@@ -33,18 +35,18 @@ import java.awt.geom.Rectangle2D;
*
* @author Yegor Kozlov
*/
-public class AutoShape extends TextShape {
+public class HSLFAutoShape extends HSLFTextShape implements AutoShape<HSLFTextParagraph> {
- protected AutoShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
+ protected HSLFAutoShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
super(escherRecord, parent);
}
- public AutoShape(ShapeType type, ShapeContainer<HSLFShape> parent){
+ public HSLFAutoShape(ShapeType type, ShapeContainer<HSLFShape> parent){
super(null, parent);
_escherContainer = createSpContainer(type, parent instanceof HSLFGroupShape);
}
- public AutoShape(ShapeType type){
+ public HSLFAutoShape(ShapeType type){
this(type, null);
}
@@ -66,10 +68,10 @@ public class AutoShape extends TextShape
return _escherContainer;
}
- protected void setDefaultTextProperties(TextRun _txtrun){
- setVerticalAlignment(TextBox.AnchorMiddle);
- setHorizontalAlignment(TextBox.AlignCenter);
- setWordWrap(TextBox.WrapNone);
+ protected void setDefaultTextProperties(HSLFTextParagraph _txtrun){
+ setVerticalAlignment(HSLFTextBox.AnchorMiddle);
+ setHorizontalAlignment(HSLFTextBox.AlignCenter);
+ setWordWrap(HSLFTextBox.WrapNone);
}
/**
@@ -118,5 +120,4 @@ public class AutoShape extends TextShape
java.awt.Shape shape = outline.getOutline(this);
return AutoShapes.transform(shape, anchor);
}
-
}
Copied: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFBackground.java (from r1664935, poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Background.java)
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFBackground.java?p2=poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFBackground.java&p1=poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Background.java&r1=1664935&r2=1667902&rev=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Background.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFBackground.java Thu Mar 19 23:44:23 2015
@@ -17,65 +17,22 @@
package org.apache.poi.hslf.model;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.Image;
-import java.awt.Rectangle;
-import java.awt.image.BufferedImage;
-import java.io.ByteArrayInputStream;
-
-import javax.imageio.ImageIO;
-
import org.apache.poi.ddf.EscherContainerRecord;
-import org.apache.poi.hslf.blip.Bitmap;
-import org.apache.poi.hslf.usermodel.PictureData;
+import org.apache.poi.sl.usermodel.Background;
import org.apache.poi.sl.usermodel.ShapeContainer;
-import org.apache.poi.util.POILogger;
/**
* Background shape
*
* @author Yegor Kozlov
*/
-public final class Background extends HSLFShape {
+public final class HSLFBackground extends HSLFShape implements Background {
- protected Background(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent) {
+ protected HSLFBackground(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent) {
super(escherRecord, parent);
}
protected EscherContainerRecord createSpContainer(boolean isChild) {
return null;
}
-
- public void draw(Graphics2D graphics) {
- Fill f = getFill();
- Dimension pg = getSheet().getSlideShow().getPageSize();
- Rectangle anchor = new Rectangle(0, 0, pg.width, pg.height);
- switch (f.getFillType()) {
- case Fill.FILL_SOLID:
- Color color = f.getForegroundColor();
- graphics.setPaint(color);
- graphics.fill(anchor);
- break;
- case Fill.FILL_PICTURE:
- PictureData data = f.getPictureData();
- if (data instanceof Bitmap) {
- BufferedImage img = null;
- try {
- img = ImageIO.read(new ByteArrayInputStream(data.getData()));
- } catch (Exception e) {
- logger.log(POILogger.WARN, "ImageIO failed to create image. image.type: " + data.getType());
- return;
- }
- Image scaledImg = img.getScaledInstance(anchor.width, anchor.height, Image.SCALE_SMOOTH);
- graphics.drawImage(scaledImg, anchor.x, anchor.y, null);
-
- }
- break;
- default:
- logger.log(POILogger.WARN, "unsuported fill type: " + f.getFillType());
- break;
- }
- }
}
Copied: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFFill.java (from r1664935, poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Fill.java)
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFFill.java?p2=poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFFill.java&p1=poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Fill.java&r1=1664935&r2=1667902&rev=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Fill.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFFill.java Thu Mar 19 23:44:23 2015
@@ -18,17 +18,17 @@
package org.apache.poi.hslf.model;
import java.awt.Color;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
import java.util.List;
-import org.apache.poi.ddf.EscherBSERecord;
-import org.apache.poi.ddf.EscherContainerRecord;
-import org.apache.poi.ddf.EscherOptRecord;
-import org.apache.poi.ddf.EscherProperties;
-import org.apache.poi.ddf.EscherRecord;
-import org.apache.poi.ddf.EscherSimpleProperty;
+import org.apache.poi.ddf.*;
import org.apache.poi.hslf.record.Document;
-import org.apache.poi.hslf.usermodel.PictureData;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.HSLFPictureData;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
+import org.apache.poi.sl.usermodel.*;
+import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint;
+import org.apache.poi.sl.usermodel.PaintStyle.TexturePaint;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
@@ -37,7 +37,7 @@ import org.apache.poi.util.POILogger;
*
* @author Yegor Kozlov
*/
-public final class Fill {
+public final class HSLFFill {
// For logging
protected POILogger logger = POILogFactory.getLogger(this.getClass());
@@ -106,10 +106,55 @@ public final class Fill {
*
* @param shape the shape this background applies to
*/
- public Fill(HSLFShape shape){
+ public HSLFFill(HSLFShape shape){
this.shape = shape;
}
+
+ public FillStyle getFillStyle() {
+ return new FillStyle() {
+ public PaintStyle getPaint() {
+ switch (getFillType()) {
+ case FILL_SOLID: {
+ return new SolidPaint() {
+ public ColorStyle getSolidColor() {
+ return new ColorStyle() {
+ public Color getColor() { return getForegroundColor(); }
+ public int getAlpha() { return -1; }
+ public int getLumOff() { return -1; }
+ public int getLumMod() { return -1; }
+ public int getShade() { return -1; }
+ public int getTint() { return -1; }
+ };
+ }
+ };
+ }
+ case FILL_PICTURE: {
+ return new TexturePaint() {
+ final HSLFPictureData pd = getPictureData();
+
+ public InputStream getImageData() {
+ return new ByteArrayInputStream(pd.getData());
+ }
+
+ public String getContentType() {
+ return pd.getContentType();
+ }
+
+ public int getAlpha() {
+ return (int)(shape.getAlpha(EscherProperties.FILL__FILLOPACITY)*100000.0);
+ }
+ };
+ }
+ default:
+ logger.log(POILogger.WARN, "unsuported fill type: " + getFillType());
+ break;
+ }
+ return PaintStyle.TRANSPARENT_PAINT;
+ }
+ };
+ }
+
/**
* Returns fill type.
* Must be one of the <code>FILL_*</code> constants defined in this class.
@@ -124,7 +169,7 @@ public final class Fill {
/**
*/
- protected void afterInsert(Sheet sh){
+ protected void afterInsert(HSLFSheet sh){
EscherOptRecord opt = shape.getEscherOptRecord();
EscherSimpleProperty p = HSLFShape.getEscherProperty(opt, EscherProperties.FILL__PATTERNTEXTURE);
if(p != null) {
@@ -135,12 +180,12 @@ public final class Fill {
}
protected EscherBSERecord getEscherBSERecord(int idx){
- Sheet sheet = shape.getSheet();
+ HSLFSheet sheet = shape.getSheet();
if(sheet == null) {
logger.log(POILogger.DEBUG, "Fill has not yet been assigned to a sheet");
return null;
}
- SlideShow ppt = sheet.getSlideShow();
+ HSLFSlideShow ppt = sheet.getSlideShow();
Document doc = ppt.getDocumentRecord();
EscherContainerRecord dggContainer = doc.getPPDrawingGroup().getDggContainer();
EscherContainerRecord bstore = HSLFShape.getEscherChild(dggContainer, EscherContainerRecord.BSTORE_CONTAINER);
@@ -220,13 +265,13 @@ public final class Fill {
/**
* <code>PictureData</code> object used in a texture, pattern of picture fill.
*/
- public PictureData getPictureData(){
+ public HSLFPictureData getPictureData(){
EscherOptRecord opt = shape.getEscherOptRecord();
EscherSimpleProperty p = HSLFShape.getEscherProperty(opt, EscherProperties.FILL__PATTERNTEXTURE);
if (p == null) return null;
- SlideShow ppt = shape.getSheet().getSlideShow();
- PictureData[] pict = ppt.getPictureData();
+ HSLFSlideShow ppt = shape.getSheet().getSlideShow();
+ HSLFPictureData[] pict = ppt.getPictureData();
Document doc = ppt.getDocumentRecord();
EscherContainerRecord dggContainer = doc.getPPDrawingGroup().getDggContainer();
Copied: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFFreeformShape.java (from r1664935, poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Freeform.java)
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFFreeformShape.java?p2=poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFFreeformShape.java&p1=poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Freeform.java&r1=1664935&r2=1667902&rev=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Freeform.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFFreeformShape.java Thu Mar 19 23:44:23 2015
@@ -45,7 +45,7 @@ import org.apache.poi.util.POILogger;
* </p>
* @author Yegor Kozlov
*/
-public final class Freeform extends AutoShape {
+public final class HSLFFreeformShape extends HSLFAutoShape {
public static final byte[] SEGMENTINFO_MOVETO = new byte[]{0x00, 0x40};
public static final byte[] SEGMENTINFO_LINETO = new byte[]{0x00, (byte)0xAC};
@@ -62,7 +62,7 @@ public final class Freeform extends Auto
* @param escherRecord <code>EscherSpContainer</code> container which holds information about this shape
* @param parent the parent of the shape
*/
- protected Freeform(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
+ protected HSLFFreeformShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
super(escherRecord, parent);
}
@@ -73,7 +73,7 @@ public final class Freeform extends Auto
* @param parent the parent of this Shape. For example, if this text box is a cell
* in a table then the parent is Table.
*/
- public Freeform(ShapeContainer<HSLFShape> parent){
+ public HSLFFreeformShape(ShapeContainer<HSLFShape> parent){
super((EscherContainerRecord)null, parent);
_escherContainer = createSpContainer(ShapeType.NOT_PRIMITIVE, parent instanceof HSLFGroupShape);
}
@@ -82,7 +82,7 @@ public final class Freeform extends Auto
* Create a new Freeform. This constructor is used when a new shape is created.
*
*/
- public Freeform(){
+ public HSLFFreeformShape(){
this(null);
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFGroupShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFGroupShape.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFGroupShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFGroupShape.java Thu Mar 19 23:44:23 2015
@@ -177,7 +177,7 @@ public class HSLFGroupShape extends HSLF
public void addShape(HSLFShape shape){
_escherContainer.addChildRecord(shape.getSpContainer());
- Sheet sheet = getSheet();
+ HSLFSheet sheet = getSheet();
shape.setSheet(sheet);
shape.setShapeId(sheet.allocateShapeId());
shape.afterInsert(sheet);
Copied: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFMasterSheet.java (from r1664935, poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/MasterSheet.java)
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFMasterSheet.java?p2=poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFMasterSheet.java&p1=poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/MasterSheet.java&r1=1664935&r2=1667902&rev=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/MasterSheet.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFMasterSheet.java Thu Mar 19 23:44:23 2015
@@ -18,7 +18,9 @@
package org.apache.poi.hslf.model;
import org.apache.poi.hslf.record.SheetContainer;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.hslf.model.textproperties.TextProp;
+import org.apache.poi.sl.usermodel.MasterSheet;
/**
* The superclass of all master sheets - Slide masters, Notes masters, etc.
@@ -27,8 +29,8 @@ import org.apache.poi.hslf.model.textpro
*
* @author Yegor Kozlov
*/
-public abstract class MasterSheet extends Sheet {
- public MasterSheet(SheetContainer container, int sheetNo){
+public abstract class HSLFMasterSheet extends HSLFSheet implements MasterSheet<HSLFShape,HSLFSlideShow> {
+ public HSLFMasterSheet(SheetContainer container, int sheetNo){
super(container, sheetNo);
}
@@ -47,9 +49,9 @@ public abstract class MasterSheet extend
* @return true if the shape is a placeholder
*/
public static boolean isPlaceholder(HSLFShape shape){
- if(!(shape instanceof TextShape)) return false;
+ if(!(shape instanceof HSLFTextShape)) return false;
- TextShape tx = (TextShape)shape;
+ HSLFTextShape tx = (HSLFTextShape)shape;
return tx.getPlaceholderAtom() != null;
}
}
Copied: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFNotes.java (from r1662967, poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Notes.java)
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFNotes.java?p2=poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFNotes.java&p1=poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Notes.java&r1=1662967&r2=1667902&rev=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Notes.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFNotes.java Thu Mar 19 23:44:23 2015
@@ -17,6 +17,12 @@
package org.apache.poi.hslf.model;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
+import org.apache.poi.sl.usermodel.Notes;
+
/**
* This class represents a slide's notes in a PowerPoint Document. It
* allows access to the text within, and the layout. For now, it only
@@ -25,42 +31,45 @@ package org.apache.poi.hslf.model;
* @author Nick Burch
*/
-public final class Notes extends Sheet
-{
- private TextRun[] _runs;
-
- /**
- * Constructs a Notes Sheet from the given Notes record.
- * Initialises TextRuns, to provide easier access to the text
- *
- * @param notes the Notes record to read from
- */
- public Notes (org.apache.poi.hslf.record.Notes notes) {
- super(notes, notes.getNotesAtom().getSlideID());
-
- // Now, build up TextRuns from pairs of TextHeaderAtom and
- // one of TextBytesAtom or TextCharsAtom, found inside
- // EscherTextboxWrapper's in the PPDrawing
- _runs = findTextRuns(getPPDrawing());
-
- // Set the sheet on each TextRun
- for (int i = 0; i < _runs.length; i++)
- _runs[i].setSheet(this);
- }
-
-
- // Accesser methods follow
-
- /**
- * Returns an array of all the TextRuns found
- */
- public TextRun[] getTextRuns() { return _runs; }
+public final class HSLFNotes extends HSLFSheet implements Notes<HSLFShape, HSLFSlideShow> {
+ private HSLFTextParagraph[] _runs;
+
+ /**
+ * Constructs a Notes Sheet from the given Notes record.
+ * Initialises TextRuns, to provide easier access to the text
+ *
+ * @param notes the Notes record to read from
+ */
+ public HSLFNotes(org.apache.poi.hslf.record.Notes notes) {
+ super(notes, notes.getNotesAtom().getSlideID());
+
+ // Now, build up TextRuns from pairs of TextHeaderAtom and
+ // one of TextBytesAtom or TextCharsAtom, found inside
+ // EscherTextboxWrapper's in the PPDrawing
+ _runs = findTextRuns(getPPDrawing());
+
+ // Set the sheet on each TextRun
+ for (HSLFTextParagraph tp : _runs) {
+ tp.supplySheet(this);
+ }
+ }
/**
+ * Returns an array of all the TextRuns found
+ */
+ public HSLFTextParagraph[] getTextRuns() {
+ return _runs;
+ }
+
+ @Override
+ public List<HSLFTextParagraph> getTextParagraphs() {
+ return Arrays.asList(_runs);
+ }
+
+ /**
* Return <code>null</code> - Notes Masters are not yet supported
*/
- public MasterSheet getMasterSheet() {
+ public HSLFMasterSheet getMasterSheet() {
return null;
}
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org