You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2015/03/08 00:35:41 UTC
svn commit: r1664935 [3/4] - in /poi/branches/common_sl/src:
examples/src/org/apache/poi/hslf/examples/
ooxml/java/org/apache/poi/xslf/model/
ooxml/java/org/apache/poi/xslf/usermodel/
scratchpad/src/org/apache/poi/hslf/blip/ scratchpad/src/org/apache/p...
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/MovieShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/MovieShape.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/MovieShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/MovieShape.java Sat Mar 7 23:35:40 2015
@@ -55,7 +55,7 @@ public final class MovieShape extends Pi
* @param idx the index of the picture
* @param parent the parent shape
*/
- public MovieShape(int movieIdx, int idx, ShapeContainer<Shape> parent) {
+ public MovieShape(int movieIdx, int idx, ShapeContainer<HSLFShape> parent) {
super(idx, parent);
setMovieIndex(movieIdx);
}
@@ -67,7 +67,7 @@ public final class MovieShape extends Pi
* this picture in the <code>Slide</code>
* @param parent the parent shape of this picture
*/
- protected MovieShape(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent){
+ protected MovieShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
super(escherRecord, parent);
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/OLEShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/OLEShape.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/OLEShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/OLEShape.java Sat Mar 7 23:35:40 2015
@@ -52,7 +52,7 @@ public final class OLEShape extends Pict
* @param idx the index of the picture
* @param parent the parent shape
*/
- public OLEShape(int idx, ShapeContainer<Shape> parent) {
+ public OLEShape(int idx, ShapeContainer<HSLFShape> parent) {
super(idx, parent);
}
@@ -63,7 +63,7 @@ public final class OLEShape extends Pict
* this picture in the <code>Slide</code>
* @param parent the parent shape of this picture
*/
- protected OLEShape(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent){
+ protected OLEShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
super(escherRecord, parent);
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java Sat Mar 7 23:35:40 2015
@@ -43,7 +43,7 @@ public final class PPGraphics2D extends
protected POILogger log = POILogFactory.getLogger(this.getClass());
//The ppt object to write into.
- private ShapeGroup _group;
+ private HSLFGroupShape _group;
private AffineTransform _transform;
private Stroke _stroke;
@@ -58,7 +58,7 @@ public final class PPGraphics2D extends
*
* @param group The shape group to write the graphics calls into.
*/
- public PPGraphics2D(ShapeGroup group){
+ public PPGraphics2D(HSLFGroupShape group){
this._group = group;
_transform = new AffineTransform();
@@ -73,7 +73,7 @@ public final class PPGraphics2D extends
/**
* @return the shape group being used for drawing
*/
- public ShapeGroup getShapeGroup(){
+ public HSLFGroupShape getShapeGroup(){
return _group;
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Picture.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Picture.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Picture.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Picture.java Sat Mar 7 23:35:40 2015
@@ -98,9 +98,9 @@ public class Picture extends SimpleShape
* @param idx the index of the picture
* @param parent the parent shape
*/
- public Picture(int idx, ShapeContainer<Shape> parent) {
+ public Picture(int idx, ShapeContainer<HSLFShape> parent) {
super(null, parent);
- _escherContainer = createSpContainer(idx, parent instanceof ShapeGroup);
+ _escherContainer = createSpContainer(idx, parent instanceof HSLFGroupShape);
}
/**
@@ -110,7 +110,7 @@ public class Picture extends SimpleShape
* this picture in the <code>Slide</code>
* @param parent the parent shape of this picture
*/
- protected Picture(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent){
+ protected Picture(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
super(escherRecord, parent);
}
@@ -205,7 +205,7 @@ public class Picture extends SimpleShape
SlideShow ppt = getSheet().getSlideShow();
Document doc = ppt.getDocumentRecord();
EscherContainerRecord dggContainer = doc.getPPDrawingGroup().getDggContainer();
- EscherContainerRecord bstore = Shape.getEscherChild(dggContainer, EscherContainerRecord.BSTORE_CONTAINER);
+ EscherContainerRecord bstore = HSLFShape.getEscherChild(dggContainer, EscherContainerRecord.BSTORE_CONTAINER);
if(bstore == null) {
logger.log(POILogger.DEBUG, "EscherContainerRecord.BSTORE_CONTAINER was not found ");
return null;
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Placeholder.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Placeholder.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Placeholder.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Placeholder.java Sat Mar 7 23:35:40 2015
@@ -31,11 +31,11 @@ import java.io.ByteArrayOutputStream;
*/
public final class Placeholder extends TextBox {
- protected Placeholder(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent){
+ protected Placeholder(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
super(escherRecord, parent);
}
- public Placeholder(ShapeContainer<Shape> parent){
+ public Placeholder(ShapeContainer<HSLFShape> parent){
super(parent);
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Polygon.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Polygon.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Polygon.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Polygon.java Sat Mar 7 23:35:40 2015
@@ -36,7 +36,7 @@ public final class Polygon extends AutoS
* @param escherRecord <code>EscherSpContainer</code> container which holds information about this shape
* @param parent the parent of the shape
*/
- protected Polygon(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent){
+ protected Polygon(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
super(escherRecord, parent);
}
@@ -47,9 +47,9 @@ public final class Polygon extends AutoS
* @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<Shape> parent){
+ public Polygon(ShapeContainer<HSLFShape> parent){
super((EscherContainerRecord)null, parent);
- _escherContainer = createSpContainer(ShapeType.NOT_PRIMITIVE, parent instanceof ShapeGroup);
+ _escherContainer = createSpContainer(ShapeType.NOT_PRIMITIVE, parent instanceof HSLFGroupShape);
}
/**
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ShapeFactory.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ShapeFactory.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ShapeFactory.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ShapeFactory.java Sat Mar 7 23:35:40 2015
@@ -51,16 +51,16 @@ public final class ShapeFactory {
/**
* Create a new shape from the data provided.
*/
- public static Shape createShape(EscherContainerRecord spContainer, ShapeContainer<Shape> parent){
+ public static HSLFShape createShape(EscherContainerRecord spContainer, ShapeContainer<HSLFShape> parent){
if (spContainer.getRecordId() == EscherContainerRecord.SPGR_CONTAINER){
return createShapeGroup(spContainer, parent);
}
return createSimpeShape(spContainer, parent);
}
- public static ShapeGroup createShapeGroup(EscherContainerRecord spContainer, ShapeContainer<Shape> parent){
- ShapeGroup group = null;
- EscherRecord opt = Shape.getEscherChild((EscherContainerRecord)spContainer.getChild(0), (short)0xF122);
+ 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();
@@ -69,21 +69,21 @@ public final class ShapeFactory {
if(p.getPropertyNumber() == 0x39F && p.getPropertyValue() == 1){
group = new Table(spContainer, parent);
} else {
- group = new ShapeGroup(spContainer, parent);
+ group = new HSLFGroupShape(spContainer, parent);
}
} catch (Exception e){
logger.log(POILogger.WARN, e.getMessage());
- group = new ShapeGroup(spContainer, parent);
+ group = new HSLFGroupShape(spContainer, parent);
}
} else {
- group = new ShapeGroup(spContainer, parent);
+ group = new HSLFGroupShape(spContainer, parent);
}
return group;
}
- public static Shape createSimpeShape(EscherContainerRecord spContainer, ShapeContainer<Shape> parent){
- Shape shape = null;
+ public static HSLFShape createSimpeShape(EscherContainerRecord spContainer, ShapeContainer<HSLFShape> parent){
+ HSLFShape shape = null;
EscherSpRecord spRecord = spContainer.getChildById(EscherSpRecord.RECORD_ID);
ShapeType type = ShapeType.forId(spRecord.getShapeType(), false);
@@ -117,8 +117,8 @@ public final class ShapeFactory {
shape = new Line(spContainer, parent);
break;
case NOT_PRIMITIVE: {
- EscherOptRecord opt = Shape.getEscherChild(spContainer, EscherOptRecord.RECORD_ID);
- EscherProperty prop = Shape.getEscherProperty(opt, EscherProperties.GEOMETRY__VERTICES);
+ EscherOptRecord opt = HSLFShape.getEscherChild(spContainer, EscherOptRecord.RECORD_ID);
+ EscherProperty prop = HSLFShape.getEscherProperty(opt, EscherProperties.GEOMETRY__VERTICES);
if(prop != null)
shape = new Freeform(spContainer, parent);
else {
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ShapeOutline.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ShapeOutline.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ShapeOutline.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ShapeOutline.java Sat Mar 7 23:35:40 2015
@@ -23,6 +23,6 @@ package org.apache.poi.hslf.model;
* @author Yegor Kozlov
*/
public interface ShapeOutline {
- java.awt.Shape getOutline(Shape shape);
+ java.awt.Shape getOutline(HSLFShape shape);
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Sheet.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Sheet.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Sheet.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Sheet.java Sat Mar 7 23:35:40 2015
@@ -57,7 +57,7 @@ import org.apache.poi.util.POILogger;
* @author Yegor Kozlov
*/
-public abstract class Sheet implements ShapeContainer<Shape> {
+public abstract class Sheet implements ShapeContainer<HSLFShape> {
private static POILogger logger = POILogFactory.getLogger(Sheet.class);
/**
@@ -272,9 +272,9 @@ public abstract class Sheet implements S
*
* @return all shapes contained in this Sheet (Slide or Notes)
*/
- public Shape[] getShapes() {
- List<Shape> shapeList = getShapeList();
- return shapeList.toArray(new Shape[shapeList.size()]);
+ public HSLFShape[] getShapes() {
+ List<HSLFShape> shapeList = getShapeList();
+ return shapeList.toArray(new HSLFShape[shapeList.size()]);
}
/**
@@ -282,11 +282,11 @@ public abstract class Sheet implements S
*
* @param shape - the Shape to add
*/
- public void addShape(Shape shape) {
+ public void addShape(HSLFShape shape) {
PPDrawing ppdrawing = getPPDrawing();
EscherContainerRecord dgContainer = (EscherContainerRecord) ppdrawing.getEscherRecords()[0];
- EscherContainerRecord spgr = (EscherContainerRecord) Shape.getEscherChild(dgContainer, EscherContainerRecord.SPGR_CONTAINER);
+ EscherContainerRecord spgr = (EscherContainerRecord) HSLFShape.getEscherChild(dgContainer, EscherContainerRecord.SPGR_CONTAINER);
spgr.addChildRecord(shape.getSpContainer());
shape.setSheet(this);
@@ -339,7 +339,7 @@ public abstract class Sheet implements S
* @param shape shape to be removed from this sheet, if present.
* @return <tt>true</tt> if the shape was deleted.
*/
- public boolean removeShape(Shape shape) {
+ public boolean removeShape(HSLFShape shape) {
PPDrawing ppdrawing = getPPDrawing();
EscherContainerRecord dg = (EscherContainerRecord) ppdrawing.getEscherRecords()[0];
@@ -427,7 +427,7 @@ public abstract class Sheet implements S
* @return <code>TextShape</code> or <code>null</code>
*/
public TextShape getPlaceholderByTextType(int type){
- Shape[] shape = getShapes();
+ HSLFShape[] shape = getShapes();
for (int i = 0; i < shape.length; i++) {
if(shape[i] instanceof TextShape){
TextShape tx = (TextShape)shape[i];
@@ -447,7 +447,7 @@ public abstract class Sheet implements S
* @return <code>TextShape</code> or <code>null</code>
*/
public TextShape getPlaceholder(int type){
- Shape[] shape = getShapes();
+ HSLFShape[] shape = getShapes();
for (int i = 0; i < shape.length; i++) {
if(shape[i] instanceof TextShape){
TextShape tx = (TextShape)shape[i];
@@ -497,7 +497,7 @@ public abstract class Sheet implements S
}
- public Iterator<Shape> iterator() {
+ public Iterator<HSLFShape> iterator() {
return getShapeList().iterator();
}
@@ -507,7 +507,7 @@ public abstract class Sheet implements S
*
* @return all shapes contained in this Sheet (Slide or Notes)
*/
- protected List<Shape> getShapeList() {
+ protected List<HSLFShape> getShapeList() {
PPDrawing ppdrawing = getPPDrawing();
EscherContainerRecord dg = (EscherContainerRecord) ppdrawing.getEscherRecords()[0];
@@ -524,7 +524,7 @@ public abstract class Sheet implements S
throw new IllegalStateException("spgr not found");
}
- List<Shape> shapeList = new ArrayList<Shape>();
+ List<HSLFShape> shapeList = new ArrayList<HSLFShape>();
Iterator<EscherRecord> it = spgr.getChildIterator();
if (it.hasNext()) {
// skip first item
@@ -532,7 +532,7 @@ public abstract class Sheet implements S
}
for (; it.hasNext();) {
EscherContainerRecord sp = (EscherContainerRecord) it.next();
- Shape sh = ShapeFactory.createShape(sp, null);
+ HSLFShape sh = ShapeFactory.createShape(sp, null);
sh.setSheet(this);
shapeList.add(sh);
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java Sat Mar 7 23:35:40 2015
@@ -47,7 +47,7 @@ import org.apache.poi.util.LittleEndian;
*
* @author Yegor Kozlov
*/
-public abstract class SimpleShape extends Shape {
+public abstract class SimpleShape extends HSLFShape {
public final static double DEFAULT_LINE_WIDTH = 0.75;
@@ -63,7 +63,7 @@ public abstract class SimpleShape extend
* @param escherRecord <code>EscherSpContainer</code> container which holds information about this shape
* @param parent the parent of the shape
*/
- protected SimpleShape(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent){
+ protected SimpleShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
super(escherRecord, parent);
}
@@ -223,15 +223,15 @@ public abstract class SimpleShape extend
//if it is a groupped shape see if we need to transform the coordinates
if (getParent() != null){
- ArrayList<ShapeGroup> lst = new ArrayList<ShapeGroup>();
- for (ShapeContainer<Shape> parent=this.getParent();
- parent instanceof ShapeGroup;
- parent = ((ShapeGroup)parent).getParent()) {
- lst.add(0, (ShapeGroup)parent);
+ ArrayList<HSLFGroupShape> lst = new ArrayList<HSLFGroupShape>();
+ for (ShapeContainer<HSLFShape> parent=this.getParent();
+ parent instanceof HSLFGroupShape;
+ parent = ((HSLFGroupShape)parent).getParent()) {
+ lst.add(0, (HSLFGroupShape)parent);
}
AffineTransform tx = new AffineTransform();
- for(ShapeGroup prnt : lst) {
+ for(HSLFGroupShape prnt : lst) {
Rectangle2D exterior = prnt.getAnchor2D();
Rectangle2D interior = prnt.getCoordinates();
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Slide.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Slide.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Slide.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Slide.java Sat Mar 7 23:35:40 2015
@@ -149,7 +149,7 @@ public final class Slide extends Sheet {
//initialize drawing group id
EscherDggRecord dgg = getSlideShow().getDocumentRecord().getPPDrawingGroup().getEscherDggRecord();
EscherContainerRecord dgContainer = (EscherContainerRecord)getSheetContainer().getPPDrawing().getEscherRecords()[0];
- EscherDgRecord dg = (EscherDgRecord) Shape.getEscherChild(dgContainer, EscherDgRecord.RECORD_ID);
+ EscherDgRecord dg = (EscherDgRecord) HSLFShape.getEscherChild(dgContainer, EscherDgRecord.RECORD_ID);
int dgId = dgg.getMaxDrawingGroupId() + 1;
dg.setOptions((short)(dgId << 4));
dgg.setDrawingsSaved(dgg.getDrawingsSaved() + 1);
@@ -428,7 +428,7 @@ public final class Slide extends Sheet {
if(bg != null)bg.draw(graphics);
if(getFollowMasterObjects()){
- Shape[] sh = master.getShapes();
+ HSLFShape[] sh = master.getShapes();
for (int i = 0; i < sh.length; i++) {
if(MasterSheet.isPlaceholder(sh[i])) continue;
@@ -436,7 +436,7 @@ public final class Slide extends Sheet {
}
}
- Shape[] sh = getShapes();
+ HSLFShape[] sh = getShapes();
for (int i = 0; i < sh.length; i++) {
sh[i].draw(graphics);
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Table.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Table.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Table.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Table.java Sat Mar 7 23:35:40 2015
@@ -30,7 +30,7 @@ import java.awt.*;
*
* @author Yegor Kozlov
*/
-public final class Table extends ShapeGroup {
+public final class Table extends HSLFGroupShape {
protected static final int BORDER_TOP = 1;
protected static final int BORDER_RIGHT = 2;
@@ -93,7 +93,7 @@ public final class Table extends ShapeGr
* @param escherRecord <code>EscherSpContainer</code> container which holds information about this shape
* @param parent the parent of the shape
*/
- public Table(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent) {
+ public Table(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent) {
super(escherRecord, parent);
}
@@ -150,9 +150,9 @@ public final class Table extends ShapeGr
}
protected void initTable(){
- List<Shape> shapeList = getShapeList();
- Collections.sort(shapeList, new Comparator<Shape>(){
- public int compare( Shape o1, Shape o2 ) {
+ List<HSLFShape> shapeList = getShapeList();
+ Collections.sort(shapeList, new Comparator<HSLFShape>(){
+ public int compare( HSLFShape o1, HSLFShape o2 ) {
Rectangle anchor1 = o1.getAnchor();
Rectangle anchor2 = o2.getAnchor();
int delta = anchor1.y - anchor2.y;
@@ -162,14 +162,14 @@ public final class Table extends ShapeGr
});
int y0 = -1;
int maxrowlen = 0;
- List<List<Shape>> lst = new ArrayList<List<Shape>>();
- List<Shape> row = null;
- for (Shape sh : shapeList) {
+ List<List<HSLFShape>> lst = new ArrayList<List<HSLFShape>>();
+ List<HSLFShape> row = null;
+ for (HSLFShape sh : shapeList) {
if(sh instanceof TextShape){
Rectangle anchor = sh.getAnchor();
if(anchor.y != y0){
y0 = anchor.y;
- row = new ArrayList<Shape>();
+ row = new ArrayList<HSLFShape>();
lst.add(row);
}
row.add(sh);
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TableCell.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TableCell.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TableCell.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TableCell.java Sat Mar 7 23:35:40 2015
@@ -45,7 +45,7 @@ public final class TableCell extends Tex
* @param escherRecord {@link EscherSpContainer} container which holds information about this shape
* @param parent the parent of the shape
*/
- protected TableCell(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent){
+ protected TableCell(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
super(escherRecord, parent);
}
@@ -55,7 +55,7 @@ public final class TableCell extends Tex
* @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 TableCell(ShapeContainer<Shape> parent){
+ public TableCell(ShapeContainer<HSLFShape> parent){
super(parent);
setShapeType(ShapeType.RECT);
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TextBox.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TextBox.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TextBox.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TextBox.java Sat Mar 7 23:35:40 2015
@@ -38,7 +38,7 @@ public class TextBox extends TextShape {
* @param escherRecord <code>EscherSpContainer</code> container which holds information about this shape
* @param parent the parent of the shape
*/
- protected TextBox(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent){
+ protected TextBox(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
super(escherRecord, parent);
}
@@ -49,7 +49,7 @@ public class TextBox extends TextShape {
* @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 TextBox(ShapeContainer<Shape> parent){
+ public TextBox(ShapeContainer<HSLFShape> parent){
super(parent);
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TextPainter.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TextPainter.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TextPainter.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TextPainter.java Sat Mar 7 23:35:40 2015
@@ -270,8 +270,8 @@ public final class TextPainter {
TextRulerAtom ruler = run.getTextRuler();
if(ruler != null) {
- int bullet_val = ruler.getBulletOffsets()[indent]*Shape.POINT_DPI/Shape.MASTER_DPI;
- int text_val = ruler.getTextOffsets()[indent]*Shape.POINT_DPI/Shape.MASTER_DPI;
+ int bullet_val = ruler.getBulletOffsets()[indent]*HSLFShape.POINT_DPI/HSLFShape.MASTER_DPI;
+ int text_val = ruler.getTextOffsets()[indent]*HSLFShape.POINT_DPI/HSLFShape.MASTER_DPI;
if(bullet_val > text_val){
int a = bullet_val;
bullet_val = text_val;
@@ -309,7 +309,7 @@ public final class TextPainter {
if(linespacing >= 0){
el.ascent = textLayout.getAscent()*linespacing/100;
} else {
- el.ascent = -linespacing*Shape.POINT_DPI/Shape.MASTER_DPI;
+ el.ascent = -linespacing*HSLFShape.POINT_DPI/HSLFShape.MASTER_DPI;
}
el._align = rt.getAlignment();
@@ -325,7 +325,7 @@ public final class TextPainter {
if(sp >= 0){
spaceBefore = lineHeight * sp/100;
} else {
- spaceBefore = -sp*Shape.POINT_DPI/Shape.MASTER_DPI;
+ spaceBefore = -sp*HSLFShape.POINT_DPI/HSLFShape.MASTER_DPI;
}
el.ascent += spaceBefore;
}
@@ -334,7 +334,7 @@ public final class TextPainter {
if(linespacing >= 0){
descent = (textLayout.getDescent() + textLayout.getLeading())*linespacing/100;
} else {
- descent = -linespacing*Shape.POINT_DPI/Shape.MASTER_DPI;
+ descent = -linespacing*HSLFShape.POINT_DPI/HSLFShape.MASTER_DPI;
}
if (prStart){
int sp = rt.getSpaceAfter();
@@ -342,7 +342,7 @@ public final class TextPainter {
if(sp >= 0){
spaceAfter = lineHeight * sp/100;
} else {
- spaceAfter = -sp*Shape.POINT_DPI/Shape.MASTER_DPI;
+ spaceAfter = -sp*HSLFShape.POINT_DPI/HSLFShape.MASTER_DPI;
}
el.ascent += spaceAfter;
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TextShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TextShape.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TextShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TextShape.java Sat Mar 7 23:35:40 2015
@@ -111,7 +111,7 @@ public abstract class TextShape extends
* @param escherRecord <code>EscherSpContainer</code> container which holds information about this shape
* @param parent the parent of the shape
*/
- protected TextShape(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent){
+ protected TextShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
super(escherRecord, parent);
}
@@ -122,9 +122,9 @@ public abstract class TextShape extends
* @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 TextShape(ShapeContainer<Shape> parent){
+ public TextShape(ShapeContainer<HSLFShape> parent){
super(null, parent);
- _escherContainer = createSpContainer(parent instanceof ShapeGroup);
+ _escherContainer = createSpContainer(parent instanceof HSLFGroupShape);
}
/**
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java Sat Mar 7 23:35:40 2015
@@ -20,7 +20,7 @@ package org.apache.poi.hslf.usermodel;
import java.awt.Color;
import org.apache.poi.hslf.model.MasterSheet;
-import org.apache.poi.hslf.model.Shape;
+import org.apache.poi.hslf.model.HSLFShape;
import org.apache.poi.hslf.model.Sheet;
import org.apache.poi.hslf.model.TextRun;
import org.apache.poi.hslf.model.textproperties.BitMaskTextProp;
@@ -618,28 +618,28 @@ public final class RichTextRun {
* Sets the bullet offset
*/
public void setBulletOffset(int offset) {
- setParaTextPropVal("bullet.offset", offset*Shape.MASTER_DPI/Shape.POINT_DPI);
+ setParaTextPropVal("bullet.offset", offset*HSLFShape.MASTER_DPI/HSLFShape.POINT_DPI);
}
/**
* Returns the bullet offset
*/
public int getBulletOffset() {
- return getParaTextPropVal("bullet.offset")*Shape.POINT_DPI/Shape.MASTER_DPI;
+ return getParaTextPropVal("bullet.offset")*HSLFShape.POINT_DPI/HSLFShape.MASTER_DPI;
}
/**
* Sets the text offset
*/
public void setTextOffset(int offset) {
- setParaTextPropVal("text.offset", offset*Shape.MASTER_DPI/Shape.POINT_DPI);
+ setParaTextPropVal("text.offset", offset*HSLFShape.MASTER_DPI/HSLFShape.POINT_DPI);
}
/**
* Returns the text offset
*/
public int getTextOffset() {
- return getParaTextPropVal("text.offset")*Shape.POINT_DPI/Shape.MASTER_DPI;
+ return getParaTextPropVal("text.offset")*HSLFShape.POINT_DPI/HSLFShape.MASTER_DPI;
}
/**
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java Sat Mar 7 23:35:40 2015
@@ -46,7 +46,7 @@ import org.apache.poi.hslf.model.MovieSh
import org.apache.poi.hslf.model.Notes;
import org.apache.poi.hslf.model.PPFont;
import org.apache.poi.hslf.model.Picture;
-import org.apache.poi.hslf.model.Shape;
+import org.apache.poi.hslf.model.HSLFShape;
import org.apache.poi.hslf.model.Slide;
import org.apache.poi.hslf.model.SlideMaster;
import org.apache.poi.hslf.model.TitleMaster;
@@ -532,8 +532,8 @@ public final class SlideShow {
*/
public Dimension getPageSize() {
DocumentAtom docatom = _documentRecord.getDocumentAtom();
- int pgx = (int) docatom.getSlideSizeX() * Shape.POINT_DPI / Shape.MASTER_DPI;
- int pgy = (int) docatom.getSlideSizeY() * Shape.POINT_DPI / Shape.MASTER_DPI;
+ int pgx = (int) docatom.getSlideSizeX() * HSLFShape.POINT_DPI / HSLFShape.MASTER_DPI;
+ int pgy = (int) docatom.getSlideSizeY() * HSLFShape.POINT_DPI / HSLFShape.MASTER_DPI;
return new Dimension(pgx, pgy);
}
@@ -545,8 +545,8 @@ public final class SlideShow {
*/
public void setPageSize(Dimension pgsize) {
DocumentAtom docatom = _documentRecord.getDocumentAtom();
- docatom.setSlideSizeX(pgsize.width * Shape.MASTER_DPI / Shape.POINT_DPI);
- docatom.setSlideSizeY(pgsize.height * Shape.MASTER_DPI / Shape.POINT_DPI);
+ docatom.setSlideSizeX(pgsize.width * HSLFShape.MASTER_DPI / HSLFShape.POINT_DPI);
+ docatom.setSlideSizeY(pgsize.height * HSLFShape.MASTER_DPI / HSLFShape.POINT_DPI);
}
/**
@@ -784,7 +784,7 @@ public final class SlideShow {
EscherContainerRecord bstore;
EscherContainerRecord dggContainer = _documentRecord.getPPDrawingGroup().getDggContainer();
- bstore = (EscherContainerRecord) Shape.getEscherChild(dggContainer,
+ bstore = (EscherContainerRecord) HSLFShape.getEscherChild(dggContainer,
EscherContainerRecord.BSTORE_CONTAINER);
if (bstore == null) {
bstore = new EscherContainerRecord();
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawAutoShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawAutoShape.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawAutoShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawAutoShape.java Sat Mar 7 23:35:40 2015
@@ -3,7 +3,7 @@ package org.apache.poi.sl.draw;
import org.apache.poi.sl.usermodel.*;
-public class DrawAutoShape<T extends AutoShape> extends DrawTextShape<T> {
+public class DrawAutoShape<T extends AutoShape<? extends TextParagraph>> extends DrawTextShape<T> {
public DrawAutoShape(T shape) {
super(shape);
}
Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawBackground.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawBackground.java?rev=1664935&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawBackground.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawBackground.java Sat Mar 7 23:35:40 2015
@@ -0,0 +1,41 @@
+package org.apache.poi.sl.draw;
+
+import java.awt.*;
+import java.awt.geom.Rectangle2D;
+
+import org.apache.poi.sl.usermodel.*;
+
+
+public class DrawBackground<T extends Background> extends DrawShape<T> {
+ public DrawBackground(T shape) {
+ super(shape);
+ }
+
+ public void draw(Graphics2D graphics) {
+ Dimension pg = shape.getSheet().getSlideShow().getPageSize();
+ final Rectangle2D anchor = new Rectangle2D.Double(0, 0, pg.getWidth(), pg.getHeight());
+
+ PlaceableShape ps = new PlaceableShape(){
+ public Rectangle2D getAnchor() { return anchor; }
+ public void setAnchor(Rectangle2D anchor) {}
+ public double getRotation() { return 0; }
+ public void setRotation(double theta) {}
+ public void setFlipHorizontal(boolean flip) {}
+ public void setFlipVertical(boolean flip) {}
+ public boolean getFlipHorizontal() { return false; }
+ public boolean getFlipVertical() { return false; }
+ };
+
+ DrawFactory drawFact = DrawFactory.getInstance(graphics);
+ DrawPaint dp = drawFact.getPaint(ps);
+ Paint fill = dp.getPaint(graphics, shape.getFillStyle().getPaint());
+ Rectangle2D anchor2 = getAnchor(graphics, anchor);
+
+ if(fill != null) {
+ graphics.setPaint(fill);
+ graphics.fill(anchor2);
+ }
+ }
+
+
+}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawFactory.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawFactory.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawFactory.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawFactory.java Sat Mar 7 23:35:40 2015
@@ -40,8 +40,13 @@ public class DrawFactory {
}
public static DrawFactory getInstance(Graphics2D graphics) {
- // first try to find the factory over the rendering hing
- DrawFactory factory = (DrawFactory)graphics.getRenderingHint(DRAW_FACTORY);
+ // first try to find the factory over the rendering hint
+ DrawFactory factory = null;
+ boolean isHint = false;
+ if (graphics != null) {
+ factory = (DrawFactory)graphics.getRenderingHint(DRAW_FACTORY);
+ isHint = true;
+ }
// secondly try the thread local default
if (factory == null) {
factory = defaultFactory.get();
@@ -49,43 +54,78 @@ public class DrawFactory {
// and at last, use the default factory
if (factory == null) {
factory = new DrawFactory();
+ }
+ if (graphics != null && !isHint) {
graphics.setRenderingHint(DRAW_FACTORY, factory);
}
return factory;
}
- public Drawable getDrawable(Sheet sheet) {
- return new DrawSheet(sheet);
- }
-
- public Drawable getDrawable(MasterSheet sheet) {
- return new DrawMasterSheet(sheet);
- }
-
@SuppressWarnings("unchecked")
public Drawable getDrawable(Shape shape) {
if (shape instanceof TextBox) {
- return getDrawable((TextBox)shape);
+ return getDrawable((TextBox<? extends TextParagraph<? extends TextRun>>)shape);
} else if (shape instanceof FreeformShape) {
- return getDrawable((FreeformShape)shape);
+ return getDrawable((FreeformShape<? extends TextParagraph<? extends TextRun>>)shape);
+ } else if (shape instanceof TextShape) {
+ return getDrawable((TextShape<? extends TextParagraph<? extends TextRun>>)shape);
+ } else if (shape instanceof ShapeGroup) {
+ return getDrawable((ShapeGroup<? extends Shape>)shape);
+ } else if (shape instanceof PictureShape) {
+ return getDrawable((PictureShape)shape);
+ } else if (shape instanceof Background) {
+ return getDrawable((Background)shape);
+ } else if (shape instanceof Slide) {
+ return getDrawable((Slide<? extends Shape>)shape);
+ } else if (shape instanceof MasterSheet) {
+ return getDrawable((MasterSheet<? extends Shape>)shape);
+ } else if (shape instanceof Sheet) {
+ return getDrawable((Sheet<? extends Shape>)shape);
}
throw new IllegalArgumentException("Unsupported shape type: "+shape.getClass());
}
- public <T extends TextBox> DrawTextBox<T> getDrawable(T shape) {
+ public <T extends Slide<? extends Shape>> DrawSlide<T> getDrawable(T sheet) {
+ return new DrawSlide<T>(sheet);
+ }
+
+ public <T extends Sheet<? extends Shape>> DrawSheet<T> getDrawable(T sheet) {
+ return new DrawSheet<T>(sheet);
+ }
+
+ public <T extends MasterSheet<? extends Shape>> DrawMasterSheet<T> getDrawable(T sheet) {
+ return new DrawMasterSheet<T>(sheet);
+ }
+
+ public <T extends TextBox<? extends TextParagraph<?>>> DrawTextBox<T> getDrawable(T shape) {
return new DrawTextBox<T>(shape);
}
- public <T extends FreeformShape> DrawFreeformShape<T> getDrawable(T shape) {
+ public <T extends FreeformShape<? extends TextParagraph<? extends TextRun>>> DrawFreeformShape<T> getDrawable(T shape) {
return new DrawFreeformShape<T>(shape);
}
+ public <T extends TextShape<? extends TextParagraph<? extends TextRun>>> DrawTextShape<T> getDrawable(T shape) {
+ return new DrawTextShape<T>(shape);
+ }
+
+ public <T extends ShapeGroup<? extends Shape>> DrawShapeGroup<T> getDrawable(T shape) {
+ return new DrawShapeGroup<T>(shape);
+ }
- public DrawTextParagraph getDrawable(TextParagraph paragraph) {
- return new DrawTextParagraph(paragraph);
+ public <T extends PictureShape> DrawPictureShape<T> getDrawable(T shape) {
+ return new DrawPictureShape<T>(shape);
+ }
+
+ public <T extends TextRun> DrawTextParagraph<T> getDrawable(TextParagraph<T> paragraph) {
+ return new DrawTextParagraph<T>(paragraph);
}
+ public <T extends Background> DrawBackground<T> getDrawable(T shape) {
+ return new DrawBackground<T>(shape);
+ }
+
public DrawTextFragment getTextFragment(TextLayout layout, AttributedString str) {
return new DrawTextFragment(layout, str);
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawFreeformShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawFreeformShape.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawFreeformShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawFreeformShape.java Sat Mar 7 23:35:40 2015
@@ -2,7 +2,7 @@ package org.apache.poi.sl.draw;
import org.apache.poi.sl.usermodel.*;
-public class DrawFreeformShape<T extends FreeformShape> extends DrawAutoShape<T> {
+public class DrawFreeformShape<T extends FreeformShape<? extends TextParagraph<? extends TextRun>>> extends DrawAutoShape<T> {
public DrawFreeformShape(T shape) {
super(shape);
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawMasterSheet.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawMasterSheet.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawMasterSheet.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawMasterSheet.java Sat Mar 7 23:35:40 2015
@@ -1,12 +1,11 @@
package org.apache.poi.sl.draw;
-import org.apache.poi.sl.usermodel.MasterSheet;
-import org.apache.poi.sl.usermodel.Shape;
+import org.apache.poi.sl.usermodel.*;
-public class DrawMasterSheet extends DrawSheet {
+public class DrawMasterSheet<T extends MasterSheet<? extends Shape>> extends DrawSheet<T> {
- public DrawMasterSheet(MasterSheet sheet) {
+ public DrawMasterSheet(T sheet) {
super(sheet);
}
@@ -17,6 +16,6 @@ public class DrawMasterSheet extends Dra
* for instance, slide masters and layouts don't display placeholders
*/
protected boolean canDraw(Shape shape){
- return !shape.isPlaceholder();
+ return !(shape instanceof SimpleShape) || !((SimpleShape)shape).isPlaceholder();
}
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawPaint.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawPaint.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawPaint.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawPaint.java Sat Mar 7 23:35:40 2015
@@ -27,8 +27,9 @@ import java.io.IOException;
import java.io.InputStream;
import org.apache.poi.sl.usermodel.*;
-import org.apache.poi.sl.usermodel.GradientPaint;
-import org.apache.poi.sl.usermodel.TexturePaint;
+import org.apache.poi.sl.usermodel.PaintStyle.GradientPaint;
+import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint;
+import org.apache.poi.sl.usermodel.PaintStyle.TexturePaint;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
@@ -142,7 +143,6 @@ public class DrawPaint {
float red,green,blue;
- Color color;
if (lumOff > 0) {
float flumOff = lumOff / 100000.f;
red = (255.f - r) * (1.f - flumOff) + r;
@@ -150,9 +150,9 @@ public class DrawPaint {
blue = (255.f - b) * flumOff + b;
} else {
float flumMod = lumMod / 100000.f;
- red = r * lumMod;
- green = g * lumMod;
- blue = b * lumMod;
+ red = r * flumMod;
+ green = g * flumMod;
+ blue = b * flumMod;
}
return new Color(Math.round(red), Math.round(green), Math.round(blue), c.getAlpha());
}
Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawPictureShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawPictureShape.java?rev=1664935&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawPictureShape.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawPictureShape.java Sat Mar 7 23:35:40 2015
@@ -0,0 +1,37 @@
+package org.apache.poi.sl.draw;
+
+import java.awt.Graphics2D;
+import java.awt.Insets;
+import java.awt.geom.Rectangle2D;
+import java.io.IOException;
+
+import org.apache.poi.sl.usermodel.PictureData;
+import org.apache.poi.sl.usermodel.PictureShape;
+
+
+public class DrawPictureShape<T extends PictureShape> extends DrawSimpleShape<T> {
+ public DrawPictureShape(T shape) {
+ super(shape);
+ }
+
+ @Override
+ public void drawContent(Graphics2D graphics) {
+ PictureData data = shape.getPictureData();
+ if(data == null) return;
+
+ ImageRenderer renderer = (ImageRenderer)graphics.getRenderingHint(Drawable.IMAGE_RENDERER);
+ if (renderer == null) renderer = new ImageRenderer();
+
+ Rectangle2D anchor = getAnchor(graphics, shape);
+
+ Insets insets = shape.getClipping();
+
+ try {
+ renderer.loadImage(data.getData(), data.getContentType());
+ renderer.drawImage(graphics, anchor, insets);
+ } catch (IOException e) {
+ // TODO: draw specific runtime exception?
+ throw new RuntimeException(e);
+ }
+ }
+}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawShape.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawShape.java Sat Mar 7 23:35:40 2015
@@ -22,14 +22,17 @@ public class DrawShape<T extends Shape>
* @param graphics the graphics whos transform matrix will be modified
*/
public void applyTransform(Graphics2D graphics) {
- Rectangle2D anchor = shape.getAnchor();
+ if (!(shape instanceof PlaceableShape)) return;
+
+ PlaceableShape ps = (PlaceableShape)shape;
+ Rectangle2D anchor = ps.getAnchor();
AffineTransform tx = (AffineTransform)graphics.getRenderingHint(Drawable.GROUP_TRANSFORM);
if(tx != null) {
anchor = tx.createTransformedShape(anchor).getBounds2D();
}
// rotation
- double rotation = shape.getRotation();
+ double rotation = ps.getRotation();
if (rotation != 0.) {
// PowerPoint rotates shapes relative to the geometric center
double centerX = anchor.getCenterX();
@@ -59,7 +62,7 @@ public class DrawShape<T extends Shape>
txs.rotate(Math.toRadians(-quadrant*90));
txs.translate(-centerX, -centerY);
txg.concatenate(txs);
- Rectangle2D anchor2 = txg.createTransformedShape(shape.getAnchor()).getBounds2D();
+ Rectangle2D anchor2 = txg.createTransformedShape(ps.getAnchor()).getBounds2D();
scaleX = anchor.getWidth() == 0. ? 1.0 : anchor.getWidth() / anchor2.getWidth();
scaleY = anchor.getHeight() == 0. ? 1.0 : anchor.getHeight() / anchor2.getHeight();
}
@@ -73,14 +76,14 @@ public class DrawShape<T extends Shape>
}
//flip horizontal
- if (shape.getFlipHorizontal()) {
+ if (ps.getFlipHorizontal()) {
graphics.translate(anchor.getX() + anchor.getWidth(), anchor.getY());
graphics.scale(-1, 1);
graphics.translate(-anchor.getX(), -anchor.getY());
}
//flip vertical
- if (shape.getFlipVertical()) {
+ if (ps.getFlipVertical()) {
graphics.translate(anchor.getX(), anchor.getY() + anchor.getHeight());
graphics.scale(1, -1);
graphics.translate(-anchor.getX(), -anchor.getY());
@@ -93,9 +96,12 @@ public class DrawShape<T extends Shape>
public void drawContent(Graphics2D context) {
}
-
+
public static Rectangle2D getAnchor(Graphics2D graphics, PlaceableShape shape) {
- Rectangle2D anchor = shape.getAnchor();
+ return getAnchor(graphics, shape.getAnchor());
+ }
+
+ public static Rectangle2D getAnchor(Graphics2D graphics, Rectangle2D anchor) {
if(graphics == null) {
return anchor;
}
Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawShapeGroup.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawShapeGroup.java?rev=1664935&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawShapeGroup.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawShapeGroup.java Sat Mar 7 23:35:40 2015
@@ -0,0 +1,60 @@
+package org.apache.poi.sl.draw;
+
+import java.awt.Graphics2D;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Rectangle2D;
+
+import org.apache.poi.sl.usermodel.*;
+
+
+public class DrawShapeGroup<T extends ShapeGroup<? extends Shape>> implements Drawable {
+
+ protected final T shape;
+
+ public DrawShapeGroup(T shape) {
+ this.shape = shape;
+ }
+
+ public void applyTransform(Graphics2D context) {
+ }
+
+ public void draw(Graphics2D graphics) {
+
+ // the coordinate system of this group of shape
+ Rectangle2D interior = shape.getInteriorAnchor();
+ // anchor of this group relative to the parent shape
+ Rectangle2D exterior = shape.getAnchor();
+
+ AffineTransform tx = (AffineTransform)graphics.getRenderingHint(Drawable.GROUP_TRANSFORM);
+ AffineTransform tx0 = new AffineTransform(tx);
+
+ double scaleX = interior.getWidth() == 0. ? 1.0 : exterior.getWidth() / interior.getWidth();
+ double scaleY = interior.getHeight() == 0. ? 1.0 : exterior.getHeight() / interior.getHeight();
+
+ tx.translate(exterior.getX(), exterior.getY());
+ tx.scale(scaleX, scaleY);
+ tx.translate(-interior.getX(), -interior.getY());
+
+ DrawFactory drawFact = DrawFactory.getInstance(graphics);
+
+ for (Shape child : shape) {
+ // remember the initial transform and restore it after we are done with the drawing
+ AffineTransform at = graphics.getTransform();
+ graphics.setRenderingHint(Drawable.GSAVE, true);
+
+ Drawable draw = drawFact.getDrawable(child);
+ draw.applyTransform(graphics);
+ draw.draw(graphics);
+
+ // restore the coordinate system
+ graphics.setTransform(at);
+ graphics.setRenderingHint(Drawable.GRESTORE, true);
+ }
+
+ graphics.setRenderingHint(Drawable.GROUP_TRANSFORM, tx0);
+
+ }
+
+ public void drawContent(Graphics2D context) {
+ }
+}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawSheet.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawSheet.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawSheet.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawSheet.java Sat Mar 7 23:35:40 2015
@@ -3,16 +3,14 @@ package org.apache.poi.sl.draw;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
-import org.apache.poi.sl.usermodel.MasterSheet;
-import org.apache.poi.sl.usermodel.Shape;
-import org.apache.poi.sl.usermodel.Sheet;
+import org.apache.poi.sl.usermodel.*;
-public class DrawSheet implements Drawable {
+public class DrawSheet<T extends Sheet<? extends Shape>> implements Drawable {
- protected final Sheet sheet;
+ protected final T sheet;
- public DrawSheet(Sheet sheet) {
+ public DrawSheet(T sheet) {
this.sheet = sheet;
}
@@ -23,7 +21,7 @@ public class DrawSheet implements Drawab
public void draw(Graphics2D graphics) {
DrawFactory drawFact = DrawFactory.getInstance(graphics);
- MasterSheet master = sheet.getMasterSheet();
+ MasterSheet<? extends Shape> master = sheet.getMasterSheet();
if(sheet.getFollowMasterGraphics() && master != null) {
Drawable drawer = drawFact.getDrawable(master);
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawSimpleShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawSimpleShape.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawSimpleShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawSimpleShape.java Sat Mar 7 23:35:40 2015
@@ -17,6 +17,7 @@ import org.apache.poi.sl.draw.binding.CT
import org.apache.poi.sl.draw.geom.*;
import org.apache.poi.sl.usermodel.*;
import org.apache.poi.sl.usermodel.LineDecoration.DecorationSize;
+import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint;
import org.apache.poi.sl.usermodel.StrokeStyle.LineDash;
import org.apache.poi.util.Units;
@@ -257,6 +258,9 @@ public class DrawSimpleShape<T extends S
Shadow shadow = shape.getShadow();
if (shadow == null || (fill == null && line == null)) return;
+ SolidPaint shadowPaint = shadow.getFillStyle();
+ Color shadowColor = DrawPaint.applyColorTransform(shadowPaint.getSolidColor());
+
double shapeRotation = shape.getRotation();
if(shape.getFlipVertical()) {
shapeRotation += 180;
@@ -272,12 +276,11 @@ public class DrawSimpleShape<T extends S
java.awt.Shape s = o.getOutline();
Path p = o.getPath();
graphics.setRenderingHint(Drawable.GRADIENT_SHAPE, s);
+ graphics.setPaint(shadowColor);
if(fill != null && p.isFilled()){
- graphics.setPaint(fill);
graphics.fill(s);
} else if (line != null && p.isStroked()) {
- graphics.setPaint(line);
graphics.draw(s);
}
}
Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawSlide.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawSlide.java?rev=1664935&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawSlide.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawSlide.java Sat Mar 7 23:35:40 2015
@@ -0,0 +1,24 @@
+package org.apache.poi.sl.draw;
+
+import java.awt.Graphics2D;
+
+import org.apache.poi.sl.usermodel.*;
+
+
+public class DrawSlide<T extends Slide<? extends Shape>> extends DrawSheet<T> {
+
+ public DrawSlide(T slide) {
+ super(slide);
+ }
+
+ public void draw(Graphics2D graphics) {
+ Background bg = sheet.getBackground();
+ if(bg != null) {
+ DrawFactory drawFact = DrawFactory.getInstance(graphics);
+ DrawBackground<Background> db = drawFact.getDrawable(bg);
+ db.draw(graphics);
+ }
+
+ super.draw(graphics);
+ }
+}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawTextBox.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawTextBox.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawTextBox.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawTextBox.java Sat Mar 7 23:35:40 2015
@@ -2,7 +2,7 @@ package org.apache.poi.sl.draw;
import org.apache.poi.sl.usermodel.*;
-public class DrawTextBox<T extends TextBox> extends DrawAutoShape<T> {
+public class DrawTextBox<T extends TextBox<? extends TextParagraph<? extends TextRun>>> extends DrawAutoShape<T> {
public DrawTextBox(T shape) {
super(shape);
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawTextParagraph.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawTextParagraph.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawTextParagraph.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawTextParagraph.java Sat Mar 7 23:35:40 2015
@@ -13,8 +13,8 @@ import org.apache.poi.sl.usermodel.TextP
import org.apache.poi.sl.usermodel.TextRun.TextCap;
import org.apache.poi.sl.usermodel.TextParagraph.TextAlign;
-public class DrawTextParagraph implements Drawable {
- protected TextParagraph paragraph;
+public class DrawTextParagraph<T extends TextRun> implements Drawable {
+ protected TextParagraph<T> paragraph;
double x, y;
protected Insets2D insets = new Insets2D(0,0,0,0);
protected List<DrawTextFragment> lines = new ArrayList<DrawTextFragment>();
@@ -26,7 +26,7 @@ public class DrawTextParagraph implement
*/
protected double maxLineHeight;
- public DrawTextParagraph(TextParagraph paragraph) {
+ public DrawTextParagraph(TextParagraph<T> paragraph) {
this.paragraph = paragraph;
}
@@ -275,7 +275,7 @@ public class DrawTextParagraph implement
double indent = paragraph.getIndent();
double width;
- TextShape ts = paragraph.getParentShape();
+ TextShape<? extends TextParagraph<T>> ts = paragraph.getParentShape();
if (!ts.getWordWrap()) {
// if wordWrap == false then we return the advance to the right border of the sheet
width = ts.getSheet().getSlideShow().getPageSize().getWidth() - anchor.getX();
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawTextShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawTextShape.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawTextShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawTextShape.java Sat Mar 7 23:35:40 2015
@@ -8,7 +8,7 @@ import java.util.Iterator;
import org.apache.poi.sl.usermodel.*;
-public class DrawTextShape<T extends TextShape> extends DrawSimpleShape<T> {
+public class DrawTextShape<T extends TextShape<? extends TextParagraph>> extends DrawSimpleShape<T> {
public DrawTextShape(T shape) {
super(shape);
@@ -84,7 +84,7 @@ public class DrawTextShape<T extends Tex
Insets2D shapePadding = shape.getInsets();
double y0 = y;
- Iterator<TextParagraph> paragraphs = shape.iterator();
+ Iterator<? extends TextParagraph> paragraphs = shape.iterator();
boolean isFirstLine = true;
while (paragraphs.hasNext()){
@@ -129,12 +129,10 @@ public class DrawTextShape<T extends Tex
/**
* Compute the cumulative height occupied by the text
*/
- protected double getTextHeight(){
+ public double getTextHeight(){
// 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();
return drawParagraphs(graphics, 0, 0);
}
-
-
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/ImageRenderer.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/ImageRenderer.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/ImageRenderer.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/ImageRenderer.java Sat Mar 7 23:35:40 2015
@@ -23,8 +23,7 @@ import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.awt.image.RescaleOp;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
import javax.imageio.ImageIO;
@@ -74,6 +73,17 @@ public class ImageRenderer {
}
/**
+ * Load and buffer the image
+ *
+ * @param data the raw image stream
+ * @param contentType the content type
+ */
+ public void loadImage(byte data[], String contentType) throws IOException {
+ img = ImageIO.read(new ByteArrayInputStream(data));
+ }
+
+
+ /**
* @return the buffered image
*/
public BufferedImage getImage() {
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/AutoShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/AutoShape.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/AutoShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/AutoShape.java Sat Mar 7 23:35:40 2015
@@ -17,6 +17,5 @@
package org.apache.poi.sl.usermodel;
-public interface AutoShape extends TextShape {
- public TextRun getTextRun();
+public interface AutoShape<T extends TextParagraph> extends TextShape<T> {
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Background.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Background.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Background.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Background.java Sat Mar 7 23:35:40 2015
@@ -18,5 +18,5 @@
package org.apache.poi.sl.usermodel;
public interface Background extends Shape {
-
+ FillStyle getFillStyle();
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/FreeformShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/FreeformShape.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/FreeformShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/FreeformShape.java Sat Mar 7 23:35:40 2015
@@ -17,6 +17,6 @@
package org.apache.poi.sl.usermodel;
-public interface FreeformShape extends AutoShape {
+public interface FreeformShape<T extends TextParagraph> extends AutoShape<T> {
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/MasterSheet.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/MasterSheet.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/MasterSheet.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/MasterSheet.java Sat Mar 7 23:35:40 2015
@@ -17,6 +17,6 @@
package org.apache.poi.sl.usermodel;
-public interface MasterSheet extends Sheet {
+public interface MasterSheet<T extends Shape> extends Sheet<T> {
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Notes.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Notes.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Notes.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Notes.java Sat Mar 7 23:35:40 2015
@@ -17,6 +17,6 @@
package org.apache.poi.sl.usermodel;
-public interface Notes extends Sheet {
+public interface Notes<T extends Shape> extends Sheet<T> {
public TextRun getTextRun();
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PaintStyle.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PaintStyle.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PaintStyle.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PaintStyle.java Sat Mar 7 23:35:40 2015
@@ -17,9 +17,42 @@
package org.apache.poi.sl.usermodel;
+import java.io.InputStream;
+
public interface PaintStyle {
+ public interface SolidPaint extends PaintStyle {
+ ColorStyle getSolidColor();
+ }
+ public interface GradientPaint extends PaintStyle {
+ enum GradientType { linear, circular, shape }
+
+ /**
+ * @return the angle of the gradient
+ */
+ double getGradientAngle();
+ ColorStyle[] getGradientColors();
+ float[] getGradientFractions();
+ boolean isRotatedWithShape();
+ GradientType getGradientType();
+ }
+ public interface TexturePaint extends PaintStyle {
+ /**
+ * @return the raw image stream
+ */
+ InputStream getImageData();
+
+ /**
+ * @return the content type of the image data
+ */
+ String getContentType();
+
+ /**
+ * @return the alpha mask in percents [0..100000]
+ */
+ int getAlpha();
+ }
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PictureData.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PictureData.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PictureData.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PictureData.java Sat Mar 7 23:35:40 2015
@@ -17,10 +17,11 @@
package org.apache.poi.sl.usermodel;
+import java.io.IOException;
+
public interface PictureData {
- public int getType();
- public byte[] getUID();
+ public String getContentType();
public byte[] getData();
- public void setData(byte[] data);
+ public void setData(byte[] data) throws IOException;
}
Copied: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PictureShape.java (from r1662967, poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Picture.java)
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PictureShape.java?p2=poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PictureShape.java&p1=poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Picture.java&r1=1662967&r2=1664935&rev=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Picture.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PictureShape.java Sat Mar 7 23:35:40 2015
@@ -17,6 +17,13 @@
package org.apache.poi.sl.usermodel;
-public interface Picture extends SimpleShape {
- public PictureData getPictureData();
+import java.awt.Insets;
+
+public interface PictureShape extends SimpleShape {
+ PictureData getPictureData();
+
+ /**
+ * @return the clipping rectangle, which is given in percent in relation to the image width/height
+ */
+ Insets getClipping();
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PlaceableShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PlaceableShape.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PlaceableShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PlaceableShape.java Sat Mar 7 23:35:40 2015
@@ -20,11 +20,17 @@ package org.apache.poi.sl.usermodel;
import java.awt.geom.Rectangle2D;
public interface PlaceableShape {
+ /**
+ * @return the position of this shape within the drawing canvas.
+ * The coordinates are expressed in points
+ */
Rectangle2D getAnchor();
- FillStyle getFillStyle();
-
- StrokeStyle getStrokeStyle();
+ /**
+ * @param anchor the position of this shape within the drawing canvas.
+ * The coordinates are expressed in points
+ */
+ void setAnchor(Rectangle2D anchor);
/**
* Rotation angle in degrees
@@ -36,4 +42,41 @@ public interface PlaceableShape {
* @return rotation angle in degrees
*/
double getRotation();
+
+ /**
+ * Rotate this shape.
+ * <p>
+ * Positive angles are clockwise (i.e., towards the positive y axis);
+ * negative angles are counter-clockwise (i.e., towards the negative y axis).
+ * </p>
+ *
+ * @param theta the rotation angle in degrees.
+ */
+ void setRotation(double theta);
+
+ /**
+ * @param flip whether the shape is horizontally flipped
+ */
+ void setFlipHorizontal(boolean flip);
+
+ /**
+ * Whether the shape is vertically flipped
+ *
+ * @param flip whether the shape is vertically flipped
+ */
+ void setFlipVertical(boolean flip);
+
+ /**
+ * Whether the shape is horizontally flipped
+ *
+ * @return whether the shape is horizontally flipped
+ */
+ boolean getFlipHorizontal();
+
+ /**
+ * Whether the shape is vertically flipped
+ *
+ * @return whether the shape is vertically flipped
+ */
+ boolean getFlipVertical();
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Shadow.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Shadow.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Shadow.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Shadow.java Sat Mar 7 23:35:40 2015
@@ -17,10 +17,13 @@
package org.apache.poi.sl.usermodel;
-import java.awt.Color;
+import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint;
+
public interface Shadow {
+ SimpleShape getShadowParent();
+
/**
* @return the offset of this shadow in points
*/
@@ -43,5 +46,5 @@ public interface Shadow {
* @return the color of this shadow.
* Depending whether the parent shape is filled or stroked, this color is used to fill or stroke this shadow
*/
- Color getColor();
+ SolidPaint getFillStyle();
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Shape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Shape.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Shape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Shape.java Sat Mar 7 23:35:40 2015
@@ -17,63 +17,16 @@
package org.apache.poi.sl.usermodel;
-import java.awt.geom.Rectangle2D;
-
-import org.apache.poi.sl.draw.geom.CustomGeometry;
-
-public interface Shape extends PlaceableShape {
- CustomGeometry getGeometry();
-
- ShapeType getShapeType();
-
- void setAnchor(Rectangle2D anchor);
+public interface Shape {
ShapeContainer getParent();
- boolean isPlaceholder();
-
/**
*
* @return the sheet this shape belongs to
*/
Sheet getSheet();
- /**
- * Rotate this shape.
- * <p>
- * Positive angles are clockwise (i.e., towards the positive y axis);
- * negative angles are counter-clockwise (i.e., towards the negative y axis).
- * </p>
- *
- * @param theta the rotation angle in degrees.
- */
- void setRotation(double theta);
-
- /**
- * @param flip whether the shape is horizontally flipped
- */
- void setFlipHorizontal(boolean flip);
-
- /**
- * Whether the shape is vertically flipped
- *
- * @param flip whether the shape is vertically flipped
- */
- void setFlipVertical(boolean flip);
-
- /**
- * Whether the shape is horizontally flipped
- *
- * @return whether the shape is horizontally flipped
- */
- boolean getFlipHorizontal();
-
- /**
- * Whether the shape is vertically flipped
- *
- * @return whether the shape is vertically flipped
- */
- boolean getFlipVertical();
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeContainer.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeContainer.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeContainer.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeContainer.java Sat Mar 7 23:35:40 2015
@@ -18,7 +18,7 @@
package org.apache.poi.sl.usermodel;
-public interface ShapeContainer extends Iterable<Shape>, PlaceableShape {
+public interface ShapeContainer<T extends Shape> extends Iterable<T> {
/**
* Returns an array containing all of the elements in this container in proper
* sequence (from first to last element).
@@ -26,9 +26,9 @@ public interface ShapeContainer extends
* @return an array containing all of the elements in this container in proper
* sequence
*/
- public Shape[] getShapes();
+ public T[] getShapes();
- public void addShape(Shape shape);
+ public void addShape(T shape);
/**
* Removes the specified shape from this sheet, if it is present
@@ -40,5 +40,5 @@ public interface ShapeContainer extends
* @throws IllegalArgumentException if the type of the specified shape
* is incompatible with this sheet (optional)
*/
- public boolean removeShape(Shape shape);
+ public boolean removeShape(T shape);
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeGroup.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeGroup.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeGroup.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeGroup.java Sat Mar 7 23:35:40 2015
@@ -17,6 +17,8 @@
package org.apache.poi.sl.usermodel;
-public interface ShapeGroup extends ShapeContainer {
+import java.awt.geom.Rectangle2D;
+public interface ShapeGroup<T extends Shape> extends ShapeContainer<T>, PlaceableShape {
+ Rectangle2D getInteriorAnchor();
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Sheet.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Sheet.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Sheet.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Sheet.java Sat Mar 7 23:35:40 2015
@@ -21,7 +21,7 @@ package org.apache.poi.sl.usermodel;
/**
* Common parent of Slides, Notes and Masters
*/
-public interface Sheet extends ShapeContainer {
+public interface Sheet<T extends Shape> extends ShapeContainer<T> {
SlideShow getSlideShow();
/**
@@ -31,7 +31,7 @@ public interface Sheet extends ShapeCont
*/
boolean getFollowMasterGraphics();
- MasterSheet getMasterSheet();
+ MasterSheet<T> getMasterSheet();
Background getBackground();
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/SimpleShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/SimpleShape.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/SimpleShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/SimpleShape.java Sat Mar 7 23:35:40 2015
@@ -17,14 +17,20 @@
package org.apache.poi.sl.usermodel;
+import org.apache.poi.sl.draw.geom.CustomGeometry;
import org.apache.poi.sl.draw.geom.IAdjustableShape;
-public interface SimpleShape extends Shape, IAdjustableShape {
- StrokeStyle getStrokeStyle();
+public interface SimpleShape extends Shape, IAdjustableShape, PlaceableShape {
+ FillStyle getFillStyle();
+ LineDecoration getLineDecoration();
+ StrokeStyle getStrokeStyle();
+
+ CustomGeometry getGeometry();
+
+ ShapeType getShapeType();
+
+ boolean isPlaceholder();
+
Shadow getShadow();
- LineDecoration getLineDecoration();
-
- Hyperlink getHyperlink();
- void setHyperlink(Hyperlink hyperlink);
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Slide.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Slide.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Slide.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Slide.java Sat Mar 7 23:35:40 2015
@@ -17,9 +17,9 @@
package org.apache.poi.sl.usermodel;
-public interface Slide extends Sheet {
- public Notes getNotes();
- public void setNotes(Notes notes);
+public interface Slide<T extends Shape> extends Sheet<T> {
+ public Notes<T> getNotes();
+ public void setNotes(Notes<T> notes);
public boolean getFollowMasterBackground();
public void setFollowMasterBackground(boolean follow);
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextBox.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextBox.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextBox.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextBox.java Sat Mar 7 23:35:40 2015
@@ -17,5 +17,5 @@
package org.apache.poi.sl.usermodel;
-public interface TextBox extends AutoShape {
+public interface TextBox<T extends TextParagraph> extends AutoShape<T> {
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextParagraph.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextParagraph.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextParagraph.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextParagraph.java Sat Mar 7 23:35:40 2015
@@ -20,7 +20,7 @@ package org.apache.poi.sl.usermodel;
import java.awt.Color;
-public interface TextParagraph extends Iterable<TextRun> {
+public interface TextParagraph<T extends TextRun> extends Iterable<T> {
/**
* Specified a list of text alignment types
*/
@@ -128,5 +128,5 @@ public interface TextParagraph extends I
*/
BulletStyle getBulletStyle();
- TextShape getParentShape();
+ TextShape<? extends TextParagraph<T>> getParentShape();
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextShape.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextShape.java Sat Mar 7 23:35:40 2015
@@ -19,7 +19,7 @@ package org.apache.poi.sl.usermodel;
-public interface TextShape extends SimpleShape, Iterable<TextParagraph> {
+public interface TextShape<T extends TextParagraph<?>> extends SimpleShape, Iterable<T> {
/**
* Vertical Text Types
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org