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/02/21 11:56:06 UTC
svn commit: r1661322 [2/14] - in /poi/branches/common_sl: ./
src/examples/src/org/apache/poi/hslf/examples/
src/examples/src/org/apache/poi/xslf/usermodel/
src/java/org/apache/poi/common/usermodel/
src/java/org/apache/poi/hssf/usermodel/ src/java/org/a...
Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java Sat Feb 21 10:56:03 2015
@@ -19,26 +19,25 @@
package org.apache.poi.xslf.usermodel;
+import java.awt.*;
+import java.awt.Shape;
+import java.awt.geom.*;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.poi.sl.draw.geom.*;
+import org.apache.poi.sl.usermodel.*;
+import org.apache.poi.sl.usermodel.StrokeStyle.LineCap;
+import org.apache.poi.sl.usermodel.StrokeStyle.LineDash;
import org.apache.poi.util.Beta;
import org.apache.poi.util.Units;
import org.apache.poi.xslf.model.PropertyFetcher;
-import org.apache.poi.xslf.model.geom.CustomGeometry;
-import org.apache.poi.xslf.model.geom.Outline;
-import org.apache.poi.xslf.model.geom.Path;
-import org.apache.poi.xslf.model.geom.PresetGeometries;
import org.apache.xmlbeans.XmlObject;
import org.openxmlformats.schemas.drawingml.x2006.main.*;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTShape;
-import org.openxmlformats.schemas.presentationml.x2006.main.STPlaceholderType;
-
-import java.awt.*;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Ellipse2D;
-import java.awt.geom.GeneralPath;
-import java.awt.geom.Rectangle2D;
-import java.util.ArrayList;
-import java.util.List;
+import org.openxmlformats.schemas.presentationml.x2006.main.*;
/**
* Represents a single (non-group) shape in a .pptx slide show
@@ -46,24 +45,11 @@ import java.util.List;
* @author Yegor Kozlov
*/
@Beta
-public abstract class XSLFSimpleShape extends XSLFShape {
+public abstract class XSLFSimpleShape extends XSLFShape implements SimpleShape {
private static CTOuterShadowEffect NO_SHADOW = CTOuterShadowEffect.Factory.newInstance();
- private final XmlObject _shape;
- private final XSLFSheet _sheet;
- private CTShapeProperties _spPr;
- private CTShapeStyle _spStyle;
- private CTNonVisualDrawingProps _nvPr;
- private CTPlaceholder _ph;
-
/* package */XSLFSimpleShape(XmlObject shape, XSLFSheet sheet) {
- _shape = shape;
- _sheet = sheet;
- }
-
- @Override
- public XmlObject getXmlObject() {
- return _shape;
+ super(shape,sheet);
}
/**
@@ -78,16 +64,16 @@ public abstract class XSLFSimpleShape ex
*
* @param type
*/
- public void setShapeType(XSLFShapeType type){
+ public void setShapeType(ShapeType type){
CTShape shape = (CTShape) getXmlObject();
- STShapeType.Enum geom = STShapeType.Enum.forInt(type.getIndex());
+ STShapeType.Enum geom = STShapeType.Enum.forInt(type.ooxmlId);
shape.getSpPr().getPrstGeom().setPrst(geom);
}
- public XSLFShapeType getShapeType(){
+ public ShapeType getShapeType(){
CTShape shape = (CTShape) getXmlObject();
STShapeType.Enum geom = shape.getSpPr().getPrstGeom().getPrst();
- return XSLFShapeType.forInt(geom.intValue());
+ return ShapeType.forId(geom.intValue(), true);
}
@Override
@@ -100,101 +86,6 @@ public abstract class XSLFSimpleShape ex
return (int) getNvPr().getId();
}
- protected CTNonVisualDrawingProps getNvPr() {
- if (_nvPr == null) {
- XmlObject[] rs = _shape
- .selectPath("declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//*/p:cNvPr");
- if (rs.length != 0) {
- _nvPr = (CTNonVisualDrawingProps) rs[0];
- }
- }
- return _nvPr;
- }
-
- protected CTShapeProperties getSpPr() {
- if (_spPr == null) {
- for (XmlObject obj : _shape.selectPath("*")) {
- if (obj instanceof CTShapeProperties) {
- _spPr = (CTShapeProperties) obj;
- }
- }
- }
- if (_spPr == null) {
- throw new IllegalStateException("CTShapeProperties was not found.");
- }
- return _spPr;
- }
-
- protected CTShapeStyle getSpStyle() {
- if (_spStyle == null) {
- for (XmlObject obj : _shape.selectPath("*")) {
- if (obj instanceof CTShapeStyle) {
- _spStyle = (CTShapeStyle) obj;
- }
- }
- }
- return _spStyle;
- }
-
- protected CTPlaceholder getCTPlaceholder() {
- if (_ph == null) {
- XmlObject[] obj = _shape.selectPath(
- "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//*/p:nvPr/p:ph");
- if (obj.length == 1) {
- _ph = (CTPlaceholder) obj[0];
- }
- }
- return _ph;
- }
-
- CTTransform2D getXfrm() {
- PropertyFetcher<CTTransform2D> fetcher = new PropertyFetcher<CTTransform2D>() {
- public boolean fetch(XSLFSimpleShape shape) {
- CTShapeProperties pr = shape.getSpPr();
- if (pr.isSetXfrm()) {
- setValue(pr.getXfrm());
- return true;
- }
- return false;
- }
- };
- fetchShapeProperty(fetcher);
- return fetcher.getValue();
- }
-
- @Override
- public Rectangle2D getAnchor() {
-
- CTTransform2D xfrm = getXfrm();
-
- CTPoint2D off = xfrm.getOff();
- long x = off.getX();
- long y = off.getY();
- CTPositiveSize2D ext = xfrm.getExt();
- long cx = ext.getCx();
- long cy = ext.getCy();
- return new Rectangle2D.Double(
- Units.toPoints(x), Units.toPoints(y),
- Units.toPoints(cx), Units.toPoints(cy));
- }
-
- @Override
- public void setAnchor(Rectangle2D anchor) {
- CTShapeProperties spPr = getSpPr();
- CTTransform2D xfrm = spPr.isSetXfrm() ? spPr.getXfrm() : spPr.addNewXfrm();
- CTPoint2D off = xfrm.isSetOff() ? xfrm.getOff() : xfrm.addNewOff();
- long x = Units.toEMU(anchor.getX());
- long y = Units.toEMU(anchor.getY());
- off.setX(x);
- off.setY(y);
- CTPositiveSize2D ext = xfrm.isSetExt() ? xfrm.getExt() : xfrm
- .addNewExt();
- long cx = Units.toEMU(anchor.getWidth());
- long cy = Units.toEMU(anchor.getHeight());
- ext.setCx(cx);
- ext.setCy(cy);
- }
-
@Override
public void setRotation(double theta) {
CTShapeProperties spPr = getSpPr();
@@ -314,7 +205,7 @@ public abstract class XSLFSimpleShape ex
*/
public double getLineWidth() {
PropertyFetcher<Double> fetcher = new PropertyFetcher<Double>() {
- public boolean fetch(XSLFSimpleShape shape) {
+ public boolean fetch(XSLFShape shape) {
CTShapeProperties spPr = shape.getSpPr();
CTLineProperties ln = spPr.getLn();
if (ln != null) {
@@ -371,7 +262,7 @@ public abstract class XSLFSimpleShape ex
public LineDash getLineDash() {
PropertyFetcher<LineDash> fetcher = new PropertyFetcher<LineDash>() {
- public boolean fetch(XSLFSimpleShape shape) {
+ public boolean fetch(XSLFShape shape) {
CTShapeProperties spPr = shape.getSpPr();
CTLineProperties ln = spPr.getLn();
if (ln != null) {
@@ -421,7 +312,7 @@ public abstract class XSLFSimpleShape ex
*/
public LineCap getLineCap() {
PropertyFetcher<LineCap> fetcher = new PropertyFetcher<LineCap>() {
- public boolean fetch(XSLFSimpleShape shape) {
+ public boolean fetch(XSLFShape shape) {
CTShapeProperties spPr = shape.getSpPr();
CTLineProperties ln = spPr.getLn();
if (ln != null) {
@@ -499,7 +390,7 @@ public abstract class XSLFSimpleShape ex
*/
public XSLFShadow getShadow() {
PropertyFetcher<CTOuterShadowEffect> fetcher = new PropertyFetcher<CTOuterShadowEffect>() {
- public boolean fetch(XSLFSimpleShape shape) {
+ public boolean fetch(XSLFShape shape) {
CTShapeProperties spPr = shape.getSpPr();
if (spPr.isSetEffectLst()) {
CTOuterShadowEffect obj = spPr.getEffectLst().getOuterShdw();
@@ -528,90 +419,11 @@ public abstract class XSLFSimpleShape ex
return (obj == null || obj == NO_SHADOW) ? null : new XSLFShadow(obj, this);
}
- @Override
- public void draw(Graphics2D graphics) {
- RenderableShape rShape = new RenderableShape(this);
- rShape.render(graphics);
-
- // draw line decorations
- Color lineColor = getLineColor();
- if(lineColor != null) {
- graphics.setPaint(lineColor);
- for(Outline o : getDecorationOutlines(graphics)){
- if(o.getPath().isFilled()){
- graphics.fill(o.getOutline());
- }
- if(o.getPath().isStroked()){
- graphics.draw(o.getOutline());
- }
- }
- }
- }
-
-
- /**
- * Walk up the inheritance tree and fetch shape properties.
- *
- * The following order of inheritance is assumed:
- * <p>
- * slide <-- slideLayout <-- slideMaster
- * </p>
- *
- * @param visitor the object that collects the desired property
- * @return true if the property was fetched
- */
- boolean fetchShapeProperty(PropertyFetcher visitor) {
- boolean ok = visitor.fetch(this);
-
- XSLFSimpleShape masterShape;
- XSLFSheet masterSheet = getSheet().getMasterSheet();
- CTPlaceholder ph = getCTPlaceholder();
-
- if (masterSheet != null && ph != null) {
- if (!ok) {
- masterShape = masterSheet.getPlaceholder(ph);
- if (masterShape != null) {
- ok = visitor.fetch(masterShape);
- }
- }
-
- // try slide master
- if (!ok ) {
- int textType;
- if ( !ph.isSetType()) textType = STPlaceholderType.INT_BODY;
- else {
- switch (ph.getType().intValue()) {
- case STPlaceholderType.INT_TITLE:
- case STPlaceholderType.INT_CTR_TITLE:
- textType = STPlaceholderType.INT_TITLE;
- break;
- case STPlaceholderType.INT_FTR:
- case STPlaceholderType.INT_SLD_NUM:
- case STPlaceholderType.INT_DT:
- textType = ph.getType().intValue();
- break;
- default:
- textType = STPlaceholderType.INT_BODY;
- break;
- }
- }
- XSLFSheet master = masterSheet.getMasterSheet();
- if (master != null) {
- masterShape = master.getPlaceholderByType(textType);
- if (masterShape != null) {
- ok = visitor.fetch(masterShape);
- }
- }
- }
- }
- return ok;
- }
-
/**
*
* @return definition of the shape geometry
*/
- CustomGeometry getGeometry(){
+ public CustomGeometry getGeometry(){
CTShapeProperties spPr = getSpPr();
CustomGeometry geom;
PresetGeometries dict = PresetGeometries.getInstance();
@@ -622,23 +434,16 @@ public abstract class XSLFSimpleShape ex
throw new IllegalStateException("Unknown shape geometry: " + name);
}
} else if (spPr.isSetCustGeom()){
- geom = new CustomGeometry(spPr.getCustGeom());
+ XMLStreamReader staxReader = spPr.getCustGeom().newXMLStreamReader();
+ geom = PresetGeometries.convertCustomGeometry(staxReader);
+ try { staxReader.close(); }
+ catch (XMLStreamException e) {}
} else {
geom = dict.get("rect");
}
return geom;
}
-
-
- /**
- * draw any content within this shape (image, text, etc.).
- *
- * @param graphics the graphics to draw into
- */
- public void drawContent(Graphics2D graphics){
-
- }
-
+
@Override
void copy(XSLFShape sh){
super.copy(sh);
@@ -943,4 +748,30 @@ public abstract class XSLFSimpleShape ex
return lst;
}
+ public boolean isPlaceholder() {
+ CTPlaceholder ph = getCTPlaceholder();
+ return ph != null;
+ }
+
+ public Hyperlink getHyperlink() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setHyperlink(Hyperlink hyperlink) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Guide getAdjustValue(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public org.apache.poi.sl.usermodel.LineDecoration getLineDecoration() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
}
Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java Sat Feb 21 10:56:03 2015
@@ -16,29 +16,31 @@
==================================================================== */
package org.apache.poi.xslf.usermodel;
+import java.awt.Graphics2D;
+import java.io.IOException;
+
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
+import org.apache.poi.sl.usermodel.Notes;
+import org.apache.poi.sl.usermodel.Slide;
import org.apache.poi.util.Beta;
import org.apache.xmlbeans.XmlException;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTBlip;
import org.openxmlformats.schemas.drawingml.x2006.main.CTGroupShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.main.CTGroupTransform2D;
import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps;
import org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D;
import org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTBlip;
+import org.openxmlformats.schemas.presentationml.x2006.main.CTBackground;
import org.openxmlformats.schemas.presentationml.x2006.main.CTCommonSlideData;
import org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape;
import org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShapeNonVisual;
import org.openxmlformats.schemas.presentationml.x2006.main.CTSlide;
import org.openxmlformats.schemas.presentationml.x2006.main.SldDocument;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTBackground;
-
-import java.awt.Graphics2D;
-import java.io.IOException;
@Beta
-public final class XSLFSlide extends XSLFSheet {
+public final class XSLFSlide extends XSLFSheet implements Slide {
private final CTSlide _slide;
private XSLFSlideLayout _layout;
private XSLFComments _comments;
@@ -111,7 +113,6 @@ public final class XSLFSlide extends XSL
return "sld";
}
- @Override
public XSLFSlideLayout getMasterSheet(){
return getSlideLayout();
}
@@ -211,6 +212,15 @@ public final class XSLFSlide extends XSL
}
+ public boolean getFollowMasterObjects() {
+ return getFollowMasterGraphics();
+ }
+
+ public void setFollowMasterObjects(boolean follow) {
+ setFollowMasterGraphics(follow);
+ }
+
+
@Override
public void draw(Graphics2D graphics){
@@ -239,4 +249,26 @@ public final class XSLFSlide extends XSL
return this;
}
+ public boolean getFollowMasterBackground() {
+ return false;
+ }
+
+ public void setFollowMasterBackground(boolean follow) {
+ // not implemented ... also not in the specs
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean getFollowMasterColourScheme() {
+ return false;
+ }
+
+ public void setFollowMasterColourScheme(boolean follow) {
+ // not implemented ... only for OLE objects in the specs
+ throw new UnsupportedOperationException();
+ }
+
+ public void setNotes(Notes<XSLFShape> notes) {
+ // TODO Auto-generated method stub
+
+ }
}
Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideLayout.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideLayout.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideLayout.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideLayout.java Sat Feb 21 10:56:03 2015
@@ -19,6 +19,7 @@ package org.apache.poi.xslf.usermodel;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
+import org.apache.poi.sl.usermodel.MasterSheet;
import org.apache.poi.util.Beta;
import org.apache.poi.util.Internal;
import org.apache.xmlbeans.XmlException;
@@ -30,7 +31,7 @@ import org.openxmlformats.schemas.presen
import java.io.IOException;
@Beta
-public class XSLFSlideLayout extends XSLFSheet {
+public class XSLFSlideLayout extends XSLFSheet implements MasterSheet {
private CTSlideLayout _layout;
private XSLFSlideMaster _master;
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=1661322&r1=1661321&r2=1661322&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 Sat Feb 21 10:56:03 2015
@@ -19,6 +19,7 @@ package org.apache.poi.xslf.usermodel;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
+import org.apache.poi.sl.usermodel.MasterSheet;
import org.apache.poi.util.Beta;
import org.apache.xmlbeans.XmlException;
import org.openxmlformats.schemas.drawingml.x2006.main.CTColorMapping;
@@ -53,7 +54,7 @@ import java.util.Map;
* @author Yegor Kozlov
*/
@Beta
- public class XSLFSlideMaster extends XSLFSheet {
+ public class XSLFSlideMaster extends XSLFSheet implements MasterSheet {
private CTSlideMaster _slide;
private Map<String, XSLFSlideLayout> _layouts;
private XSLFTheme _theme;
@@ -82,7 +83,7 @@ import java.util.Map;
}
@Override
- public XSLFSheet getMasterSheet() {
+ public MasterSheet getMasterSheet() {
return null;
}
@@ -177,5 +178,4 @@ import java.util.Map;
return null;
}
}
-
}
\ No newline at end of file
Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java Sat Feb 21 10:56:03 2015
@@ -21,6 +21,7 @@ package org.apache.poi.xslf.usermodel;
import java.awt.Color;
+import org.apache.poi.sl.usermodel.VerticalAlignment;
import org.apache.poi.util.Units;
import org.openxmlformats.schemas.drawingml.x2006.main.CTLineEndProperties;
import org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties;
Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java Sat Feb 21 10:56:03 2015
@@ -18,42 +18,14 @@ package org.apache.poi.xslf.usermodel;
import java.awt.Color;
import java.awt.Graphics2D;
-import java.awt.font.LineBreakMeasurer;
-import java.awt.font.TextAttribute;
-import java.awt.font.TextLayout;
import java.awt.geom.Rectangle2D;
-import java.text.AttributedCharacterIterator;
-import java.text.AttributedString;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.poi.hslf.model.TextPainter;
-import org.apache.poi.util.Beta;
-import org.apache.poi.util.Internal;
-import org.apache.poi.util.Units;
+import java.util.*;
+
+import org.apache.poi.sl.usermodel.TextParagraph;
+import org.apache.poi.util.*;
import org.apache.poi.xslf.model.ParagraphPropertyFetcher;
import org.apache.xmlbeans.XmlObject;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTColor;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTRegularTextRun;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTextAutonumberBullet;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBulletSizePercent;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBulletSizePoint;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharBullet;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTextField;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTextFont;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTextLineBreak;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTextNormalAutofit;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTextSpacing;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTextTabStop;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTextTabStopList;
-import org.openxmlformats.schemas.drawingml.x2006.main.STTextAlignType;
-import org.openxmlformats.schemas.drawingml.x2006.main.STTextAutonumberScheme;
+import org.openxmlformats.schemas.drawingml.x2006.main.*;
import org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder;
import org.openxmlformats.schemas.presentationml.x2006.main.STPlaceholderType;
@@ -65,16 +37,10 @@ import org.openxmlformats.schemas.presen
* @since POI-3.8
*/
@Beta
-public class XSLFTextParagraph implements Iterable<XSLFTextRun>{
+public class XSLFTextParagraph implements TextParagraph {
private final CTTextParagraph _p;
private final List<XSLFTextRun> _runs;
private final XSLFTextShape _shape;
- private List<TextFragment> _lines;
- private TextFragment _bullet;
- /**
- * the highest line in this paragraph. Used for line spacing.
- */
- private double _maxLineHeight;
XSLFTextParagraph(CTTextParagraph p, XSLFTextShape shape){
_p = p;
@@ -122,7 +88,7 @@ public class XSLFTextParagraph implement
return _p;
}
- XSLFTextShape getParentShape() {
+ public XSLFTextShape getParentShape() {
return _shape;
}
@@ -194,7 +160,7 @@ public class XSLFTextParagraph implement
/**
* Specifies the alignment that is to be applied to the paragraph.
* Possible values for this include left, right, centered, justified and distributed,
- * see {@link org.apache.poi.xslf.usermodel.TextAlign}.
+ * see {@link org.apache.poi.sl.usermodel.TextAlign}.
*
* @param align text align
*/
@@ -410,6 +376,26 @@ public class XSLFTextParagraph implement
/**
*
+ * @return the right margin of the paragraph
+ */
+ public double getRightMargin(){
+ ParagraphPropertyFetcher<Double> fetcher = new ParagraphPropertyFetcher<Double>(getLevel()){
+ public boolean fetch(CTTextParagraphProperties props){
+ if(props.isSetMarR()){
+ double val = Units.toPoints(props.getMarR());
+ setValue(val);
+ return true;
+ }
+ return false;
+ }
+ };
+ fetchParagraphProperty(fetcher);
+ // if the marL attribute is omitted, then a value of 347663 is implied
+ return fetcher.getValue() == null ? 0 : fetcher.getValue();
+ }
+
+ /**
+ *
* @return the default size for a tab character within this paragraph in points
*/
public double getDefaultTabSize(){
@@ -711,10 +697,6 @@ public class XSLFTextParagraph implement
return "[" + getClass() + "]" + getText();
}
- List<TextFragment> getTextLines(){
- return _lines;
- }
-
/**
* Returns wrapping width to break lines in this paragraph
*
@@ -754,244 +736,6 @@ public class XSLFTextParagraph implement
return width;
}
- public double draw(Graphics2D graphics, double x, double y){
- double leftInset = _shape.getLeftInset();
- double rightInset = _shape.getRightInset();
- RenderableShape rShape = new RenderableShape(_shape);
- Rectangle2D anchor = rShape.getAnchor(graphics);
- double penY = y;
-
- double leftMargin = getLeftMargin();
- boolean firstLine = true;
- double indent = getIndent();
-
- //The vertical line spacing
- double spacing = getLineSpacing();
- for(TextFragment line : _lines){
- double penX = x + leftMargin;
-
- if(firstLine) {
- if(_bullet != null){
- if(indent < 0) {
- // a negative value means "Hanging" indentation and
- // indicates the position of the actual bullet character.
- // (the bullet is shifted to right relative to the text)
- _bullet.draw(graphics, penX + indent, penY);
- } else if(indent > 0){
- // a positive value means the "First Line" indentation:
- // the first line is indented and other lines start at the bullet ofset
- _bullet.draw(graphics, penX, penY);
- penX += indent;
- } else {
- // a zero indent means that the bullet and text have the same offset
- _bullet.draw(graphics, penX, penY);
-
- // don't let text overlay the bullet and advance by the bullet width
- penX += _bullet._layout.getAdvance() + 1;
- }
- } else {
- penX += indent;
- }
- }
-
-
- switch (getTextAlign()) {
- case CENTER:
- penX += (anchor.getWidth() - leftMargin - line.getWidth() - leftInset - rightInset) / 2;
- break;
- case RIGHT:
- penX += (anchor.getWidth() - line.getWidth() - leftInset - rightInset);
- break;
- default:
- break;
- }
-
- line.draw(graphics, penX, penY);
-
- if(spacing > 0) {
- // If linespacing >= 0, then linespacing is a percentage of normal line height.
- penY += spacing*0.01* line.getHeight();
- } else {
- // positive value means absolute spacing in points
- penY += -spacing;
- }
-
- firstLine = false;
- }
-
- return penY - y;
- }
-
- AttributedString getAttributedString(Graphics2D graphics){
-
- String text = getRenderableText();
-
- AttributedString string = new AttributedString(text);
-
- XSLFFontManager fontHandler = (XSLFFontManager)graphics.getRenderingHint(XSLFRenderingHint.FONT_HANDLER);
-
- int startIndex = 0;
- for (XSLFTextRun run : _runs){
- int length = run.getRenderableText().length();
- if(length == 0) {
- // skip empty runs
- continue;
- }
- int endIndex = startIndex + length;
-
- string.addAttribute(TextAttribute.FOREGROUND, run.getFontColor(), startIndex, endIndex);
-
- // user can pass an custom object to convert fonts
- String fontFamily = run.getFontFamily();
- @SuppressWarnings("unchecked")
- Map<String,String> fontMap = (Map<String,String>)graphics.getRenderingHint(TextPainter.KEY_FONTMAP);
- if (fontMap != null && fontMap.containsKey(fontFamily)) {
- fontFamily = fontMap.get(fontFamily);
- }
- if(fontHandler != null) {
- fontFamily = fontHandler.getRendererableFont(fontFamily, run.getPitchAndFamily());
- }
- string.addAttribute(TextAttribute.FAMILY, fontFamily, startIndex, endIndex);
-
- float fontSz = (float)run.getFontSize();
- string.addAttribute(TextAttribute.SIZE, fontSz , startIndex, endIndex);
-
- if(run.isBold()) {
- string.addAttribute(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD, startIndex, endIndex);
- }
- if(run.isItalic()) {
- string.addAttribute(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE, startIndex, endIndex);
- }
- if(run.isUnderline()) {
- string.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON, startIndex, endIndex);
- string.addAttribute(TextAttribute.INPUT_METHOD_UNDERLINE, TextAttribute.UNDERLINE_LOW_TWO_PIXEL, startIndex, endIndex);
- }
- if(run.isStrikethrough()) {
- string.addAttribute(TextAttribute.STRIKETHROUGH, TextAttribute.STRIKETHROUGH_ON, startIndex, endIndex);
- }
- if(run.isSubscript()) {
- string.addAttribute(TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUB, startIndex, endIndex);
- }
- if(run.isSuperscript()) {
- string.addAttribute(TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUPER, startIndex, endIndex);
- }
-
-
- startIndex = endIndex;
- }
-
- return string;
- }
-
- /**
- * ensure that the paragraph contains at least one character.
- * We need this trick to correctly measure text
- */
- private void ensureNotEmpty(){
- XSLFTextRun r = addNewTextRun();
- r.setText(" ");
- CTTextCharacterProperties endPr = _p.getEndParaRPr();
- if(endPr != null) {
- if(endPr.isSetSz()) r.setFontSize(endPr.getSz() / 100);
- }
- }
-
- /**
- * break text into lines
- *
- * @param graphics
- * @return array of text fragments,
- * each representing a line of text that fits in the wrapping width
- */
- List<TextFragment> breakText(Graphics2D graphics){
- _lines = new ArrayList<TextFragment>();
-
- // does this paragraph contain text?
- boolean emptyParagraph = _runs.size() == 0;
-
- // ensure that the paragraph contains at least one character
- if(_runs.size() == 0) ensureNotEmpty();
-
- String text = getRenderableText();
- if(text.length() == 0) return _lines;
-
- AttributedString at = getAttributedString(graphics);
- AttributedCharacterIterator it = at.getIterator();
- LineBreakMeasurer measurer = new LineBreakMeasurer(it, graphics.getFontRenderContext()) ;
- for (;;) {
- int startIndex = measurer.getPosition();
-
- double wrappingWidth = getWrappingWidth(_lines.size() == 0, graphics) + 1; // add a pixel to compensate rounding errors
- // shape width can be smaller that the sum of insets (this was proved by a test file)
- if(wrappingWidth < 0) wrappingWidth = 1;
-
- int nextBreak = text.indexOf('\n', startIndex + 1);
- if(nextBreak == -1) nextBreak = it.getEndIndex();
-
- TextLayout layout = measurer.nextLayout((float)wrappingWidth, nextBreak, true);
- if (layout == null) {
- // layout can be null if the entire word at the current position
- // does not fit within the wrapping width. Try with requireNextWord=false.
- layout = measurer.nextLayout((float)wrappingWidth, nextBreak, false);
- }
-
- if(layout == null) {
- // exit if can't break any more
- break;
- }
-
- int endIndex = measurer.getPosition();
- // skip over new line breaks (we paint 'clear' text runs not starting or ending with \n)
- if(endIndex < it.getEndIndex() && text.charAt(endIndex) == '\n'){
- measurer.setPosition(endIndex + 1);
- }
-
- TextAlign hAlign = getTextAlign();
- if(hAlign == TextAlign.JUSTIFY || hAlign == TextAlign.JUSTIFY_LOW) {
- layout = layout.getJustifiedLayout((float)wrappingWidth);
- }
-
- AttributedString str = new AttributedString(it, startIndex, endIndex);
- TextFragment line = new TextFragment(
- layout, // we will not paint empty paragraphs
- emptyParagraph ? null : str);
- _lines.add(line);
-
- _maxLineHeight = Math.max(_maxLineHeight, line.getHeight());
-
- if(endIndex == it.getEndIndex()) break;
-
- }
-
- if(isBullet() && !emptyParagraph) {
- String buCharacter = getBulletCharacter();
- String buFont = getBulletFont();
- if(buFont == null) buFont = getTextRuns().get(0).getFontFamily();
- if(buCharacter != null && buFont != null && _lines.size() > 0) {
- AttributedString str = new AttributedString(buCharacter);
-
- TextFragment firstLine = _lines.get(0);
- AttributedCharacterIterator bit = firstLine._str.getIterator();
-
- Color buColor = getBulletFontColor();
- str.addAttribute(TextAttribute.FOREGROUND, buColor == null ?
- bit.getAttribute(TextAttribute.FOREGROUND) : buColor);
- str.addAttribute(TextAttribute.FAMILY, buFont);
-
- float fontSize = (Float)bit.getAttribute(TextAttribute.SIZE);
- float buSz = (float)getBulletFontSize();
- if(buSz > 0) fontSize *= buSz* 0.01;
- else fontSize = -buSz;
-
- str.addAttribute(TextAttribute.SIZE, fontSize);
-
- TextLayout layout = new TextLayout(str.getIterator(), graphics.getFontRenderContext());
- _bullet = new TextFragment(layout, str);
- }
- }
- return _lines;
- }
-
CTTextParagraphProperties getDefaultMasterStyle(){
CTPlaceholder ph = _shape.getCTPlaceholder();
String defaultStyleSelector;
@@ -1017,7 +761,7 @@ public class XSLFTextParagraph implement
// wind up and find the root master sheet which must be slide master
XSLFSheet masterSheet = _shape.getSheet();
while (masterSheet.getMasterSheet() != null){
- masterSheet = masterSheet.getMasterSheet();
+ masterSheet = (XSLFSheet)masterSheet.getMasterSheet();
}
XmlObject[] o = masterSheet.getXmlObject().selectPath(
@@ -1130,4 +874,32 @@ public class XSLFTextParagraph implement
}
}
+ public double getDefaultFontSize() {
+ CTTextCharacterProperties endPr = _p.getEndParaRPr();
+ return (endPr == null || !endPr.isSetSz()) ? 12 : (endPr.getSz() / 100);
+ }
+
+ public String getDefaultFontFamily() {
+ return (_runs.isEmpty() ? "Arial" : _runs.get(0).getFontFamily());
+ }
+
+ public BulletStyle getBulletStyle() {
+ return new BulletStyle(){
+ public String getBulletCharacter() {
+ return XSLFTextParagraph.this.getBulletCharacter();
+ }
+
+ public String getBulletFont() {
+ return XSLFTextParagraph.this.getBulletFont();
+ }
+
+ public double getBulletFontSize() {
+ return XSLFTextParagraph.this.getBulletFontSize();
+ }
+
+ public Color getBulletFontColor() {
+ return XSLFTextParagraph.this.getBulletFontColor();
+ }
+ };
+ }
}
Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java Sat Feb 21 10:56:03 2015
@@ -22,6 +22,7 @@ import java.awt.font.TextAttribute;
import java.awt.font.TextLayout;
import java.text.AttributedString;
+import org.apache.poi.sl.usermodel.TextRun;
import org.apache.poi.util.Beta;
import org.apache.poi.xslf.model.CharacterPropertyFetcher;
import org.openxmlformats.schemas.drawingml.x2006.main.CTRegularTextRun;
@@ -45,7 +46,7 @@ import org.openxmlformats.schemas.presen
* @author Yegor Kozlov
*/
@Beta
-public class XSLFTextRun {
+public class XSLFTextRun implements TextRun {
private final CTRegularTextRun _r;
private final XSLFTextParagraph _p;
Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java Sat Feb 21 10:56:03 2015
@@ -23,26 +23,20 @@ import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
import org.apache.poi.POIXMLException;
+import org.apache.poi.sl.draw.DrawFactory;
+import org.apache.poi.sl.draw.geom.Guide;
+import org.apache.poi.sl.usermodel.*;
+import org.apache.poi.sl.usermodel.LineDecoration;
import org.apache.poi.util.Beta;
import org.apache.poi.util.Units;
import org.apache.poi.xslf.model.PropertyFetcher;
import org.apache.poi.xslf.model.TextBodyPropertyFetcher;
import org.apache.xmlbeans.XmlObject;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBodyProperties;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph;
-import org.openxmlformats.schemas.drawingml.x2006.main.STTextAnchoringType;
-import org.openxmlformats.schemas.drawingml.x2006.main.STTextVerticalType;
-import org.openxmlformats.schemas.drawingml.x2006.main.STTextWrappingType;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTApplicationNonVisualDrawingProps;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTShape;
-import org.openxmlformats.schemas.presentationml.x2006.main.STPlaceholderType;
+import org.openxmlformats.schemas.drawingml.x2006.main.*;
+import org.openxmlformats.schemas.presentationml.x2006.main.*;
/**
* Represents a shape that can hold text.
@@ -50,7 +44,7 @@ import org.openxmlformats.schemas.presen
* @author Yegor Kozlov
*/
@Beta
-public abstract class XSLFTextShape extends XSLFSimpleShape implements Iterable<XSLFTextParagraph>{
+public abstract class XSLFTextShape extends XSLFSimpleShape implements TextShape {
private final List<XSLFTextParagraph> _paragraphs;
/**
@@ -338,7 +332,13 @@ public abstract class XSLFTextShape exte
}
}
-
+ @Override
+ public Insets2D getInsets() {
+ Insets2D insets = new Insets2D(getTopInset(), getLeftInset(), getBottomInset(), getRightInset());
+ return insets;
+ }
+
+
/**
* @return whether to wrap words within the bounding rectangle
*/
@@ -453,6 +453,9 @@ public abstract class XSLFTextShape exte
// dry-run in a 1x1 image and return the vertical advance
BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = img.createGraphics();
+ DrawFactory fact = DrawFactory.getInstance(graphics);
+ fact.getDrawable(this);
+
breakText(graphics);
return drawParagraphs(graphics, 0, 0);
}
@@ -475,121 +478,6 @@ public abstract class XSLFTextShape exte
return anchor;
}
- /**
- * break the contained text into lines
- */
- private void breakText(Graphics2D graphics){
- if(!_isTextBroken) {
- for(XSLFTextParagraph p : _paragraphs) p.breakText(graphics);
-
- _isTextBroken = true;
- }
- }
-
- @Override
- public void drawContent(Graphics2D graphics) {
- breakText(graphics);
-
- RenderableShape rShape = new RenderableShape(this);
- Rectangle2D anchor = rShape.getAnchor(graphics);
- double x = anchor.getX() + getLeftInset();
- double y = anchor.getY();
-
- // remember the initial transform
- AffineTransform tx = graphics.getTransform();
-
- // Transform of text in flipped shapes is special.
- // At this point the flip and rotation transform is already applied
- // (see XSLFShape#applyTransform ), but we need to restore it to avoid painting "upside down".
- // See Bugzilla 54210.
-
- if(getFlipVertical()){
- graphics.translate(anchor.getX(), anchor.getY() + anchor.getHeight());
- graphics.scale(1, -1);
- graphics.translate(-anchor.getX(), -anchor.getY());
-
- // text in vertically flipped shapes is rotated by 180 degrees
- double centerX = anchor.getX() + anchor.getWidth()/2;
- double centerY = anchor.getY() + anchor.getHeight()/2;
- graphics.translate(centerX, centerY);
- graphics.rotate(Math.toRadians(180));
- graphics.translate(-centerX, -centerY);
- }
-
- // Horizontal flipping applies only to shape outline and not to the text in the shape.
- // Applying flip second time restores the original not-flipped transform
- if(getFlipHorizontal()){
- graphics.translate(anchor.getX() + anchor.getWidth(), anchor.getY());
- graphics.scale(-1, 1);
- graphics.translate(-anchor.getX() , -anchor.getY());
- }
-
-
- // first dry-run to calculate the total height of the text
- double textHeight = getTextHeight();
-
- switch (getVerticalAlignment()){
- case TOP:
- y += getTopInset();
- break;
- case BOTTOM:
- y += anchor.getHeight() - textHeight - getBottomInset();
- break;
- default:
- case MIDDLE:
- double delta = anchor.getHeight() - textHeight -
- getTopInset() - getBottomInset();
- y += getTopInset() + delta/2;
- break;
- }
-
- drawParagraphs(graphics, x, y);
-
- // restore the transform
- graphics.setTransform(tx);
- }
-
-
- /**
- * paint the paragraphs starting from top left (x,y)
- *
- * @return the vertical advance, i.e. the cumulative space occupied by the text
- */
- private double drawParagraphs(Graphics2D graphics, double x, double y) {
- double y0 = y;
- for(int i = 0; i < _paragraphs.size(); i++){
- XSLFTextParagraph p = _paragraphs.get(i);
- List<TextFragment> lines = p.getTextLines();
-
- if(i > 0 && lines.size() > 0) {
- // the amount of vertical white space before the paragraph
- double spaceBefore = p.getSpaceBefore();
- if(spaceBefore > 0) {
- // positive value means percentage spacing of the height of the first line, e.g.
- // the higher the first line, the bigger the space before the paragraph
- y += spaceBefore*0.01*lines.get(0).getHeight();
- } else {
- // negative value means the absolute spacing in points
- y += -spaceBefore;
- }
- }
-
- y += p.draw(graphics, x, y);
-
- if(i < _paragraphs.size() - 1) {
- double spaceAfter = p.getSpaceAfter();
- if(spaceAfter > 0) {
- // positive value means percentage spacing of the height of the last line, e.g.
- // the higher the last line, the bigger the space after the paragraph
- y += spaceAfter*0.01*lines.get(lines.size() - 1).getHeight();
- } else {
- // negative value means the absolute spacing in points
- y += -spaceAfter;
- }
- }
- }
- return y - y0;
- }
@Override
void copy(XSLFShape sh){
@@ -633,4 +521,19 @@ public abstract class XSLFTextShape exte
}
}
+
+ public LineDecoration getLineDecoration() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public FillStyle getFillStyle() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Guide getAdjustValue(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
\ No newline at end of file
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=1661322&r1=1661321&r2=1661322&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 Sat Feb 21 10:56:03 2015
@@ -17,6 +17,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.util.Units;
import org.openxmlformats.schemas.drawingml.x2006.main.STTextStrikeType;
import org.openxmlformats.schemas.drawingml.x2006.main.STTextUnderlineType;
@@ -270,12 +274,12 @@ public class TestXSLFAutoShape extends T
XSLFSlide slide = ppt.createSlide();
XSLFAutoShape shape = slide.createAutoShape();
- assertEquals(XSLFShapeType.RECT, shape.getShapeType());
+ assertEquals(ShapeType.RECT, shape.getShapeType());
- shape.setShapeType(XSLFShapeType.TRIANGLE);
- assertEquals(XSLFShapeType.TRIANGLE, shape.getShapeType());
+ shape.setShapeType(ShapeType.TRIANGLE);
+ assertEquals(ShapeType.TRIANGLE, shape.getShapeType());
- for(XSLFShapeType tp : XSLFShapeType.values()) {
+ for(ShapeType tp : ShapeType.values()) {
shape.setShapeType(tp);
assertEquals(tp, shape.getShapeType());
}
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=1661322&r1=1661321&r2=1661322&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 Sat Feb 21 10:56:03 2015
@@ -17,6 +17,8 @@
package org.apache.poi.xslf.usermodel;
import junit.framework.TestCase;
+
+import org.apache.poi.sl.usermodel.ShapeType;
import org.openxmlformats.schemas.drawingml.x2006.main.*;
import org.openxmlformats.schemas.presentationml.x2006.main.CTConnector;
@@ -112,12 +114,12 @@ public class TestXSLFConnectorShape exte
XSLFSlide slide = pptx.createSlide();
XSLFAutoShape rect1 = slide.createAutoShape();
- rect1.setShapeType(XSLFShapeType.RECT);
+ rect1.setShapeType(ShapeType.RECT);
rect1.setAnchor(new Rectangle(100, 100, 100, 100));
rect1.setFillColor(Color.blue);
XSLFAutoShape rect2 = slide.createAutoShape();
- rect2.setShapeType(XSLFShapeType.RECT);
+ rect2.setShapeType(ShapeType.RECT);
rect2.setAnchor(new Rectangle(300, 300, 100, 100));
rect2.setFillColor(Color.red);
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=1661322&r1=1661321&r2=1661322&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 Sat Feb 21 10:56:03 2015
@@ -20,6 +20,8 @@ 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.util.Units;
import org.apache.poi.xslf.XSLFTestDataSamples;
import org.openxmlformats.schemas.drawingml.x2006.main.CTEffectStyleItem;
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=1661322&r1=1661321&r2=1661322&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 Sat Feb 21 10:56:03 2015
@@ -17,6 +17,8 @@
package org.apache.poi.xslf.usermodel;
import junit.framework.TestCase;
+
+import org.apache.poi.sl.usermodel.VerticalAlignment;
import org.apache.poi.xslf.XSLFTestDataSamples;
import org.openxmlformats.schemas.presentationml.x2006.main.CTGraphicalObjectFrame;
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=1661322&r1=1661321&r2=1661322&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 Sat Feb 21 10:56:03 2015
@@ -17,6 +17,9 @@
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;
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=1661322&r1=1661321&r2=1661322&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 Sat Feb 21 10:56:03 2015
@@ -17,6 +17,9 @@
package org.apache.poi.xslf.usermodel;
import junit.framework.TestCase;
+
+import org.apache.poi.sl.usermodel.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;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org