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 2016/06/18 23:48:00 UTC

svn commit: r1749108 [1/2] - in /poi: site/src/documentation/content/xdocs/ trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/ trunk/src/ooxml/testcases/org/apache/poi/xslf/ trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/

Author: kiwiwings
Date: Sat Jun 18 23:48:00 2016
New Revision: 1749108

URL: http://svn.apache.org/viewvc?rev=1749108&view=rev
Log:
#59702 - Setting background color in slide master

Added:
    poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPropertiesDelegate.java   (with props)
Modified:
    poi/site/src/documentation/content/xdocs/status.xml
    poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFBackground.java
    poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java
    poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java
    poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java
    poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java
    poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFSlideShow.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFConnectorShape.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFFreeformShape.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSimpleShape.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java

Modified: poi/site/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/status.xml?rev=1749108&r1=1749107&r2=1749108&view=diff
==============================================================================
--- poi/site/src/documentation/content/xdocs/status.xml (original)
+++ poi/site/src/documentation/content/xdocs/status.xml Sat Jun 18 23:48:00 2016
@@ -40,7 +40,7 @@
     </devs>
 
     <release version="3.15-beta2" date="2016-07-??">
-        <action dev="PD" type="fix">Common-SS: changed UDFFinder from interface to abstract class</action>
+        <action dev="PD" type="fix" fixes-bug="59702">Setting background color in slide master</action>
         <action dev="PD" type="add" fixes-bug="57838">Remove related cell-comments when removing a row</action>
         <action dev="PD" type="add">Initial steps to allow to compile against Java 9</action>
         <action dev="PD" type="add" fixes-bug="57840">XSSF: 30% faster formula evaluation</action>

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFBackground.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFBackground.java?rev=1749108&r1=1749107&r2=1749108&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFBackground.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFBackground.java Sat Jun 18 23:48:00 2016
@@ -22,20 +22,16 @@ import java.awt.Dimension;
 import java.awt.geom.Rectangle2D;
 
 import org.apache.poi.POIXMLException;
-import org.apache.poi.sl.draw.DrawPaint;
 import org.apache.poi.sl.usermodel.Background;
-import org.apache.poi.sl.usermodel.ColorStyle;
-import org.apache.poi.sl.usermodel.FillStyle;
-import org.apache.poi.sl.usermodel.PaintStyle;
 import org.apache.poi.sl.usermodel.Placeholder;
-import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint;
+import org.apache.xmlbeans.XmlObject;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTBackground;
+import org.openxmlformats.schemas.presentationml.x2006.main.CTBackgroundProperties;
 
 /**
  * Background shape
- *
- * @author Yegor Kozlov
  */
 public class XSLFBackground extends XSLFSimpleShape
     implements Background<XSLFShape,XSLFTextParagraph> {
@@ -50,27 +46,16 @@ public class XSLFBackground extends XSLF
         return new Rectangle2D.Double(0, 0, pg.getWidth(), pg.getHeight());
     }
 
-    @Override
-    public Color getFillColor(){
-        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;
-    }
-
     /**
-     * background does not have a associated transform.
-     * we return a dummy transform object to prevent exceptions in inherited methods.
+     * background does not have a associated transform, therefore we return null
+     * 
+     * @param create ignored
      *
-     * @return  dummy  CTTransform2D bean
+     * @return null
      */
     @Override
-    protected CTTransform2D getXfrm() {
-        return CTTransform2D.Factory.newInstance();
+    protected CTTransform2D getXfrm(boolean create) {
+        return null;
     }
     
     @Override
@@ -78,4 +63,50 @@ public class XSLFBackground extends XSLF
         // extending XSLFSimpleShape is a bit unlucky ...
         throw new POIXMLException("Can't set a placeholder for a background");
     }
+
+    protected CTBackgroundProperties getBgPr(boolean create) {
+        CTBackground bg = (CTBackground)getXmlObject();
+        if (!bg.isSetBgPr() && create) {
+            if (bg.isSetBgRef()) {
+                bg.unsetBgRef();
+            }
+            return bg.addNewBgPr();
+        }
+        return bg.getBgPr();
+    }
+    
+    public void setFillColor(Color color) {
+        CTBackgroundProperties bgPr = getBgPr(true);
+        
+        if (color == null) {
+            if (bgPr.isSetSolidFill()) {
+                bgPr.unsetSolidFill();
+            }
+
+            if (!bgPr.isSetNoFill()) {
+                bgPr.addNewNoFill();
+            }
+        } else {
+            if (bgPr.isSetNoFill()) {
+                bgPr.unsetNoFill();
+            }
+
+            CTSolidColorFillProperties fill = bgPr.isSetSolidFill() ? bgPr.getSolidFill() : bgPr.addNewSolidFill();
+                    
+            XSLFColor col = new XSLFColor(fill, getSheet().getTheme(), fill.getSchemeClr());
+            col.setColor(color);
+        }
+    }
+
+    @Override
+    protected XmlObject getShapeProperties() {
+        CTBackground bg = (CTBackground)getXmlObject();
+        if (bg.isSetBgPr()) {
+            return bg.getBgPr();
+        } else if (bg.isSetBgRef()) {
+            return bg.getBgRef();
+        } else {
+            return null;
+        }
+    }
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java?rev=1749108&r1=1749107&r2=1749108&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java Sat Jun 18 23:48:00 2016
@@ -45,8 +45,6 @@ import org.openxmlformats.schemas.presen
 /**
  * Represents a custom geometric shape.
  * This shape will consist of a series of lines and curves described within a creation path.
- *
- * @author Yegor Kozlov
  */
 @Beta
 public class XSLFFreeformShape extends XSLFAutoShape
@@ -115,7 +113,13 @@ public class XSLFFreeformShape extends X
             }
             it.next();
         }
-        getSpPr().getCustGeom().getPathLst().setPathArray(new CTPath2D[]{ctPath});
+        
+        XmlObject xo = getShapeProperties();
+        if (!(xo instanceof CTShapeProperties)) {
+            return -1;
+        }
+
+        ((CTShapeProperties)xo).getCustGeom().getPathLst().setPathArray(new CTPath2D[]{ctPath});
         setAnchor(bounds);
         return numPoints;
     }
@@ -125,7 +129,12 @@ public class XSLFFreeformShape extends X
         Path2D.Double path = new Path2D.Double();
         Rectangle2D bounds = getAnchor();
 
