You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2015/02/21 11:56:06 UTC

svn commit: r1661322 [4/14] - in /poi/branches/common_sl: ./ src/examples/src/org/apache/poi/hslf/examples/ src/examples/src/org/apache/poi/xslf/usermodel/ src/java/org/apache/poi/common/usermodel/ src/java/org/apache/poi/hssf/usermodel/ src/java/org/a...

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java Sat Feb 21 10:56:03 2015
@@ -34,6 +34,8 @@ 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.sl.usermodel.ShapeContainer;
+import org.apache.poi.sl.usermodel.ShapeType;
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.StringUtil;
 
@@ -63,7 +65,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, Shape parent){
+     protected ActiveXShape(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent){
         super(escherRecord, parent);
     }
 
@@ -78,7 +80,7 @@ public final class ActiveXShape extends
         EscherSpRecord spRecord = _escherContainer.getChildById(EscherSpRecord.RECORD_ID);
         spRecord.setFlags(EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE | EscherSpRecord.FLAG_OLESHAPE);
 
-        setShapeType(ShapeTypes.HostControl);
+        setShapeType(ShapeType.HOST_CONTROL);
         setEscherProperty(EscherProperties.BLIP__PICTUREID, idx);
         setEscherProperty(EscherProperties.LINESTYLE__COLOR, 0x8000001);
         setEscherProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x80008);

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/AutoShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/AutoShape.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/AutoShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/AutoShape.java Sat Feb 21 10:56:03 2015
@@ -18,6 +18,8 @@
 package org.apache.poi.hslf.model;
 
 import org.apache.poi.ddf.*;
+import org.apache.poi.sl.usermodel.ShapeContainer;
+import org.apache.poi.sl.usermodel.ShapeType;
 import org.apache.poi.util.POILogger;
 
 import java.awt.geom.Rectangle2D;
