poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1664935 [1/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...
Date Sat, 07 Mar 2015 23:35:41 GMT
Author: kiwiwings
Date: Sat Mar  7 23:35:40 2015
New Revision: 1664935

URL: http://svn.apache.org/r1664935
Log:
committing intermediate results - xslf now compiles - hslf needs to be migrated to common interface - drawing is not yet tested

Added:
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFGroupShape.java
      - copied, changed from r1662967, poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ShapeGroup.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/HSLFShape.java
      - copied, changed from r1662967, poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Shape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawBackground.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawPictureShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawShapeGroup.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawSlide.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PictureShape.java
      - copied, changed from r1662967, poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Picture.java
Removed:
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/LineDecoration.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/LineEndLength.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/LineEndWidth.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/RenderableShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Shape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ShapeGroup.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/GradientPaint.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Picture.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/SolidPaint.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TexturePaint.java
Modified:
    poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/ApacheconEU08.java
    poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/DataExtraction.java
    poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/Graphics2DDemo.java
    poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/Hyperlinks.java
    poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/SoundFinder.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/model/ParagraphPropertyFetcher.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/model/PropertyFetcher.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/model/TextBodyPropertyFetcher.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFAutoShape.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFBackground.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGraphicFrame.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureData.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShadow.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShapeContainer.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideLayout.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/EMF.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/PICT.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/WMF.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/AutoShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/AutoShapes.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Background.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Fill.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Freeform.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Hyperlink.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Line.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/MasterSheet.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/MovieShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/OLEShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Picture.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Placeholder.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Polygon.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ShapeFactory.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/ShapeOutline.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Sheet.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Slide.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Table.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TableCell.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TextBox.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TextPainter.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TextShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawAutoShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawFactory.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawFreeformShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawMasterSheet.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawPaint.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawSheet.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawSimpleShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawTextBox.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawTextParagraph.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawTextShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/ImageRenderer.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/AutoShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Background.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/FreeformShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/MasterSheet.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Notes.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PaintStyle.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PictureData.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PlaceableShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Shadow.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Shape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeContainer.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeGroup.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Sheet.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/SimpleShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Slide.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextBox.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextParagraph.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextShape.java
    poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestBackground.java
    poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestOleEmbedding.java
    poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPPGraphics2D.java
    poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java
    poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSheet.java
    poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java
    poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java
    poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextShape.java
    poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java
    poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPictures.java
    poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTable.java

Modified: poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/ApacheconEU08.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/ApacheconEU08.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/ApacheconEU08.java (original)
+++ poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/ApacheconEU08.java Sat Mar  7 23:35:40 2015
@@ -419,7 +419,7 @@ public final class ApacheconEU08 {
 
         Slide slide = ppt.createSlide();
 
-        ShapeGroup group = new ShapeGroup();
+        HSLFGroupShape group = new HSLFGroupShape();
         //define position of the drawing in the slide
         Rectangle bounds = new java.awt.Rectangle(200, 100, 350, 300);
         group.setAnchor(bounds);

Modified: poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/DataExtraction.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/DataExtraction.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/DataExtraction.java (original)
+++ poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/DataExtraction.java Sat Mar  7 23:35:40 2015
@@ -60,7 +60,7 @@ public final class DataExtraction {
         //extract embedded OLE documents
         Slide[] slide = ppt.getSlides();
         for (int i = 0; i < slide.length; i++) {
-            Shape[] shape = slide[i].getShapes();
+            HSLFShape[] shape = slide[i].getShapes();
             for (int j = 0; j < shape.length; j++) {
                 if (shape[j] instanceof OLEShape) {
                     OLEShape ole = (OLEShape) shape[j];
@@ -102,7 +102,7 @@ public final class DataExtraction {
 
         //Pictures
         for (int i = 0; i < slide.length; i++) {
-            Shape[] shape = slide[i].getShapes();
+            HSLFShape[] shape = slide[i].getShapes();
             for (int j = 0; j < shape.length; j++) {
                 if (shape[j] instanceof Picture) {
                     Picture p = (Picture) shape[j];

Modified: poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/Graphics2DDemo.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/Graphics2DDemo.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/Graphics2DDemo.java (original)
+++ poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/Graphics2DDemo.java Sat Mar  7 23:35:40 2015
@@ -46,7 +46,7 @@ public final class Graphics2DDemo {
 
         Slide slide = ppt.createSlide();
 
-        ShapeGroup group = new ShapeGroup();
+        HSLFGroupShape group = new HSLFGroupShape();
         //define position of the drawing in the slide
         Rectangle bounds = new java.awt.Rectangle(200, 100, 350, 300);
         group.setAnchor(bounds);

Modified: poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/Hyperlinks.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/Hyperlinks.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/Hyperlinks.java (original)
+++ poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/Hyperlinks.java Sat Mar  7 23:35:40 2015
@@ -21,7 +21,7 @@ import org.apache.poi.hslf.usermodel.Sli
 import org.apache.poi.hslf.model.Slide;
 import org.apache.poi.hslf.model.TextRun;
 import org.apache.poi.hslf.model.Hyperlink;
-import org.apache.poi.hslf.model.Shape;
+import org.apache.poi.hslf.model.HSLFShape;
 
 import java.io.FileInputStream;
 
@@ -63,7 +63,7 @@ public final class Hyperlinks {
                 //for example to a Line object. The code below demonstrates how to
                 //read such hyperlinks
                 System.out.println("  reading hyperlinks from the slide's shapes");
-                Shape[] sh = slide[j].getShapes();
+                HSLFShape[] sh = slide[j].getShapes();
                 for (int k = 0; k < sh.length; k++) {
                     Hyperlink link = sh[k].getHyperlink();
                     if(link != null)  {

Modified: poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/SoundFinder.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/SoundFinder.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/SoundFinder.java (original)
+++ poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/SoundFinder.java Sat Mar  7 23:35:40 2015
@@ -37,7 +37,7 @@ public class SoundFinder {
 
         Slide[] slide = ppt.getSlides();
         for (int i = 0; i < slide.length; i++) {
-            Shape[] shape = slide[i].getShapes();
+            HSLFShape[] shape = slide[i].getShapes();
             for (int j = 0; j < shape.length; j++) {
                 int soundRef = getSoundReference(shape[j]);
                 if(soundRef != -1) {
@@ -54,7 +54,7 @@ public class SoundFinder {
      * @return 0-based reference to a sound in the sound collection
      * or -1 if the shape is not associated with a sound
      */
-    protected static int getSoundReference(Shape shape){
+    protected static int getSoundReference(HSLFShape shape){
         int soundRef = -1;
         //dive into the shape container and search for InteractiveInfoAtom
         EscherContainerRecord spContainer = shape.getSpContainer();

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/model/ParagraphPropertyFetcher.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/model/ParagraphPropertyFetcher.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/model/ParagraphPropertyFetcher.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/model/ParagraphPropertyFetcher.java Sat Mar  7 23:35:40 2015
@@ -19,7 +19,7 @@
 
 package org.apache.poi.xslf.model;
 
-import org.apache.poi.xslf.usermodel.XSLFSimpleShape;
+import org.apache.poi.xslf.usermodel.XSLFShape;
 import org.apache.xmlbeans.XmlObject;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties;
 
@@ -34,7 +34,7 @@ public abstract class ParagraphPropertyF
         _level = level;
     }
 
-    public boolean fetch(XSLFSimpleShape shape) {
+    public boolean fetch(XSLFShape shape) {
 
         XmlObject[] o = shape.getXmlObject().selectPath(
                 "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' " +

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/model/PropertyFetcher.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/model/PropertyFetcher.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/model/PropertyFetcher.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/model/PropertyFetcher.java Sat Mar  7 23:35:40 2015
@@ -36,7 +36,7 @@ public abstract class PropertyFetcher<T>
      * @param shape the shape being examined
      * @return true if the desired property was fetched
      */
-    public abstract boolean fetch(XSLFShape shape) ;
+    public abstract boolean fetch(XSLFShape shape);
 
     public T getValue(){
         return _value;

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/model/TextBodyPropertyFetcher.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/model/TextBodyPropertyFetcher.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/model/TextBodyPropertyFetcher.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/model/TextBodyPropertyFetcher.java Sat Mar  7 23:35:40 2015
@@ -19,7 +19,7 @@
 
 package org.apache.poi.xslf.model;
 
-import org.apache.poi.xslf.usermodel.XSLFSimpleShape;
+import org.apache.poi.xslf.usermodel.XSLFShape;
 import org.apache.xmlbeans.XmlObject;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBodyProperties;
 
@@ -32,7 +32,7 @@ import org.openxmlformats.schemas.drawin
  */
 public abstract class TextBodyPropertyFetcher<T> extends PropertyFetcher<T> {
 
-    public boolean fetch(XSLFSimpleShape shape) {
+    public boolean fetch(XSLFShape shape) {
 
         XmlObject[] o = shape.getXmlObject().selectPath(
                 "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' " +

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java Sat Mar  7 23:35:40 2015
@@ -496,11 +496,11 @@ public class XMLSlideShow extends POIXML
         return null;
     }
 
-    public MasterSheet<XSLFShape>[] getMasterSheet() {
+    public XSLFSlideMaster[] getMasterSheet() {
         return getSlideMasters();
     }
 
-    public MasterSheet<XSLFShape> createMasterSheet() throws IOException {
+    public MasterSheet createMasterSheet() throws IOException {
         // TODO: implement!
         throw new UnsupportedOperationException();
     }

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFAutoShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFAutoShape.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFAutoShape.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFAutoShape.java Sat Mar  7 23:35:40 2015
@@ -36,7 +36,7 @@ import org.openxmlformats.schemas.presen
  * @author Yegor Kozlov
  */
 @Beta
-public class XSLFAutoShape extends XSLFTextShape implements AutoShape {
+public class XSLFAutoShape extends XSLFTextShape implements AutoShape<XSLFTextParagraph> {
 
     /*package*/ XSLFAutoShape(CTShape shape, XSLFSheet sheet) {
         super(shape, sheet);
@@ -72,7 +72,7 @@ public class XSLFAutoShape extends XSLFT
     }
 
     protected CTTextBody getTextBody(boolean create){
-        CTShape shape = (CTShape) getXmlObject();
+        CTShape shape = (CTShape)getXmlObject();
         CTTextBody txBody = shape.getTxBody();
         if (txBody == null && create) {
             txBody = shape.addNewTxBody();

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFBackground.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFBackground.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFBackground.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFBackground.java Sat Mar  7 23:35:40 2015
@@ -20,9 +20,10 @@ package org.apache.poi.xslf.usermodel;
 import java.awt.*;
 import java.awt.geom.Rectangle2D;
 
-import org.apache.poi.sl.usermodel.Background;
-import org.apache.xmlbeans.XmlObject;
-import org.openxmlformats.schemas.drawingml.x2006.main.*;
+import org.apache.poi.sl.draw.DrawPaint;
+import org.apache.poi.sl.usermodel.*;
+import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTBackground;
 
 /**
@@ -42,48 +43,14 @@ public class XSLFBackground extends XSLF
         return new Rectangle2D.Double(0, 0, pg.getWidth(), pg.getHeight());
     }
 
-    public void draw(Graphics2D graphics) {
-        Rectangle2D anchor = getAnchor();
-
-        Paint fill = getPaint(graphics);
-        if(fill != null) {
-            graphics.setPaint(fill);
-            graphics.fill(anchor);
-        }
-    }
-
-    /**
-     * @return the Paint object to fill
-     */
-    Paint getPaint(Graphics2D graphics){
-        RenderableShape rShape = new RenderableShape(this);
-
-        Paint fill = null;
-        CTBackground bg = (CTBackground)getXmlObject();
-        if(bg.isSetBgPr()){
-            XmlObject spPr = bg.getBgPr();
-            fill = rShape.getPaint(graphics, spPr, null);
-        } else if (bg.isSetBgRef()){
-            CTStyleMatrixReference bgRef= bg.getBgRef();
-            CTSchemeColor phClr = bgRef.getSchemeClr();
-
-            int idx = (int)bgRef.getIdx() - 1001;
-            XSLFTheme theme = getSheet().getTheme();
-            CTBackgroundFillStyleList bgStyles =
-                    theme.getXmlObject().getThemeElements().getFmtScheme().getBgFillStyleLst();
-
-            XmlObject bgStyle = bgStyles.selectPath("*")[idx];
-            fill = rShape.selectPaint(graphics, bgStyle, phClr, theme.getPackagePart());
-        }
-
-        return fill;
-    }
-
     @Override
     public Color getFillColor(){
-        Paint p = getPaint(null);
-        if(p instanceof Color){
-            return (Color)p;
+        FillStyle fs = getFillStyle();
+        PaintStyle ps = fs.getPaint();
+        if (ps instanceof SolidPaint) {
+            SolidPaint sp = (SolidPaint)ps;
+            ColorStyle cs = sp.getSolidColor();
+            return DrawPaint.applyColorTransform(cs);
         }
         return null;
     }
@@ -95,7 +62,7 @@ public class XSLFBackground extends XSLF
      * @return  dummy  CTTransform2D bean
      */
     @Override
-    CTTransform2D getXfrm() {
+    protected CTTransform2D getXfrm() {
         return CTTransform2D.Factory.newInstance();
     }
 }

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGraphicFrame.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGraphicFrame.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGraphicFrame.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGraphicFrame.java Sat Mar  7 23:35:40 2015
@@ -19,6 +19,10 @@
 
 package org.apache.poi.xslf.usermodel;
 
+import java.awt.geom.Rectangle2D;
+
+import javax.xml.namespace.QName;
+
 import org.apache.poi.POIXMLException;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.openxml4j.opc.PackagePart;
@@ -28,52 +32,24 @@ import org.apache.poi.util.Beta;
 import org.apache.poi.util.Units;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlObject;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTGraphicalObjectData;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D;
+import org.openxmlformats.schemas.drawingml.x2006.main.*;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTGraphicalObjectFrame;
 
-import javax.xml.namespace.QName;
-
-import java.awt.Graphics2D;
-import java.awt.geom.Rectangle2D;
-
 /**
  * @author Yegor Kozlov
  */
 @Beta
 public class XSLFGraphicFrame extends XSLFShape {
-    private final CTGraphicalObjectFrame _shape;
-    private final XSLFSheet _sheet;
-
     /*package*/ XSLFGraphicFrame(CTGraphicalObjectFrame shape, XSLFSheet sheet){
-        _shape = shape;
-        _sheet = sheet;
-    }
-
-    public CTGraphicalObjectFrame getXmlObject(){
-        return _shape;
-    }
-
-    public XSLFSheet getSheet(){
-        return _sheet;
+        super(shape,sheet);
     }
 
     public ShapeType getShapeType(){
         throw new UnsupportedOperationException();
     }
 
-    public int getShapeId(){
-        return (int)_shape.getNvGraphicFramePr().getCNvPr().getId();
-    }
-
-    public String getShapeName(){
-        return _shape.getNvGraphicFramePr().getCNvPr().getName();
-    }
-
     public Rectangle2D getAnchor(){
-        CTTransform2D xfrm = _shape.getXfrm();
+        CTTransform2D xfrm = ((CTGraphicalObjectFrame)getXmlObject()).getXfrm();
         CTPoint2D off = xfrm.getOff();
         long x = off.getX();
         long y = off.getY();
@@ -86,7 +62,7 @@ public class XSLFGraphicFrame extends XS
     }
 
     public void setAnchor(Rectangle2D anchor){
-        CTTransform2D xfrm = _shape.getXfrm();
+        CTTransform2D xfrm = ((CTGraphicalObjectFrame)getXmlObject()).getXfrm();
         CTPoint2D off = xfrm.isSetOff() ? xfrm.getOff() : xfrm.addNewOff();
         long x = Units.toEMU(anchor.getX());
         long y = Units.toEMU(anchor.getY());
@@ -157,15 +133,11 @@ public class XSLFGraphicFrame extends XS
     	return false;
     }
 
-    public void draw(Graphics2D graphics){
-
-    }
-
     @Override
     void copy(XSLFShape sh){
         super.copy(sh);
 
-        CTGraphicalObjectData data = _shape.getGraphic().getGraphicData();
+        CTGraphicalObjectData data = ((CTGraphicalObjectFrame)getXmlObject()).getGraphic().getGraphicData();
         String uri = data.getUri();
         if(uri.equals("http://schemas.openxmlformats.org/drawingml/2006/diagram")){
             copyDiagram(data, (XSLFGraphicFrame)sh);
@@ -187,22 +159,22 @@ public class XSLFGraphicFrame extends XS
                 String dm = c.getAttributeText(new QName("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "dm"));
                 PackageRelationship dmRel = sheet.getPackagePart().getRelationship(dm);
                 PackagePart dmPart = sheet.getPackagePart().getRelatedPart(dmRel);
-                _sheet.importPart(dmRel, dmPart);
+                getSheet().importPart(dmRel, dmPart);
 
                 String lo = c.getAttributeText(new QName("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "lo"));
                 PackageRelationship loRel = sheet.getPackagePart().getRelationship(lo);
                 PackagePart loPart = sheet.getPackagePart().getRelatedPart(loRel);
-                _sheet.importPart(loRel, loPart);
+                getSheet().importPart(loRel, loPart);
 
                 String qs = c.getAttributeText(new QName("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "qs"));
                 PackageRelationship qsRel = sheet.getPackagePart().getRelationship(qs);
                 PackagePart qsPart = sheet.getPackagePart().getRelatedPart(qsRel);
-                _sheet.importPart(qsRel, qsPart);
+                getSheet().importPart(qsRel, qsPart);
 
                 String cs = c.getAttributeText(new QName("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "cs"));
                 PackageRelationship csRel = sheet.getPackagePart().getRelationship(cs);
                 PackagePart csPart = sheet.getPackagePart().getRelatedPart(csRel);
-                _sheet.importPart(csRel, csPart);
+                getSheet().importPart(csRel, csPart);
 
             } catch (InvalidFormatException e){
                 throw new POIXMLException(e);

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java Sat Mar  7 23:35:40 2015
@@ -29,15 +29,11 @@ import java.util.regex.Pattern;
 import org.apache.poi.openxml4j.opc.PackagePart;
 import org.apache.poi.openxml4j.opc.PackageRelationship;
 import org.apache.poi.openxml4j.opc.TargetMode;
-import org.apache.poi.sl.usermodel.ShapeType;
+import org.apache.poi.sl.usermodel.*;
 import org.apache.poi.util.Beta;
 import org.apache.poi.util.Units;
 import org.apache.xmlbeans.XmlObject;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTGroupShapeProperties;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTGroupTransform2D;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D;
+import org.openxmlformats.schemas.drawingml.x2006.main.*;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTConnector;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShapeNonVisual;
@@ -49,29 +45,33 @@ import org.openxmlformats.schemas.presen
  * @author Yegor Kozlov
  */
 @Beta
-public class XSLFGroupShape extends XSLFShape implements XSLFShapeContainer {
-    private final CTGroupShape _shape;
-    private final XSLFSheet _sheet;
+public class XSLFGroupShape extends XSLFShape implements XSLFShapeContainer, PlaceableShape {
     private final List<XSLFShape> _shapes;
-    private final CTGroupShapeProperties _spPr;
+    private final CTGroupShapeProperties _grpSpPr;
     private XSLFDrawing _drawing;
 
-    /*package*/ XSLFGroupShape(CTGroupShape shape, XSLFSheet sheet){
-        _shape = shape;
-        _sheet = sheet;
-
-        _shapes = _sheet.buildShapes(_shape);
-        _spPr = shape.getGrpSpPr();
-    }
-
-    @Override
-    public CTGroupShape getXmlObject(){
-        return _shape;
+    protected XSLFGroupShape(CTGroupShape shape, XSLFSheet sheet){
+        super(shape,sheet);
+        _shapes = sheet.buildShapes(shape);
+        _grpSpPr = shape.getGrpSpPr();
+    }
+
+    protected CTGroupShapeProperties getGrpSpPr() {
+        return _grpSpPr;
+    }
+    
+    protected CTGroupTransform2D getSafeXfrm() {
+        CTGroupTransform2D xfrm = getXfrm();
+        return (xfrm == null ? getGrpSpPr().addNewXfrm() : xfrm);
+    }
+    
+    protected CTGroupTransform2D getXfrm() {
+        return getGrpSpPr().getXfrm();
     }
 
     @Override
     public Rectangle2D getAnchor(){
-        CTGroupTransform2D xfrm = _spPr.getXfrm();
+        CTGroupTransform2D xfrm = getXfrm();
         CTPoint2D off = xfrm.getOff();
         long x = off.getX();
         long y = off.getY();
@@ -85,7 +85,7 @@ public class XSLFGroupShape extends XSLF
 
     @Override
     public void setAnchor(Rectangle2D anchor){
-        CTGroupTransform2D xfrm = _spPr.isSetXfrm() ? _spPr.getXfrm() : _spPr.addNewXfrm();
+        CTGroupTransform2D xfrm = getSafeXfrm();
         CTPoint2D off = xfrm.isSetOff() ? xfrm.getOff() : xfrm.addNewOff();
         long x = Units.toEMU(anchor.getX());
         long y = Units.toEMU(anchor.getY());
@@ -105,7 +105,7 @@ public class XSLFGroupShape extends XSLF
      * behavior of shapes placed within a group.
      */
     public Rectangle2D getInteriorAnchor(){
-        CTGroupTransform2D xfrm = _spPr.getXfrm();
+        CTGroupTransform2D xfrm = getXfrm();
         CTPoint2D off = xfrm.getChOff();
         long x = off.getX();
         long y = off.getY();
@@ -124,7 +124,7 @@ public class XSLFGroupShape extends XSLF
      * behavior of shapes placed within a group.
      */
     public void setInteriorAnchor(Rectangle2D anchor){
-        CTGroupTransform2D xfrm = _spPr.isSetXfrm() ? _spPr.getXfrm() : _spPr.addNewXfrm();
+        CTGroupTransform2D xfrm = getSafeXfrm();
         CTPoint2D off = xfrm.isSetChOff() ? xfrm.getChOff() : xfrm.addNewChOff();
         long x = Units.toEMU(anchor.getX());
         long y = Units.toEMU(anchor.getY());
@@ -159,28 +159,19 @@ public class XSLFGroupShape extends XSLF
      */
     public boolean removeShape(XSLFShape xShape) {
         XmlObject obj = xShape.getXmlObject();
+        CTGroupShape grpSp = (CTGroupShape)getXmlObject();
         if(obj instanceof CTShape){
-            _shape.getSpList().remove(obj);
+            grpSp.getSpList().remove(obj);
         } else if (obj instanceof CTGroupShape){
-            _shape.getGrpSpList().remove(obj);
+            grpSp.getGrpSpList().remove(obj);
         } else if (obj instanceof CTConnector){
-            _shape.getCxnSpList().remove(obj);
+            grpSp.getCxnSpList().remove(obj);
         } else {
             throw new IllegalArgumentException("Unsupported shape: " + xShape);
         }
         return _shapes.remove(xShape);
     }
 
-    @Override
-    public String getShapeName(){
-        return _shape.getNvGrpSpPr().getCNvPr().getName();
-    }
-
-    @Override
-    public int getShapeId(){
-        return (int)_shape.getNvGrpSpPr().getCNvPr().getId();
-    }
-
     /**
      * @param shapeId 1-based shapeId
      */
@@ -200,7 +191,7 @@ public class XSLFGroupShape extends XSLF
     // shape factory methods
     private XSLFDrawing getDrawing(){
         if(_drawing == null) {
-            _drawing = new XSLFDrawing(_sheet, _shape);
+            _drawing = new XSLFDrawing(getSheet(), (CTGroupShape)getXmlObject());
         }
         return _drawing;
     }
@@ -242,7 +233,7 @@ public class XSLFGroupShape extends XSLF
 
     public XSLFPictureShape createPicture(int pictureIndex){
 
-        List<PackagePart>  pics = _sheet.getPackagePart().getPackage()
+        List<PackagePart>  pics = getSheet().getPackagePart().getPackage()
                 .getPartsByName(Pattern.compile("/ppt/media/image" + (pictureIndex + 1) + ".*?"));
 
         if(pics.size() == 0) {
@@ -251,7 +242,7 @@ public class XSLFGroupShape extends XSLF
 
         PackagePart pic = pics.get(0);
 
-        PackageRelationship rel = _sheet.getPackagePart().addRelationship(
+        PackageRelationship rel = getSheet().getPackagePart().addRelationship(
                 pic.getPartName(), TargetMode.INTERNAL, XSLFRelation.IMAGES.getRelation());
 
         XSLFPictureShape sh = getDrawing().createPicture(rel.getId());
@@ -263,67 +254,35 @@ public class XSLFGroupShape extends XSLF
 
     @Override
     public void setFlipHorizontal(boolean flip){
-        _spPr.getXfrm().setFlipH(flip);
+        getSafeXfrm().setFlipH(flip);
     }
 
     @Override
     public void setFlipVertical(boolean flip){
-        _spPr.getXfrm().setFlipV(flip);
+        getSafeXfrm().setFlipV(flip);
     }
 
     @Override
     public boolean getFlipHorizontal(){
-         return _spPr.getXfrm().getFlipH();
+        CTGroupTransform2D xfrm = getXfrm();
+        return (xfrm == null || !xfrm.isSetFlipH()) ? false : xfrm.getFlipH();
     }
 
     @Override
     public boolean getFlipVertical(){
-         return _spPr.getXfrm().getFlipV();
+        CTGroupTransform2D xfrm = getXfrm();
+        return (xfrm == null || !xfrm.isSetFlipV()) ? false : xfrm.getFlipV();
     }
 
     @Override
     public void setRotation(double theta){
-        _spPr.getXfrm().setRot((int)(theta*60000));
+        getSafeXfrm().setRot((int) (theta * 60000));
     }
 
     @Override
     public double getRotation(){
-        return (double)_spPr.getXfrm().getRot()/60000;
-    }
-
-    @Override
-    public void draw(Graphics2D graphics){
-
-    	// the coordinate system of this group of shape
-        Rectangle2D interior = getInteriorAnchor();
-        // anchor of this group relative to the parent shape
-        Rectangle2D exterior = getAnchor();
-
-        AffineTransform tx = (AffineTransform)graphics.getRenderingHint(XSLFRenderingHint.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());
-
-        for (XSLFShape shape : getShapes()) {
-        	// remember the initial transform and restore it after we are done with the drawing
-        	AffineTransform at = graphics.getTransform();
-            graphics.setRenderingHint(XSLFRenderingHint.GSAVE, true);
-
-            shape.applyTransform(graphics);
-        	shape.draw(graphics);
-
-            // restore the coordinate system
-            graphics.setTransform(at);
-            graphics.setRenderingHint(XSLFRenderingHint.GRESTORE, true);
-        }
-
-        graphics.setRenderingHint(XSLFRenderingHint.GROUP_TRANSFORM, tx0);
-        
+        CTGroupTransform2D xfrm = getXfrm();
+        return (xfrm == null || !xfrm.isSetRot()) ? 0 : (xfrm.getRot() / 60000.d);
     }
 
     @Override
@@ -350,13 +309,9 @@ public class XSLFGroupShape extends XSLF
         }
     }
 
-    public ShapeType getShapeType(){
-        return null;
-    }
-
     public void addShape(XSLFShape shape) {
         throw new UnsupportedOperationException(
             "Adding a shape from a different container is not supported -"
-            + " create it from scratch witht XSLFGroupShape.create* methods");
+            + " create it from scratch with XSLFGroupShape.create* methods");
     }
 }
\ No newline at end of file

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureData.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureData.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureData.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureData.java Sat Mar  7 23:35:40 2015
@@ -20,12 +20,12 @@
 package org.apache.poi.xslf.usermodel;
 
 import java.io.IOException;
+import java.io.OutputStream;
 
-import org.apache.poi.POIXMLDocumentPart;
-import org.apache.poi.POIXMLException;
-import org.apache.poi.POIXMLRelation;
+import org.apache.poi.*;
 import org.apache.poi.openxml4j.opc.PackagePart;
 import org.apache.poi.openxml4j.opc.PackageRelationship;
+import org.apache.poi.sl.usermodel.PictureData;
 import org.apache.poi.util.Beta;
 import org.apache.poi.util.IOUtils;
 
@@ -35,7 +35,7 @@ import org.apache.poi.util.IOUtils;
  * @author Yegor Kozlov
  */
 @Beta
-public final class XSLFPictureData extends POIXMLDocumentPart {
+public final class XSLFPictureData extends POIXMLDocumentPart implements PictureData {
     /**
      * Extended windows meta file
      */
@@ -215,4 +215,17 @@ public final class XSLFPictureData exten
     protected void prepareForCommit() {
         // do not clear the part here
     }
+    
+    public String getContentType() {
+        POIXMLRelation rel = RELATIONS[getPictureType()];
+        return (rel == null) ? null : rel.getContentType();
+    }
+
+    public void setData(byte[] data) throws IOException {
+        OutputStream os = getPackagePart().getOutputStream();
+        os.write(data);
+        os.close();
+    }
+    
+    
 }
\ No newline at end of file

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java Sat Mar  7 23:35:40 2015
@@ -179,30 +179,13 @@ public class XSLFPictureShape extends XS
         return id;
     }
 
-    public Insets getBlipClip(){
+    public Insets getClipping(){
         CTPicture ct = (CTPicture)getXmlObject();
         CTRelativeRect r = ct.getBlipFill().getSrcRect();
         return (r == null) ? null : new Insets(r.getT(), r.getL(), r.getB(), r.getR());
     }
 
-    @Override
-    public void drawContent(Graphics2D graphics) {
-
-        XSLFPictureData data = getPictureData();
-    	if(data == null) return;
-
-        XSLFImageRenderer renderer = (XSLFImageRenderer)graphics.getRenderingHint(XSLFRenderingHint.IMAGE_RENDERER);
-        if(renderer == null) renderer = new XSLFImageRenderer();
-
-        RenderableShape rShape = new RenderableShape(this);
-        Rectangle2D anchor = rShape.getAnchor(graphics);
-        
-        Insets insets = getBlipClip();
-
-        renderer.drawImage(graphics, data, anchor, insets);
-    }
-
-
+    @SuppressWarnings("deprecation")
     @Override
     void copy(XSLFShape sh){
         super.copy(sh);

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShadow.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShadow.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShadow.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShadow.java Sat Mar  7 23:35:40 2015
@@ -17,22 +17,22 @@
 
 package org.apache.poi.xslf.usermodel;
 
-import org.apache.poi.sl.usermodel.Shadow;
+import java.awt.Color;
+import java.awt.geom.Rectangle2D;
+
+import org.apache.poi.sl.draw.DrawPaint;
+import org.apache.poi.sl.usermodel.*;
+import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint;
 import org.apache.poi.util.Units;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTOuterShadowEffect;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor;
 
-import java.awt.Color;
-import java.awt.Graphics2D;
-import java.awt.Shape;
-import java.awt.geom.Rectangle2D;
-
 /**
  * Represents a shadow of a shape. For now supports only outer shadows.
  *
  * @author Yegor Kozlov
  */
-public class XSLFShadow extends XSLFSimpleShape implements Shadow {
+public class XSLFShadow extends XSLFShape implements Shadow {
 
     private XSLFSimpleShape _parent;
 
@@ -42,54 +42,15 @@ public class XSLFShadow extends XSLFSimp
         _parent = parentShape;
     }
 
-
-    public void fill(Graphics2D graphics, Shape outline) {
-
-        double shapeRotation = _parent.getRotation();
-        if(_parent.getFlipVertical()){
-            shapeRotation += 180;
-        }
-        double angle = getAngle() - shapeRotation;
-        double dist = getDistance();
-        double dx = dist * Math.cos(Math.toRadians(angle));
-        double dy = dist * Math.sin(Math.toRadians(angle));
-
-        graphics.translate(dx, dy);
-
-        Color fillColor = getFillColor();
-        if (fillColor != null) {
-            graphics.setColor(fillColor);
-            graphics.fill(outline);
-        }
-
-        graphics.translate(-dx, -dy);
-    }
-
-    public void draw(Graphics2D graphics, Shape outline) {
-
-        double angle = getAngle();
-        double dist = getDistance();
-        double dx = dist * Math.cos(Math.toRadians(angle));
-        double dy = dist * Math.sin(Math.toRadians(angle));
-
-        graphics.translate(dx, dy);
-
-        Color fillColor = getFillColor();
-        if (fillColor != null) {
-            graphics.setColor(fillColor);
-            graphics.draw(outline);
-        }
-
-        graphics.translate(-dx, -dy);
+    @Override
+    public XSLFSimpleShape getShadowParent() {
+        return _parent;
     }
 
-
-    @Override
     public Rectangle2D getAnchor(){
         return _parent.getAnchor();
     }
 
-    @Override
     public void setAnchor(Rectangle2D anchor){
         throw new IllegalStateException("You can't set anchor of a shadow");
     }
@@ -125,15 +86,25 @@ public class XSLFShadow extends XSLFSimp
      * @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
      */
-    @Override
     public Color getFillColor() {
+        SolidPaint ps = getFillStyle();
+        if (ps == TRANSPARENT_PAINT) return null;
+        Color col = DrawPaint.applyColorTransform(ps.getSolidColor());
+        return col;
+    }
+
+    @Override
+    public SolidPaint getFillStyle() {
         XSLFTheme theme = getSheet().getTheme();
         CTOuterShadowEffect ct = (CTOuterShadowEffect)getXmlObject();
-        if(ct == null) {
-            return null;
-        } else {
-            CTSchemeColor phClr = ct.getSchemeClr();
-            return new XSLFColor(ct, theme, phClr).getColor();
-        }
+        if(ct == null) return TRANSPARENT_PAINT;
+            
+        CTSchemeColor phClr = ct.getSchemeClr();
+        final XSLFColor xc = new XSLFColor(ct, theme, phClr);
+        return new SolidPaint(){
+            public ColorStyle getSolidColor() {
+                return xc.getColorStyle();
+            }
+        };
     }
 }
\ No newline at end of file

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java Sat Mar  7 23:35:40 2015
@@ -20,7 +20,6 @@
 package org.apache.poi.xslf.usermodel;
 
 import java.awt.Color;
-import java.awt.geom.Rectangle2D;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Arrays;
@@ -30,14 +29,16 @@ import org.apache.poi.openxml4j.exceptio
 import org.apache.poi.openxml4j.opc.PackagePart;
 import org.apache.poi.openxml4j.opc.PackageRelationship;
 import org.apache.poi.sl.draw.DrawPaint;
-import org.apache.poi.sl.draw.geom.CustomGeometry;
 import org.apache.poi.sl.usermodel.*;
-import org.apache.poi.util.*;
+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.Beta;
+import org.apache.poi.util.Internal;
 import org.apache.poi.xslf.model.PropertyFetcher;
 import org.apache.xmlbeans.XmlObject;
 import org.openxmlformats.schemas.drawingml.x2006.main.*;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder;
-import org.openxmlformats.schemas.presentationml.x2006.main.STPlaceholderType;
+import org.openxmlformats.schemas.presentationml.x2006.main.*;
 
 /**
  * Base super-class class for all shapes in PresentationML
@@ -46,16 +47,16 @@ import org.openxmlformats.schemas.presen
  */
 @Beta
 public abstract class XSLFShape implements Shape {
-    protected final XmlObject _shape;
-    protected final XSLFSheet _sheet;
-    protected XSLFShapeContainer _parent;
+    private final XmlObject _shape;
+    private final XSLFSheet _sheet;
+    private XSLFShapeContainer _parent;
 
     private CTShapeProperties _spPr;
     private CTShapeStyle _spStyle;
     private CTNonVisualDrawingProps _nvPr;
     private CTPlaceholder _ph;
 
-    private static final PaintStyle TRANSPARENT_PAINT = new SolidPaint() {
+    protected static final SolidPaint TRANSPARENT_PAINT = new SolidPaint() {
         public ColorStyle getSolidColor() {
             return new ColorStyle(){
                 public Color getColor() { return DrawPaint.NO_PAINT; }
@@ -68,24 +69,30 @@ public abstract class XSLFShape implemen
         }
     };
     
-    
     protected XSLFShape(XmlObject shape, XSLFSheet sheet) {
         _shape = shape;
         _sheet = sheet;
     }
-
     
     /**
      * @return the xml bean holding this shape's data
      */
-    public XmlObject getXmlObject() {
+    public final XmlObject getXmlObject() {
+        // it's final because the xslf inheritance hierarchy is not necessary the same as
+        // the (not existing) xmlbeans hierarchy and subclasses shouldn't narrow it's return value
         return _shape;
     }
     
+    public XSLFSheet getSheet() {
+        return _sheet;
+    }
+    
     /**
      * @return human-readable name of this shape, e.g. "Rectange 3"
      */
-    public abstract String getShapeName();
+    public String getShapeName(){
+        return getCNvPr().getName();
+    }
 
     /**
      * Returns a unique identifier for this shape within the current document.
@@ -98,55 +105,9 @@ public abstract class XSLFShape implemen
      *
      * @return unique id of this shape
      */
-    public abstract int getShapeId();
-
-    /**
-     * 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.
-     */
-    public abstract void setRotation(double theta);
-
-    /**
-     * Rotation angle in degrees
-     * <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>
-     *
-     * @return rotation angle in degrees
-     */
-    public abstract double getRotation();
-
-    /**
-     * @param flip whether the shape is horizontally flipped
-     */
-    public abstract void setFlipHorizontal(boolean flip);
-
-    /**
-     * Whether the shape is vertically flipped
-     *
-     * @param flip whether the shape is vertically flipped
-     */
-    public abstract void setFlipVertical(boolean flip);
-
-    /**
-     * Whether the shape is horizontally flipped
-     *
-     * @return whether the shape is horizontally flipped
-     */
-    public abstract boolean getFlipHorizontal();
-
-    /**
-     * Whether the shape is vertically flipped
-     *
-     * @return whether the shape is vertically flipped
-     */
-    public abstract boolean getFlipVertical();
+    public int getShapeId() {
+        return (int)getCNvPr().getId();
+    }
 
     /**
      * Set the contents of this shape to be a copy of the source shape.
@@ -162,7 +123,12 @@ public abstract class XSLFShape implemen
                     "Can't copy " + sh.getClass().getSimpleName() + " into " + getClass().getSimpleName());
         }
 
-        setAnchor(sh.getAnchor());
+        if (this instanceof PlaceableShape) {
+            PlaceableShape ps = (PlaceableShape)this;
+            ps.setAnchor(((PlaceableShape)sh).getAnchor());
+        }
+        
+        
     }
     
     public void setParent(XSLFShapeContainer parent) {
@@ -173,93 +139,148 @@ public abstract class XSLFShape implemen
         return this._parent;
     }
     
-    public boolean isPlaceholder() {
-        return false;
+    protected PaintStyle getFillPaint() {
+        PropertyFetcher<PaintStyle> fetcher = new PropertyFetcher<PaintStyle>() {
+            public boolean fetch(XSLFShape shape) {
+                XmlObject pr = null;
+                try {
+                    pr = shape.getSpPr();
+                    if (((CTShapeProperties)pr).isSetNoFill()) {
+                        setValue(TRANSPARENT_PAINT);
+                        return true;
+                    }                    
+                } catch (IllegalStateException e) {}
+                // trying background properties now
+                if (pr == null) {
+                    pr = shape.getBgPr();
+                }
+                if (pr == null) {
+                    pr = shape.getGrpSpPr();
+                }
+                if (pr == null) {
+                    setValue(TRANSPARENT_PAINT);
+                    return true;
+                }
+                
+                PaintStyle paint = null;
+                for (XmlObject obj : pr.selectPath("*")) {
+                    paint = selectPaint(obj, null, getSheet().getPackagePart());
+                    if (paint != null) break;
+                }
+                
+                if (paint == null) return false;
+                
+                setValue(paint);
+                return true;
+            }
+        };
+        fetchShapeProperty(fetcher);
+
+        PaintStyle paint = fetcher.getValue();
+        if (paint != null) return paint;
+        
+        // fill color was not found, check if it is defined in the theme
+        // get a reference to a fill style within the style matrix.
+        CTStyleMatrixReference fillRef = null;
+        if (fillRef == null) {
+            CTShapeStyle style = getSpStyle();
+            if (style != null) fillRef = style.getFillRef();
+        }
+        if (fillRef == null) {
+            fillRef = getBgRef();
+        }
+        if (fillRef == null) {
+            return TRANSPARENT_PAINT;
+        }
+
+        // The idx attribute refers to the index of a fill style or
+        // background fill style within the presentation's style matrix, defined by the fmtScheme element.
+        // value of 0 or 1000 indicates no background,
+        // values 1-999 refer to the index of a fill style within the fillStyleLst element
+        // values 1001 and above refer to the index of a background fill style within the bgFillStyleLst element.
+        int idx = (int)fillRef.getIdx();
+        CTSchemeColor phClr = fillRef.getSchemeClr();
+        XSLFSheet sheet = getSheet();
+        XSLFTheme theme = sheet.getTheme();
+        XmlObject fillProps = null;
+        CTStyleMatrix matrix = theme.getXmlObject().getThemeElements().getFmtScheme();
+        if(idx >= 1 && idx <= 999){
+            fillProps = matrix.getFillStyleLst().selectPath("*")[idx - 1];
+        } else if (idx >= 1001 ){
+            fillProps = matrix.getBgFillStyleLst().selectPath("*")[idx - 1001];
+        }
+        if(fillProps != null) {
+            paint = selectPaint(fillProps, phClr, sheet.getPackagePart());
+        }
+
+        return paint == null ? TRANSPARENT_PAINT : paint;
     }
 
-    public StrokeStyle getStrokeStyle() {
-        // TODO Auto-generated method stub
-        return null;
+    protected CTBackgroundProperties getBgPr() {
+        String xquery = "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//*/p:bgPr";
+        return selectProperty(CTBackgroundProperties.class, xquery);
+    }
+    
+    protected CTStyleMatrixReference getBgRef() {
+        String xquery = "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//*/p:bgRef";
+        return selectProperty(CTStyleMatrixReference.class, xquery);
+    }
+    
+    protected CTGroupShapeProperties getGrpSpPr() {
+        String xquery = "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//*/p:grpSpPr";
+        return selectProperty(CTGroupShapeProperties.class, xquery);
+    }
+    
+    protected CTNonVisualDrawingProps getCNvPr() {
+        if (_nvPr == null) {
+            String xquery = "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//*/p:cNvPr";
+            _nvPr = selectProperty(CTNonVisualDrawingProps.class, xquery);
+        }
+        return _nvPr;
     }
 
-    public CustomGeometry getGeometry() {
-        // TODO Auto-generated method stub
-        return null;
+    protected CTShapeProperties getSpPr() {
+        if (_spPr == null) {
+            String xquery = "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//*/p:spPr";
+            _spPr = selectProperty(CTShapeProperties.class, xquery);
+        }
+        if (_spPr == null) {
+            throw new IllegalStateException("CTShapeProperties was not found.");
+        }
+        return _spPr;
     }
 
-    public ShapeType getShapeType() {
-        // TODO Auto-generated method stub
-        return null;
+    protected CTShapeStyle getSpStyle() {
+        if (_spStyle == null) {
+            String xquery = "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//*/p:style";
+            _spStyle = selectProperty(CTShapeStyle.class, xquery);
+        }
+        return _spStyle;
     }
 
-    public XSLFSheet getSheet() {
-        // TODO Auto-generated method stub
-        return null;
+    protected CTPlaceholder getCTPlaceholder() {
+        if (_ph == null) {
+            String xquery = "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//*/p:nvPr/p:ph";
+            _ph = selectProperty(CTPlaceholder.class, xquery);
+        }
+        return _ph;
     }
     
     /**
-     * fetch shape fill as a java.awt.Paint
-     *
-     * @return either Color or GradientPaint or TexturePaint or null
-     */
-    @Override
-    public FillStyle getFillStyle() {
-        return new FillStyle() {
-            public PaintStyle getPaint() {
-                PropertyFetcher<PaintStyle> fetcher = new PropertyFetcher<PaintStyle>() {
-                    public boolean fetch(XSLFShape shape) {
-                        CTShapeProperties spPr = shape.getSpPr();
-                        if (spPr.isSetNoFill()) {
-                            setValue(TRANSPARENT_PAINT);
-                            return true;
-                        }
-                        
-                        PaintStyle paint = null;
-                        for (XmlObject obj : spPr.selectPath("*")) {
-                            paint = selectPaint(obj, null, getSheet().getPackagePart());
-                            if (paint != null) break;
-                        }
-                        
-                        if (paint == null) return false;
-                        
-                        setValue(paint);
-                        return true;
-                    }
-                };
-                fetchShapeProperty(fetcher);
-
-                PaintStyle paint = fetcher.getValue();
-
-                if (paint != null) return paint;
-                
-                // fill color was not found, check if it is defined in the theme
-                CTShapeStyle style = getSpStyle();
-                if (style != null) {
-                    // get a reference to a fill style within the style matrix.
-                    CTStyleMatrixReference fillRef = style.getFillRef();
-                    // The idx attribute refers to the index of a fill style or
-                    // background fill style within the presentation's style matrix, defined by the fmtScheme element.
-                    // value of 0 or 1000 indicates no background,
-                    // values 1-999 refer to the index of a fill style within the fillStyleLst element
-                    // values 1001 and above refer to the index of a background fill style within the bgFillStyleLst element.
-                    int idx = (int)fillRef.getIdx();
-                    CTSchemeColor phClr = fillRef.getSchemeClr();
-                    XSLFSheet sheet = _sheet;
-                    XSLFTheme theme = sheet.getTheme();
-                    XmlObject fillProps = null;
-                    CTStyleMatrix matrix = theme.getXmlObject().getThemeElements().getFmtScheme();
-                    if(idx >= 1 && idx <= 999){
-                        fillProps = matrix.getFillStyleLst().selectPath("*")[idx - 1];
-                    } else if (idx >= 1001 ){
-                        fillProps = matrix.getBgFillStyleLst().selectPath("*")[idx - 1001];
-                    }
-                    if(fillProps != null) {
-                        paint = selectPaint(fillProps, phClr, sheet.getPackagePart());
-                    }
-                }
-                return paint == RenderableShape.NO_PAINT ? null : paint;
-            }
-        };
+     * As there's no xmlbeans hierarchy, but XSLF works with subclassing, not all
+     * child classes work with a {@link CTShape} object, but often contain the same
+     * properties. This method is the generalized form of selecting and casting those
+     * properties.
+     *
+     * @param resultClass
+     * @param xquery
+     * @return
+     */
+    @SuppressWarnings("unchecked")
+    protected <T extends XmlObject> T selectProperty(Class<T> resultClass, String xquery) {
+        XmlObject[] rs = getXmlObject().selectPath(xquery);
+        if (rs.length == 0) return null;
+        return (resultClass.isInstance(rs[0])) ? (T)rs[0] : null;
     }
 
     /**
@@ -320,108 +341,15 @@ public abstract class XSLFShape implemen
         return ok;
     }
 
-    protected CTPlaceholder getCTPlaceholder() {
-        if (_ph == null) {
-            XmlObject[] obj = _shape.selectPath(
-                    "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//*/p:nvPr/p:ph");
-            if (obj.length == 1) {
-                _ph = (CTPlaceholder) obj[0];
-            }
-        }
-        return _ph;
-    }
-    
-    protected CTShapeStyle getSpStyle() {
-        if (_spStyle == null) {
-            for (XmlObject obj : _shape.selectPath("*")) {
-                if (obj instanceof CTShapeStyle) {
-                    _spStyle = (CTShapeStyle) obj;
-                }
-            }
-        }
-        return _spStyle;
-    }
-
-    protected CTNonVisualDrawingProps getNvPr() {
-        if (_nvPr == null) {
-            XmlObject[] rs = _shape
-                    .selectPath("declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//*/p:cNvPr");
-            if (rs.length != 0) {
-                _nvPr = (CTNonVisualDrawingProps) rs[0];
-            }
-        }
-        return _nvPr;
-    }
-
-    protected CTShapeProperties getSpPr() {
-        if (_spPr == null) {
-            for (XmlObject obj : _shape.selectPath("*")) {
-                if (obj instanceof CTShapeProperties) {
-                    _spPr = (CTShapeProperties) obj;
-                }
-            }
-        }
-        if (_spPr == null) {
-            throw new IllegalStateException("CTShapeProperties was not found.");
+    protected PaintStyle getPaint(XmlObject spPr, CTSchemeColor phClr) {
+        PaintStyle paint = null;
+        PackagePart pp = getSheet().getPackagePart();
+        for (XmlObject obj : spPr.selectPath("*")) {
+            paint = selectPaint(obj, phClr, pp);
+            if(paint != null) break;
         }
-        return _spPr;
-    }
-
-    CTTransform2D getXfrm() {
-        PropertyFetcher<CTTransform2D> fetcher = new PropertyFetcher<CTTransform2D>() {
-            public boolean fetch(XSLFShape shape) {
-                CTShapeProperties pr = shape.getSpPr();
-                if (pr.isSetXfrm()) {
-                    setValue(pr.getXfrm());
-                    return true;
-                }
-                return false;
-            }
-        };
-        fetchShapeProperty(fetcher);
-        return fetcher.getValue();
-    }
-    
-    /**
-     * @return the position of this shape within the drawing canvas.
-     *         The coordinates are expressed in points
-     */
-    public Rectangle2D getAnchor() {
-        CTTransform2D xfrm = getXfrm();
-        if (xfrm == null) return null;
-
-        CTPoint2D off = xfrm.getOff();
-        long x = off.getX();
-        long y = off.getY();
-        CTPositiveSize2D ext = xfrm.getExt();
-        long cx = ext.getCx();
-        long cy = ext.getCy();
-        return new Rectangle2D.Double(
-                Units.toPoints(x), Units.toPoints(y),
-                Units.toPoints(cx), Units.toPoints(cy));
-    }
-
-    /**
-     * @param anchor the position of this shape within the drawing canvas.
-     *               The coordinates are expressed in points
-     */
-    public void setAnchor(Rectangle2D anchor) {
-        CTShapeProperties spPr = getSpPr();
-        if (spPr == null) return;
-        
-        CTTransform2D xfrm = spPr.isSetXfrm() ? spPr.getXfrm() : spPr.addNewXfrm();
-        CTPoint2D off = xfrm.isSetOff() ? xfrm.getOff() : xfrm.addNewOff();
-        long x = Units.toEMU(anchor.getX());
-        long y = Units.toEMU(anchor.getY());
-        off.setX(x);
-        off.setY(y);
-        CTPositiveSize2D ext = xfrm.isSetExt() ? xfrm.getExt() : xfrm
-                .addNewExt();
-        long cx = Units.toEMU(anchor.getWidth());
-        long cy = Units.toEMU(anchor.getHeight());
-        ext.setCx(cx);
-        ext.setCy(cy);
-    }
+        return paint == null ? TRANSPARENT_PAINT : paint;
+    }    
     
     /**
      * Convert shape fill into java.awt.Paint. The result is either Color or
@@ -444,122 +372,126 @@ public abstract class XSLFShape implemen
      * @return  the applied Paint or null if none was applied
      */
     protected PaintStyle selectPaint(XmlObject obj, final CTSchemeColor phClr, final PackagePart parentPart) {
-        final XSLFTheme theme = getSheet().getTheme();
-
         if (obj instanceof CTNoFillProperties) {
             return TRANSPARENT_PAINT;
+        } else if (obj instanceof CTSolidColorFillProperties) {
+            return selectPaint((CTSolidColorFillProperties)obj, phClr, parentPart);
+        } else if (obj instanceof CTBlipFillProperties) {
+            return selectPaint((CTBlipFillProperties)obj, phClr, parentPart);
+        } else if (obj instanceof CTGradientFillProperties) {
+            return selectPaint((CTGradientFillProperties) obj, phClr, parentPart);
+        } else {
+            return null;
         }
-        
-        if (obj instanceof CTSolidColorFillProperties) {
-            CTSolidColorFillProperties solidFill = (CTSolidColorFillProperties) obj;
-            final XSLFColor c = new XSLFColor(solidFill, theme, phClr);
-            return new SolidPaint() {
-                public ColorStyle getSolidColor() {
-                    return c.getColorStyle();
-                }
-            };
-        }
-        
-        if (obj instanceof CTBlipFillProperties) {
-            CTBlipFillProperties blipFill = (CTBlipFillProperties)obj;
-            final CTBlip blip = blipFill.getBlip();
-            return new TexturePaint() {
-                private PackagePart getPart() {
-                    try {
-                        String blipId = blip.getEmbed();
-                        PackageRelationship rel = parentPart.getRelationship(blipId);
-                        return parentPart.getRelatedPart(rel);
-                    } catch (InvalidFormatException e) {
-                        throw new RuntimeException(e);
-                    }
+    }
+
+    protected PaintStyle selectPaint(final CTSolidColorFillProperties solidFill, final CTSchemeColor phClr, final PackagePart parentPart) {
+        final XSLFTheme theme = getSheet().getTheme();
+        final XSLFColor c = new XSLFColor(solidFill, theme, phClr);
+        return new SolidPaint() {
+            public ColorStyle getSolidColor() {
+                return c.getColorStyle();
+            }
+        };
+    }
+    
+    protected PaintStyle selectPaint(final CTBlipFillProperties blipFill, final CTSchemeColor phClr, final PackagePart parentPart) {
+        final CTBlip blip = blipFill.getBlip();
+        return new TexturePaint() {
+            private PackagePart getPart() {
+                try {
+                    String blipId = blip.getEmbed();
+                    PackageRelationship rel = parentPart.getRelationship(blipId);
+                    return parentPart.getRelatedPart(rel);
+                } catch (InvalidFormatException e) {
+                    throw new RuntimeException(e);
                 }
-                
-                public InputStream getImageData() {
-                    try {
-                        return getPart().getInputStream();
-                    } catch (IOException e) {
-                        throw new RuntimeException(e);
-                    }
+            }
+            
+            public InputStream getImageData() {
+                try {
+                    return getPart().getInputStream();
+                } catch (IOException e) {
+                    throw new RuntimeException(e);
                 }
+            }
 
-                public String getContentType() {
-                    /* TOOD: map content-type */
-                    return getPart().getContentType();
-                }
+            public String getContentType() {
+                /* TOOD: map content-type */
+                return getPart().getContentType();
+            }
 
-                public int getAlpha() {
-                    return (blip.sizeOfAlphaModFixArray() > 0)
-                        ? blip.getAlphaModFixArray(0).getAmt()
-                        : 0;
-                }
-            };
-        }
-        
-        if (obj instanceof CTGradientFillProperties) {
-            final CTGradientFillProperties gradFill = (CTGradientFillProperties) obj;
+            public int getAlpha() {
+                return (blip.sizeOfAlphaModFixArray() > 0)
+                    ? blip.getAlphaModFixArray(0).getAmt()
+                    : 0;
+            }
+        };        
+    }
+    
+    protected PaintStyle selectPaint(final CTGradientFillProperties gradFill, final CTSchemeColor phClr, final PackagePart parentPart) {
 
-            @SuppressWarnings("deprecation")
-            final CTGradientStop[] gs = gradFill.getGsLst().getGsArray();
+        @SuppressWarnings("deprecation")
+        final CTGradientStop[] gs = gradFill.getGsLst().getGsArray();
 
-            Arrays.sort(gs, new Comparator<CTGradientStop>() {
-                public int compare(CTGradientStop o1, CTGradientStop o2) {
-                    Integer pos1 = o1.getPos();
-                    Integer pos2 = o2.getPos();
-                    return pos1.compareTo(pos2);
-                }
-            });
+        Arrays.sort(gs, new Comparator<CTGradientStop>() {
+            public int compare(CTGradientStop o1, CTGradientStop o2) {
+                Integer pos1 = o1.getPos();
+                Integer pos2 = o2.getPos();
+                return pos1.compareTo(pos2);
+            }
+        });
 
-            final ColorStyle cs[] = new ColorStyle[gs.length];
-            final float fractions[] = new float[gs.length];
-            
-            int i=0;
-            for (CTGradientStop cgs : gs) {
-                cs[i] = new XSLFColor(cgs, theme, phClr).getColorStyle();
-                fractions[i] = cgs.getPos() / 100000.f;
+        final ColorStyle cs[] = new ColorStyle[gs.length];
+        final float fractions[] = new float[gs.length];
+        XSLFTheme theme = getSheet().getTheme();
+        
+        int i=0;
+        for (CTGradientStop cgs : gs) {
+            cs[i] = new XSLFColor(cgs, theme, phClr).getColorStyle();
+            fractions[i] = cgs.getPos() / 100000.f;
+        }
+        
+        return new GradientPaint() {
+
+            public double getGradientAngle() {
+                return (gradFill.isSetLin())
+                    ? gradFill.getLin().getAng() / 60000.d
+                    : 0;
             }
-            
-            return new GradientPaint() {
 
-                public double getGradientAngle() {
-                    return (gradFill.isSetLin())
-                        ? gradFill.getLin().getAng() / 60000.d
-                        : 0;
-                }
+            public ColorStyle[] getGradientColors() {
+                return cs;
+            }
 
-                public ColorStyle[] getGradientColors() {
-                    return cs;
-                }
+            public float[] getGradientFractions() {
+                return fractions;
+            }
 
-                public float[] getGradientFractions() {
-                    return fractions;
-                }
+            public boolean isRotatedWithShape() {
+                // TODO: is this correct???
+                return (gradFill.isSetRotWithShape() || !gradFill.getRotWithShape());
+            }
 
-                public boolean isRotatedWithShape() {
-                    // TODO: is this correct???
-                    return (gradFill.isSetRotWithShape() || !gradFill.getRotWithShape());
+            public GradientType getGradientType() {
+                if (gradFill.isSetLin()) {
+                    return GradientType.linear;
                 }
-
-                public GradientType getGradientType() {
-                    if (gradFill.isSetLin()) {
-                        return GradientType.linear;
-                    }
-                    
-                    if (gradFill.isSetPath()) {
-                        /* TODO: handle rect path */
-                        STPathShadeType.Enum ps = gradFill.getPath().getPath();
-                        if (ps == STPathShadeType.CIRCLE) {
-                            return GradientType.circular;
-                        } else if (ps == STPathShadeType.SHAPE) {
-                            return GradientType.shape;
-                        }
+                
+                if (gradFill.isSetPath()) {
+                    /* TODO: handle rect path */
+                    STPathShadeType.Enum ps = gradFill.getPath().getPath();
+                    if (ps == STPathShadeType.CIRCLE) {
+                        return GradientType.circular;
+                    } else if (ps == STPathShadeType.SHAPE) {
+                        return GradientType.shape;
                     }
-                    
-                    return GradientType.linear;
                 }
-            };
-        }
-        
-        return TRANSPARENT_PAINT;
+                
+                return GradientType.linear;
+            }
+        };        
     }
+    
 
 }
\ No newline at end of file

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShapeContainer.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShapeContainer.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShapeContainer.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShapeContainer.java Sat Mar  7 23:35:40 2015
@@ -24,7 +24,7 @@ import org.apache.poi.sl.usermodel.Shape
 /**
  * Common interface for shape containers, e.g. sheets or groups of shapes
  */
-public interface XSLFShapeContainer extends ShapeContainer {
+public interface XSLFShapeContainer extends ShapeContainer<XSLFShape> {
 
     /**
      * create a new shape with a predefined geometry and add it to this shape container

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java?rev=1664935&r1=1664934&r2=1664935&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java Sat Mar  7 23:35:40 2015
@@ -16,47 +16,28 @@
 ==================================================================== */
 package org.apache.poi.xslf.usermodel;
 
+import java.awt.Graphics2D;
+import java.io.*;
+import java.util.*;
+import java.util.regex.Pattern;
+
+import javax.xml.namespace.QName;
+
 import org.apache.poi.POIXMLDocumentPart;
 import org.apache.poi.POIXMLException;
-import org.apache.poi.openxml4j.opc.OPCPackage;
-import org.apache.poi.openxml4j.opc.PackagePart;
-import org.apache.poi.openxml4j.opc.PackageRelationship;
-import org.apache.poi.openxml4j.opc.TargetMode;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
-import org.apache.poi.sl.usermodel.MasterSheet;
+import org.apache.poi.openxml4j.opc.*;
+import org.apache.poi.sl.draw.DrawFactory;
+import org.apache.poi.sl.draw.Drawable;
 import org.apache.poi.sl.usermodel.Sheet;
-import org.apache.poi.util.Beta;
-import org.apache.poi.util.IOUtils;
-import org.apache.poi.util.Internal;
+import org.apache.poi.util.*;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
 import org.openxmlformats.schemas.officeDocument.x2006.relationships.STRelationshipId;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTCommonSlideData;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTConnector;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTGraphicalObjectFrame;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTPicture;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTShape;
-
-import com.sun.org.apache.xml.internal.utils.UnImplNode;
-
-import javax.xml.namespace.QName;
-
-import java.awt.Graphics2D;
-import java.awt.geom.AffineTransform;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Pattern;
+import org.openxmlformats.schemas.presentationml.x2006.main.*;
 
 @Beta
-public abstract class XSLFSheet extends POIXMLDocumentPart implements XSLFShapeContainer, Sheet {
+public abstract class XSLFSheet extends POIXMLDocumentPart implements XSLFShapeContainer, Sheet<XSLFShape> {
     private XSLFCommonSlideData _commonSlideData;
     private XSLFDrawing _drawing;
     private List<XSLFShape> _shapes;
@@ -498,31 +479,9 @@ public abstract class XSLFSheet extends
      * @param graphics
      */
     public void draw(Graphics2D graphics){
-        XSLFSheet master = (XSLFSheet)getMasterSheet();
-        if(getFollowMasterGraphics() && master != null) master.draw(graphics);
-
-        graphics.setRenderingHint(XSLFRenderingHint.GROUP_TRANSFORM, new AffineTransform());
-        for(XSLFShape shape : getShapeList()) {
-            if(!canDraw(shape)) continue;
-
-        	// remember the initial transform and restore it after we are done with drawing
-        	AffineTransform at = graphics.getTransform();
-
-            // concrete implementations can make sense of this hint,
-            // for example PSGraphics2D or PDFGraphics2D would call gsave() / grestore
-            graphics.setRenderingHint(XSLFRenderingHint.GSAVE, true);
-
-            // apply rotation and flipping
-            shape.applyTransform(graphics);
-            // draw stuff
-            shape.draw(graphics);
-
-            // restore the coordinate system
-            graphics.setTransform(at);
-
-            graphics.setRenderingHint(XSLFRenderingHint.GRESTORE, true);
-
-        }
+        DrawFactory drawFact = DrawFactory.getInstance(graphics);
+        Drawable draw = drawFact.getDrawable(this);
+        draw.draw(graphics);
     }
 
     /**



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


Mime
View raw message