-        CTCustomGeometry2D geom = getSpPr().getCustGeom();
+        XmlObject xo = getShapeProperties();
+        if (!(xo instanceof CTShapeProperties)) {
+            return null;
+        }
+        
+        CTCustomGeometry2D geom = ((CTShapeProperties)xo).getCustGeom();
         for(CTPath2D spPath : geom.getPathLst().getPathArray()){
             double scaleW = bounds.getWidth() / Units.toPoints(spPath.getW());
             double scaleH = bounds.getHeight() / Units.toPoints(spPath.getH());

Added: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPropertiesDelegate.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPropertiesDelegate.java?rev=1749108&view=auto
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPropertiesDelegate.java (added)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPropertiesDelegate.java Sat Jun 18 23:48:00 2016
@@ -0,0 +1,1830 @@
+/* ====================================================================
+   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.xslf.usermodel;
+
+import org.apache.poi.util.Internal;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlObject;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTBlipFillProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTCustomGeometry2D;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTEffectContainer;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTEffectList;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTFillProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTGradientFillProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTGroupFillProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTNoFillProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPatternFillProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPresetGeometry2D;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTStyleMatrixReference;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTableCellProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties;
+import org.openxmlformats.schemas.presentationml.x2006.main.CTBackgroundProperties;
+
+/**
+ * Internal helper class to unify property access.
+ * 
+ * This class is experimental and not (yet) supposed for public usage.
+ * Maybe the xml schemas might be enhanced with interfaces to make this class superfluous
+ * 
+ * @since POI 3.15-beta2
+ */
+@Internal
+/* package */ class XSLFPropertiesDelegate {
+    private static final POILogger LOG = POILogFactory.getLogger(XSLFPropertiesDelegate.class);
+
+    
+    public static XSLFFillProperties getFillDelegate(XmlObject props) {
+        return getDelegate(XSLFFillProperties.class, props);
+    }
+
+    public static XSLFGeometryProperties getGeometryDelegate(XmlObject props) {
+        return getDelegate(XSLFGeometryProperties.class, props);
+    }
+    
+    public static XSLFEffectProperties getEffectDelegate(XmlObject props) {
+        return getDelegate(XSLFEffectProperties.class, props);
+    }
+    
+    public interface XSLFFillProperties {
+        /**
+         * Gets the "noFill" element
+         */
+        CTNoFillProperties getNoFill();
+        
+        /**
+         * True if has "noFill" element
+         */
+        boolean isSetNoFill();
+        
+        /**
+         * Sets the "noFill" element
+         */
+        void setNoFill(CTNoFillProperties noFill);
+        
+        /**
+         * Appends and returns a new empty "noFill" element
+         */
+        CTNoFillProperties addNewNoFill();
+        
+        /**
+         * Unsets the "noFill" element
+         */
+        void unsetNoFill();
+        
+        /**
+         * Gets the "solidFill" element
+         */
+        CTSolidColorFillProperties getSolidFill();
+        
+        /**
+         * True if has "solidFill" element
+         */
+        boolean isSetSolidFill();
+        
+        /**
+         * Sets the "solidFill" element
+         */
+        void setSolidFill(CTSolidColorFillProperties solidFill);
+        
+        /**
+         * Appends and returns a new empty "solidFill" element
+         */
+        CTSolidColorFillProperties addNewSolidFill();
+        
+        /**
+         * Unsets the "solidFill" element
+         */
+        void unsetSolidFill();
+        
+        /**
+         * Gets the "gradFill" element
+         */
+        CTGradientFillProperties getGradFill();
+        
+        /**
+         * True if has "gradFill" element
+         */
+        boolean isSetGradFill();
+        
+        /**
+         * Sets the "gradFill" element
+         */
+        void setGradFill(CTGradientFillProperties gradFill);
+        
+        /**
+         * Appends and returns a new empty "gradFill" element
+         */
+        CTGradientFillProperties addNewGradFill();
+        
+        /**
+         * Unsets the "gradFill" element
+         */
+        void unsetGradFill();
+        
+        /**
+         * Gets the "blipFill" element
+         */
+        CTBlipFillProperties getBlipFill();
+        
+        /**
+         * True if has "blipFill" element
+         */
+        boolean isSetBlipFill();
+        
+        /**
+         * Sets the "blipFill" element
+         */
+        void setBlipFill(CTBlipFillProperties blipFill);
+        
+        /**
+         * Appends and returns a new empty "blipFill" element
+         */
+        CTBlipFillProperties addNewBlipFill();
+        
+        /**
+         * Unsets the "blipFill" element
+         */
+        void unsetBlipFill();
+        
+        /**
+         * Gets the "pattFill" element
+         */
+        CTPatternFillProperties getPattFill();
+        
+        /**
+         * True if has "pattFill" element
+         */
+        boolean isSetPattFill();
+        
+        /**
+         * Sets the "pattFill" element
+         */
+        void setPattFill(CTPatternFillProperties pattFill);
+        
+        /**
+         * Appends and returns a new empty "pattFill" element
+         */
+        CTPatternFillProperties addNewPattFill();
+        
+        /**
+         * Unsets the "pattFill" element
+         */
+        void unsetPattFill();
+        
+        /**
+         * Gets the "grpFill" element
+         */
+        CTGroupFillProperties getGrpFill();
+        
+        /**
+         * True if has "grpFill" element
+         */
+        boolean isSetGrpFill();
+        
+        /**
+         * Sets the "grpFill" element
+         */
+        void setGrpFill(CTGroupFillProperties grpFill);
+        
+        /**
+         * Appends and returns a new empty "grpFill" element
+         */
+        CTGroupFillProperties addNewGrpFill();
+        
+        /**
+         * Unsets the "grpFill" element
+         */
+        void unsetGrpFill();
+        
+        /**
+         * Helper method to unify other properties with style matrix references
+         * @return true, if this is a matrix style delegate
+         */
+        boolean isSetMatrixStyle();
+        
+        /**
+         * Helper method to unify other properties with style matrix references
+         */
+        CTStyleMatrixReference getMatrixStyle();
+        
+        /**
+         * Helper method to choose between fill and line style
+         *
+         * @return true, if this applies to a line
+         */
+        boolean isLineStyle();
+    }
+
+    public interface XSLFGeometryProperties {
+        /**
+         * Gets the "custGeom" element
+         */
+        CTCustomGeometry2D getCustGeom();
+        
+        /**
+         * True if has "custGeom" element
+         */
+        boolean isSetCustGeom();
+        
+        /**
+         * Sets the "custGeom" element
+         */
+        void setCustGeom(CTCustomGeometry2D custGeom);
+        
+        /**
+         * Appends and returns a new empty "custGeom" element
+         */
+        CTCustomGeometry2D addNewCustGeom();
+        
+        /**
+         * Unsets the "custGeom" element
+         */
+        void unsetCustGeom();
+        
+        /**
+         * Gets the "prstGeom" element
+         */
+        CTPresetGeometry2D getPrstGeom();
+        
+        /**
+         * True if has "prstGeom" element
+         */
+        boolean isSetPrstGeom();
+        
+        /**
+         * Sets the "prstGeom" element
+         */
+        void setPrstGeom(CTPresetGeometry2D prstGeom);
+        
+        /**
+         * Appends and returns a new empty "prstGeom" element
+         */
+        CTPresetGeometry2D addNewPrstGeom();
+        
+        /**
+         * Unsets the "prstGeom" element
+         */
+        void unsetPrstGeom();
+    }
+
+    public interface XSLFEffectProperties {
+        /**
+         * Gets the "effectLst" element
+         */
+        CTEffectList getEffectLst();
+        
+        /**
+         * True if has "effectLst" element
+         */
+        boolean isSetEffectLst();
+        
+        /**
+         * Sets the "effectLst" element
+         */
+        void setEffectLst(CTEffectList effectLst);
+        
+        /**
+         * Appends and returns a new empty "effectLst" element
+         */
+        CTEffectList addNewEffectLst();
+        
+        /**
+         * Unsets the "effectLst" element
+         */
+        void unsetEffectLst();
+        
+        /**
+         * Gets the "effectDag" element
+         */
+        CTEffectContainer getEffectDag();
+        
+        /**
+         * True if has "effectDag" element
+         */
+        boolean isSetEffectDag();
+        
+        /**
+         * Sets the "effectDag" element
+         */
+        void setEffectDag(CTEffectContainer effectDag);
+        
+        /**
+         * Appends and returns a new empty "effectDag" element
+         */
+        CTEffectContainer addNewEffectDag();
+        
+        /**
+         * Unsets the "effectDag" element
+         */
+        void unsetEffectDag();
+    }
+    
+    private static class ShapeDelegate implements XSLFFillProperties, XSLFGeometryProperties, XSLFEffectProperties {
+        final CTShapeProperties props;
+        
+        ShapeDelegate(CTShapeProperties props) {
+            this.props = props;
+        }
+
+        @Override
+        public CTNoFillProperties getNoFill() {
+            return props.getNoFill();
+        }
+
+        @Override
+        public boolean isSetNoFill() {
+            return props.isSetNoFill();
+        }
+
+        @Override
+        public void setNoFill(CTNoFillProperties noFill) {
+            props.setNoFill(noFill);
+        }
+
+        @Override
+        public CTNoFillProperties addNewNoFill() {
+            return props.addNewNoFill();
+        }
+
+        @Override
+        public void unsetNoFill() {
+            props.unsetNoFill();
+        }
+
+        @Override
+        public CTSolidColorFillProperties getSolidFill() {
+            return props.getSolidFill();
+        }
+
+        @Override
+        public boolean isSetSolidFill() {
+            return props.isSetSolidFill();
+        }
+
+        @Override
+        public void setSolidFill(CTSolidColorFillProperties solidFill) {
+            props.setSolidFill(solidFill);
+        }
+
+        @Override
+        public CTSolidColorFillProperties addNewSolidFill() {
+            return props.addNewSolidFill();
+        }
+
+        @Override
+        public void unsetSolidFill() {
+            props.unsetSolidFill();
+        }
+
+        @Override
+        public CTGradientFillProperties getGradFill() {
+            return props.getGradFill();
+        }
+
+        @Override
+        public boolean isSetGradFill() {
+            return props.isSetGradFill();
+        }
+
+        @Override
+        public void setGradFill(CTGradientFillProperties gradFill) {
+            props.setGradFill(gradFill);
+        }
+
+        @Override
+        public CTGradientFillProperties addNewGradFill() {
+            return props.addNewGradFill();
+        }
+
+        @Override
+        public void unsetGradFill() {
+            props.unsetGradFill();
+        }
+
+        @Override
+        public CTBlipFillProperties getBlipFill() {
+            return props.getBlipFill();
+        }
+
+        @Override
+        public boolean isSetBlipFill() {
+            return props.isSetBlipFill();
+        }
+
+        @Override
+        public void setBlipFill(CTBlipFillProperties blipFill) {
+            props.setBlipFill(blipFill);
+        }
+
+        @Override
+        public CTBlipFillProperties addNewBlipFill() {
+            return props.addNewBlipFill();
+        }
+
+        @Override
+        public void unsetBlipFill() {
+            props.unsetBlipFill();
+        }
+
+        @Override
+        public CTPatternFillProperties getPattFill() {
+            return props.getPattFill();
+        }
+
+        @Override
+        public boolean isSetPattFill() {
+            return props.isSetPattFill();
+        }
+
+        @Override
+        public void setPattFill(CTPatternFillProperties pattFill) {
+            props.setPattFill(pattFill);
+        }
+
+        @Override
+        public CTPatternFillProperties addNewPattFill() {
+            return props.addNewPattFill();
+        }
+
+        @Override
+        public void unsetPattFill() {
+            props.unsetPattFill();
+        }
+
+        @Override
+        public CTGroupFillProperties getGrpFill() {
+            return props.getGrpFill();
+        }
+
+        @Override
+        public boolean isSetGrpFill() {
+            return props.isSetGrpFill();
+        }
+
+        @Override
+        public void setGrpFill(CTGroupFillProperties grpFill) {
+            props.setGrpFill(grpFill);
+        }
+
+        @Override
+        public CTGroupFillProperties addNewGrpFill() {
+            return props.addNewGrpFill();
+        }
+
+        @Override
+        public void unsetGrpFill() {
+            props.unsetGrpFill();
+        }
+
+        @Override
+        public CTCustomGeometry2D getCustGeom() {
+            return props.getCustGeom();
+        }
+
+        @Override
+        public boolean isSetCustGeom() {
+            return props.isSetCustGeom();
+        }
+
+        @Override
+        public void setCustGeom(CTCustomGeometry2D custGeom) {
+            props.setCustGeom(custGeom);
+        }
+
+        @Override
+        public CTCustomGeometry2D addNewCustGeom() {
+            return props.addNewCustGeom();
+        }
+
+        @Override
+        public void unsetCustGeom() {
+            props.unsetCustGeom();
+        }
+
+        @Override
+        public CTPresetGeometry2D getPrstGeom() {
+            return props.getPrstGeom();
+        }
+
+        @Override
+        public boolean isSetPrstGeom() {
+            return props.isSetPrstGeom();
+        }
+
+        @Override
+        public void setPrstGeom(CTPresetGeometry2D prstGeom) {
+            props.setPrstGeom(prstGeom);
+        }
+
+        @Override
+        public CTPresetGeometry2D addNewPrstGeom() {
+            return props.addNewPrstGeom();
+        }
+
+        @Override
+        public void unsetPrstGeom() {
+            props.unsetPrstGeom();
+        }
+
+        @Override
+        public CTEffectList getEffectLst() {
+            return props.getEffectLst();
+        }
+
+        @Override
+        public boolean isSetEffectLst() {
+            return props.isSetEffectLst();
+        }
+
+        @Override
+        public void setEffectLst(CTEffectList effectLst) {
+            props.setEffectLst(effectLst);
+        }
+
+        @Override
+        public CTEffectList addNewEffectLst() {
+            return props.addNewEffectLst();
+        }
+
+        @Override
+        public void unsetEffectLst() {
+            props.unsetEffectLst();
+        }
+
+        @Override
+        public CTEffectContainer getEffectDag() {
+            return props.getEffectDag();
+        }
+
+        @Override
+        public boolean isSetEffectDag() {
+            return props.isSetEffectDag();
+        }
+
+        @Override
+        public void setEffectDag(CTEffectContainer effectDag) {
+            props.setEffectDag(effectDag);
+        }
+
+        @Override
+        public CTEffectContainer addNewEffectDag() {
+            return props.addNewEffectDag();
+        }
+
+        @Override
+        public void unsetEffectDag() {
+            props.unsetEffectDag();
+        }
+
+        @Override
+        public boolean isSetMatrixStyle() {
+            return false;
+        }
+
+        @Override
+        public CTStyleMatrixReference getMatrixStyle() {
+            return null;
+        }
+        
+        @Override
+        public boolean isLineStyle() {
+            return false;
+        }
+    }
+
+    private static class BackgroundDelegate implements XSLFFillProperties, XSLFEffectProperties {
+        final CTBackgroundProperties props;
+        
+        BackgroundDelegate(CTBackgroundProperties props) {
+            this.props = props;
+        }
+
+        @Override
+        public CTNoFillProperties getNoFill() {
+            return props.getNoFill();
+        }
+
+        @Override
+        public boolean isSetNoFill() {
+            return props.isSetNoFill();
+        }
+
+        @Override
+        public void setNoFill(CTNoFillProperties noFill) {
+            props.setNoFill(noFill);
+        }
+
+        @Override
+        public CTNoFillProperties addNewNoFill() {
+            return props.addNewNoFill();
+        }
+
+        @Override
+        public void unsetNoFill() {
+            props.unsetNoFill();
+        }
+
+        @Override
+        public CTSolidColorFillProperties getSolidFill() {
+            return props.getSolidFill();
+        }
+
+        @Override
+        public boolean isSetSolidFill() {
+            return props.isSetSolidFill();
+        }
+
+        @Override
+        public void setSolidFill(CTSolidColorFillProperties solidFill) {
+            props.setSolidFill(solidFill);
+        }
+
+        @Override
+        public CTSolidColorFillProperties addNewSolidFill() {
+            return props.addNewSolidFill();
+        }
+
+        @Override
+        public void unsetSolidFill() {
+            props.unsetSolidFill();
+        }
+
+        @Override
+        public CTGradientFillProperties getGradFill() {
+            return props.getGradFill();
+        }
+
+        @Override
+        public boolean isSetGradFill() {
+            return props.isSetGradFill();
+        }
+
+        @Override
+        public void setGradFill(CTGradientFillProperties gradFill) {
+            props.setGradFill(gradFill);
+        }
+
+        @Override
+        public CTGradientFillProperties addNewGradFill() {
+            return props.addNewGradFill();
+        }
+
+        @Override
+        public void unsetGradFill() {
+            props.unsetGradFill();
+        }
+
+        @Override
+        public CTBlipFillProperties getBlipFill() {
+            return props.getBlipFill();
+        }
+
+        @Override
+        public boolean isSetBlipFill() {
+            return props.isSetBlipFill();
+        }
+
+        @Override
+        public void setBlipFill(CTBlipFillProperties blipFill) {
+            props.setBlipFill(blipFill);
+        }
+
+        @Override
+        public CTBlipFillProperties addNewBlipFill() {
+            return props.addNewBlipFill();
+        }
+
+        @Override
+        public void unsetBlipFill() {
+            props.unsetBlipFill();
+        }
+
+        @Override
+        public CTPatternFillProperties getPattFill() {
+            return props.getPattFill();
+        }
+
+        @Override
+        public boolean isSetPattFill() {
+            return props.isSetPattFill();
+        }
+
+        @Override
+        public void setPattFill(CTPatternFillProperties pattFill) {
+            props.setPattFill(pattFill);
+        }
+
+        @Override
+        public CTPatternFillProperties addNewPattFill() {
+            return props.addNewPattFill();
+        }
+
+        @Override
+        public void unsetPattFill() {
+            props.unsetPattFill();
+        }
+
+        @Override
+        public CTGroupFillProperties getGrpFill() {
+            return props.getGrpFill();
+        }
+
+        @Override
+        public boolean isSetGrpFill() {
+            return props.isSetGrpFill();
+        }
+
+        @Override
+        public void setGrpFill(CTGroupFillProperties grpFill) {
+            props.setGrpFill(grpFill);
+        }
+
+        @Override
+        public CTGroupFillProperties addNewGrpFill() {
+            return props.addNewGrpFill();
+        }
+
+        @Override
+        public void unsetGrpFill() {
+            props.unsetGrpFill();
+        }
+
+        @Override
+        public CTEffectList getEffectLst() {
+            return props.getEffectLst();
+        }
+
+        @Override
+        public boolean isSetEffectLst() {
+            return props.isSetEffectLst();
+        }
+
+        @Override
+        public void setEffectLst(CTEffectList effectLst) {
+            props.setEffectLst(effectLst);
+        }
+
+        @Override
+        public CTEffectList addNewEffectLst() {
+            return props.addNewEffectLst();
+        }
+
+        @Override
+        public void unsetEffectLst() {
+            props.unsetEffectLst();
+        }
+
+        @Override
+        public CTEffectContainer getEffectDag() {
+            return props.getEffectDag();
+        }
+
+        @Override
+        public boolean isSetEffectDag() {
+            return props.isSetEffectDag();
+        }
+
+        @Override
+        public void setEffectDag(CTEffectContainer effectDag) {
+            props.setEffectDag(effectDag);
+        }
+
+        @Override
+        public CTEffectContainer addNewEffectDag() {
+            return props.addNewEffectDag();
+        }
+
+        @Override
+        public void unsetEffectDag() {
+            props.unsetEffectDag();
+        }
+
+        @Override
+        public boolean isSetMatrixStyle() {
+            return false;
+        }
+
+        @Override
+        public CTStyleMatrixReference getMatrixStyle() {
+            return null;
+        }
+        
+        @Override
+        public boolean isLineStyle() {
+            return false;
+        }
+    }
+
+    private static class TableCellDelegate implements XSLFFillProperties {
+        final CTTableCellProperties props;
+        
+        TableCellDelegate(CTTableCellProperties props) {
+            this.props = props;
+        }
+
+        @Override
+        public CTNoFillProperties getNoFill() {
+            return props.getNoFill();
+        }
+
+        @Override
+        public boolean isSetNoFill() {
+            return props.isSetNoFill();
+        }
+
+        @Override
+        public void setNoFill(CTNoFillProperties noFill) {
+            props.setNoFill(noFill);
+        }
+
+        @Override
+        public CTNoFillProperties addNewNoFill() {
+            return props.addNewNoFill();
+        }
+
+        @Override
+        public void unsetNoFill() {
+            props.unsetNoFill();
+        }
+
+        @Override
+        public CTSolidColorFillProperties getSolidFill() {
+            return props.getSolidFill();
+        }
+
+        @Override
+        public boolean isSetSolidFill() {
+            return props.isSetSolidFill();
+        }
+
+        @Override
+        public void setSolidFill(CTSolidColorFillProperties solidFill) {
+            props.setSolidFill(solidFill);
+        }
+
+        @Override
+        public CTSolidColorFillProperties addNewSolidFill() {
+            return props.addNewSolidFill();
+        }
+
+        @Override
+        public void unsetSolidFill() {
+            props.unsetSolidFill();
+        }
+
+        @Override
+        public CTGradientFillProperties getGradFill() {
+            return props.getGradFill();
+        }
+
+        @Override
+        public boolean isSetGradFill() {
+            return props.isSetGradFill();
+        }
+
+        @Override
+        public void setGradFill(CTGradientFillProperties gradFill) {
+            props.setGradFill(gradFill);
+        }
+
+        @Override
+        public CTGradientFillProperties addNewGradFill() {
+            return props.addNewGradFill();
+        }
+
+        @Override
+        public void unsetGradFill() {
+            props.unsetGradFill();
+        }
+
+        @Override
+        public CTBlipFillProperties getBlipFill() {
+            return props.getBlipFill();
+        }
+
+        @Override
+        public boolean isSetBlipFill() {
+            return props.isSetBlipFill();
+        }
+
+        @Override
+        public void setBlipFill(CTBlipFillProperties blipFill) {
+            props.setBlipFill(blipFill);
+        }
+
+        @Override
+        public CTBlipFillProperties addNewBlipFill() {
+            return props.addNewBlipFill();
+        }
+
+        @Override
+        public void unsetBlipFill() {
+            props.unsetBlipFill();
+        }
+
+        @Override
+        public CTPatternFillProperties getPattFill() {
+            return props.getPattFill();
+        }
+
+        @Override
+        public boolean isSetPattFill() {
+            return props.isSetPattFill();
+        }
+
+        @Override
+        public void setPattFill(CTPatternFillProperties pattFill) {
+            props.setPattFill(pattFill);
+        }
+
+        @Override
+        public CTPatternFillProperties addNewPattFill() {
+            return props.addNewPattFill();
+        }
+
+        @Override
+        public void unsetPattFill() {
+            props.unsetPattFill();
+        }
+
+        @Override
+        public CTGroupFillProperties getGrpFill() {
+            return props.getGrpFill();
+        }
+
+        @Override
+        public boolean isSetGrpFill() {
+            return props.isSetGrpFill();
+        }
+
+        @Override
+        public void setGrpFill(CTGroupFillProperties grpFill) {
+            props.setGrpFill(grpFill);
+        }
+
+        @Override
+        public CTGroupFillProperties addNewGrpFill() {
+            return props.addNewGrpFill();
+        }
+
+        @Override
+        public void unsetGrpFill() {
+            props.unsetGrpFill();
+        }
+
+        @Override
+        public boolean isSetMatrixStyle() {
+            return false;
+        }
+
+        @Override
+        public CTStyleMatrixReference getMatrixStyle() {
+            return null;
+        }
+        
+        @Override
+        public boolean isLineStyle() {
+            return false;
+        }
+    }
+
+    private static class StyleMatrixDelegate implements XSLFFillProperties {
+        final CTStyleMatrixReference props;
+        
+        StyleMatrixDelegate(CTStyleMatrixReference props) {
+            this.props = props;
+        }
+
+        @Override
+        public CTNoFillProperties getNoFill() {
+            return null;
+        }
+
+        @Override
+        public boolean isSetNoFill() {
+            return false;
+        }
+
+        @Override
+        public void setNoFill(CTNoFillProperties noFill) {}
+
+        @Override
+        public CTNoFillProperties addNewNoFill() {
+            return null;
+        }
+
+        @Override
+        public void unsetNoFill() {}
+
+        @Override
+        public CTSolidColorFillProperties getSolidFill() {
+            return null;
+        }
+
+        @Override
+        public boolean isSetSolidFill() {
+            return false;
+        }
+
+        @Override
+        public void setSolidFill(CTSolidColorFillProperties solidFill) {}
+
+        @Override
+        public CTSolidColorFillProperties addNewSolidFill() {
+            return null;
+        }
+
+        @Override
+        public void unsetSolidFill() {}
+
+        @Override
+        public CTGradientFillProperties getGradFill() {
+            return null;
+        }
+
+        @Override
+        public boolean isSetGradFill() {
+            return false;
+        }
+
+        @Override
+        public void setGradFill(CTGradientFillProperties gradFill) {}
+
+        @Override
+        public CTGradientFillProperties addNewGradFill() {
+            return null;
+        }
+
+        @Override
+        public void unsetGradFill() {}
+
+        @Override
+        public CTBlipFillProperties getBlipFill() {
+            return null;
+        }
+
+        @Override
+        public boolean isSetBlipFill() {
+            return false;
+        }
+
+        @Override
+        public void setBlipFill(CTBlipFillProperties blipFill) {}
+
+        @Override
+        public CTBlipFillProperties addNewBlipFill() {
+            return null;
+        }
+
+        @Override
+        public void unsetBlipFill() {}
+
+        @Override
+        public CTPatternFillProperties getPattFill() {
+            return null;
+        }
+
+        @Override
+        public boolean isSetPattFill() {
+            return false;
+        }
+
+        @Override
+        public void setPattFill(CTPatternFillProperties pattFill) {}
+
+        @Override
+        public CTPatternFillProperties addNewPattFill() {
+            return null;
+        }
+
+        @Override
+        public void unsetPattFill() {}
+
+        @Override
+        public CTGroupFillProperties getGrpFill() {
+            return null;
+        }
+
+        @Override
+        public boolean isSetGrpFill() {
+            return false;
+        }
+
+        @Override
+        public void setGrpFill(CTGroupFillProperties grpFill) {}
+
+        @Override
+        public CTGroupFillProperties addNewGrpFill() {
+            return null;
+        }
+
+        @Override
+        public void unsetGrpFill() {}
+
+    
+        @Override
+        public boolean isSetMatrixStyle() {
+            return true;
+        }
+
+        @Override
+        public CTStyleMatrixReference getMatrixStyle() {
+            return props;
+        }
+        
+        @Override
+        public boolean isLineStyle() {
+            XmlCursor cur = props.newCursor();
+            String name = cur.getName().getLocalPart();
+            cur.dispose();
+            return "lnRef".equals(name);
+        }
+    }
+
+    private static class FillDelegate implements XSLFFillProperties {
+        final CTFillProperties props;
+        
+        FillDelegate(CTFillProperties props) {
+            this.props = props;
+        }
+
+        @Override
+        public CTNoFillProperties getNoFill() {
+            return props.getNoFill();
+        }
+
+        @Override
+        public boolean isSetNoFill() {
+            return props.isSetNoFill();
+        }
+
+        @Override
+        public void setNoFill(CTNoFillProperties noFill) {
+            props.setNoFill(noFill);
+        }
+
+        @Override
+        public CTNoFillProperties addNewNoFill() {
+            return props.addNewNoFill();
+        }
+
+        @Override
+        public void unsetNoFill() {
+            props.unsetNoFill();
+        }
+
+        @Override
+        public CTSolidColorFillProperties getSolidFill() {
+            return props.getSolidFill();
+        }
+
+        @Override
+        public boolean isSetSolidFill() {
+            return props.isSetSolidFill();
+        }
+
+        @Override
+        public void setSolidFill(CTSolidColorFillProperties solidFill) {
+            props.setSolidFill(solidFill);
+        }
+
+        @Override
+        public CTSolidColorFillProperties addNewSolidFill() {
+            return props.addNewSolidFill();
+        }
+
+        @Override
+        public void unsetSolidFill() {
+            props.unsetSolidFill();
+        }
+
+        @Override
+        public CTGradientFillProperties getGradFill() {
+            return props.getGradFill();
+        }
+
+        @Override
+        public boolean isSetGradFill() {
+            return props.isSetGradFill();
+        }
+
+        @Override
+        public void setGradFill(CTGradientFillProperties gradFill) {
+            props.setGradFill(gradFill);
+        }
+
+        @Override
+        public CTGradientFillProperties addNewGradFill() {
+            return props.addNewGradFill();
+        }
+
+        @Override
+        public void unsetGradFill() {
+            props.unsetGradFill();
+        }
+
+        @Override
+        public CTBlipFillProperties getBlipFill() {
+            return props.getBlipFill();
+        }
+
+        @Override
+        public boolean isSetBlipFill() {
+            return props.isSetBlipFill();
+        }
+
+        @Override
+        public void setBlipFill(CTBlipFillProperties blipFill) {
+            props.setBlipFill(blipFill);
+        }
+
+        @Override
+        public CTBlipFillProperties addNewBlipFill() {
+            return props.addNewBlipFill();
+        }
+
+        @Override
+        public void unsetBlipFill() {
+            props.unsetBlipFill();
+        }
+
+        @Override
+        public CTPatternFillProperties getPattFill() {
+            return props.getPattFill();
+        }
+
+        @Override
+        public boolean isSetPattFill() {
+            return props.isSetPattFill();
+        }
+
+        @Override
+        public void setPattFill(CTPatternFillProperties pattFill) {
+            props.setPattFill(pattFill);
+        }
+
+        @Override
+        public CTPatternFillProperties addNewPattFill() {
+            return props.addNewPattFill();
+        }
+
+        @Override
+        public void unsetPattFill() {
+            props.unsetPattFill();
+        }
+
+        @Override
+        public CTGroupFillProperties getGrpFill() {
+            return props.getGrpFill();
+        }
+
+        @Override
+        public boolean isSetGrpFill() {
+            return props.isSetGrpFill();
+        }
+
+        @Override
+        public void setGrpFill(CTGroupFillProperties grpFill) {
+            props.setGrpFill(grpFill);
+        }
+
+        @Override
+        public CTGroupFillProperties addNewGrpFill() {
+            return props.addNewGrpFill();
+        }
+
+        @Override
+        public void unsetGrpFill() {
+            props.unsetGrpFill();
+        }
+
+        @Override
+        public boolean isSetMatrixStyle() {
+            return false;
+        }
+
+        @Override
+        public CTStyleMatrixReference getMatrixStyle() {
+            return null;
+        }
+        
+        @Override
+        public boolean isLineStyle() {
+            return false;
+        }
+    }
+
+    private static class FillPartDelegate implements XSLFFillProperties {
+        final XmlObject props;
+        
+        FillPartDelegate(XmlObject props) {
+            this.props = props;
+        }
+
+        public CTNoFillProperties getNoFill() {
+            return isSetNoFill() ? (CTNoFillProperties)props : null;
+        }
+
+        public boolean isSetNoFill() {
+            return (props instanceof CTNoFillProperties);
+        }
+
+        public void setNoFill(CTNoFillProperties noFill) {}
+
+        public CTNoFillProperties addNewNoFill() {
+            return null;
+        }
+
+        public void unsetNoFill() {}
+
+        public CTSolidColorFillProperties getSolidFill() {
+            return isSetSolidFill() ? (CTSolidColorFillProperties)props : null;
+        }
+
+        public boolean isSetSolidFill() {
+            return (props instanceof CTSolidColorFillProperties);
+        }
+
+        public void setSolidFill(CTSolidColorFillProperties solidFill) {}
+
+        public CTSolidColorFillProperties addNewSolidFill() {
+            return null;
+        }
+
+        public void unsetSolidFill() {}
+
+        public CTGradientFillProperties getGradFill() {
+            return isSetGradFill() ? (CTGradientFillProperties)props : null;
+        }
+
+        public boolean isSetGradFill() {
+            return (props instanceof CTGradientFillProperties);
+        }
+
+        public void setGradFill(CTGradientFillProperties gradFill) {}
+
+        public CTGradientFillProperties addNewGradFill() {
+            return null;
+        }
+
+        public void unsetGradFill() {}
+
+        public CTBlipFillProperties getBlipFill() {
+            return isSetBlipFill() ? (CTBlipFillProperties)props : null;
+        }
+
+        public boolean isSetBlipFill() {
+            return (props instanceof CTBlipFillProperties);
+        }
+
+        public void setBlipFill(CTBlipFillProperties blipFill) {}
+
+        public CTBlipFillProperties addNewBlipFill() {
+            return null;
+        }
+
+        public void unsetBlipFill() {}
+
+        public CTPatternFillProperties getPattFill() {
+            return isSetPattFill() ? (CTPatternFillProperties)props : null;
+        }
+
+        public boolean isSetPattFill() {
+            return (props instanceof CTPatternFillProperties);
+        }
+
+        public void setPattFill(CTPatternFillProperties pattFill) {}
+
+        public CTPatternFillProperties addNewPattFill() {
+            return null;
+        }
+
+        public void unsetPattFill() {}
+
+        public CTGroupFillProperties getGrpFill() {
+            return isSetGrpFill() ? (CTGroupFillProperties)props : null;
+        }
+
+        public boolean isSetGrpFill() {
+            return (props instanceof CTGroupFillProperties);
+        }
+
+        public void setGrpFill(CTGroupFillProperties grpFill) {}
+
+        public CTGroupFillProperties addNewGrpFill() {
+            return null;
+        }
+
+        public void unsetGrpFill() {}
+
+        public boolean isSetMatrixStyle() {
+            return false;
+        }
+
+        public CTStyleMatrixReference getMatrixStyle() {
+            return null;
+        }
+        
+        @Override
+        public boolean isLineStyle() {
+            return false;
+        }
+    }
+    
+    private static class LineStyleDelegate implements XSLFFillProperties {
+        final CTLineProperties props;
+        
+        LineStyleDelegate(CTLineProperties props) {
+            this.props = props;
+        }
+
+        @Override
+        public CTNoFillProperties getNoFill() {
+            return props.getNoFill();
+        }
+
+        @Override
+        public boolean isSetNoFill() {
+            return props.isSetNoFill();
+        }
+
+        @Override
+        public void setNoFill(CTNoFillProperties noFill) {
+            props.setNoFill(noFill);
+        }
+
+        @Override
+        public CTNoFillProperties addNewNoFill() {
+            return props.addNewNoFill();
+        }
+
+        @Override
+        public void unsetNoFill() {
+            props.unsetNoFill();
+        }
+
+        @Override
+        public CTSolidColorFillProperties getSolidFill() {
+            return props.getSolidFill();
+        }
+
+        @Override
+        public boolean isSetSolidFill() {
+            return props.isSetSolidFill();
+        }
+
+        @Override
+        public void setSolidFill(CTSolidColorFillProperties solidFill) {
+            props.setSolidFill(solidFill);
+        }
+
+        @Override
+        public CTSolidColorFillProperties addNewSolidFill() {
+            return props.addNewSolidFill();
+        }
+
+        @Override
+        public void unsetSolidFill() {
+            props.unsetSolidFill();
+        }
+
+        @Override
+        public CTGradientFillProperties getGradFill() {
+            return props.getGradFill();
+        }
+
+        @Override
+        public boolean isSetGradFill() {
+            return props.isSetGradFill();
+        }
+
+        @Override
+        public void setGradFill(CTGradientFillProperties gradFill) {
+            props.setGradFill(gradFill);
+        }
+
+        @Override
+        public CTGradientFillProperties addNewGradFill() {
+            return props.addNewGradFill();
+        }
+
+        @Override
+        public void unsetGradFill() {
+            props.unsetGradFill();
+        }
+
+        @Override
+        public CTBlipFillProperties getBlipFill() {
+            return null;
+        }
+
+        @Override
+        public boolean isSetBlipFill() {
+            return false;
+        }
+
+        @Override
+        public void setBlipFill(CTBlipFillProperties blipFill) {}
+
+        @Override
+        public CTBlipFillProperties addNewBlipFill() {
+            return null;
+        }
+
+        @Override
+        public void unsetBlipFill() {}
+
+        @Override
+        public CTPatternFillProperties getPattFill() {
+            return props.getPattFill();
+        }
+
+        @Override
+        public boolean isSetPattFill() {
+            return props.isSetPattFill();
+        }
+
+        @Override
+        public void setPattFill(CTPatternFillProperties pattFill) {
+            props.setPattFill(pattFill);
+        }
+
+        @Override
+        public CTPatternFillProperties addNewPattFill() {
+            return props.addNewPattFill();
+        }
+
+        @Override
+        public void unsetPattFill() {
+            props.unsetPattFill();
+        }
+
+        @Override
+        public CTGroupFillProperties getGrpFill() {
+            return null;
+        }
+
+        @Override
+        public boolean isSetGrpFill() {
+            return false;
+        }
+
+        @Override
+        public void setGrpFill(CTGroupFillProperties grpFill) {}
+
+        @Override
+        public CTGroupFillProperties addNewGrpFill() {
+            return null;
+        }
+
+        @Override
+        public void unsetGrpFill() {}
+
+        @Override
+        public boolean isSetMatrixStyle() {
+            return false;
+        }
+
+        @Override
+        public CTStyleMatrixReference getMatrixStyle() {
+            return null;
+        }
+        
+        @Override
+        public boolean isLineStyle() {
+            return true;
+        }
+    }
+    
+    private static class TextCharDelegate implements XSLFFillProperties {
+        final CTTextCharacterProperties props;
+        
+        TextCharDelegate(CTTextCharacterProperties props) {
+            this.props = props;
+        }
+
+        @Override
+        public CTNoFillProperties getNoFill() {
+            return props.getNoFill();
+        }
+
+        @Override
+        public boolean isSetNoFill() {
+            return props.isSetNoFill();
+        }
+
+        @Override
+        public void setNoFill(CTNoFillProperties noFill) {
+            props.setNoFill(noFill);
+        }
+
+        @Override
+        public CTNoFillProperties addNewNoFill() {
+            return props.addNewNoFill();
+        }
+
+        @Override
+        public void unsetNoFill() {
+            props.unsetNoFill();
+        }
+
+        @Override
+        public CTSolidColorFillProperties getSolidFill() {
+            return props.getSolidFill();
+        }
+
+        @Override
+        public boolean isSetSolidFill() {
+            return props.isSetSolidFill();
+        }
+
+        @Override
+        public void setSolidFill(CTSolidColorFillProperties solidFill) {
+            props.setSolidFill(solidFill);
+        }
+
+        @Override
+        public CTSolidColorFillProperties addNewSolidFill() {
+            return props.addNewSolidFill();
+        }
+
+        @Override
+        public void unsetSolidFill() {
+            props.unsetSolidFill();
+        }
+
+        @Override
+        public CTGradientFillProperties getGradFill() {
+            return props.getGradFill();
+        }
+
+        @Override
+        public boolean isSetGradFill() {
+            return props.isSetGradFill();
+        }
+
+        @Override
+        public void setGradFill(CTGradientFillProperties gradFill) {
+            props.setGradFill(gradFill);
+        }
+
+        @Override
+        public CTGradientFillProperties addNewGradFill() {
+            return props.addNewGradFill();
+        }
+
+        @Override
+        public void unsetGradFill() {
+            props.unsetGradFill();
+        }
+
+        @Override
+        public CTBlipFillProperties getBlipFill() {
+            return props.getBlipFill();
+        }
+
+        @Override
+        public boolean isSetBlipFill() {
+            return props.isSetBlipFill();
+        }
+
+        @Override
+        public void setBlipFill(CTBlipFillProperties blipFill) {
+            props.setBlipFill(blipFill);
+        }
+
+        @Override
+        public CTBlipFillProperties addNewBlipFill() {
+            return props.addNewBlipFill();
+        }
+
+        @Override
+        public void unsetBlipFill() {
+            props.unsetBlipFill();
+        }
+
+        @Override
+        public CTPatternFillProperties getPattFill() {
+            return props.getPattFill();
+        }
+
+        @Override
+        public boolean isSetPattFill() {
+            return props.isSetPattFill();
+        }
+
+        @Override
+        public void setPattFill(CTPatternFillProperties pattFill) {
+            props.setPattFill(pattFill);
+        }
+
+        @Override
+        public CTPatternFillProperties addNewPattFill() {
+            return props.addNewPattFill();
+        }
+
+        @Override
+        public void unsetPattFill() {
+            props.unsetPattFill();
+        }
+
+        @Override
+        public CTGroupFillProperties getGrpFill() {
+            return props.getGrpFill();
+        }
+
+        @Override
+        public boolean isSetGrpFill() {
+            return props.isSetGrpFill();
+        }
+
+        @Override
+        public void setGrpFill(CTGroupFillProperties grpFill) {
+            props.setGrpFill(grpFill);
+        }
+
+        @Override
+        public CTGroupFillProperties addNewGrpFill() {
+            return props.addNewGrpFill();
+        }
+
+        @Override
+        public void unsetGrpFill() {
+            props.unsetGrpFill();
+        }
+
+        @Override
+        public boolean isSetMatrixStyle() {
+            return false;
+        }
+
+        @Override
+        public CTStyleMatrixReference getMatrixStyle() {
+            return null;
+        }
+        
+        @Override
+        public boolean isLineStyle() {
+            return false;
+        }
+    }
+    
+    @SuppressWarnings("unchecked")
+    private static <T> T getDelegate(Class<T> clazz, XmlObject props) {
+        Object obj = null;
+        if (props == null) {
+            return null;
+        } else if (props instanceof CTShapeProperties) {
+            obj = new ShapeDelegate((CTShapeProperties)props);
+        } else if (props instanceof CTBackgroundProperties) {
+            obj = new BackgroundDelegate((CTBackgroundProperties)props);
+        } else if (props instanceof CTStyleMatrixReference) {
+            obj = new StyleMatrixDelegate((CTStyleMatrixReference)props);
+        } else if (props instanceof CTTableCellProperties) {
+            obj = new TableCellDelegate((CTTableCellProperties)props);
+        } else if (props instanceof CTNoFillProperties
+            || props instanceof CTSolidColorFillProperties
+            || props instanceof CTGradientFillProperties
+            || props instanceof CTBlipFillProperties
+            || props instanceof CTPatternFillProperties
+            || props instanceof CTGroupFillProperties) {
+            obj = new FillPartDelegate(props);
+        } else if (props instanceof CTFillProperties) {
+            obj = new FillDelegate((CTFillProperties)props);
+        } else if (props instanceof CTLineProperties) {
+            obj = new LineStyleDelegate((CTLineProperties)props);
+        } else if (props instanceof CTTextCharacterProperties) {
+            obj = new TextCharDelegate((CTTextCharacterProperties)props);
+        } else {
+            LOG.log(POILogger.ERROR, props.getClass().toString()+" is an unknown properties type");
+            return null;
+        }
+
+        if (clazz.isInstance(obj)) {
+            return (T)obj;
+        }
+        
+        LOG.log(POILogger.WARN, obj.getClass().toString()+" doesn't implement "+clazz.toString());
+        return null;
+    }
+}

Propchange: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPropertiesDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java?rev=1749108&r1=1749107&r2=1749108&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java Sat Jun 18 23:48:00 2016
@@ -41,13 +41,14 @@ import org.apache.poi.sl.usermodel.Shape
 import org.apache.poi.util.Beta;
 import org.apache.poi.util.Internal;
 import org.apache.poi.xslf.model.PropertyFetcher;
+import org.apache.poi.xslf.usermodel.XSLFPropertiesDelegate.XSLFFillProperties;
+import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlObject;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTBlip;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTBlipFillProperties;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTGradientFillProperties;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTGradientStop;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTGroupShapeProperties;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTNoFillProperties;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties;
@@ -57,7 +58,6 @@ import org.openxmlformats.schemas.drawin
 import org.openxmlformats.schemas.drawingml.x2006.main.CTStyleMatrixReference;
 import org.openxmlformats.schemas.drawingml.x2006.main.STPathShadeType;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTApplicationNonVisualDrawingProps;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTBackground;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTBackgroundProperties;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTShape;
@@ -68,11 +68,12 @@ import org.openxmlformats.schemas.presen
  */
 @Beta
 public abstract class XSLFShape implements Shape<XSLFShape,XSLFTextParagraph> {
+    protected static final String PML_NS = "http://schemas.openxmlformats.org/presentationml/2006/main";
+    
     private final XmlObject _shape;
     private final XSLFSheet _sheet;
     private XSLFShapeContainer _parent;
 
-    private CTShapeProperties _spPr;
     private CTShapeStyle _spStyle;
     private CTNonVisualDrawingProps _nvPr;
     private CTPlaceholder _ph;
@@ -151,75 +152,52 @@ public abstract class XSLFShape implemen
         final XSLFTheme theme = getSheet().getTheme();
         PropertyFetcher<PaintStyle> fetcher = new PropertyFetcher<PaintStyle>() {
             public boolean fetch(XSLFShape shape) {
-                XmlObject pr = null;
-                try {
-                    pr = shape.getSpPr();
-                    if (((CTShapeProperties)pr).isSetNoFill()) {
-                        setValue(null);
-                        return true;
-                    }                    
-                } catch (IllegalStateException e) {}
-                // trying background properties now
-                if (pr == null) {
-                    pr = shape.getBgPr();
-                }
-                if (pr == null) {
-                    pr = shape.getGrpSpPr();
-                }
-                if (pr == null) {
-                    if (shape.getXmlObject() instanceof CTBackground) {
-                        pr = shape.getXmlObject();
-                    }
+                XSLFFillProperties fp = XSLFPropertiesDelegate.getFillDelegate(shape.getShapeProperties());
+                if (fp == null) {
+                    return false;
+                }
+
+                if (fp.isSetNoFill()) {
+                    setValue(null);
+                    return true;
                 }
                 
-                if (pr == null) return false;
-                
-                PaintStyle paint = null;
-                PackagePart pp = getSheet().getPackagePart();
-                for (XmlObject obj : pr.selectPath("*")) {
-                    paint = selectPaint(obj, null, pp, theme);
-                    if (paint != null) {
-                        setValue(paint);
-                        return true;
-                    }
+                PackagePart pp = shape.getSheet().getPackagePart();
+                PaintStyle paint = selectPaint(fp, null, pp, theme);
+                if (paint != null) {
+                    setValue(paint);
+                    return true;
                 }
+
+                CTShapeStyle style = shape.getSpStyle();
+                if (style != null) {
+                    fp = XSLFPropertiesDelegate.getFillDelegate(style.getFillRef());
+                    paint = selectPaint(fp, null, pp, theme);
+                }
+                if (paint != null) {
+                    setValue(paint);
+                    return true;
+                }
+                
                 
                 return false;
             }
         };
         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();
-        }
-        paint = selectPaint(fillRef, theme);
-
-        return paint;
+        return fetcher.getValue();
     }
 
     protected CTBackgroundProperties getBgPr() {
-        String xquery = "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' p:bgPr";
-        return selectProperty(CTBackgroundProperties.class, xquery);
+        return getChild(CTBackgroundProperties.class, PML_NS, "bgPr");
     }
     
     protected CTStyleMatrixReference getBgRef() {
-        String xquery = "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' p:bgRef";
-        return selectProperty(CTStyleMatrixReference.class, xquery);
+        return getChild(CTStyleMatrixReference.class, PML_NS, "bgRef");
     }
     
     protected CTGroupShapeProperties getGrpSpPr() {
-        String xquery = "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' p:grpSpPr";
-        return selectProperty(CTGroupShapeProperties.class, xquery);
+        return getChild(CTGroupShapeProperties.class, PML_NS, "grpSpPr");
     }
     
     protected CTNonVisualDrawingProps getCNvPr() {
@@ -230,28 +208,35 @@ public abstract class XSLFShape implemen
         return _nvPr;
     }
 
-    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;
-    }
-
     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);