@@ -33,20 +35,20 @@ import java.awt.geom.Rectangle2D;
  */
 public class AutoShape extends TextShape {
 
-    protected AutoShape(EscherContainerRecord escherRecord, Shape parent){
+    protected AutoShape(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent){
         super(escherRecord, parent);
     }
 
-    public AutoShape(int type, Shape parent){
+    public AutoShape(ShapeType type, ShapeContainer<Shape> parent){
         super(null, parent);
         _escherContainer = createSpContainer(type, parent instanceof ShapeGroup);
     }
 
-    public AutoShape(int type){
+    public AutoShape(ShapeType type){
         this(type, null);
     }
 
-    protected EscherContainerRecord createSpContainer(int shapeType, boolean isChild){
+    protected EscherContainerRecord createSpContainer(ShapeType shapeType, boolean isChild){
         _escherContainer = super.createSpContainer(isChild);
 
         setShapeType(shapeType);
@@ -110,7 +112,7 @@ public class AutoShape extends TextShape
         ShapeOutline outline = AutoShapes.getShapeOutline(getShapeType());
         Rectangle2D anchor = getLogicalAnchor2D();
         if(outline == null){
-            logger.log(POILogger.WARN, "Outline not found for " + ShapeTypes.typeName(getShapeType()));
+            logger.log(POILogger.WARN, "Outline not found for " + getShapeType().nativeName);
             return anchor;
         }
         java.awt.Shape shape = outline.getOutline(this);

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/AutoShapes.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/AutoShapes.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/AutoShapes.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/AutoShapes.java Sat Feb 21 10:56:03 2015
@@ -26,6 +26,7 @@ import java.awt.geom.Rectangle2D;
 import java.awt.geom.RoundRectangle2D;
 
 import org.apache.poi.ddf.EscherProperties;
+import org.apache.poi.sl.usermodel.ShapeType;
 
 /**
  * Stores definition of auto-shapes.
@@ -45,8 +46,8 @@ public final class AutoShapes {
      *
      * @return the shape outline
      */
-    public static ShapeOutline getShapeOutline(int type){
-        ShapeOutline outline = shapes[type];
+    public static ShapeOutline getShapeOutline(ShapeType type){
+        ShapeOutline outline = shapes[type.nativeId];
         return outline;
     }
 
@@ -68,14 +69,14 @@ public final class AutoShapes {
     static {
         shapes = new ShapeOutline[255];
 
-        shapes[ShapeTypes.Rectangle] = new ShapeOutline(){
+        shapes[ShapeType.RECT.nativeId] = new ShapeOutline(){
             public java.awt.Shape getOutline(Shape shape){
                 Rectangle2D path = new Rectangle2D.Float(0, 0, 21600, 21600);
                 return path;
             }
         };
 
-        shapes[ShapeTypes.RoundRectangle] = new ShapeOutline(){
+        shapes[ShapeType.ROUND_RECT.nativeId] = new ShapeOutline(){
             public java.awt.Shape getOutline(Shape shape){
                 int adjval = shape.getEscherProperty(EscherProperties.GEOMETRY__ADJUSTVALUE, 5400);
                 RoundRectangle2D path = new RoundRectangle2D.Float(0, 0, 21600, 21600, adjval, adjval);
@@ -83,14 +84,14 @@ public final class AutoShapes {
             }
         };
 
-        shapes[ShapeTypes.Ellipse] = new ShapeOutline(){
+        shapes[ShapeType.ELLIPSE.nativeId] = new ShapeOutline(){
             public java.awt.Shape getOutline(Shape shape){
                 Ellipse2D path = new Ellipse2D.Float(0, 0, 21600, 21600);
                 return path;
             }
         };
 
-        shapes[ShapeTypes.Diamond] = new ShapeOutline(){
+        shapes[ShapeType.DIAMOND.nativeId] = new ShapeOutline(){
             public java.awt.Shape getOutline(Shape shape){
                 GeneralPath path = new GeneralPath();
                 path.moveTo(10800, 0);
@@ -103,7 +104,7 @@ public final class AutoShapes {
         };
 
         //m@0,l,21600r21600
-        shapes[ShapeTypes.IsocelesTriangle] = new ShapeOutline(){
+        shapes[ShapeType.TRIANGLE.nativeId] = new ShapeOutline(){
             public java.awt.Shape getOutline(Shape shape){
                 int adjval = shape.getEscherProperty(EscherProperties.GEOMETRY__ADJUSTVALUE, 10800);
                 GeneralPath path = new GeneralPath();
@@ -115,7 +116,7 @@ public final class AutoShapes {
            }
         };
 
-        shapes[ShapeTypes.RightTriangle] = new ShapeOutline(){
+        shapes[ShapeType.RT_TRIANGLE.nativeId] = new ShapeOutline(){
             public java.awt.Shape getOutline(Shape shape){
                 GeneralPath path = new GeneralPath();
                 path.moveTo(0, 0);
@@ -126,7 +127,7 @@ public final class AutoShapes {
            }
         };
 
-        shapes[ShapeTypes.Parallelogram] = new ShapeOutline(){
+        shapes[ShapeType.PARALLELOGRAM.nativeId] = new ShapeOutline(){
             public java.awt.Shape getOutline(Shape shape){
                 int adjval = shape.getEscherProperty(EscherProperties.GEOMETRY__ADJUSTVALUE, 5400);
 
@@ -140,7 +141,7 @@ public final class AutoShapes {
             }
         };
 
-        shapes[ShapeTypes.Trapezoid] = new ShapeOutline(){
+        shapes[ShapeType.TRAPEZOID.nativeId] = new ShapeOutline(){
             public java.awt.Shape getOutline(Shape shape){
                 int adjval = shape.getEscherProperty(EscherProperties.GEOMETRY__ADJUSTVALUE, 5400);
 
@@ -154,7 +155,7 @@ public final class AutoShapes {
             }
         };
 
-        shapes[ShapeTypes.Hexagon] = new ShapeOutline(){
+        shapes[ShapeType.HEXAGON.nativeId] = new ShapeOutline(){
             public java.awt.Shape getOutline(Shape shape){
                 int adjval = shape.getEscherProperty(EscherProperties.GEOMETRY__ADJUSTVALUE, 5400);
 
@@ -170,7 +171,7 @@ public final class AutoShapes {
             }
         };
 
-        shapes[ShapeTypes.Octagon] = new ShapeOutline(){
+        shapes[ShapeType.OCTAGON.nativeId] = new ShapeOutline(){
             public java.awt.Shape getOutline(Shape shape){
                 int adjval = shape.getEscherProperty(EscherProperties.GEOMETRY__ADJUSTVALUE, 6326);
 
@@ -188,7 +189,7 @@ public final class AutoShapes {
             }
         };
 
-        shapes[ShapeTypes.Plus] = new ShapeOutline(){
+        shapes[ShapeType.PLUS.nativeId] = new ShapeOutline(){
             public java.awt.Shape getOutline(Shape shape){
                 int adjval = shape.getEscherProperty(EscherProperties.GEOMETRY__ADJUSTVALUE, 5400);
 
@@ -210,7 +211,7 @@ public final class AutoShapes {
             }
         };
 
-        shapes[ShapeTypes.Pentagon] = new ShapeOutline(){
+        shapes[ShapeType.PENTAGON.nativeId] = new ShapeOutline(){
             public java.awt.Shape getOutline(Shape shape){
 
                 GeneralPath path = new GeneralPath();
@@ -224,7 +225,7 @@ public final class AutoShapes {
             }
         };
 
-        shapes[ShapeTypes.DownArrow] = new ShapeOutline(){
+        shapes[ShapeType.DOWN_ARROW.nativeId] = new ShapeOutline(){
             public java.awt.Shape getOutline(Shape shape){
                 //m0@0 l@1@0 @1,0 @2,0 @2@0,21600@0,10800,21600xe
                 int adjval = shape.getEscherProperty(EscherProperties.GEOMETRY__ADJUSTVALUE, 16200);
@@ -242,7 +243,7 @@ public final class AutoShapes {
             }
         };
 
-        shapes[ShapeTypes.UpArrow] = new ShapeOutline(){
+        shapes[ShapeType.UP_ARROW.nativeId] = new ShapeOutline(){
             public java.awt.Shape getOutline(Shape shape){
                 //m0@0 l@1@0 @1,21600@2,21600@2@0,21600@0,10800,xe
                 int adjval = shape.getEscherProperty(EscherProperties.GEOMETRY__ADJUSTVALUE, 5400);
@@ -260,7 +261,7 @@ public final class AutoShapes {
             }
         };
 
-        shapes[ShapeTypes.Arrow] = new ShapeOutline(){
+        shapes[ShapeType.RIGHT_ARROW.nativeId] = new ShapeOutline(){
             public java.awt.Shape getOutline(Shape shape){
                 //m@0, l@0@1 ,0@1,0@2@0@2@0,21600,21600,10800xe
                 int adjval = shape.getEscherProperty(EscherProperties.GEOMETRY__ADJUSTVALUE, 16200);
@@ -278,7 +279,7 @@ public final class AutoShapes {
             }
         };
 
-        shapes[ShapeTypes.LeftArrow] = new ShapeOutline(){
+        shapes[ShapeType.LEFT_ARROW.nativeId] = new ShapeOutline(){
             public java.awt.Shape getOutline(Shape shape){
                 //m@0, l@0@1,21600@1,21600@2@0@2@0,21600,,10800xe
                 int adjval = shape.getEscherProperty(EscherProperties.GEOMETRY__ADJUSTVALUE, 5400);
@@ -296,7 +297,7 @@ public final class AutoShapes {
             }
         };
 
-        shapes[ShapeTypes.Can] = new ShapeOutline(){
+        shapes[ShapeType.CAN.nativeId] = new ShapeOutline(){
             public java.awt.Shape getOutline(Shape shape){
                 //m10800,qx0@1l0@2qy10800,21600,21600@2l21600@1qy10800,xem0@1qy10800@0,21600@1nfe
                 int adjval = shape.getEscherProperty(EscherProperties.GEOMETRY__ADJUSTVALUE, 5400);
@@ -320,7 +321,7 @@ public final class AutoShapes {
             }
         };
 
-        shapes[ShapeTypes.LeftBrace] = new ShapeOutline(){
+        shapes[ShapeType.LEFT_BRACE.nativeId] = new ShapeOutline(){
             public java.awt.Shape getOutline(Shape shape){
                 //m21600,qx10800@0l10800@2qy0@11,10800@3l10800@1qy21600,21600e
                 int adjval = shape.getEscherProperty(EscherProperties.GEOMETRY__ADJUSTVALUE, 1800);
@@ -348,7 +349,7 @@ public final class AutoShapes {
             }
         };
 
-        shapes[ShapeTypes.RightBrace] = new ShapeOutline(){
+        shapes[ShapeType.RIGHT_BRACE.nativeId] = new ShapeOutline(){
             public java.awt.Shape getOutline(Shape shape){
                 //m,qx10800@0 l10800@2qy21600@11,10800@3l10800@1qy,21600e
                 int adjval = shape.getEscherProperty(EscherProperties.GEOMETRY__ADJUSTVALUE, 1800);
@@ -376,7 +377,7 @@ public final class AutoShapes {
             }
         };
 
-        shapes[ShapeTypes.StraightConnector1] = new ShapeOutline(){
+        shapes[ShapeType.STRAIGHT_CONNECTOR_1.nativeId] = new ShapeOutline(){
             public java.awt.Shape getOutline(Shape shape){
                 return new Line2D.Float(0, 0, 21600, 21600);
             }

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Background.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Background.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Background.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Background.java Sat Feb 21 10:56:03 2015
@@ -17,16 +17,22 @@
 
 package org.apache.poi.hslf.model;
 
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.Rectangle;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayInputStream;
+
+import javax.imageio.ImageIO;
+
 import org.apache.poi.ddf.EscherContainerRecord;
-import org.apache.poi.hslf.usermodel.PictureData;
 import org.apache.poi.hslf.blip.Bitmap;
+import org.apache.poi.hslf.usermodel.PictureData;
+import org.apache.poi.sl.usermodel.ShapeContainer;
 import org.apache.poi.util.POILogger;
 
-import javax.imageio.ImageIO;
-import java.awt.*;
-import java.awt.image.BufferedImage;
-import java.io.ByteArrayInputStream;
-
 /**
  * Background shape
  *
@@ -34,7 +40,7 @@ import java.io.ByteArrayInputStream;
  */
 public final class Background extends Shape {
 
-    protected Background(EscherContainerRecord escherRecord, Shape parent) {
+    protected Background(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent) {
         super(escherRecord, parent);
     }
 

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Freeform.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Freeform.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Freeform.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Freeform.java Sat Feb 21 10:56:03 2015
@@ -31,6 +31,8 @@ import org.apache.poi.ddf.EscherContaine
 import org.apache.poi.ddf.EscherOptRecord;
 import org.apache.poi.ddf.EscherProperties;
 import org.apache.poi.ddf.EscherSimpleProperty;
+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;
 
@@ -60,7 +62,7 @@ public final class Freeform extends Auto
      * @param escherRecord       <code>EscherSpContainer</code> container which holds information about this shape
      * @param parent    the parent of the shape
      */
-   protected Freeform(EscherContainerRecord escherRecord, Shape parent){
+   protected Freeform(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent){
         super(escherRecord, parent);
 
     }
@@ -71,9 +73,9 @@ public final class Freeform extends Auto
      * @param parent    the parent of this Shape. For example, if this text box is a cell
      * in a table then the parent is Table.
      */
-    public Freeform(Shape parent){
-        super(null, parent);
-        _escherContainer = createSpContainer(ShapeTypes.NotPrimitive, parent instanceof ShapeGroup);
+    public Freeform(ShapeContainer<Shape> parent){
+        super((EscherContainerRecord)null, parent);
+        _escherContainer = createSpContainer(ShapeType.NOT_PRIMITIVE, parent instanceof ShapeGroup);
     }
 
     /**

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Hyperlink.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Hyperlink.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Hyperlink.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Hyperlink.java Sat Feb 21 10:56:03 2015
@@ -152,7 +152,7 @@ public final class Hyperlink {
      * @return found hyperlinks or <code>null</code> if not found
      */
     protected static Hyperlink[] find(TextRun run){
-        ArrayList lst = new ArrayList();
+        List<Hyperlink> lst = new ArrayList<Hyperlink>();
         SlideShow ppt = run.getSheet().getSlideShow();
         //document-level container which stores info about all links in a presentation
         ExObjList exobj = ppt.getDocumentRecord().getExObjList();
@@ -177,7 +177,7 @@ public final class Hyperlink {
      * @return found hyperlink or <code>null</code>
      */
     protected static Hyperlink find(Shape shape){
-        ArrayList lst = new ArrayList();
+        List<Hyperlink> lst = new ArrayList<Hyperlink>();
         SlideShow ppt = shape.getSheet().getSlideShow();
         //document-level container which stores info about all links in a presentation
         ExObjList exobj = ppt.getDocumentRecord().getExObjList();
@@ -198,7 +198,7 @@ public final class Hyperlink {
         return lst.size() == 1 ? (Hyperlink)lst.get(0) : null;
     }
 
-    private static void find(Record[] records, ExObjList exobj, List out){
+    private static void find(Record[] records, ExObjList exobj, List<Hyperlink> out){
         for (int i = 0; i < records.length; i++) {
             //see if we have InteractiveInfo in the textrun's records
             if( records[i] instanceof InteractiveInfo){

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Line.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Line.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Line.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Line.java Sat Feb 21 10:56:03 2015
@@ -18,6 +18,8 @@
 package org.apache.poi.hslf.model;
 
 import org.apache.poi.ddf.*;
+import org.apache.poi.sl.usermodel.ShapeContainer;
+import org.apache.poi.sl.usermodel.ShapeType;
 
 import java.awt.geom.Rectangle2D;
 import java.awt.geom.Line2D;
@@ -95,11 +97,11 @@ public final class Line extends SimpleSh
     public static final int LINE_TRIPLE = 4;
 
 
-    protected Line(EscherContainerRecord escherRecord, Shape parent){
+    protected Line(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent){
         super(escherRecord, parent);
     }
 
-    public Line(Shape parent){
+    public Line(ShapeContainer<Shape> parent){
         super(null, parent);
         _escherContainer = createSpContainer(parent instanceof ShapeGroup);
     }
@@ -112,7 +114,7 @@ public final class Line extends SimpleSh
         _escherContainer = super.createSpContainer(isChild);
 
         EscherSpRecord spRecord = _escherContainer.getChildById(EscherSpRecord.RECORD_ID);
-        short type = (ShapeTypes.Line << 4) | 0x2;
+        short type = (short)((ShapeType.LINE.nativeId << 4) | 0x2);
         spRecord.setOptions(type);
 
         //set default properties for a line

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=1661322&r1=1661321&r2=1661322&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 Feb 21 10:56:03 2015
@@ -25,6 +25,7 @@ import org.apache.poi.ddf.EscherProperti
 import org.apache.poi.hslf.exceptions.HSLFException;
 import org.apache.poi.hslf.record.*;
 import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.sl.usermodel.ShapeContainer;
 
 /**
  * Represents a movie in a PowerPoint document.
@@ -54,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, Shape parent) {
+    public MovieShape(int movieIdx, int idx, ShapeContainer<Shape> parent) {
         super(idx, parent);
         setMovieIndex(movieIdx);
     }
@@ -66,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, Shape parent){
+     protected MovieShape(EscherContainerRecord escherRecord, ShapeContainer<Shape> 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=1661322&r1=1661321&r2=1661322&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 Feb 21 10:56:03 2015
@@ -24,6 +24,7 @@ import org.apache.poi.hslf.record.ExObjL
 import org.apache.poi.hslf.record.Record;
 import org.apache.poi.hslf.record.ExEmbed;
 import org.apache.poi.hslf.record.RecordTypes;
+import org.apache.poi.sl.usermodel.ShapeContainer;
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.POILogger;
 
@@ -51,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, Shape parent) {
+    public OLEShape(int idx, ShapeContainer<Shape> parent) {
         super(idx, parent);
     }
 
@@ -62,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, Shape parent){
+     protected OLEShape(EscherContainerRecord escherRecord, ShapeContainer<Shape> 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=1661322&r1=1661321&r2=1661322&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 Feb 21 10:56:03 2015
@@ -1456,7 +1456,7 @@ public final class PPGraphics2D extends
      * @param hints the rendering hints to be set
      * @see RenderingHints
      */
-    public void addRenderingHints(Map hints){
+    public void addRenderingHints(Map<?,?> hints){
         this._hints.putAll(hints);
     }
 
@@ -1581,8 +1581,9 @@ public final class PPGraphics2D extends
      * @param hints the rendering hints to be set
      * @see RenderingHints
      */
-    public void setRenderingHints(Map hints){
-        this._hints = new RenderingHints(hints);
+    public void setRenderingHints(Map<?,?> hints){
+        this._hints = new RenderingHints(null);
+        this._hints.putAll(hints);
     }
 
     /**

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=1661322&r1=1661321&r2=1661322&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 Feb 21 10:56:03 2015
@@ -39,6 +39,8 @@ import org.apache.poi.hslf.blip.Bitmap;
 import org.apache.poi.hslf.record.Document;
 import org.apache.poi.hslf.usermodel.PictureData;
 import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.sl.usermodel.ShapeContainer;
+import org.apache.poi.sl.usermodel.ShapeType;
 import org.apache.poi.util.POILogger;
 import org.apache.poi.util.StringUtil;
 import org.apache.poi.util.Units;
@@ -96,7 +98,7 @@ public class Picture extends SimpleShape
      * @param idx the index of the picture
      * @param parent the parent shape
      */
-    public Picture(int idx, Shape parent) {
+    public Picture(int idx, ShapeContainer<Shape> parent) {
         super(null, parent);
         _escherContainer = createSpContainer(idx, parent instanceof ShapeGroup);
     }
@@ -108,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, Shape parent){
+     protected Picture(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent){
         super(escherRecord, parent);
     }
 
@@ -136,7 +138,7 @@ public class Picture extends SimpleShape
         _escherContainer.setOptions((short)15);
 
         EscherSpRecord spRecord = _escherContainer.getChildById(EscherSpRecord.RECORD_ID);
-        spRecord.setOptions((short)((ShapeTypes.PictureFrame << 4) | 0x2));
+        spRecord.setOptions((short)((ShapeType.FRAME.nativeId << 4) | 0x2));
 
         //set default properties for a picture
         EscherOptRecord opt = getEscherOptRecord();
@@ -295,6 +297,6 @@ public class Picture extends SimpleShape
         EscherSimpleProperty prop = getEscherProperty(opt, propertyId);
         if (prop == null) return 0;
         int fixedPoint = prop.getPropertyValue();
-        return Units.fixedPointToDecimal(fixedPoint);
+        return Units.fixedPointToDouble(fixedPoint);
     }
 }
\ No newline at end of file

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=1661322&r1=1661321&r2=1661322&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 Feb 21 10:56:03 2015
@@ -20,6 +20,7 @@ package org.apache.poi.hslf.model;
 import org.apache.poi.ddf.*;
 import org.apache.poi.hslf.record.OEPlaceholderAtom;
 import org.apache.poi.hslf.exceptions.HSLFException;
+import org.apache.poi.sl.usermodel.ShapeContainer;
 
 import java.io.ByteArrayOutputStream;
 
@@ -30,11 +31,11 @@ import java.io.ByteArrayOutputStream;
  */
 public final class Placeholder extends TextBox {
 
-    protected Placeholder(EscherContainerRecord escherRecord, Shape parent){
+    protected Placeholder(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent){
         super(escherRecord, parent);
     }
 
-    public Placeholder(Shape parent){
+    public Placeholder(ShapeContainer<Shape> 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=1661322&r1=1661321&r2=1661322&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 Feb 21 10:56:03 2015
@@ -18,6 +18,8 @@
 package org.apache.poi.hslf.model;
 
 import org.apache.poi.ddf.*;
+import org.apache.poi.sl.usermodel.ShapeContainer;
+import org.apache.poi.sl.usermodel.ShapeType;
 import org.apache.poi.util.LittleEndian;
 
 import java.awt.geom.Point2D;
@@ -34,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, Shape parent){
+   protected Polygon(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent){
         super(escherRecord, parent);
 
     }
@@ -45,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(Shape parent){
-        super(null, parent);
-        _escherContainer = createSpContainer(ShapeTypes.NotPrimitive, parent instanceof ShapeGroup);
+    public Polygon(ShapeContainer<Shape> parent){
+        super((EscherContainerRecord)null, parent);
+        _escherContainer = createSpContainer(ShapeType.NOT_PRIMITIVE, parent instanceof ShapeGroup);
     }
 
     /**

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Shape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Shape.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Shape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Shape.java Sat Feb 21 10:56:03 2015
@@ -19,6 +19,8 @@ package org.apache.poi.hslf.model;
 
 import org.apache.poi.ddf.*;
 import org.apache.poi.hslf.record.ColorSchemeAtom;
+import org.apache.poi.sl.usermodel.ShapeContainer;
+import org.apache.poi.sl.usermodel.ShapeType;
 import org.apache.poi.util.POILogger;
 import org.apache.poi.util.POILogFactory;
 import org.apache.poi.util.Units;
@@ -43,7 +45,7 @@ import java.awt.geom.Rectangle2D;
   *
   * @author Yegor Kozlov
  */
-public abstract class Shape {
+public abstract class Shape implements org.apache.poi.sl.usermodel.Shape<Shape> {
 
     // For logging
     protected POILogger logger = POILogFactory.getLogger(this.getClass());
@@ -83,7 +85,7 @@ public abstract class Shape {
      * Parent of this shape.
      * <code>null</code> for the topmost shapes.
      */
-    protected Shape _parent;
+    protected ShapeContainer<Shape> _parent;
 
     /**
      * The <code>Sheet</code> this shape belongs to
@@ -101,7 +103,7 @@ public abstract class Shape {
      * @param escherRecord       <code>EscherSpContainer</code> container which holds information about this shape
      * @param parent             the parent of this Shape
      */
-      protected Shape(EscherContainerRecord escherRecord, Shape parent){
+      protected Shape(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent){
         _escherContainer = escherRecord;
         _parent = parent;
      }
@@ -114,7 +116,7 @@ public abstract class Shape {
     /**
      *  @return the parent of this shape
      */
-    public Shape getParent(){
+    public ShapeContainer<Shape> getParent(){
         return _parent;
     }
 
@@ -122,25 +124,25 @@ public abstract class Shape {
      * @return name of the shape.
      */
     public String getShapeName(){
-        return ShapeTypes.typeName(getShapeType());
+        return getShapeType().nativeName;
     }
 
     /**
      * @return type of the shape.
      * @see org.apache.poi.hslf.record.RecordTypes
      */
-    public int getShapeType(){
+    public ShapeType getShapeType(){
         EscherSpRecord spRecord = getEscherChild(EscherSpRecord.RECORD_ID);
-        return spRecord.getShapeType();
+        return ShapeType.forId(spRecord.getShapeType(), false);
     }
 
     /**
      * @param type type of the shape.
      * @see org.apache.poi.hslf.record.RecordTypes
      */
-    public void setShapeType(int type){
+    public void setShapeType(ShapeType type){
         EscherSpRecord spRecord = getEscherChild(EscherSpRecord.RECORD_ID);
-        spRecord.setShapeType( (short) type );
+        spRecord.setShapeType( (short) type.nativeId );
         spRecord.setVersion( (short) 0x2 );
     }
 
@@ -395,7 +397,7 @@ public abstract class Shape {
         EscherSimpleProperty op = getEscherProperty(opt, opacityProperty);
         int defaultOpacity = 0x00010000;
         int opacity = (op == null) ? defaultOpacity : op.getPropertyValue();
-        double alpha = Units.fixedPointToDecimal(opacity)*255.0;
+        double alpha = Units.fixedPointToDouble(opacity)*255.0;
         return new Color(rgb[0], rgb[1], rgb[2], (int)alpha);
     }
 
@@ -456,7 +458,7 @@ public abstract class Shape {
      * @return the hyperlink assigned to this shape
      * or <code>null</code> if not found.
      */
-     public Hyperlink getHyperlink(){
+    public Hyperlink getHyperlink(){
         return Hyperlink.find(this);
     }
 
@@ -477,44 +479,47 @@ public abstract class Shape {
         return getEscherChild(EscherOptRecord.RECORD_ID);
     }
     
-    /**
-     * Whether the shape is horizontally flipped
-     *
-     * @return whether the shape is horizontally flipped
-     */
-     public boolean getFlipHorizontal(){
+    @Override
+    public boolean getFlipHorizontal(){
         EscherSpRecord spRecord = getEscherChild(EscherSpRecord.RECORD_ID);
         return (spRecord.getFlags()& EscherSpRecord.FLAG_FLIPHORIZ) != 0;
     }
+     
+    @Override
+    public void setFlipHorizontal(boolean flip) {
+        EscherSpRecord spRecord = getEscherChild(EscherSpRecord.RECORD_ID);
+        int flag = spRecord.getFlags() | EscherSpRecord.FLAG_FLIPHORIZ;
+        spRecord.setFlags(flag);
+    }
 
-    /**
-     * Whether the shape is vertically flipped
-     *
-     * @return whether the shape is vertically flipped
-     */
+    @Override
     public boolean getFlipVertical(){
         EscherSpRecord spRecord = getEscherChild(EscherSpRecord.RECORD_ID);
         return (spRecord.getFlags()& EscherSpRecord.FLAG_FLIPVERT) != 0;
     }
+    
+    @Override
+    public void setFlipVertical(boolean flip) {
+        EscherSpRecord spRecord = getEscherChild(EscherSpRecord.RECORD_ID);
+        int flag = spRecord.getFlags() | EscherSpRecord.FLAG_FLIPVERT;
+        spRecord.setFlags(flag);
+    }
 
-    /**
-     * Rotation angle in degrees
-     *
-     * @return rotation angle in degrees
-     */
-    public int getRotation(){
+    @Override
+    public double getRotation(){
         int rot = getEscherProperty(EscherProperties.TRANSFORM__ROTATION);
-        int angle = (rot >> 16) % 360;
-
+        double angle = Units.fixedPointToDouble(rot) % 360.0;
         return angle;
     }
+    
+    @Override
+    public void setRotation(double theta){
+        int rot = Units.doubleToFixedPoint(theta % 360.0);
+        setEscherProperty(EscherProperties.TRANSFORM__ROTATION, rot);
+    }
 
-    /**
-     * Rotate this shape
-     *
-     * @param theta the rotation angle in degrees
-     */
-    public void setRotation(int theta){
-        setEscherProperty(EscherProperties.TRANSFORM__ROTATION, (theta << 16));
+    @Override
+    public boolean isPlaceholder() {
+        return false;
     }
 }

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=1661322&r1=1661321&r2=1661322&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 Feb 21 10:56:03 2015
@@ -34,6 +34,8 @@ import org.apache.poi.hslf.record.Intera
 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.sl.usermodel.ShapeContainer;
+import org.apache.poi.sl.usermodel.ShapeType;
 import org.apache.poi.util.POILogFactory;
 import org.apache.poi.util.POILogger;
 
@@ -49,14 +51,14 @@ public final class ShapeFactory {
     /**
      * Create a new shape from the data provided.
      */
-    public static Shape createShape(EscherContainerRecord spContainer, Shape parent){
+    public static Shape createShape(EscherContainerRecord spContainer, ShapeContainer<Shape> parent){
         if (spContainer.getRecordId() == EscherContainerRecord.SPGR_CONTAINER){
             return createShapeGroup(spContainer, parent);
         }
         return createSimpeShape(spContainer, parent);
     }
 
-    public static ShapeGroup createShapeGroup(EscherContainerRecord spContainer, Shape parent){
+    public static ShapeGroup createShapeGroup(EscherContainerRecord spContainer, ShapeContainer<Shape> parent){
         ShapeGroup group = null;
         EscherRecord opt = Shape.getEscherChild((EscherContainerRecord)spContainer.getChild(0), (short)0xF122);
         if(opt != null){
@@ -80,17 +82,17 @@ public final class ShapeFactory {
         return group;
      }
 
-    public static Shape createSimpeShape(EscherContainerRecord spContainer, Shape parent){
+    public static Shape createSimpeShape(EscherContainerRecord spContainer, ShapeContainer<Shape> parent){
         Shape shape = null;
         EscherSpRecord spRecord = spContainer.getChildById(EscherSpRecord.RECORD_ID);
 
-        int type = spRecord.getShapeType();
+        ShapeType type = ShapeType.forId(spRecord.getShapeType(), false);
         switch (type){
-            case ShapeTypes.TextBox:
+            case TEXT_BOX:
                 shape = new TextBox(spContainer, parent);
                 break;
-            case ShapeTypes.HostControl:
-            case ShapeTypes.PictureFrame: {
+            case HOST_CONTROL:
+            case FRAME: {
                 InteractiveInfo info = getClientDataRecord(spContainer, RecordTypes.InteractiveInfo.typeID);
                 OEShapeAtom oes = getClientDataRecord(spContainer, RecordTypes.OEShapeAtom.typeID);
                 if(info != null && info.getInteractiveInfoAtom() != null){
@@ -111,10 +113,10 @@ public final class ShapeFactory {
                 if(shape == null) shape = new Picture(spContainer, parent);
                 break;
             }
-            case ShapeTypes.Line:
+            case LINE:
                 shape = new Line(spContainer, parent);
                 break;
-            case ShapeTypes.NotPrimitive: {
+            case NOT_PRIMITIVE: {
                 EscherOptRecord opt = Shape.getEscherChild(spContainer, EscherOptRecord.RECORD_ID);
                 EscherProperty prop = Shape.getEscherProperty(opt, EscherProperties.GEOMETRY__VERTICES);
                 if(prop != null)

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ShapeGroup.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ShapeGroup.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ShapeGroup.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ShapeGroup.java Sat Feb 21 10:56:03 2015
@@ -30,6 +30,8 @@ import org.apache.poi.ddf.EscherContaine
 import org.apache.poi.ddf.EscherRecord;
 import org.apache.poi.ddf.EscherSpRecord;
 import org.apache.poi.ddf.EscherSpgrRecord;
+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;
 
@@ -38,7 +40,7 @@ import org.apache.poi.util.POILogger;
  *
  * @author Yegor Kozlov
  */
-public class ShapeGroup extends Shape{
+public class ShapeGroup extends Shape implements ShapeContainer<Shape> {
 
     /**
       * Create a new ShapeGroup. This constructor is used when a new shape is created.
@@ -55,7 +57,7 @@ public class ShapeGroup extends Shape{
       * @param escherRecord       <code>EscherSpContainer</code> container which holds information about this shape
       * @param parent    the parent of the shape
       */
-    protected ShapeGroup(EscherContainerRecord escherRecord, Shape parent){
+    protected ShapeGroup(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent){
         super(escherRecord, parent);
     }
 
@@ -63,31 +65,7 @@ public class ShapeGroup extends Shape{
      * @return the shapes contained in this group container
      */
     public Shape[] getShapes() {
-    	// Out escher container record should contain several
-        //  SpContainers, the first of which is the group shape itself
-        Iterator<EscherRecord> iter = _escherContainer.getChildIterator();
-
-        // Don't include the first SpContainer, it is always NotPrimitive
-        if (iter.hasNext()) {
-        	iter.next();
-        }
-        List<Shape> shapeList = new ArrayList<Shape>();
-        while (iter.hasNext()) {
-        	EscherRecord r = iter.next();
-        	if(r instanceof EscherContainerRecord) {
-        		// Create the Shape for it
-        		EscherContainerRecord container = (EscherContainerRecord)r;
-        		Shape shape = ShapeFactory.createShape(container, this);
-                shape.setSheet(getSheet());
-        		shapeList.add( shape );
-        	} else {
-        		// Should we do anything special with these non
-        		//  Container records?
-        		logger.log(POILogger.ERROR, "Shape contained non container escher record, was " + r.getClass().getName());
-        	}
-        }
-
-        // Put the shapes into an array, and return
+        List<Shape> shapeList = getShapeList();
         Shape[] shapes = shapeList.toArray(new Shape[shapeList.size()]);
         return shapes;
     }
@@ -179,7 +157,7 @@ public class ShapeGroup extends Shape{
         spcont.addChildRecord(spg);
 
         EscherSpRecord sp = new EscherSpRecord();
-        short type = (ShapeTypes.NotPrimitive << 4) + 2;
+        short type = (short)((ShapeType.NOT_PRIMITIVE.nativeId << 4) + 2);
         sp.setOptions(type);
         sp.setFlags(EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_GROUP);
         spcont.addChildRecord(sp);
@@ -260,9 +238,10 @@ public class ShapeGroup extends Shape{
      *
      * @return type of the shape.
      */
-    public int getShapeType(){
+    public ShapeType getShapeType(){
         EscherSpRecord spRecord = getEscherChild(EscherSpRecord.RECORD_ID);
-        return spRecord.getOptions() >> 4;
+        int nativeId = spRecord.getOptions() >> 4;
+        return ShapeType.forId(nativeId, false);
     }
 
     /**
@@ -291,4 +270,45 @@ public class ShapeGroup extends Shape{
         EscherContainerRecord groupInfoContainer = (EscherContainerRecord)_escherContainer.getChild(0);
         return groupInfoContainer.getChildById((short)recordId);
     }
+
+    public Iterator<Shape> iterator() {
+        return getShapeList().iterator();
+    }
+
+    public boolean removeShape(Shape shape) {
+        // TODO: implement!
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * @return the shapes contained in this group container
+     */
+    protected List<Shape> getShapeList() {
+        // Out escher container record should contain several
+        //  SpContainers, the first of which is the group shape itself
+        Iterator<EscherRecord> iter = _escherContainer.getChildIterator();
+
+        // Don't include the first SpContainer, it is always NotPrimitive
+        if (iter.hasNext()) {
+            iter.next();
+        }
+        List<Shape> shapeList = new ArrayList<Shape>();
+        while (iter.hasNext()) {
+            EscherRecord r = iter.next();
+            if(r instanceof EscherContainerRecord) {
+                // Create the Shape for it
+                EscherContainerRecord container = (EscherContainerRecord)r;
+                Shape shape = ShapeFactory.createShape(container, this);
+                shape.setSheet(getSheet());
+                shapeList.add( shape );
+            } else {
+                // Should we do anything special with these non
+                //  Container records?
+                logger.log(POILogger.ERROR, "Shape contained non container escher record, was " + r.getClass().getName());
+            }
+        }
+
+        return shapeList;
+    }
+
 }

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=1661322&r1=1661321&r2=1661322&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 Feb 21 10:56:03 2015
@@ -45,6 +45,7 @@ import org.apache.poi.hslf.record.TextHe
 import org.apache.poi.hslf.record.TextRulerAtom;
 import org.apache.poi.hslf.record.TextSpecInfoAtom;
 import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.sl.usermodel.ShapeContainer;
 import org.apache.poi.util.POILogFactory;
 import org.apache.poi.util.POILogger;
 
@@ -56,7 +57,7 @@ import org.apache.poi.util.POILogger;
  * @author Yegor Kozlov
  */
 
-public abstract class Sheet {
+public abstract class Sheet implements ShapeContainer<Shape> {
 	private static POILogger logger = POILogFactory.getLogger(Sheet.class);
 
     /**
@@ -272,36 +273,8 @@ public abstract class Sheet {
      * @return all shapes contained in this Sheet (Slide or Notes)
      */
     public Shape[] getShapes() {
-        PPDrawing ppdrawing = getPPDrawing();
-
-        EscherContainerRecord dg = (EscherContainerRecord) ppdrawing.getEscherRecords()[0];
-        EscherContainerRecord spgr = null;
-
-        for (Iterator<EscherRecord> it = dg.getChildIterator(); it.hasNext();) {
-            EscherRecord rec = it.next();
-            if (rec.getRecordId() == EscherContainerRecord.SPGR_CONTAINER) {
-                spgr = (EscherContainerRecord) rec;
-                break;
-            }
-        }
-        if (spgr == null) {
-            throw new IllegalStateException("spgr not found");
-        }
-
-        List<Shape> shapes = new ArrayList<Shape>();
-        Iterator<EscherRecord> it = spgr.getChildIterator();
-        if (it.hasNext()) {
-            // skip first item
-            it.next();
-        }
-        for (; it.hasNext();) {
-            EscherContainerRecord sp = (EscherContainerRecord) it.next();
-            Shape sh = ShapeFactory.createShape(sp, null);
-            sh.setSheet(this);
-            shapes.add(sh);
-        }
-
-        return shapes.toArray(new Shape[shapes.size()]);
+        List<Shape> shapeList = getShapeList();
+        return shapeList.toArray(new Shape[shapeList.size()]);
     }
 
     /**
@@ -524,4 +497,47 @@ public abstract class Sheet {
 
     }
 
+    public Iterator<Shape> iterator() {
+        return getShapeList().iterator();
+    }
+
+
+    /**
+     * Returns all shapes contained in this Sheet
+     *
+     * @return all shapes contained in this Sheet (Slide or Notes)
+     */
+    protected List<Shape> getShapeList() {
+        PPDrawing ppdrawing = getPPDrawing();
+
+        EscherContainerRecord dg = (EscherContainerRecord) ppdrawing.getEscherRecords()[0];
+        EscherContainerRecord spgr = null;
+
+        for (Iterator<EscherRecord> it = dg.getChildIterator(); it.hasNext();) {
+            EscherRecord rec = it.next();
+            if (rec.getRecordId() == EscherContainerRecord.SPGR_CONTAINER) {
+                spgr = (EscherContainerRecord) rec;
+                break;
+            }
+        }
+        if (spgr == null) {
+            throw new IllegalStateException("spgr not found");
+        }
+
+        List<Shape> shapeList = new ArrayList<Shape>();
+        Iterator<EscherRecord> it = spgr.getChildIterator();
+        if (it.hasNext()) {
+            // skip first item
+            it.next();
+        }
+        for (; it.hasNext();) {
+            EscherContainerRecord sp = (EscherContainerRecord) it.next();
+            Shape sh = ShapeFactory.createShape(sp, null);
+            sh.setSheet(this);
+            shapeList.add(sh);
+        }
+
+        return shapeList;
+    }
+
 }

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=1661322&r1=1661321&r2=1661322&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 Feb 21 10:56:03 2015
@@ -38,6 +38,7 @@ import org.apache.poi.hslf.exceptions.HS
 import org.apache.poi.hslf.record.InteractiveInfo;
 import org.apache.poi.hslf.record.InteractiveInfoAtom;
 import org.apache.poi.hslf.record.Record;
+import org.apache.poi.sl.usermodel.ShapeContainer;
 import org.apache.poi.util.LittleEndian;
 
 /**
@@ -62,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, Shape parent){
+    protected SimpleShape(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent){
         super(escherRecord, parent);
     }
 
@@ -191,7 +192,7 @@ public abstract class SimpleShape extend
      *
      * @return style of the line.
      */
-    public int getLineStyle(){
+    public int getStrokeStyle(){
         EscherOptRecord opt = getEscherOptRecord();
         EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.LINESTYLE__LINESTYLE);
         return prop == null ? Line.LINE_SIMPLE : prop.getPropertyValue();
@@ -221,12 +222,14 @@ public abstract class SimpleShape extend
         Rectangle2D anchor = getAnchor2D();
 
         //if it is a groupped shape see if we need to transform the coordinates
-        if (_parent != null){
+        if (getParent() != null){
             ArrayList<ShapeGroup> lst = new ArrayList<ShapeGroup>();
-            for (Shape top=this; (top = top.getParent()) != null; ) {
-                lst.add(0, (ShapeGroup)top);
+            for (ShapeContainer<Shape> parent=this.getParent();
+                parent instanceof ShapeGroup;
+                parent = ((ShapeGroup)parent).getParent()) {
+                lst.add(0, (ShapeGroup)parent);
             }
-
+            
             AffineTransform tx = new AffineTransform();
             for(ShapeGroup prnt : lst) {
                 Rectangle2D exterior = prnt.getAnchor2D();
@@ -243,8 +246,8 @@ public abstract class SimpleShape extend
             anchor = tx.createTransformedShape(anchor).getBounds2D();
         }
 
-        int angle = getRotation();
-        if(angle != 0){
+        double angle = getRotation();
+        if(angle != 0.){
             double centerX = anchor.getX() + anchor.getWidth()/2;
             double centerY = anchor.getY() + anchor.getHeight()/2;
 

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=1661322&r1=1661321&r2=1661322&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 Feb 21 10:56:03 2015
@@ -34,9 +34,10 @@ import org.apache.poi.hslf.record.Record
 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.hslf.record.SlideListWithText.SlideAtomsSet;
+import org.apache.poi.sl.usermodel.ShapeType;
 
 /**
  * This class represents a slide in a PowerPoint Document. It allows
@@ -47,8 +48,7 @@ import org.apache.poi.hslf.record.SlideL
  * @author Yegor Kozlov
  */
 
-public final class Slide extends Sheet
-{
+public final class Slide extends Sheet {
 	private int _slideNo;
 	private SlideAtomsSet _atomSet;
 	private TextRun[] _runs;
@@ -180,7 +180,7 @@ public final class Slide extends Sheet
 	 */
 	public TextBox addTitle() {
 		Placeholder pl = new Placeholder();
-		pl.setShapeType(ShapeTypes.Rectangle);
+		pl.setShapeType(ShapeType.RECT);
 		pl.getTextRun().setRunType(TextHeaderAtom.TITLE_TYPE);
 		pl.setText("Click to edit title");
 		pl.setAnchor(new java.awt.Rectangle(54, 48, 612, 90));

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=1661322&r1=1661321&r2=1661322&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 Feb 21 10:56:03 2015
@@ -18,6 +18,7 @@
 package org.apache.poi.hslf.model;
 
 import org.apache.poi.ddf.*;
+import org.apache.poi.sl.usermodel.ShapeContainer;
 import org.apache.poi.util.LittleEndian;
 
 import java.util.*;
@@ -92,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, Shape parent) {
+    public Table(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent) {
         super(escherRecord, parent);
     }
 
@@ -125,7 +126,7 @@ public final class Table extends ShapeGr
             TableCell cell = cells[i][0];
             int rowHeight = cell.getAnchor().height*MASTER_DPI/POINT_DPI;
             byte[] val = new byte[4];
-            LittleEndian.putInt(val, rowHeight);
+            LittleEndian.putInt(val, 0, rowHeight);
             p.setElement(i, val);
             for (int j = 0; j < cells[i].length; j++) {
                 TableCell c = cells[i][j];
@@ -149,11 +150,11 @@ public final class Table extends ShapeGr
     }
 
     protected void initTable(){
-        Shape[] sh = getShapes();
-        Arrays.sort(sh, new Comparator(){
-            public int compare( Object o1, Object o2 ) {
-                Rectangle anchor1 = ((Shape)o1).getAnchor();
-                Rectangle anchor2 = ((Shape)o2).getAnchor();
+        List<Shape> shapeList = getShapeList();
+        Collections.sort(shapeList, new Comparator<Shape>(){
+            public int compare( Shape o1, Shape o2 ) {
+                Rectangle anchor1 = o1.getAnchor();
+                Rectangle anchor2 = o2.getAnchor();
                 int delta = anchor1.y - anchor2.y;
                 if(delta == 0) delta = anchor1.x - anchor2.x;
                 return delta;
@@ -161,23 +162,23 @@ public final class Table extends ShapeGr
         });
         int y0 = -1;
         int maxrowlen = 0;
-        ArrayList lst = new ArrayList();
-        ArrayList row = null;
-        for (int i = 0; i < sh.length; i++) {
-            if(sh[i] instanceof TextShape){
-                Rectangle anchor = sh[i].getAnchor();
+        List<List<Shape>> lst = new ArrayList<List<Shape>>();
+        List<Shape> row = null;
+        for (Shape sh : shapeList) {
+            if(sh instanceof TextShape){
+                Rectangle anchor = sh.getAnchor();
                 if(anchor.y != y0){
                     y0 = anchor.y;
-                    row = new ArrayList();
+                    row = new ArrayList<Shape>();
                     lst.add(row);
                 }
-                row.add(sh[i]);
+                row.add(sh);
                 maxrowlen = Math.max(maxrowlen, row.size());
             }
         }
         cells = new TableCell[lst.size()][maxrowlen];
         for (int i = 0; i < lst.size(); i++) {
-            row = (ArrayList)lst.get(i);
+            row = lst.get(i);
             for (int j = 0; j < row.size(); j++) {
                 TextShape tx = (TextShape)row.get(j);
                 cells[i][j] = new TableCell(tx.getSpContainer(), getParent());
@@ -318,7 +319,7 @@ public final class Table extends ShapeGr
     private Line cloneBorder(Line line){
         Line border = createBorder();
         border.setLineWidth(line.getLineWidth());
-        border.setLineStyle(line.getLineStyle());
+        border.setLineStyle(line.getStrokeStyle());
         border.setLineDashing(line.getLineDashing());
         border.setLineColor(line.getLineColor());
         return border;

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=1661322&r1=1661321&r2=1661322&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 Feb 21 10:56:03 2015
@@ -17,9 +17,13 @@
 
 package org.apache.poi.hslf.model;
 
-import org.apache.poi.ddf.*;
+import java.awt.Rectangle;
 
-import java.awt.*;
+import org.apache.poi.ddf.EscherContainerRecord;
+import org.apache.poi.ddf.EscherOptRecord;
+import org.apache.poi.ddf.EscherProperties;
+import org.apache.poi.sl.usermodel.ShapeContainer;
+import org.apache.poi.sl.usermodel.ShapeType;
 
 /**
  * Represents a cell in a ppt table
@@ -38,10 +42,10 @@ public final class TableCell extends Tex
     /**
      * Create a TableCell object and initialize it from the supplied Record container.
      *
-     * @param escherRecord       <code>EscherSpContainer</code> container which holds information about this shape
+     * @param escherRecord       {@link EscherSpContainer} container which holds information about this shape
      * @param parent    the parent of the shape
      */
-   protected TableCell(EscherContainerRecord escherRecord, Shape parent){
+   protected TableCell(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent){
         super(escherRecord, parent);
     }
 
@@ -51,10 +55,10 @@ 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(Shape parent){
+    public TableCell(ShapeContainer<Shape> parent){
         super(parent);
 
-        setShapeType(ShapeTypes.Rectangle);
+        setShapeType(ShapeType.RECT);
         //_txtrun.setRunType(TextHeaderAtom.HALF_BODY_TYPE);
         //_txtrun.getRichTextRuns()[0].setFlag(false, 0, false);
     }

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=1661322&r1=1661321&r2=1661322&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 Feb 21 10:56:03 2015
@@ -18,6 +18,8 @@
 package org.apache.poi.hslf.model;
 
 import org.apache.poi.ddf.*;
+import org.apache.poi.sl.usermodel.ShapeContainer;
+import org.apache.poi.sl.usermodel.ShapeType;
 
 /**
  * Represents a TextFrame shape in PowerPoint.
@@ -36,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, Shape parent){
+   protected TextBox(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent){
         super(escherRecord, parent);
 
     }
@@ -47,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(Shape parent){
+    public TextBox(ShapeContainer<Shape> parent){
         super(parent);
     }
 
@@ -67,7 +69,7 @@ public class TextBox extends TextShape {
     protected EscherContainerRecord createSpContainer(boolean isChild){
         _escherContainer = super.createSpContainer(isChild);
 
-        setShapeType(ShapeTypes.TextBox);
+        setShapeType(ShapeType.TEXT_BOX);
 
         //set default properties for a TextBox
         setEscherProperty(EscherProperties.FILL__FILLCOLOR, 0x8000004);

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=1661322&r1=1661321&r2=1661322&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 Feb 21 10:56:03 2015
@@ -41,12 +41,14 @@ import org.apache.poi.hslf.record.Outlin
 import org.apache.poi.hslf.record.PPDrawing;
 import org.apache.poi.hslf.record.Record;
 import org.apache.poi.hslf.record.RecordTypes;
+import org.apache.poi.hslf.record.RoundTripHFPlaceholder12;
 import org.apache.poi.hslf.record.StyleTextPropAtom;
 import org.apache.poi.hslf.record.TextBytesAtom;
 import org.apache.poi.hslf.record.TextCharsAtom;
 import org.apache.poi.hslf.record.TextHeaderAtom;
 import org.apache.poi.hslf.record.TxInteractiveInfoAtom;
 import org.apache.poi.hslf.usermodel.RichTextRun;
+import org.apache.poi.sl.usermodel.ShapeContainer;
 import org.apache.poi.util.POILogger;
 
 /**
@@ -109,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, Shape parent){
+   protected TextShape(EscherContainerRecord escherRecord, ShapeContainer<Shape> parent){
         super(escherRecord, parent);
 
     }
@@ -120,7 +122,7 @@ 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(Shape parent){
+    public TextShape(ShapeContainer<Shape> parent){
         super(null, parent);
         _escherContainer = createSpContainer(parent instanceof ShapeGroup);
     }
@@ -623,4 +625,17 @@ public abstract class TextShape extends
 
     }
 
+    @Override
+    public boolean isPlaceholder() {
+        OEPlaceholderAtom oep = getPlaceholderAtom();
+        if (oep != null) return true;
+
+        //special case for files saved in Office 2007
+        RoundTripHFPlaceholder12 hldr = getClientDataRecord(RecordTypes.RoundTripHFPlaceholder12.typeID);
+        if (hldr != null) return true;
+
+        return false;
+    }
+
+    
 }

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java Sat Feb 21 10:56:03 2015
@@ -37,7 +37,7 @@ import org.apache.poi.ddf.EscherSpRecord
 import org.apache.poi.ddf.EscherSpgrRecord;
 import org.apache.poi.ddf.EscherTextboxRecord;
 import org.apache.poi.ddf.UnknownEscherRecord;
-import org.apache.poi.hslf.model.ShapeTypes;
+import org.apache.poi.sl.usermodel.ShapeType;
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.POILogger;
 
@@ -95,7 +95,7 @@ public final class PPDrawing extends Rec
 		final DefaultEscherRecordFactory erf = new DefaultEscherRecordFactory();
 		final List<EscherRecord> escherChildren = new ArrayList<EscherRecord>();
 		findEscherChildren(erf, contents, 8, len-8, escherChildren);
-		this.childRecords = (EscherRecord[]) escherChildren.toArray(new EscherRecord[escherChildren.size()]);
+		this.childRecords = escherChildren.toArray(new EscherRecord[escherChildren.size()]);
 
 		if (1 == this.childRecords.length && (short)0xf002 == this.childRecords[0].getRecordId() && this.childRecords[0] instanceof EscherContainerRecord) {
 			this.textboxWrappers = findInDgContainer((EscherContainerRecord) this.childRecords[0]);
@@ -103,7 +103,7 @@ public final class PPDrawing extends Rec
 			// Find and EscherTextboxRecord's, and wrap them up
 			final List<EscherTextboxWrapper> textboxes = new ArrayList<EscherTextboxWrapper>();
 			findEscherTextboxRecord(childRecords, textboxes);
-			this.textboxWrappers = (EscherTextboxWrapper[]) textboxes.toArray(new EscherTextboxWrapper[textboxes.size()]);
+			this.textboxWrappers = textboxes.toArray(new EscherTextboxWrapper[textboxes.size()]);
 		}
 	}
 	private EscherTextboxWrapper[] findInDgContainer(final EscherContainerRecord escherContainerF002) {
@@ -131,7 +131,7 @@ public final class PPDrawing extends Rec
 				found.add(w);
 			}
 		}
-		return (EscherTextboxWrapper[]) found.toArray(new EscherTextboxWrapper[found.size()]);
+		return found.toArray(new EscherTextboxWrapper[found.size()]);
 	}
 	private StyleTextProp9Atom findInSpContainer(final EscherContainerRecord spContainer) {
 		final EscherContainerRecord escherContainerF011 = findFirstEscherContainerRecordOfType((short)0xf011, spContainer);
@@ -301,7 +301,7 @@ public final class PPDrawing extends Rec
 		spContainer.addChildRecord(spgr);
 
 		EscherSpRecord sp = new EscherSpRecord();
-		sp.setOptions((short)((ShapeTypes.NotPrimitive << 4) + 2));
+		sp.setOptions((short)((ShapeType.NOT_PRIMITIVE.nativeId << 4) + 2));
 		sp.setFlags(EscherSpRecord.FLAG_PATRIARCH | EscherSpRecord.FLAG_GROUP);
 		spContainer.addChildRecord(sp);
 		spgrContainer.addChildRecord(spContainer);
@@ -311,7 +311,7 @@ public final class PPDrawing extends Rec
 		spContainer.setOptions((short)15);
 		spContainer.setRecordId(EscherContainerRecord.SP_CONTAINER);
 		sp = new EscherSpRecord();
-		sp.setOptions((short)((ShapeTypes.Rectangle << 4) + 2));
+		sp.setOptions((short)((ShapeType.RECT.nativeId << 4) + 2));
 		sp.setFlags(EscherSpRecord.FLAG_BACKGROUND | EscherSpRecord.FLAG_HASSHAPETYPE);
 		spContainer.addChildRecord(sp);
 
@@ -393,7 +393,7 @@ public final class PPDrawing extends Rec
 				result.add(child);
 			}
 		}
-		return (EscherContainerRecord[]) result.toArray(new EscherContainerRecord[result.size()]);
+		return result.toArray(new EscherContainerRecord[result.size()]);
     }
     protected Record buildFromUnknownEscherRecord(UnknownEscherRecord unknown) {
 		byte[] bingo = unknown.getData();
@@ -436,6 +436,6 @@ public final class PPDrawing extends Rec
 				}
 			}
     	}
-    	return (StyleTextProp9Atom[]) result.toArray(new StyleTextProp9Atom[result.size()]);
+    	return result.toArray(new StyleTextProp9Atom[result.size()]);
 	}
 }

Added: 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=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawAutoShape.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawAutoShape.java Sat Feb 21 10:56:03 2015
@@ -0,0 +1,10 @@
+package org.apache.poi.sl.draw;
+
+import org.apache.poi.sl.usermodel.*;
+
+
+public class DrawAutoShape<T extends AutoShape> extends DrawTextShape<T> {
+    public DrawAutoShape(T shape) {
+        super(shape);
+    }
+}

Added: 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=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawFactory.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawFactory.java Sat Feb 21 10:56:03 2015
@@ -0,0 +1,96 @@
+/* ====================================================================
+   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.sl.draw;
+
+import static org.apache.poi.sl.draw.Drawable.DRAW_FACTORY;
+
+import java.awt.Graphics2D;
+import java.awt.font.TextLayout;
+import java.text.AttributedString;
+
+import org.apache.poi.sl.usermodel.*;
+
+public class DrawFactory {
+    protected static ThreadLocal<DrawFactory> defaultFactory = new ThreadLocal<DrawFactory>();
+
+    /**
+     * Set a custom draw factory for the current thread.
+     * This is a fallback, for operations where usercode can't set a graphics context.
+     * Preferably use the rendering hint {@link Drawable#DRAW_FACTORY} to set the factory.
+     *
+     * @param factory
+     */
+    public static void setDefaultFactory(DrawFactory factory) {
+        defaultFactory.set(factory);
+    }
+
+    public static DrawFactory getInstance(Graphics2D graphics) {
+        // first try to find the factory over the rendering hing
+        DrawFactory factory = (DrawFactory)graphics.getRenderingHint(DRAW_FACTORY);
+        // secondly try the thread local default
+        if (factory == null) {
+            factory = defaultFactory.get();
+        }
+        // and at last, use the default factory
+        if (factory == null) {
+            factory = new DrawFactory();
+            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);
+        } else if (shape instanceof FreeformShape) {
+            return getDrawable((FreeformShape)shape);
+        }
+
+        throw new IllegalArgumentException("Unsupported shape type: "+shape.getClass());
+    }
+
+    public <T extends TextBox> DrawTextBox<T> getDrawable(T shape) {
+        return new DrawTextBox<T>(shape);
+    }
+
+    public <T extends FreeformShape> DrawFreeformShape<T> getDrawable(T shape) {
+        return new DrawFreeformShape<T>(shape);
+    }
+
+    
+    public DrawTextParagraph getDrawable(TextParagraph paragraph) {
+        return new DrawTextParagraph(paragraph);
+    }
+
+    public DrawTextFragment getTextFragment(TextLayout layout, AttributedString str) {
+        return new DrawTextFragment(layout, str);
+    }
+    
+    public DrawPaint getPaint(PlaceableShape shape) {
+        return new DrawPaint(shape);
+    }
+}

Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawFontManager.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawFontManager.java?rev=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawFontManager.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawFontManager.java Sat Feb 21 10:56:03 2015
@@ -0,0 +1,38 @@
+/*
+ *  ====================================================================
+ *    Licensed to the Apache Software Foundation (ASF) under one or more
+ *    contributor license agreements.  See the NOTICE file distributed with
+ *    this work for additional information regarding copyright ownership.
+ *    The ASF licenses this file to You under the Apache License, Version 2.0
+ *    (the "License"); you may not use this file except in compliance with
+ *    the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ * ====================================================================
+ */
+
+package org.apache.poi.sl.draw;
+
+/**
+ * Manages fonts when rendering slides.
+ *
+ * Use this class to handle unknown / missing fonts or to substitute fonts
+ */
+public interface DrawFontManager {
+
+    /**
+     * select a font to be used to paint text
+     *
+     * @param typeface the font family as defined in the .pptx file.
+     * This can be unknown or missing in the graphic environment.
+     *
+     * @return the font to be used to paint text
+     */
+    String getRendererableFont(String typeface, int pitchFamily);
+}

Added: 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=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawFreeformShape.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawFreeformShape.java Sat Feb 21 10:56:03 2015
@@ -0,0 +1,9 @@
+package org.apache.poi.sl.draw;
+
+import org.apache.poi.sl.usermodel.*;
+
+public class DrawFreeformShape<T extends FreeformShape> extends DrawAutoShape<T> {
+    public DrawFreeformShape(T shape) {
+        super(shape);
+    }
+}

Added: 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=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawMasterSheet.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawMasterSheet.java Sat Feb 21 10:56:03 2015
@@ -0,0 +1,22 @@
+package org.apache.poi.sl.draw;
+
+import org.apache.poi.sl.usermodel.MasterSheet;
+import org.apache.poi.sl.usermodel.Shape;
+
+
+public class DrawMasterSheet extends DrawSheet {
+
+    public DrawMasterSheet(MasterSheet sheet) {
+        super(sheet);
+    }
+
+    /**
+     * Checks if this <code>sheet</code> displays the specified shape.
+     *
+     * Subclasses can override it and skip certain shapes from drawings,
+     * for instance, slide masters and layouts don't display placeholders
+     */
+    protected boolean canDraw(Shape shape){
+        return !shape.isPlaceholder();
+    }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org