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/08/25 01:15:16 UTC
svn commit: r1697515 [2/3] - in /poi/trunk/src:
integrationtest/org/apache/poi/stress/ java/org/apache/poi/ddf/
java/org/apache/poi/sl/draw/ java/org/apache/poi/sl/usermodel/
ooxml/java/org/apache/poi/xslf/usermodel/
ooxml/java/org/apache/poi/xslf/util...
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFNotes.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFNotes.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFNotes.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFNotes.java Mon Aug 24 23:15:14 2015
@@ -31,7 +31,8 @@ import org.openxmlformats.schemas.presen
import org.openxmlformats.schemas.presentationml.x2006.main.NotesDocument;
@Beta
-public final class XSLFNotes extends XSLFSheet implements Notes<XSLFShape,XMLSlideShow> {
+public final class XSLFNotes extends XSLFSheet
+implements Notes<XSLFShape,XSLFTextParagraph> {
private CTNotesSlide _notes;
/**
@@ -83,6 +84,7 @@ public final class XSLFNotes extends XSL
return getMasterSheet().getTheme();
}
+ @Override
public XSLFNotesMaster getMasterSheet() {
for (POIXMLDocumentPart p : getRelations()) {
if (p instanceof XSLFNotesMaster){
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFNotesMaster.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFNotesMaster.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFNotesMaster.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFNotesMaster.java Mon Aug 24 23:15:14 2015
@@ -47,7 +47,8 @@ import org.openxmlformats.schemas.presen
* @author Yegor Kozlov
*/
@Beta
- public class XSLFNotesMaster extends XSLFSheet implements MasterSheet<XSLFShape,XMLSlideShow> {
+ public class XSLFNotesMaster extends XSLFSheet
+ implements MasterSheet<XSLFShape,XSLFTextParagraph> {
private CTNotesMaster _slide;
private XSLFTheme _theme;
@@ -94,7 +95,7 @@ import org.openxmlformats.schemas.presen
}
@Override
- public MasterSheet<XSLFShape,XMLSlideShow> getMasterSheet() {
+ public MasterSheet<XSLFShape,XSLFTextParagraph> getMasterSheet() {
return null;
}
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java Mon Aug 24 23:15:14 2015
@@ -51,7 +51,8 @@ import org.openxmlformats.schemas.presen
* Represents a picture shape
*/
@Beta
-public class XSLFPictureShape extends XSLFSimpleShape implements PictureShape {
+public class XSLFPictureShape extends XSLFSimpleShape
+ implements PictureShape<XSLFShape,XSLFTextParagraph> {
private XSLFPictureData _data;
/*package*/ XSLFPictureShape(CTPicture shape, XSLFSheet sheet) {
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java Mon Aug 24 23:15:14 2015
@@ -65,7 +65,7 @@ import org.openxmlformats.schemas.presen
* @author Yegor Kozlov
*/
@Beta
-public abstract class XSLFShape implements Shape {
+public abstract class XSLFShape implements Shape<XSLFShape,XSLFTextParagraph> {
private final XmlObject _shape;
private final XSLFSheet _sheet;
private XSLFShapeContainer _parent;
@@ -130,8 +130,8 @@ public abstract class XSLFShape implemen
}
if (this instanceof PlaceableShape) {
- PlaceableShape ps = (PlaceableShape)this;
- ps.setAnchor(((PlaceableShape)sh).getAnchor());
+ PlaceableShape<?,?> ps = (PlaceableShape<?,?>)this;
+ ps.setAnchor(((PlaceableShape<?,?>)sh).getAnchor());
}
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShapeContainer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShapeContainer.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShapeContainer.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShapeContainer.java Mon Aug 24 23:15:14 2015
@@ -19,43 +19,32 @@
package org.apache.poi.xslf.usermodel;
+import org.apache.poi.sl.usermodel.PictureData;
import org.apache.poi.sl.usermodel.ShapeContainer;
/**
* Common interface for shape containers, e.g. sheets or groups of shapes
*/
-public interface XSLFShapeContainer extends ShapeContainer<XSLFShape> {
+public interface XSLFShapeContainer
+ extends ShapeContainer<XSLFShape,XSLFTextParagraph> {
- /**
- * create a new shape with a predefined geometry and add it to this shape container
- */
+ @Override
XSLFAutoShape createAutoShape();
- /**
- * create a new shape with a custom geometry
- */
+ @Override
XSLFFreeformShape createFreeform();
- /**
- * create a text box
- */
+ @Override
XSLFTextBox createTextBox();
- /**
- *
- * create a connector
- */
+ @Override
XSLFConnectorShape createConnector();
- /**
- * create a group of shapes belonging to this container
- */
+ @Override
XSLFGroupShape createGroup();
- /**
- * create a picture belonging to this container
- */
- XSLFPictureShape createPicture(XSLFPictureData pictureData);
+ @Override
+ XSLFPictureShape createPicture(PictureData pictureData);
/**
* Removes all of the elements from this container (optional operation).
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java Mon Aug 24 23:15:14 2015
@@ -37,6 +37,7 @@ import org.apache.poi.openxml4j.opc.Pack
import org.apache.poi.openxml4j.opc.TargetMode;
import org.apache.poi.sl.draw.DrawFactory;
import org.apache.poi.sl.draw.Drawable;
+import org.apache.poi.sl.usermodel.PictureData;
import org.apache.poi.sl.usermodel.Sheet;
import org.apache.poi.util.Beta;
import org.apache.poi.util.IOUtils;
@@ -53,7 +54,8 @@ import org.openxmlformats.schemas.presen
import org.openxmlformats.schemas.presentationml.x2006.main.CTShape;
@Beta
-public abstract class XSLFSheet extends POIXMLDocumentPart implements XSLFShapeContainer, Sheet<XSLFShape, XMLSlideShow> {
+public abstract class XSLFSheet extends POIXMLDocumentPart
+implements XSLFShapeContainer, Sheet<XSLFShape,XSLFTextParagraph> {
private XSLFCommonSlideData _commonSlideData;
private XSLFDrawing _drawing;
private List<XSLFShape> _shapes;
@@ -72,9 +74,9 @@ public abstract class XSLFSheet extends
}
/**
- *
* @return the XMLSlideShow this sheet belongs to
*/
+ @Override
public XMLSlideShow getSlideShow() {
POIXMLDocumentPart p = getParent();
while(p != null) {
@@ -158,6 +160,7 @@ public abstract class XSLFSheet extends
// shape factory methods
+ @Override
public XSLFAutoShape createAutoShape(){
XSLFAutoShape sh = getDrawing().createAutoShape();
getShapes().add(sh);
@@ -165,6 +168,7 @@ public abstract class XSLFSheet extends
return sh;
}
+ @Override
public XSLFFreeformShape createFreeform(){
XSLFFreeformShape sh = getDrawing().createFreeform();
getShapes().add(sh);
@@ -172,6 +176,7 @@ public abstract class XSLFSheet extends
return sh;
}
+ @Override
public XSLFTextBox createTextBox(){
XSLFTextBox sh = getDrawing().createTextBox();
getShapes().add(sh);
@@ -179,6 +184,7 @@ public abstract class XSLFSheet extends
return sh;
}
+ @Override
public XSLFConnectorShape createConnector(){
XSLFConnectorShape sh = getDrawing().createConnector();
getShapes().add(sh);
@@ -186,6 +192,7 @@ public abstract class XSLFSheet extends
return sh;
}
+ @Override
public XSLFGroupShape createGroup(){
XSLFGroupShape sh = getDrawing().createGroup();
getShapes().add(sh);
@@ -193,8 +200,13 @@ public abstract class XSLFSheet extends
return sh;
}
- public XSLFPictureShape createPicture(XSLFPictureData pictureData){
- PackagePart pic = pictureData.getPackagePart();
+ @Override
+ public XSLFPictureShape createPicture(PictureData pictureData){
+ if (!(pictureData instanceof XSLFPictureData)) {
+ throw new IllegalArgumentException("pictureData needs to be of type XSLFPictureData");
+ }
+ XSLFPictureData xPictureData = (XSLFPictureData)pictureData;
+ PackagePart pic = xPictureData.getPackagePart();
PackageRelationship rel = getPackagePart().addRelationship(
pic.getPartName(), TargetMode.INTERNAL, XSLFRelation.IMAGES.getRelation());
@@ -214,6 +226,24 @@ public abstract class XSLFSheet extends
return sh;
}
+ @Override
+ public XSLFTable createTable(int numRows, int numCols){
+ if (numRows < 1 || numCols < 1) {
+ throw new IllegalArgumentException("numRows and numCols must be greater than 0");
+ }
+ XSLFTable sh = getDrawing().createTable();
+ getShapes().add(sh);
+ sh.setParent(this);
+ for (int r=0; r<numRows; r++) {
+ XSLFTableRow row = sh.addRow();
+ for (int c=0; c<numCols; c++) {
+ row.addCell();
+ }
+ }
+ return sh;
+ }
+
+
/**
* Returns an iterator over the shapes in this sheet
*
@@ -481,9 +511,9 @@ public abstract class XSLFSheet extends
}
/**
- *
* @return background for this sheet
*/
+ @Override
public XSLFBackground getBackground() {
return null;
}
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java Mon Aug 24 23:15:14 2015
@@ -54,7 +54,8 @@ import org.openxmlformats.schemas.presen
* @author Yegor Kozlov
*/
@Beta
-public abstract class XSLFSimpleShape extends XSLFShape implements SimpleShape {
+public abstract class XSLFSimpleShape extends XSLFShape
+ implements SimpleShape<XSLFShape,XSLFTextParagraph> {
private static CTOuterShadowEffect NO_SHADOW = CTOuterShadowEffect.Factory.newInstance();
/* package */XSLFSimpleShape(XmlObject shape, XSLFSheet sheet) {
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java Mon Aug 24 23:15:14 2015
@@ -24,6 +24,7 @@ import org.apache.poi.openxml4j.opc.Pack
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.sl.draw.DrawFactory;
import org.apache.poi.sl.draw.Drawable;
+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;
@@ -41,7 +42,8 @@ import org.openxmlformats.schemas.presen
import org.openxmlformats.schemas.presentationml.x2006.main.SldDocument;
@Beta
-public final class XSLFSlide extends XSLFSheet implements Slide<XSLFShape, XMLSlideShow, XSLFNotes> {
+public final class XSLFSlide extends XSLFSheet
+implements Slide<XSLFShape,XSLFTextParagraph> {
private final CTSlide _slide;
private XSLFSlideLayout _layout;
private XSLFComments _comments;
@@ -254,11 +256,12 @@ public final class XSLFSlide extends XSL
throw new UnsupportedOperationException();
}
- public void setNotes(XSLFNotes notes) {
+ @Override
+ public void setNotes(Notes<XSLFShape,XSLFTextParagraph> notes) {
+ assert(notes instanceof XSLFNotes);
// TODO Auto-generated method stub
-
}
-
+
@Override
public int getSlideNumber() {
int idx = getSlideShow().getSlides().indexOf(this);
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideLayout.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideLayout.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideLayout.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideLayout.java Mon Aug 24 23:15:14 2015
@@ -31,7 +31,8 @@ import org.openxmlformats.schemas.presen
import org.openxmlformats.schemas.presentationml.x2006.main.SldLayoutDocument;
@Beta
-public class XSLFSlideLayout extends XSLFSheet implements MasterSheet<XSLFShape, XMLSlideShow> {
+public class XSLFSlideLayout extends XSLFSheet
+implements MasterSheet<XSLFShape,XSLFTextParagraph> {
private CTSlideLayout _layout;
private XSLFSlideMaster _master;
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java Mon Aug 24 23:15:14 2015
@@ -54,7 +54,8 @@ import org.openxmlformats.schemas.presen
* @author Yegor Kozlov
*/
@Beta
- public class XSLFSlideMaster extends XSLFSheet implements MasterSheet<XSLFShape, XMLSlideShow> {
+ public class XSLFSlideMaster extends XSLFSheet
+ implements MasterSheet<XSLFShape,XSLFTextParagraph> {
private CTSlideMaster _slide;
private Map<String, XSLFSlideLayout> _layouts;
private XSLFTheme _theme;
@@ -83,7 +84,7 @@ import org.openxmlformats.schemas.presen
}
@Override
- public MasterSheet<XSLFShape, XMLSlideShow> getMasterSheet() {
+ public XSLFSlideMaster getMasterSheet() {
return null;
}
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java Mon Aug 24 23:15:14 2015
@@ -46,7 +46,8 @@ import org.openxmlformats.schemas.presen
*
* @author Yegor Kozlov
*/
-public class XSLFTable extends XSLFGraphicFrame implements Iterable<XSLFTableRow>, TableShape {
+public class XSLFTable extends XSLFGraphicFrame implements Iterable<XSLFTableRow>,
+ TableShape<XSLFShape,XSLFTextParagraph> {
static String TABLE_URI = "http://schemas.openxmlformats.org/drawingml/2006/table";
private CTTable _table;
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java Mon Aug 24 23:15:14 2015
@@ -21,14 +21,29 @@ package org.apache.poi.xslf.usermodel;
import java.awt.Color;
+import org.apache.poi.sl.usermodel.TableCell;
import org.apache.poi.sl.usermodel.VerticalAlignment;
import org.apache.poi.util.Units;
-import org.openxmlformats.schemas.drawingml.x2006.main.*;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTLineEndProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTableCell;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTableCellProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody;
+import org.openxmlformats.schemas.drawingml.x2006.main.STCompoundLine;
+import org.openxmlformats.schemas.drawingml.x2006.main.STLineCap;
+import org.openxmlformats.schemas.drawingml.x2006.main.STLineEndLength;
+import org.openxmlformats.schemas.drawingml.x2006.main.STLineEndType;
+import org.openxmlformats.schemas.drawingml.x2006.main.STLineEndWidth;
+import org.openxmlformats.schemas.drawingml.x2006.main.STPenAlignment;
+import org.openxmlformats.schemas.drawingml.x2006.main.STPresetLineDashVal;
+import org.openxmlformats.schemas.drawingml.x2006.main.STTextAnchoringType;
/**
* Represents a cell of a table in a .pptx presentation
*/
-public class XSLFTableCell extends XSLFTextShape {
+public class XSLFTableCell extends XSLFTextShape implements TableCell<XSLFShape,XSLFTextParagraph> {
static double defaultBorderWidth = 1.0;
private CTTableCellProperties _tcPr = null;
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextBox.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextBox.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextBox.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextBox.java Mon Aug 24 23:15:14 2015
@@ -19,6 +19,7 @@
package org.apache.poi.xslf.usermodel;
+import org.apache.poi.sl.usermodel.TextBox;
import org.apache.poi.util.Beta;
import org.openxmlformats.schemas.drawingml.x2006.main.*;
import org.openxmlformats.schemas.presentationml.x2006.main.CTShape;
@@ -29,7 +30,8 @@ import org.openxmlformats.schemas.presen
* @author Yegor Kozlov
*/
@Beta
-public class XSLFTextBox extends XSLFAutoShape {
+public class XSLFTextBox extends XSLFAutoShape
+ implements TextBox<XSLFShape,XSLFTextParagraph> {
/*package*/ XSLFTextBox(CTShape shape, XSLFSheet sheet){
super(shape, sheet);
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java Mon Aug 24 23:15:14 2015
@@ -44,7 +44,7 @@ import org.openxmlformats.schemas.presen
* @since POI-3.8
*/
@Beta
-public class XSLFTextParagraph implements TextParagraph<XSLFTextRun> {
+public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun> {
private final CTTextParagraph _p;
private final List<XSLFTextRun> _runs;
private final XSLFTextShape _shape;
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java Mon Aug 24 23:15:14 2015
@@ -48,7 +48,8 @@ import org.openxmlformats.schemas.presen
* Represents a shape that can hold text.
*/
@Beta
-public abstract class XSLFTextShape extends XSLFSimpleShape implements TextShape<XSLFTextParagraph> {
+public abstract class XSLFTextShape extends XSLFSimpleShape
+ implements TextShape<XSLFShape,XSLFTextParagraph> {
private final List<XSLFTextParagraph> _paragraphs;
@SuppressWarnings("deprecation")
@@ -96,10 +97,7 @@ public abstract class XSLFTextShape exte
addNewTextParagraph().addNewTextRun().setText(text);
}
- /**
- *
- * @return text paragraphs in this shape
- */
+ @Override
public List<XSLFTextParagraph> getTextParagraphs() {
return _paragraphs;
}
@@ -459,7 +457,7 @@ public abstract class XSLFTextShape exte
@Override
public double getTextHeight(){
DrawFactory drawFact = DrawFactory.getInstance(null);
- DrawTextShape<XSLFTextShape> dts = drawFact.getDrawable(this);
+ DrawTextShape dts = drawFact.getDrawable(this);
return dts.getTextHeight();
}
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/util/PPTX2PNG.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/util/PPTX2PNG.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/util/PPTX2PNG.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/util/PPTX2PNG.java Mon Aug 24 23:15:14 2015
@@ -116,8 +116,8 @@ public class PPTX2PNG {
if (!quite) {
System.out.println("Processing " + file);
}
- SlideShow ss = SlideShowFactory.create(file, null, true);
- List<? extends Slide<?,?,?>> slides = ss.getSlides();
+ SlideShow<?,?> ss = SlideShowFactory.create(file, null, true);
+ List<? extends Slide<?,?>> slides = ss.getSlides();
if (slidenum < -1 || slidenum == 0 || slidenum > slides.size()) {
@@ -130,7 +130,7 @@ public class PPTX2PNG {
int height = (int) (pgsize.height * scale);
int slideNo=1;
- for(Slide<?,?,?> slide : slides) {
+ for(Slide<?,?> slide : slides) {
if (slidenum == -1 || slideNo == slidenum) {
String title = slide.getTitle();
if (!quite) {
Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java Mon Aug 24 23:15:14 2015
@@ -44,7 +44,7 @@ import org.junit.Test;
public class TestXSLFTextParagraph {
// private static POILogger _logger = POILogFactory.getLogger(XSLFTextParagraph.class);
- static class DrawTextParagraphProxy extends DrawTextParagraph<XSLFTextRun> {
+ static class DrawTextParagraphProxy extends DrawTextParagraph {
DrawTextParagraphProxy(XSLFTextParagraph p) {
super(p);
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java Mon Aug 24 23:15:14 2015
@@ -20,10 +20,10 @@ package org.apache.poi.hslf.model;
import java.io.ByteArrayOutputStream;
import java.util.Iterator;
+import org.apache.poi.ddf.AbstractEscherOptRecord;
import org.apache.poi.ddf.EscherClientDataRecord;
import org.apache.poi.ddf.EscherComplexProperty;
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.EscherSpRecord;
@@ -34,7 +34,11 @@ import org.apache.poi.hslf.record.ExObjL
import org.apache.poi.hslf.record.OEShapeAtom;
import org.apache.poi.hslf.record.Record;
import org.apache.poi.hslf.record.RecordTypes;
-import org.apache.poi.hslf.usermodel.*;
+import org.apache.poi.hslf.usermodel.HSLFPictureData;
+import org.apache.poi.hslf.usermodel.HSLFPictureShape;
+import org.apache.poi.hslf.usermodel.HSLFShape;
+import org.apache.poi.hslf.usermodel.HSLFSheet;
+import org.apache.poi.hslf.usermodel.HSLFTextParagraph;
import org.apache.poi.sl.usermodel.ShapeContainer;
import org.apache.poi.sl.usermodel.ShapeType;
import org.apache.poi.util.LittleEndian;
@@ -66,7 +70,7 @@ public final class ActiveXShape extends
* this picture in the <code>Slide</code>
* @param parent the parent shape of this picture
*/
- protected ActiveXShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
+ protected ActiveXShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
super(escherRecord, parent);
}
@@ -172,7 +176,7 @@ public final class ActiveXShape extends
String name = ctrl.getProgId() + "-" + getControlIndex() + '\u0000';
byte[] data = StringUtil.getToUnicodeLE(name);
EscherComplexProperty prop = new EscherComplexProperty(EscherProperties.GROUPSHAPE__SHAPENAME, false, data);
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
opt.addEscherProperty(prop);
}
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/MovieShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/MovieShape.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/MovieShape.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/MovieShape.java Mon Aug 24 23:15:14 2015
@@ -55,7 +55,7 @@ public final class MovieShape extends HS
* @param pictureData the picture data
* @param parent the parent shape
*/
- public MovieShape(int movieIdx, HSLFPictureData pictureData, ShapeContainer<HSLFShape> parent) {
+ public MovieShape(int movieIdx, HSLFPictureData pictureData, ShapeContainer<HSLFShape,HSLFTextParagraph> parent) {
super(pictureData, parent);
setMovieIndex(movieIdx);
}
@@ -67,7 +67,7 @@ public final class MovieShape extends HS
* this picture in the <code>Slide</code>
* @param parent the parent shape of this picture
*/
- public MovieShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
+ public MovieShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
super(escherRecord, parent);
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/OLEShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/OLEShape.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/OLEShape.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/OLEShape.java Mon Aug 24 23:15:14 2015
@@ -51,7 +51,7 @@ public final class OLEShape extends HSLF
* @param data the picture data
* @param parent the parent shape
*/
- public OLEShape(HSLFPictureData data, ShapeContainer<HSLFShape> parent) {
+ public OLEShape(HSLFPictureData data, ShapeContainer<HSLFShape,HSLFTextParagraph> parent) {
super(data, parent);
}
@@ -62,7 +62,7 @@ public final class OLEShape extends HSLF
* this picture in the <code>Slide</code>
* @param parent the parent shape of this picture
*/
- public OLEShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
+ public OLEShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
super(escherRecord, parent);
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Placeholder.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Placeholder.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Placeholder.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Placeholder.java Mon Aug 24 23:15:14 2015
@@ -21,6 +21,7 @@ import org.apache.poi.ddf.*;
import org.apache.poi.hslf.record.OEPlaceholderAtom;
import org.apache.poi.hslf.usermodel.HSLFShape;
import org.apache.poi.hslf.usermodel.HSLFTextBox;
+import org.apache.poi.hslf.usermodel.HSLFTextParagraph;
import org.apache.poi.hslf.exceptions.HSLFException;
import org.apache.poi.sl.usermodel.ShapeContainer;
@@ -33,11 +34,11 @@ import java.io.ByteArrayOutputStream;
*/
public final class Placeholder extends HSLFTextBox {
- protected Placeholder(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
+ protected Placeholder(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
super(escherRecord, parent);
}
- public Placeholder(ShapeContainer<HSLFShape> parent){
+ public Placeholder(ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
super(parent);
}
@@ -59,7 +60,7 @@ public final class Placeholder extends H
EscherClientDataRecord cldata = new EscherClientDataRecord();
cldata.setOptions((short)15);
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
//Placeholders can't be grouped
setEscherProperty(opt, EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 262144);
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Polygon.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Polygon.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Polygon.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Polygon.java Mon Aug 24 23:15:14 2015
@@ -38,7 +38,7 @@ public final class Polygon extends HSLFA
* @param escherRecord <code>EscherSpContainer</code> container which holds information about this shape
* @param parent the parent of the shape
*/
- protected Polygon(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
+ protected Polygon(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
super(escherRecord, parent);
}
@@ -49,7 +49,7 @@ public final class Polygon extends HSLFA
* @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 Polygon(ShapeContainer<HSLFShape> parent){
+ public Polygon(ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
super((EscherContainerRecord)null, parent);
_escherContainer = createSpContainer(ShapeType.NOT_PRIMITIVE, parent instanceof HSLFGroupShape);
}
@@ -75,7 +75,7 @@ public final class Polygon extends HSLFA
float left = findSmallest(xPoints);
float top = findSmallest(yPoints);
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__RIGHT, Units.pointsToMaster(right - left)));
opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__BOTTOM, Units.pointsToMaster(bottom - top)));
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFAutoShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFAutoShape.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFAutoShape.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFAutoShape.java Mon Aug 24 23:15:14 2015
@@ -31,13 +31,13 @@ import org.apache.poi.ss.usermodel.Shape
*
* @author Yegor Kozlov
*/
-public class HSLFAutoShape extends HSLFTextShape implements AutoShape<HSLFTextParagraph> {
+public class HSLFAutoShape extends HSLFTextShape implements AutoShape<HSLFShape,HSLFTextParagraph> {
- protected HSLFAutoShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
+ protected HSLFAutoShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
super(escherRecord, parent);
}
- public HSLFAutoShape(ShapeType type, ShapeContainer<HSLFShape> parent){
+ public HSLFAutoShape(ShapeType type, ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
super(null, parent);
_escherContainer = createSpContainer(type, parent instanceof HSLFGroupShape);
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFBackground.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFBackground.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFBackground.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFBackground.java Mon Aug 24 23:15:14 2015
@@ -26,9 +26,9 @@ import org.apache.poi.sl.usermodel.Shape
*
* @author Yegor Kozlov
*/
-public final class HSLFBackground extends HSLFShape implements Background {
+public final class HSLFBackground extends HSLFShape implements Background<HSLFShape,HSLFTextParagraph> {
- protected HSLFBackground(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent) {
+ protected HSLFBackground(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape,HSLFTextParagraph> parent) {
super(escherRecord, parent);
}
Added: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFConnectorShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFConnectorShape.java?rev=1697515&view=auto
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFConnectorShape.java (added)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFConnectorShape.java Mon Aug 24 23:15:14 2015
@@ -0,0 +1,65 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ====================================================================
+ */
+
+package org.apache.poi.hslf.usermodel;
+
+import org.apache.poi.ddf.EscherContainerRecord;
+import org.apache.poi.sl.usermodel.ConnectorShape;
+import org.apache.poi.sl.usermodel.ShapeContainer;
+import org.apache.poi.util.Beta;
+
+/**
+ * Specifies a connection shape.
+ *
+ * This is currently only a dummy implementation.
+ */
+@Beta
+public class HSLFConnectorShape extends HSLFSimpleShape
+implements ConnectorShape<HSLFShape,HSLFTextParagraph> {
+
+ /**
+ * Create a ConnectorShape object and initialize it from the supplied Record container.
+ *
+ * @param escherRecord <code>EscherSpContainer</code> container which holds information about this shape
+ * @param parent the parent of the shape
+ */
+ protected HSLFConnectorShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
+ super(escherRecord, parent);
+
+ }
+
+ /**
+ * Create a new ConnectorShape. This constructor is used when a new shape is created.
+ *
+ * @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 HSLFConnectorShape(ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
+ super(null, parent);
+ _escherContainer = createSpContainer(parent instanceof HSLFGroupShape);
+ }
+
+ /**
+ * Create a new ConnectorShape. This constructor is used when a new shape is created.
+ *
+ */
+ public HSLFConnectorShape(){
+ this(null);
+ }
+}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFill.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFill.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFill.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFill.java Mon Aug 24 23:15:14 2015
@@ -22,9 +22,9 @@ import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.List;
+import org.apache.poi.ddf.AbstractEscherOptRecord;
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;
@@ -155,7 +155,7 @@ public final class HSLFFill {
* @return type of fill
*/
public int getFillType(){
- EscherOptRecord opt = shape.getEscherOptRecord();
+ AbstractEscherOptRecord opt = shape.getEscherOptRecord();
EscherSimpleProperty prop = HSLFShape.getEscherProperty(opt, EscherProperties.FILL__FILLTYPE);
return prop == null ? FILL_SOLID : prop.getPropertyValue();
}
@@ -163,7 +163,7 @@ public final class HSLFFill {
/**
*/
protected void afterInsert(HSLFSheet sh){
- EscherOptRecord opt = shape.getEscherOptRecord();
+ AbstractEscherOptRecord opt = shape.getEscherOptRecord();
EscherSimpleProperty p = HSLFShape.getEscherProperty(opt, EscherProperties.FILL__PATTERNTEXTURE);
if(p != null) {
int idx = p.getPropertyValue();
@@ -197,7 +197,7 @@ public final class HSLFFill {
* @param type type of the fill
*/
public void setFillType(int type){
- EscherOptRecord opt = shape.getEscherOptRecord();
+ AbstractEscherOptRecord opt = shape.getEscherOptRecord();
HSLFShape.setEscherProperty(opt, EscherProperties.FILL__FILLTYPE, type);
}
@@ -205,7 +205,7 @@ public final class HSLFFill {
* Foreground color
*/
public Color getForegroundColor(){
- EscherOptRecord opt = shape.getEscherOptRecord();
+ AbstractEscherOptRecord opt = shape.getEscherOptRecord();
EscherSimpleProperty p = HSLFShape.getEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST);
if(p != null && (p.getPropertyValue() & 0x10) == 0) return null;
@@ -218,7 +218,7 @@ public final class HSLFFill {
* Foreground color
*/
public void setForegroundColor(Color color){
- EscherOptRecord opt = shape.getEscherOptRecord();
+ AbstractEscherOptRecord opt = shape.getEscherOptRecord();
if (color == null) {
HSLFShape.setEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST, 0x150000);
}
@@ -233,7 +233,7 @@ public final class HSLFFill {
* Background color
*/
public Color getBackgroundColor(){
- EscherOptRecord opt = shape.getEscherOptRecord();
+ AbstractEscherOptRecord opt = shape.getEscherOptRecord();
EscherSimpleProperty p = HSLFShape.getEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST);
if(p != null && (p.getPropertyValue() & 0x10) == 0) return null;
@@ -245,7 +245,7 @@ public final class HSLFFill {
* Background color
*/
public void setBackgroundColor(Color color){
- EscherOptRecord opt = shape.getEscherOptRecord();
+ AbstractEscherOptRecord opt = shape.getEscherOptRecord();
if (color == null) {
HSLFShape.setEscherProperty(opt, EscherProperties.FILL__FILLBACKCOLOR, -1);
}
@@ -259,7 +259,7 @@ public final class HSLFFill {
* <code>PictureData</code> object used in a texture, pattern of picture fill.
*/
public HSLFPictureData getPictureData(){
- EscherOptRecord opt = shape.getEscherOptRecord();
+ AbstractEscherOptRecord opt = shape.getEscherOptRecord();
EscherSimpleProperty p = HSLFShape.getEscherProperty(opt, EscherProperties.FILL__PATTERNTEXTURE);
if (p == null) return null;
@@ -292,7 +292,7 @@ public final class HSLFFill {
* @param data the picture data added to this ppt by {@link HSLFSlideShow#addPicture(byte[], org.apache.poi.sl.usermodel.PictureData.PictureType)} method.
*/
public void setPictureData(HSLFPictureData data){
- EscherOptRecord opt = shape.getEscherOptRecord();
+ AbstractEscherOptRecord opt = shape.getEscherOptRecord();
HSLFShape.setEscherProperty(opt, (short)(EscherProperties.FILL__PATTERNTEXTURE + 0x4000), (data == null ? 0 : data.getIndex()));
if(data != null && shape.getSheet() != null) {
EscherBSERecord bse = getEscherBSERecord(data.getIndex());
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFreeformShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFreeformShape.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFreeformShape.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFreeformShape.java Mon Aug 24 23:15:14 2015
@@ -26,9 +26,9 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import org.apache.poi.ddf.AbstractEscherOptRecord;
import org.apache.poi.ddf.EscherArrayProperty;
import org.apache.poi.ddf.EscherContainerRecord;
-import org.apache.poi.ddf.EscherOptRecord;
import org.apache.poi.ddf.EscherProperties;
import org.apache.poi.ddf.EscherSimpleProperty;
import org.apache.poi.sl.usermodel.FreeformShape;
@@ -47,7 +47,7 @@ import org.apache.poi.util.Units;
* </p>
* @author Yegor Kozlov
*/
-public final class HSLFFreeformShape extends HSLFAutoShape implements FreeformShape<HSLFTextParagraph> {
+public final class HSLFFreeformShape extends HSLFAutoShape implements FreeformShape<HSLFShape,HSLFTextParagraph> {
public static final byte[] SEGMENTINFO_MOVETO = new byte[]{0x00, 0x40};
public static final byte[] SEGMENTINFO_LINETO = new byte[]{0x00, (byte)0xAC};
@@ -64,7 +64,7 @@ public final class HSLFFreeformShape ext
* @param escherRecord <code>EscherSpContainer</code> container which holds information about this shape
* @param parent the parent of the shape
*/
- protected HSLFFreeformShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
+ protected HSLFFreeformShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
super(escherRecord, parent);
}
@@ -75,7 +75,7 @@ public final class HSLFFreeformShape ext
* @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 HSLFFreeformShape(ShapeContainer<HSLFShape> parent){
+ public HSLFFreeformShape(ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
super((EscherContainerRecord)null, parent);
_escherContainer = createSpContainer(ShapeType.NOT_PRIMITIVE, parent instanceof HSLFGroupShape);
}
@@ -140,7 +140,7 @@ public final class HSLFFreeformShape ext
if(!isClosed) segInfo.add(SEGMENTINFO_LINETO);
segInfo.add(new byte[]{0x00, (byte)0x80});
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__SHAPEPATH, 0x4));
EscherArrayProperty verticesProp = new EscherArrayProperty((short)(EscherProperties.GEOMETRY__VERTICES + 0x4000), false, null);
@@ -178,7 +178,7 @@ public final class HSLFFreeformShape ext
@Override
public GeneralPath getPath(){
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__SHAPEPATH, 0x4));
EscherArrayProperty verticesProp = getEscherProperty(opt, (short)(EscherProperties.GEOMETRY__VERTICES + 0x4000));
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java Mon Aug 24 23:15:14 2015
@@ -17,11 +17,22 @@
package org.apache.poi.hslf.usermodel;
+import java.awt.Rectangle;
import java.awt.geom.Rectangle2D;
-import java.util.*;
-
-import org.apache.poi.ddf.*;
-import org.apache.poi.sl.usermodel.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.poi.ddf.EscherChildAnchorRecord;
+import org.apache.poi.ddf.EscherClientAnchorRecord;
+import org.apache.poi.ddf.EscherContainerRecord;
+import org.apache.poi.ddf.EscherRecord;
+import org.apache.poi.ddf.EscherSpRecord;
+import org.apache.poi.ddf.EscherSpgrRecord;
+import org.apache.poi.sl.usermodel.GroupShape;
+import org.apache.poi.sl.usermodel.PictureData;
+import org.apache.poi.sl.usermodel.ShapeContainer;
+import org.apache.poi.sl.usermodel.ShapeType;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.POILogger;
import org.apache.poi.util.Units;
@@ -31,7 +42,8 @@ import org.apache.poi.util.Units;
*
* @author Yegor Kozlov
*/
-public class HSLFGroupShape extends HSLFShape implements GroupShape<HSLFShape> {
+public class HSLFGroupShape extends HSLFShape
+implements HSLFShapeContainer, GroupShape<HSLFShape,HSLFTextParagraph> {
/**
* Create a new ShapeGroup. This constructor is used when a new shape is created.
@@ -43,12 +55,22 @@ public class HSLFGroupShape extends HSLF
}
/**
- * Create a ShapeGroup object and initilize it from the supplied Record container.
+ * Create a new ShapeGroup. This constructor is used when a new shape is created.
+ *
+ * @param parent the parent of the shape
+ */
+ public HSLFGroupShape(ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
+ this(null, parent);
+ _escherContainer = createSpContainer(parent instanceof HSLFGroupShape);
+ }
+
+ /**
+ * Create a ShapeGroup object and initialize it from the supplied Record container.
*
* @param escherRecord <code>EscherSpContainer</code> container which holds information about this shape
* @param parent the parent of the shape
*/
- protected HSLFGroupShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
+ protected HSLFGroupShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
super(escherRecord, parent);
}
@@ -273,4 +295,68 @@ public class HSLFGroupShape extends HSLF
return shapeList;
}
+ @Override
+ public HSLFTextBox createTextBox() {
+ HSLFTextBox s = new HSLFTextBox(this);
+ s.setHorizontalCentered(true);
+ s.setAnchor(new Rectangle(0, 0, 100, 100));
+ addShape(s);
+ return s;
+ }
+
+ @Override
+ public HSLFAutoShape createAutoShape() {
+ HSLFAutoShape s = new HSLFAutoShape(ShapeType.RECT, this);
+ s.setHorizontalCentered(true);
+ s.setAnchor(new Rectangle(0, 0, 100, 100));
+ addShape(s);
+ return s;
+ }
+
+ @Override
+ public HSLFFreeformShape createFreeform() {
+ HSLFFreeformShape s = new HSLFFreeformShape(this);
+ s.setHorizontalCentered(true);
+ s.setAnchor(new Rectangle(0, 0, 100, 100));
+ addShape(s);
+ return s;
+ }
+
+ @Override
+ public HSLFConnectorShape createConnector() {
+ HSLFConnectorShape s = new HSLFConnectorShape(this);
+ s.setAnchor(new Rectangle(0, 0, 100, 100));
+ addShape(s);
+ return s;
+ }
+
+ @Override
+ public HSLFGroupShape createGroup() {
+ HSLFGroupShape s = new HSLFGroupShape(this);
+ s.setAnchor(new Rectangle(0, 0, 100, 100));
+ addShape(s);
+ return s;
+ }
+
+ @Override
+ public HSLFPictureShape createPicture(PictureData pictureData) {
+ if (!(pictureData instanceof HSLFPictureData)) {
+ throw new IllegalArgumentException("pictureData needs to be of type HSLFPictureData");
+ }
+ HSLFPictureShape s = new HSLFPictureShape((HSLFPictureData)pictureData, this);
+ s.setAnchor(new Rectangle(0, 0, 100, 100));
+ addShape(s);
+ return s;
+ }
+
+ @Override
+ public HSLFTable createTable(int numRows, int numCols) {
+ if (numRows < 1 || numCols < 1) {
+ throw new IllegalArgumentException("numRows and numCols must be greater than 0");
+ }
+ HSLFTable s = new HSLFTable(numRows,numCols,this);
+ s.setAnchor(new Rectangle(0, 0, 100, 100));
+ addShape(s);
+ return s;
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFLine.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFLine.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFLine.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFLine.java Mon Aug 24 23:15:14 2015
@@ -17,8 +17,8 @@
package org.apache.poi.hslf.usermodel;
+import org.apache.poi.ddf.AbstractEscherOptRecord;
import org.apache.poi.ddf.EscherContainerRecord;
-import org.apache.poi.ddf.EscherOptRecord;
import org.apache.poi.ddf.EscherProperties;
import org.apache.poi.ddf.EscherSpRecord;
import org.apache.poi.sl.usermodel.Line;
@@ -30,12 +30,12 @@ import org.apache.poi.sl.usermodel.Shape
*
* @author Yegor Kozlov
*/
-public final class HSLFLine extends HSLFTextShape implements Line<HSLFTextParagraph> {
- public HSLFLine(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
+public final class HSLFLine extends HSLFTextShape implements Line<HSLFShape,HSLFTextParagraph> {
+ public HSLFLine(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
super(escherRecord, parent);
}
- public HSLFLine(ShapeContainer<HSLFShape> parent){
+ public HSLFLine(ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
super(null, parent);
_escherContainer = createSpContainer(parent instanceof HSLFGroupShape);
}
@@ -54,7 +54,7 @@ public final class HSLFLine extends HSLF
spRecord.setOptions(type);
//set default properties for a line
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
//default line properties
setEscherProperty(opt, EscherProperties.GEOMETRY__SHAPEPATH, 4);
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFMasterSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFMasterSheet.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFMasterSheet.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFMasterSheet.java Mon Aug 24 23:15:14 2015
@@ -28,7 +28,7 @@ import org.apache.poi.sl.usermodel.Maste
*
* @author Yegor Kozlov
*/
-public abstract class HSLFMasterSheet extends HSLFSheet implements MasterSheet<HSLFShape,HSLFSlideShow> {
+public abstract class HSLFMasterSheet extends HSLFSheet implements MasterSheet<HSLFShape,HSLFTextParagraph> {
public HSLFMasterSheet(SheetContainer container, int sheetNo){
super(container, sheetNo);
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFNotes.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFNotes.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFNotes.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFNotes.java Mon Aug 24 23:15:14 2015
@@ -32,7 +32,7 @@ import org.apache.poi.util.POILogger;
* @author Nick Burch
*/
-public final class HSLFNotes extends HSLFSheet implements Notes<HSLFShape, HSLFSlideShow> {
+public final class HSLFNotes extends HSLFSheet implements Notes<HSLFShape,HSLFTextParagraph> {
protected static final POILogger logger = POILogFactory.getLogger(HSLFNotes.class);
private List<List<HSLFTextParagraph>> _paragraphs = new ArrayList<List<HSLFTextParagraph>>();
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureShape.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureShape.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureShape.java Mon Aug 24 23:15:14 2015
@@ -26,10 +26,10 @@ import java.util.List;
import javax.imageio.ImageIO;
+import org.apache.poi.ddf.AbstractEscherOptRecord;
import org.apache.poi.ddf.EscherBSERecord;
import org.apache.poi.ddf.EscherComplexProperty;
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;
@@ -49,7 +49,7 @@ import org.apache.poi.util.Units;
*
* @author Yegor Kozlov
*/
-public class HSLFPictureShape extends HSLFSimpleShape implements PictureShape {
+public class HSLFPictureShape extends HSLFSimpleShape implements PictureShape<HSLFShape,HSLFTextParagraph> {
/**
* Create a new <code>Picture</code>
@@ -66,7 +66,7 @@ public class HSLFPictureShape extends HS
* @param data the picture data
* @param parent the parent shape
*/
- public HSLFPictureShape(HSLFPictureData data, ShapeContainer<HSLFShape> parent) {
+ public HSLFPictureShape(HSLFPictureData data, ShapeContainer<HSLFShape,HSLFTextParagraph> parent) {
super(null, parent);
_escherContainer = createSpContainer(data.getIndex(), parent instanceof HSLFGroupShape);
}
@@ -78,7 +78,7 @@ public class HSLFPictureShape extends HS
* this picture in the <code>Slide</code>
* @param parent the parent shape of this picture
*/
- protected HSLFPictureShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
+ protected HSLFPictureShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
super(escherRecord, parent);
}
@@ -90,7 +90,7 @@ public class HSLFPictureShape extends HS
* @return the index to this picture (1 based).
*/
public int getPictureIndex(){
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.BLIP__BLIPTODISPLAY);
return prop == null ? 0 : prop.getPropertyValue();
}
@@ -109,7 +109,7 @@ public class HSLFPictureShape extends HS
spRecord.setOptions((short)((ShapeType.FRAME.nativeId << 4) | 0x2));
//set default properties for a picture
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
setEscherProperty(opt, EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 0x800080);
//another weird feature of powerpoint: for picture id we must add 0x4000.
@@ -189,7 +189,7 @@ public class HSLFPictureShape extends HS
* @return name of this picture
*/
public String getPictureName(){
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
EscherComplexProperty prop = getEscherProperty(opt, EscherProperties.BLIP__BLIPFILENAME);
if (prop == null) return null;
String name = StringUtil.getFromUnicodeLE(prop.getComplexData());
@@ -202,7 +202,7 @@ public class HSLFPictureShape extends HS
* @param name of this picture
*/
public void setPictureName(String name){
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
byte[] data = StringUtil.getToUnicodeLE(name + '\u0000');
EscherComplexProperty prop = new EscherComplexProperty(EscherProperties.BLIP__BLIPFILENAME, false, data);
opt.addEscherProperty(prop);
@@ -228,7 +228,7 @@ public class HSLFPictureShape extends HS
public Insets getClipping() {
// The anchor specified by the escher properties is the displayed size,
// i.e. the size of the already clipped image
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
double top = getFractProp(opt, EscherProperties.BLIP__CROPFROMTOP);
double bottom = getFractProp(opt, EscherProperties.BLIP__CROPFROMBOTTOM);
@@ -244,7 +244,7 @@ public class HSLFPictureShape extends HS
/**
* @return the fractional property or 0 if not defined
*/
- private static double getFractProp(EscherOptRecord opt, short propertyId) {
+ private static double getFractProp(AbstractEscherOptRecord opt, short propertyId) {
EscherSimpleProperty prop = getEscherProperty(opt, propertyId);
if (prop == null) return 0;
int fixedPoint = prop.getPropertyValue();
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShape.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShape.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShape.java Mon Aug 24 23:15:14 2015
@@ -44,7 +44,7 @@ import org.apache.poi.util.*;
*
* @author Yegor Kozlov
*/
-public abstract class HSLFShape implements Shape {
+public abstract class HSLFShape implements Shape<HSLFShape,HSLFTextParagraph> {
// For logging
protected POILogger logger = POILogFactory.getLogger(this.getClass());
@@ -59,7 +59,7 @@ public abstract class HSLFShape implemen
* Parent of this shape.
* <code>null</code> for the topmost shapes.
*/
- protected ShapeContainer<HSLFShape> _parent;
+ protected ShapeContainer<HSLFShape,HSLFTextParagraph> _parent;
/**
* The <code>Sheet</code> this shape belongs to
@@ -77,7 +77,7 @@ public abstract class HSLFShape implemen
* @param escherRecord <code>EscherSpContainer</code> container which holds information about this shape
* @param parent the parent of this Shape
*/
- protected HSLFShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
+ protected HSLFShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
_escherContainer = escherRecord;
_parent = parent;
}
@@ -90,7 +90,7 @@ public abstract class HSLFShape implemen
/**
* @return the parent of this shape
*/
- public ShapeContainer<HSLFShape> getParent(){
+ public ShapeContainer<HSLFShape,HSLFTextParagraph> getParent(){
return _parent;
}
@@ -229,7 +229,7 @@ public abstract class HSLFShape implemen
*
* @return escher property or <code>null</code> if not found.
*/
- public static <T extends EscherProperty> T getEscherProperty(EscherOptRecord opt, int propId){
+ public static <T extends EscherProperty> T getEscherProperty(AbstractEscherOptRecord opt, int propId){
if (opt == null) return null;
return opt.lookup(propId);
}
@@ -241,7 +241,7 @@ public abstract class HSLFShape implemen
* @param propId The id of the property. One of the constants defined in EscherOptRecord.
* @param value value of the property. If value = -1 then the property is removed.
*/
- public static void setEscherProperty(EscherOptRecord opt, short propId, int value){
+ public static void setEscherProperty(AbstractEscherOptRecord opt, short propId, int value){
java.util.List<EscherProperty> props = opt.getEscherProperties();
for ( Iterator<EscherProperty> iterator = props.iterator(); iterator.hasNext(); ) {
if (iterator.next().getPropertyNumber() == propId){
@@ -262,7 +262,7 @@ public abstract class HSLFShape implemen
* @param value value of the property. If value = -1 then the property is removed.
*/
public void setEscherProperty(short propId, int value){
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
setEscherProperty(opt, propId, value);
}
@@ -272,7 +272,7 @@ public abstract class HSLFShape implemen
* @param propId The id of the property. One of the constants defined in EscherOptRecord.
*/
public int getEscherProperty(short propId){
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = getEscherProperty(opt, propId);
return prop == null ? 0 : prop.getPropertyValue();
}
@@ -283,7 +283,7 @@ public abstract class HSLFShape implemen
* @param propId The id of the property. One of the constants defined in EscherOptRecord.
*/
public int getEscherProperty(short propId, int defaultValue){
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = getEscherProperty(opt, propId);
return prop == null ? defaultValue : prop.getPropertyValue();
}
@@ -327,7 +327,7 @@ public abstract class HSLFShape implemen
}
Color getColor(short colorProperty, short opacityProperty, int defaultColor){
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty p = getEscherProperty(opt, colorProperty);
if(p == null && defaultColor == -1) return null;
@@ -367,7 +367,7 @@ public abstract class HSLFShape implemen
}
double getAlpha(short opacityProperty) {
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty op = getEscherProperty(opt, opacityProperty);
int defaultOpacity = 0x00010000;
int opacity = (op == null) ? defaultOpacity : op.getPropertyValue();
@@ -444,8 +444,8 @@ public abstract class HSLFShape implemen
logger.log(POILogger.INFO, "Rendering " + getShapeName());
}
- public EscherOptRecord getEscherOptRecord() {
- EscherOptRecord opt = getEscherChild(EscherOptRecord.RECORD_ID);
+ public AbstractEscherOptRecord getEscherOptRecord() {
+ AbstractEscherOptRecord opt = getEscherChild(EscherOptRecord.RECORD_ID);
if (opt == null) {
opt = getEscherChild(RecordTypes.EscherUserDefined);
}
Added: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapeContainer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapeContainer.java?rev=1697515&view=auto
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapeContainer.java (added)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapeContainer.java Mon Aug 24 23:15:14 2015
@@ -0,0 +1,49 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ====================================================================
+ */
+
+package org.apache.poi.hslf.usermodel;
+
+import org.apache.poi.sl.usermodel.PictureData;
+import org.apache.poi.sl.usermodel.ShapeContainer;
+
+/**
+ * Common interface for shape containers, e.g. sheets or groups of shapes
+ */
+public interface HSLFShapeContainer extends ShapeContainer<HSLFShape,HSLFTextParagraph> {
+
+ @Override
+ HSLFAutoShape createAutoShape();
+
+ @Override
+ HSLFFreeformShape createFreeform();
+
+ @Override
+ HSLFTextBox createTextBox();
+
+ @Override
+ HSLFConnectorShape createConnector();
+
+ @Override
+ HSLFGroupShape createGroup();
+
+ @Override
+ HSLFPictureShape createPicture(PictureData pictureData);
+
+
+}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapeFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapeFactory.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapeFactory.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapeFactory.java Mon Aug 24 23:15:14 2015
@@ -40,38 +40,39 @@ public final class HSLFShapeFactory {
/**
* Create a new shape from the data provided.
*/
- public static HSLFShape createShape(EscherContainerRecord spContainer, ShapeContainer<HSLFShape> parent){
+ public static HSLFShape createShape(EscherContainerRecord spContainer, ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
if (spContainer.getRecordId() == EscherContainerRecord.SPGR_CONTAINER){
return createShapeGroup(spContainer, parent);
}
return createSimpleShape(spContainer, parent);
}
- public static HSLFGroupShape createShapeGroup(EscherContainerRecord spContainer, ShapeContainer<HSLFShape> parent){
- HSLFGroupShape group = null;
- EscherRecord opt = HSLFShape.getEscherChild((EscherContainerRecord)spContainer.getChild(0), (short)0xF122);
- if(opt != null){
- try {
- EscherPropertyFactory f = new EscherPropertyFactory();
- List<EscherProperty> props = f.createProperties( opt.serialize(), 8, opt.getInstance() );
- EscherSimpleProperty p = (EscherSimpleProperty)props.get(0);
- if(p.getPropertyNumber() == 0x39F && p.getPropertyValue() == 1){
- group = new HSLFTable(spContainer, parent);
- } else {
- group = new HSLFGroupShape(spContainer, parent);
+ public static HSLFGroupShape createShapeGroup(EscherContainerRecord spContainer, ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
+ boolean isTable = false;
+ EscherContainerRecord ecr = (EscherContainerRecord)spContainer.getChild(0);
+ EscherRecord opt = HSLFShape.getEscherChild(ecr, (short)RecordTypes.EscherUserDefined);
+
+ if (opt != null) {
+ EscherPropertyFactory f = new EscherPropertyFactory();
+ List<EscherProperty> props = f.createProperties( opt.serialize(), 8, opt.getInstance() );
+ for (EscherProperty ep : props) {
+ if (ep.getPropertyNumber() == 0x39F
+ && ep instanceof EscherSimpleProperty
+ && ((EscherSimpleProperty)ep).getPropertyValue() == 1) {
+ isTable = true;
+ break;
}
- } catch (Exception e){
- logger.log(POILogger.WARN, e.getMessage());
- group = new HSLFGroupShape(spContainer, parent);
}
- } else {
- group = new HSLFGroupShape(spContainer, parent);
}
-
+
+ HSLFGroupShape group = (isTable)
+ ? new HSLFTable(spContainer, parent)
+ : new HSLFGroupShape(spContainer, parent);
+
return group;
}
- public static HSLFShape createSimpleShape(EscherContainerRecord spContainer, ShapeContainer<HSLFShape> parent){
+ public static HSLFShape createSimpleShape(EscherContainerRecord spContainer, ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
HSLFShape shape = null;
EscherSpRecord spRecord = spContainer.getChildById(EscherSpRecord.RECORD_ID);
@@ -106,7 +107,7 @@ public final class HSLFShapeFactory {
shape = new HSLFLine(spContainer, parent);
break;
case NOT_PRIMITIVE: {
- EscherOptRecord opt = HSLFShape.getEscherChild(spContainer, EscherOptRecord.RECORD_ID);
+ AbstractEscherOptRecord opt = HSLFShape.getEscherChild(spContainer, EscherOptRecord.RECORD_ID);
EscherProperty prop = HSLFShape.getEscherProperty(opt, EscherProperties.GEOMETRY__VERTICES);
if(prop != null)
shape = new HSLFFreeformShape(spContainer, parent);
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSheet.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSheet.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSheet.java Mon Aug 24 23:15:14 2015
@@ -18,15 +18,28 @@
package org.apache.poi.hslf.usermodel;
import java.awt.Graphics2D;
-import java.util.*;
-
-import org.apache.poi.ddf.*;
-import org.apache.poi.hslf.record.*;
+import java.awt.Rectangle;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.poi.ddf.EscherContainerRecord;
+import org.apache.poi.ddf.EscherDgRecord;
+import org.apache.poi.ddf.EscherDggRecord;
+import org.apache.poi.ddf.EscherRecord;
+import org.apache.poi.hslf.record.CString;
+import org.apache.poi.hslf.record.ColorSchemeAtom;
+import org.apache.poi.hslf.record.OEPlaceholderAtom;
+import org.apache.poi.hslf.record.PPDrawing;
+import org.apache.poi.hslf.record.RecordContainer;
+import org.apache.poi.hslf.record.RecordTypes;
+import org.apache.poi.hslf.record.RoundTripHFPlaceholder12;
+import org.apache.poi.hslf.record.SheetContainer;
import org.apache.poi.sl.draw.DrawFactory;
import org.apache.poi.sl.draw.Drawable;
+import org.apache.poi.sl.usermodel.PictureData;
+import org.apache.poi.sl.usermodel.ShapeType;
import org.apache.poi.sl.usermodel.Sheet;
-import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
/**
* This class defines the common format of "Sheets" in a powerpoint
@@ -36,9 +49,7 @@ import org.apache.poi.util.POILogger;
* @author Yegor Kozlov
*/
-public abstract class HSLFSheet implements Sheet<HSLFShape,HSLFSlideShow> {
- private static POILogger logger = POILogFactory.getLogger(HSLFSheet.class);
-
+public abstract class HSLFSheet implements HSLFShapeContainer, Sheet<HSLFShape,HSLFTextParagraph> {
/**
* The <code>SlideShow</code> we belong to
*/
@@ -387,4 +398,68 @@ public abstract class HSLFSheet implemen
}
+ @Override
+ public HSLFTextBox createTextBox() {
+ HSLFTextBox s = new HSLFTextBox();
+ s.setHorizontalCentered(true);
+ s.setAnchor(new Rectangle(0, 0, 100, 100));
+ addShape(s);
+ return s;
+ }
+
+ @Override
+ public HSLFAutoShape createAutoShape() {
+ HSLFAutoShape s = new HSLFAutoShape(ShapeType.RECT);
+ s.setHorizontalCentered(true);
+ s.setAnchor(new Rectangle(0, 0, 100, 100));
+ addShape(s);
+ return s;
+ }
+
+ @Override
+ public HSLFFreeformShape createFreeform() {
+ HSLFFreeformShape s = new HSLFFreeformShape();
+ s.setHorizontalCentered(true);
+ s.setAnchor(new Rectangle(0, 0, 100, 100));
+ addShape(s);
+ return s;
+ }
+
+ @Override
+ public HSLFConnectorShape createConnector() {
+ HSLFConnectorShape s = new HSLFConnectorShape();
+ s.setAnchor(new Rectangle(0, 0, 100, 100));
+ addShape(s);
+ return s;
+ }
+
+ @Override
+ public HSLFGroupShape createGroup() {
+ HSLFGroupShape s = new HSLFGroupShape();
+ s.setAnchor(new Rectangle(0, 0, 100, 100));
+ addShape(s);
+ return s;
+ }
+
+ @Override
+ public HSLFPictureShape createPicture(PictureData pictureData) {
+ if (!(pictureData instanceof HSLFPictureData)) {
+ throw new IllegalArgumentException("pictureData needs to be of type HSLFPictureData");
+ }
+ HSLFPictureShape s = new HSLFPictureShape((HSLFPictureData)pictureData);
+ s.setAnchor(new Rectangle(0, 0, 100, 100));
+ addShape(s);
+ return s;
+ }
+
+ @Override
+ public HSLFTable createTable(int numRows, int numCols) {
+ if (numRows < 1 || numCols < 1) {
+ throw new IllegalArgumentException("numRows and numCols must be greater than 0");
+ }
+ HSLFTable s = new HSLFTable(numRows,numCols);
+ s.setAnchor(new Rectangle(0, 0, 100, 100));
+ addShape(s);
+ return s;
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java Mon Aug 24 23:15:14 2015
@@ -39,7 +39,7 @@ import org.apache.poi.util.Units;
*
* @author Yegor Kozlov
*/
-public abstract class HSLFSimpleShape extends HSLFShape implements SimpleShape {
+public abstract class HSLFSimpleShape extends HSLFShape implements SimpleShape<HSLFShape,HSLFTextParagraph> {
public final static double DEFAULT_LINE_WIDTH = 0.75;
@@ -55,7 +55,7 @@ public abstract class HSLFSimpleShape ex
* @param escherRecord <code>EscherSpContainer</code> container which holds information about this shape
* @param parent the parent of the shape
*/
- protected HSLFSimpleShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
+ protected HSLFSimpleShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
super(escherRecord, parent);
}
@@ -76,7 +76,7 @@ public abstract class HSLFSimpleShape ex
sp.setFlags(flags);
_escherContainer.addChildRecord(sp);
- EscherOptRecord opt = new EscherOptRecord();
+ AbstractEscherOptRecord opt = new EscherOptRecord();
opt.setRecordId(EscherOptRecord.RECORD_ID);
_escherContainer.addChildRecord(opt);
@@ -102,7 +102,7 @@ public abstract class HSLFSimpleShape ex
* Returns width of the line in in points
*/
public double getLineWidth(){
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.LINESTYLE__LINEWIDTH);
double width = (prop == null) ? DEFAULT_LINE_WIDTH : Units.toPoints(prop.getPropertyValue());
return width;
@@ -113,7 +113,7 @@ public abstract class HSLFSimpleShape ex
* @param width the width of line in in points
*/
public void setLineWidth(double width){
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
setEscherProperty(opt, EscherProperties.LINESTYLE__LINEWIDTH, Units.toEMU(width));
}
@@ -123,7 +123,7 @@ public abstract class HSLFSimpleShape ex
* @param color new color of the line
*/
public void setLineColor(Color color){
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
if (color == null) {
setEscherProperty(opt, EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x80000);
} else {
@@ -137,7 +137,7 @@ public abstract class HSLFSimpleShape ex
* @return color of the line. If color is not set returns <code>java.awt.Color.black</code>
*/
public Color getLineColor(){
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty p = getEscherProperty(opt, EscherProperties.LINESTYLE__NOLINEDRAWDASH);
if(p != null && (p.getPropertyValue() & 0x8) == 0) return null;
@@ -152,7 +152,7 @@ public abstract class HSLFSimpleShape ex
* @return dashing of the line.
*/
public LineDash getLineDashing(){
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.LINESTYLE__LINEDASHING);
return (prop == null) ? LineDash.SOLID : LineDash.fromNativeId(prop.getPropertyValue());
}
@@ -163,7 +163,7 @@ public abstract class HSLFSimpleShape ex
* @param pen new style of the line.
*/
public void setLineDashing(LineDash pen){
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
setEscherProperty(opt, EscherProperties.LINESTYLE__LINEDASHING, pen == LineDash.SOLID ? -1 : pen.nativeId);
}
@@ -173,7 +173,7 @@ public abstract class HSLFSimpleShape ex
* @return the compound style of the line.
*/
public LineCompound getLineCompound() {
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.LINESTYLE__LINESTYLE);
return (prop == null) ? LineCompound.SINGLE : LineCompound.fromNativeId(prop.getPropertyValue());
}
@@ -184,7 +184,7 @@ public abstract class HSLFSimpleShape ex
* @param style new compound style of the line.
*/
public void setLineCompound(LineCompound style){
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
setEscherProperty(opt, EscherProperties.LINESTYLE__LINESTYLE, style == LineCompound.SINGLE ? -1 : style.nativeId);
}
@@ -389,7 +389,7 @@ public abstract class HSLFSimpleShape ex
public double getShadowAngle() {
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.SHADOWSTYLE__OFFSETX);
int offX = (prop == null) ? 0 : prop.getPropertyValue();
prop = getEscherProperty(opt, EscherProperties.SHADOWSTYLE__OFFSETY);
@@ -398,7 +398,7 @@ public abstract class HSLFSimpleShape ex
}
public double getShadowDistance() {
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.SHADOWSTYLE__OFFSETX);
int offX = (prop == null) ? 0 : prop.getPropertyValue();
prop = getEscherProperty(opt, EscherProperties.SHADOWSTYLE__OFFSETY);
@@ -415,12 +415,12 @@ public abstract class HSLFSimpleShape ex
}
public Shadow getShadow() {
- EscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherOptRecord();
EscherProperty shadowType = opt.lookup(EscherProperties.SHADOWSTYLE__TYPE);
if (shadowType == null) return null;
return new Shadow(){
- public SimpleShape getShadowParent() {
+ public SimpleShape<HSLFShape,HSLFTextParagraph> getShadowParent() {
return HSLFSimpleShape.this;
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlide.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlide.java?rev=1697515&r1=1697514&r2=1697515&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlide.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlide.java Mon Aug 24 23:15:14 2015
@@ -21,12 +21,28 @@ import java.awt.Graphics2D;
import java.util.ArrayList;
import java.util.List;
-import org.apache.poi.ddf.*;
-import org.apache.poi.hslf.model.*;
-import org.apache.poi.hslf.record.*;
+import org.apache.poi.ddf.EscherContainerRecord;
+import org.apache.poi.ddf.EscherDgRecord;
+import org.apache.poi.ddf.EscherDggRecord;
+import org.apache.poi.ddf.EscherSpRecord;
+import org.apache.poi.hslf.model.Comment;
+import org.apache.poi.hslf.model.HeadersFooters;
+import org.apache.poi.hslf.model.Placeholder;
+import org.apache.poi.hslf.record.ColorSchemeAtom;
+import org.apache.poi.hslf.record.Comment2000;
+import org.apache.poi.hslf.record.EscherTextboxWrapper;
+import org.apache.poi.hslf.record.HeadersFootersContainer;
+import org.apache.poi.hslf.record.Record;
+import org.apache.poi.hslf.record.RecordContainer;
+import org.apache.poi.hslf.record.RecordTypes;
+import org.apache.poi.hslf.record.SSSlideInfoAtom;
+import org.apache.poi.hslf.record.SlideAtom;
import org.apache.poi.hslf.record.SlideListWithText.SlideAtomsSet;
+import org.apache.poi.hslf.record.StyleTextProp9Atom;
+import org.apache.poi.hslf.record.TextHeaderAtom;
import org.apache.poi.sl.draw.DrawFactory;
import org.apache.poi.sl.draw.Drawable;
+import org.apache.poi.sl.usermodel.Notes;
import org.apache.poi.sl.usermodel.ShapeType;
import org.apache.poi.sl.usermodel.Slide;
@@ -39,7 +55,7 @@ import org.apache.poi.sl.usermodel.Slide
* @author Yegor Kozlov
*/
-public final class HSLFSlide extends HSLFSheet implements Slide<HSLFShape,HSLFSlideShow,HSLFNotes> {
+public final class HSLFSlide extends HSLFSheet implements Slide<HSLFShape,HSLFTextParagraph> {
private int _slideNo;
private SlideAtomsSet _atomSet;
private final List<List<HSLFTextParagraph>> _paragraphs = new ArrayList<List<HSLFTextParagraph>>();
@@ -110,8 +126,11 @@ public final class HSLFSlide extends HSL
* references in the records to point to the new ID
*/
@Override
- public void setNotes(HSLFNotes notes) {
- _notes = notes;
+ public void setNotes(Notes<HSLFShape,HSLFTextParagraph> notes) {
+ if (notes != null && !(notes instanceof HSLFNotes)) {
+ throw new IllegalArgumentException("notes needs to be of type HSLFNotes");
+ }
+ _notes = (HSLFNotes)notes;
// Update the Slide Atom's ID of where to point to
SlideAtom sa = getSlideRecord().getSlideAtom();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org