+            _spStyle = getChild(CTShapeStyle.class, PML_NS, "style");
         }
         return _spStyle;
     }
 
+    /**
+     * Return direct child objects of this shape
+     *
+     * @param childClass the class to cast the properties to
+     * @param namespace the namespace - usually it is {@code "http://schemas.openxmlformats.org/presentationml/2006/main"}
+     * @param nodename the node name, without prefix
+     * @return the properties object or null if it can't be found
+     */
+    @SuppressWarnings("unchecked")
+    protected <T extends XmlObject> T getChild(Class<T> childClass, String namespace, String nodename) {
+        XmlCursor cur = getXmlObject().newCursor();
+        T child = null;
+        if (cur.toChild(namespace, nodename)) {
+            child = (T)cur.getObject();
+        }
+        cur.dispose();
+        return child;
+    }
+    
     protected CTPlaceholder getCTPlaceholder() {
         if (_ph == null) {
-            String xquery = "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//*/p:nvPr/p:ph";
+            String xquery = "declare namespace p='"+PML_NS+"' .//*/p:nvPr/p:ph";
             _ph = selectProperty(CTPlaceholder.class, xquery);
         }
         return _ph;
@@ -275,7 +260,7 @@ public abstract class XSLFShape implemen
      * @param placeholder
      */
     protected void setPlaceholder(Placeholder placeholder) {
-        String xquery = "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//*/p:nvPr";
+        String xquery = "declare namespace p='"+PML_NS+"' .//*/p:nvPr";
         CTApplicationNonVisualDrawingProps nv = selectProperty(CTApplicationNonVisualDrawingProps.class, xquery);
         if (nv == null) return;
         if(placeholder == null) {
@@ -362,48 +347,28 @@ public abstract class XSLFShape implemen
         return ok;
     }
 
-    protected PaintStyle getPaint(XmlObject spPr, CTSchemeColor phClr) {
-        PaintStyle paint = null;
-        XSLFSheet sheet = getSheet(); 
-        PackagePart pp = sheet.getPackagePart();
-        XSLFTheme theme = sheet.getTheme();
-        for (XmlObject obj : spPr.selectPath("*")) {
-            paint = selectPaint(obj, phClr, pp, theme);
-            if(paint != null) break;
-        }
-        return paint;
-    }
-    
     /**
      * Convert shape fill into java.awt.Paint. The result is either Color or
      * TexturePaint or GradientPaint or null
      *
-     * @param obj       the xml to read. Must contain elements from the EG_ColorChoice group:
-     * <code>
-     *     a:scrgbClr    RGB Color Model - Percentage Variant
-     *     a:srgbClr    RGB Color Model - Hex Variant
-     *     a:hslClr    Hue, Saturation, Luminance Color Model
-     *     a:sysClr    System Color
-     *     a:schemeClr    Scheme Color
-     *     a:prstClr    Preset Color
-     *  </code>
-     *
-     * @param phClr     context color
-     * @param parentPart    the parent package part. Any external references (images, etc.) are resolved relative to it.
+     * @param fp          a properties handler specific to the underlying shape properties
+     * @param phClr       context color
+     * @param parentPart  the parent package part. Any external references (images, etc.) are resolved relative to it.
+     * @param theme       the theme for the shape/sheet
      *
      * @return  the applied Paint or null if none was applied
      */
-    protected static PaintStyle selectPaint(XmlObject obj, final CTSchemeColor phClr, final PackagePart parentPart, final XSLFTheme theme) {
-        if (obj instanceof CTNoFillProperties) {
+    protected static PaintStyle selectPaint(XSLFFillProperties fp, final CTSchemeColor phClr, final PackagePart parentPart, final XSLFTheme theme) {
+        if (fp == null || fp.isSetNoFill()) {
             return null;
-        } else if (obj instanceof CTSolidColorFillProperties) {
-            return selectPaint((CTSolidColorFillProperties)obj, phClr, theme);
-        } else if (obj instanceof CTBlipFillProperties) {
-            return selectPaint((CTBlipFillProperties)obj, parentPart);
-        } else if (obj instanceof CTGradientFillProperties) {
-            return selectPaint((CTGradientFillProperties) obj, phClr, theme);
-        } else if (obj instanceof CTStyleMatrixReference) {
-            return selectPaint((CTStyleMatrixReference)obj, theme);
+        } else if (fp.isSetSolidFill()) {
+            return selectPaint(fp.getSolidFill(), phClr, theme);
+        } else if (fp.isSetBlipFill()) {
+            return selectPaint(fp.getBlipFill(), parentPart);
+        } else if (fp.isSetGradFill()) {
+            return selectPaint(fp.getGradFill(), phClr, theme);
+        } else if (fp.isSetMatrixStyle()) {
+            return selectPaint(fp.getMatrixStyle(), theme, fp.isLineStyle());
         } else {
             return null;
         }
@@ -518,7 +483,7 @@ public abstract class XSLFShape implemen
         };        
     }
     
-    protected static PaintStyle selectPaint(CTStyleMatrixReference fillRef, final XSLFTheme theme) {
+    protected static PaintStyle selectPaint(CTStyleMatrixReference fillRef, final XSLFTheme theme, boolean isLineStyle) {
         if (fillRef == null) return null;
         
         // The idx attribute refers to the index of a fill style or
@@ -528,18 +493,39 @@ public abstract class XSLFShape implemen
         // 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();
-        XmlObject fillProps = null;
         CTStyleMatrix matrix = theme.getXmlObject().getThemeElements().getFmtScheme();
+        XmlObject styleLst = null;
+        int childIdx;
         if (idx >= 1 && idx <= 999) {
-            fillProps = matrix.getFillStyleLst().selectPath("*")[idx - 1];
+            childIdx = idx-1;
+            styleLst = (isLineStyle) ? matrix.getLnStyleLst() : matrix.getFillStyleLst();
         } else if (idx >= 1001 ){
-            fillProps = matrix.getBgFillStyleLst().selectPath("*")[idx - 1001];
+            childIdx = idx - 1001;
+            styleLst = matrix.getBgFillStyleLst();
+        } else {
+            return null;
+        }
+        XmlCursor cur = styleLst.newCursor();
+        XSLFFillProperties fp = null;
+        if (cur.toChild(childIdx)) {
+            fp = XSLFPropertiesDelegate.getFillDelegate(cur.getObject());
         }
-        return (fillProps == null) ? null : selectPaint(fillProps, phClr, theme.getPackagePart(), theme);
+        cur.dispose();
+        
+        return selectPaint(fp, phClr, theme.getPackagePart(), theme);
     }
     
     @Override
     public void draw(Graphics2D graphics, Rectangle2D bounds) {
         DrawFactory.getInstance(graphics).drawShape(graphics, this, bounds);
     }
+    
+    /**
+     * Return the shape specific (visual) properties
+     *
+     * @return the shape specific properties
+     */
+    protected XmlObject getShapeProperties() {
+        return getChild(CTShapeProperties.class, PML_NS, "spPr");
+    }
 }
\ No newline at end of file



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