poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ye...@apache.org
Subject svn commit: r1198658 [3/5] - in /poi/trunk: ./ src/examples/src/org/apache/poi/xslf/usermodel/tutorial/ src/ooxml/java/org/apache/poi/xslf/extractor/ src/ooxml/java/org/apache/poi/xslf/model/geom/ src/ooxml/java/org/apache/poi/xslf/usermodel/ src/ooxml...
Date Mon, 07 Nov 2011 09:12:18 GMT
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java?rev=1198658&r1=1198657&r2=1198658&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java Mon Nov  7 09:12:16
2011
@@ -30,12 +30,16 @@ import org.openxmlformats.schemas.drawin
 import org.openxmlformats.schemas.drawingml.x2006.main.STTextAnchoringType;
 import org.openxmlformats.schemas.drawingml.x2006.main.STTextVerticalType;
 import org.openxmlformats.schemas.drawingml.x2006.main.STTextWrappingType;
+import org.openxmlformats.schemas.presentationml.x2006.main.CTApplicationNonVisualDrawingProps;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder;
+import org.openxmlformats.schemas.presentationml.x2006.main.CTShape;
+import org.openxmlformats.schemas.presentationml.x2006.main.STPlaceholderType;
 
-import java.awt.*;
+import java.awt.Graphics2D;
 import java.awt.geom.Rectangle2D;
 import java.awt.image.BufferedImage;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -44,7 +48,7 @@ import java.util.List;
  * @author Yegor Kozlov
  */
 @Beta
-public abstract class XSLFTextShape extends XSLFSimpleShape {
+public abstract class XSLFTextShape extends XSLFSimpleShape implements Iterable<XSLFTextParagraph>{
     private final List<XSLFTextParagraph> _paragraphs;
 
     /*package*/ XSLFTextShape(XmlObject shape, XSLFSheet sheet) {
@@ -59,7 +63,14 @@ public abstract class XSLFTextShape exte
         }
     }
 
-    // textual properties
+    public Iterator<XSLFTextParagraph> iterator(){
+        return _paragraphs.iterator();
+    }
+
+    /**
+     *
+     * @return  text contained within this shape or empty string
+     */
     public String getText() {
         StringBuilder out = new StringBuilder();
         for (XSLFTextParagraph p : _paragraphs) {
@@ -69,10 +80,34 @@ public abstract class XSLFTextShape exte
         return out.toString();
     }
 
+    /**
+     * unset text from this shape
+     */
+    public void clearText(){
+        _paragraphs.clear();
+        CTTextBody txBody = getTextBody(true);
+        txBody.setPArray(null); // remove any existing paragraphs
+    }
+
+    public void setText(String text){
+        clearText();
+
+        addNewTextParagraph().addNewTextRun().setText(text);
+    }
+
+    /**
+     *
+     * @return text paragraphs in this shape
+     */
     public List<XSLFTextParagraph> getTextParagraphs() {
         return _paragraphs;
     }
 
+    /**
+     * add a new paragraph run to this shape
+     *
+     * @return created paragraph run
+     */
     public XSLFTextParagraph addNewTextParagraph() {
         CTTextBody txBody = getTextBody(true);
         CTTextParagraph p = txBody.addNewP();
@@ -84,9 +119,9 @@ public abstract class XSLFTextShape exte
 
     /**
      * Sets the type of vertical alignment for the text.
-     * One of the <code>Anchor*</code> constants defined in this class.
      *
-     * @param anchor - the type of alignment. Default is {@link org.apache.poi.xslf.usermodel.VerticalAlignment#TOP}
+     * @param anchor - the type of alignment.
+     * A <code>null</code> values unsets this property.
      */
     public void setVerticalAlignment(VerticalAlignment anchor){
         CTTextBodyProperties bodyPr = getTextBodyPr();
@@ -102,7 +137,7 @@ public abstract class XSLFTextShape exte
     /**
      * Returns the type of vertical alignment for the text.
      *
-     * @return the type of alignment
+     * @return the type of vertical alignment
      */
     public VerticalAlignment getVerticalAlignment(){
         PropertyFetcher<VerticalAlignment> fetcher = new TextBodyPropertyFetcher<VerticalAlignment>(){
@@ -147,13 +182,15 @@ public abstract class XSLFTextShape exte
         }
         return TextDirection.HORIZONTAL;
     }
+
+
     /**
      * Returns the distance (in points) between the bottom of the text frame
      * and the bottom of the inscribed rectangle of the shape that contains the text.
      *
-     * @return the bottom margin or -1 if not set
+     * @return the bottom inset in points
      */
-    public double getMarginBottom(){
+    public double getBottomInset(){
         PropertyFetcher<Double> fetcher = new TextBodyPropertyFetcher<Double>(){
             public boolean fetch(CTTextBodyProperties props){
                 if(props.isSetBIns()){
@@ -173,9 +210,9 @@ public abstract class XSLFTextShape exte
      *  and the left edge of the inscribed rectangle of the shape that contains
      *  the text.
      *
-     * @return the left margin
+     * @return the left inset in points
      */
-    public double getMarginLeft(){
+    public double getLeftInset(){
         PropertyFetcher<Double> fetcher = new TextBodyPropertyFetcher<Double>(){
             public boolean fetch(CTTextBodyProperties props){
                 if(props.isSetLIns()){
@@ -195,9 +232,9 @@ public abstract class XSLFTextShape exte
      *  text frame and the right edge of the inscribed rectangle of the shape
      *  that contains the text.
      *
-     * @return the right margin
+     * @return the right inset in points
      */
-    public double getMarginRight(){
+    public double getRightInset(){
         PropertyFetcher<Double> fetcher = new TextBodyPropertyFetcher<Double>(){
             public boolean fetch(CTTextBodyProperties props){
                 if(props.isSetRIns()){
@@ -216,9 +253,9 @@ public abstract class XSLFTextShape exte
      *  Returns the distance (in points) between the top of the text frame
      *  and the top of the inscribed rectangle of the shape that contains the text.
      *
-     * @return the top margin
+     * @return the top inset in points
      */
-    public double getMarginTop(){
+    public double getTopInset(){
         PropertyFetcher<Double> fetcher = new TextBodyPropertyFetcher<Double>(){
             public boolean fetch(CTTextBodyProperties props){
                 if(props.isSetTIns()){
@@ -235,11 +272,11 @@ public abstract class XSLFTextShape exte
 
     /**
      * Sets the botom margin.
-     * @see #getMarginBottom()
+     * @see #getBottomInset()
      *
      * @param margin    the bottom margin
      */
-    public void setMarginBottom(double margin){
+    public void setBottomInset(double margin){
         CTTextBodyProperties bodyPr = getTextBodyPr();
         if (bodyPr != null) {
             if(margin == -1) bodyPr.unsetBIns();
@@ -249,11 +286,11 @@ public abstract class XSLFTextShape exte
 
     /**
      * Sets the left margin.
-     * @see #getMarginLeft()
+     * @see #getLeftInset()
      *
      * @param margin    the left margin
      */
-    public void setMarginLeft(double margin){
+    public void setLeftInset(double margin){
         CTTextBodyProperties bodyPr = getTextBodyPr();
         if (bodyPr != null) {
             if(margin == -1) bodyPr.unsetLIns();
@@ -263,11 +300,11 @@ public abstract class XSLFTextShape exte
 
     /**
      * Sets the right margin.
-     * @see #getMarginRight()
+     * @see #getRightInset()
      *
      * @param margin    the right margin
      */
-    public void setMarginRight(double margin){
+    public void setRightInset(double margin){
         CTTextBodyProperties bodyPr = getTextBodyPr();
         if (bodyPr != null) {
             if(margin == -1) bodyPr.unsetRIns();
@@ -277,11 +314,11 @@ public abstract class XSLFTextShape exte
 
     /**
      * Sets the top margin.
-     * @see #getMarginTop()
+     * @see #getTopInset()
      *
      * @param margin    the top margin
      */
-    public void setMarginTop(double margin){
+    public void setTopInset(double margin){
         CTTextBodyProperties bodyPr = getTextBodyPr();
         if (bodyPr != null) {
             if(margin == -1) bodyPr.unsetTIns();
@@ -291,10 +328,7 @@ public abstract class XSLFTextShape exte
 
 
     /**
-     * Returns the value indicating word wrap.
-     * One of the <code>Wrap*</code> constants defined in this class.
-     *
-     * @return the value indicating word wrap
+     * @return whether to wrap words within the bounding rectangle
      */
     public boolean getWordWrap(){
         PropertyFetcher<Boolean> fetcher = new TextBodyPropertyFetcher<Boolean>(){
@@ -311,9 +345,8 @@ public abstract class XSLFTextShape exte
     }
 
     /**
-     *  Specifies how the text should be wrapped
      *
-     * @param wrap  the value indicating how the text should be wrapped
+     * @param wrap  whether to wrap words within the bounding rectangle
      */
     public void setWordWrap(boolean wrap){
         CTTextBodyProperties bodyPr = getTextBodyPr();
@@ -381,33 +414,25 @@ public abstract class XSLFTextShape exte
         }
     }
 
-    @Override
-    public void draw(Graphics2D graphics){
-        java.awt.Shape outline = getOutline();
-
-        // shadow
-        XSLFShadow shadow = getShadow();
-
-        Paint fill = getFill(graphics);
-        Paint line = getLinePaint(graphics);
-        if(shadow != null) {
-        	shadow.draw(graphics);
-        }
 
-        if(fill != null) {
-            graphics.setPaint(fill);
-            graphics.fill(outline);
-        }
-
-        if (line != null){
-            graphics.setPaint(line);
-            applyStroke(graphics);
-            graphics.draw(outline);
+    /**
+     * Specifies that the corresponding shape should be represented by the generating application
+     * as a placeholder. When a shape is considered a placeholder by the generating application
+     * it can have special properties to alert the user that they may enter content into
the shape.
+     * Different types of placeholders are allowed and can be specified by using the placeholder
+     * type attribute for this element
+     *
+     * @param placeholder
+     */
+    public void setPlaceholder(Placeholder placeholder){
+        CTShape sh =  (CTShape)getXmlObject();
+        CTApplicationNonVisualDrawingProps nv = sh.getNvSpPr().getNvPr();
+        if(placeholder == null) {
+            if(nv.isSetPh()) nv.unsetPh();
+        } else {
+            nv.addNewPh().setType(STPlaceholderType.Enum.forInt(placeholder.ordinal() + 1));
         }
-
-        // text
-        if(getText().length() > 0) drawText(graphics);
-    }    
+    }
 
     /**
      * Compute the cumulative height occupied by the text
@@ -418,15 +443,19 @@ public abstract class XSLFTextShape exte
         return drawParagraphs(img.createGraphics(), 0, 0);
     }
 
-    void breakText(Graphics2D graphics){
+    /**
+     * break the contained text into lines
+    */
+    private void breakText(Graphics2D graphics){
         for(XSLFTextParagraph p : _paragraphs) p.breakText(graphics);
     }
 
-    public void drawText(Graphics2D graphics) {
+    @Override
+    public void drawContent(Graphics2D graphics) {
         breakText(graphics);
 
         Rectangle2D anchor = getAnchor();
-        double x = anchor.getX() + getMarginLeft();
+        double x = anchor.getX() + getLeftInset();
         double y = anchor.getY();
 
         // first dry-run to calculate the total height of the text
@@ -434,21 +463,20 @@ public abstract class XSLFTextShape exte
 
         switch (getVerticalAlignment()){
             case TOP:
-                y += getMarginTop();
+                y += getTopInset();
                 break;
             case BOTTOM:
-                y += anchor.getHeight() - textHeight - getMarginBottom();
+                y += anchor.getHeight() - textHeight - getBottomInset();
                 break;
             default:
             case MIDDLE:
                 double delta = anchor.getHeight() - textHeight -
-                        getMarginTop() - getMarginBottom();
-                y += getMarginTop()  + delta/2;
+                        getTopInset() - getBottomInset();
+                y += getTopInset()  + delta/2;
                 break;
         }
 
         drawParagraphs(graphics, x, y);
-
     }
 
 
@@ -461,7 +489,7 @@ public abstract class XSLFTextShape exte
         double y0 = y;
         for(int i = 0; i < _paragraphs.size(); i++){
             XSLFTextParagraph p = _paragraphs.get(i);
-            java.util.List<XSLFTextParagraph.TextFragment> lines = p.getTextLines();
+            List<XSLFTextParagraph.TextFragment> lines = p.getTextLines();
 
             if(i > 0 && lines.size() > 0) {
                 // the amount of vertical white space before the paragraph

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTheme.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTheme.java?rev=1198658&r1=1198657&r2=1198658&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTheme.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTheme.java Mon Nov  7 09:12:16
2011
@@ -26,6 +26,7 @@ import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTBaseStyles;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTColor;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTColorMapping;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTColorScheme;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTOfficeStyleSheet;
 import org.openxmlformats.schemas.drawingml.x2006.main.ThemeDocument;
@@ -36,6 +37,11 @@ import java.io.OutputStream;
 import java.util.HashMap;
 import java.util.Map;
 
+/**
+ * A shared style sheet in a .pptx slide show
+ *
+ * @author Yegor Kozlov
+ */
 @Beta
 public class XSLFTheme extends POIXMLDocumentPart {
     private CTOfficeStyleSheet _theme;
@@ -64,17 +70,33 @@ public class XSLFTheme extends POIXMLDoc
     		String name = c.getDomNode().getLocalName();
     		_schemeColors.put(name, c);
     	}
+     }
 
-    	_schemeColors.put("bg1", _schemeColors.get("lt1"));
-    	_schemeColors.put("bg2", _schemeColors.get("lt2"));
-        _schemeColors.put("tx1", _schemeColors.get("dk1"));
-        _schemeColors.put("tx2", _schemeColors.get("dk2"));
+    /**
+     * re-map colors
+     *
+     * @param cmap color map defined in the master slide referencing this theme
+     */
+    void initColorMap(CTColorMapping cmap) {
+        _schemeColors.put("bg1", _schemeColors.get(cmap.getBg1().toString()));
+        _schemeColors.put("bg2", _schemeColors.get(cmap.getBg2().toString()));
+        _schemeColors.put("tx1", _schemeColors.get(cmap.getTx1().toString()));
+        _schemeColors.put("tx2", _schemeColors.get(cmap.getTx2().toString()));
     }
 
+    /**
+     *
+     * @return name of this theme, e.g. "Office Theme"
+     */
     public String getName(){
         return _theme.getName();
     }
 
+    /**
+     * Set name of this theme
+     *
+     * @param name name of this theme
+     */
     public void setName(String name){
         _theme.setName(name);
     }
@@ -111,10 +133,20 @@ public class XSLFTheme extends POIXMLDoc
         out.close();
     }
 
+    /**
+     * @return typeface of the major font to use in a document.
+     * Typically the major font is used for heading areas of a document.
+     *
+     */
     public String getMajorFont(){
         return _theme.getThemeElements().getFontScheme().getMajorFont().getLatin().getTypeface();
     }
 
+    /**
+     * @return typeface of the minor font to use in a document.
+     * Typically the monor font is used for normal text or paragraph areas.
+     *
+     */
     public String getMinorFont(){
         return _theme.getThemeElements().getFontScheme().getMinorFont().getLatin().getTypeface();
     }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/util/PPTX2PNG.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/util/PPTX2PNG.java?rev=1198658&r1=1198657&r2=1198658&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/util/PPTX2PNG.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/util/PPTX2PNG.java Mon Nov  7 09:12:16 2011
@@ -28,21 +28,26 @@ import java.awt.Color;
 import java.awt.Dimension;
 import java.awt.Graphics2D;
 import java.awt.RenderingHints;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Rectangle2D;
 import java.awt.image.BufferedImage;
-import java.io.File;
 import java.io.FileOutputStream;
 
 /**
- * Date: 10/11/11
+ * An utulity to convert slides of a .pptx slide show to a PNG image
  *
  * @author Yegor Kozlov
  */
 public class PPTX2PNG {
+
+    static void usage(){
+        System.out.println("Usage: PPTX2PNG [options] <pptx file>");
+        System.out.println("Options:");
+        System.out.println("    -scale <float>   scale factor");
+        System.out.println("    -slide <integer> 1-based index of a slide to render");
+    }
+
     public static void main(String[] args) throws Exception {
         if (args.length == 0) {
-            System.out.println("Usage: PPTX2PNG [options] <pptx file>");
+            usage();
             return;
         }
 
@@ -62,6 +67,11 @@ public class PPTX2PNG {
             }
         }
 
+        if(file == null){
+            usage();
+            return;
+        }
+
         System.out.println("Processing " + file);
         XMLSlideShow ppt = new XMLSlideShow(OPCPackage.open(file));
 
@@ -79,19 +89,23 @@ public class PPTX2PNG {
             BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
             Graphics2D graphics = img.createGraphics();
 
+            // default rendering options
             graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
             graphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
             graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
             graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
 
-            graphics.setPaint(Color.white);
-            graphics.fill(new Rectangle2D.Float(0, 0, width, height));
+            graphics.setColor(Color.white);
+            graphics.clearRect(0, 0, width, height);
 
-            graphics.scale((double) width / pgsize.width, (double) height / pgsize.height);
+            graphics.scale(scale, scale);
 
+            // draw stuff
             slide[i].draw(graphics);
 
-            String fname = file.replaceAll("\\.pptx", "-" + (i + 1) + ".png");
+            // save the result
+            int sep = file.lastIndexOf(".");
+            String fname = file.substring(0, sep == -1 ? file.length() : sep) + "-" + (i
+ 1) +".png";
             FileOutputStream out = new FileOutputStream(fname);
             ImageIO.write(img, "png", out);
             out.close();

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/geom/TestFormulaParser.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/geom/TestFormulaParser.java?rev=1198658&r1=1198657&r2=1198658&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/geom/TestFormulaParser.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/geom/TestFormulaParser.java Mon Nov
 7 09:12:16 2011
@@ -24,7 +24,7 @@ public class TestFormulaParser extends T
         };
 
         CustomGeometry geom = new CustomGeometry(CTCustomGeometry2D.Factory.newInstance());
-        Context ctx = new Context(geom, null);
+        Context ctx = new Context(geom, null, null);
         for(Formula fmla : ops) {
             ctx.evaluate(fmla);
         }

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/geom/TestPresetGeometries.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/geom/TestPresetGeometries.java?rev=1198658&r1=1198657&r2=1198658&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/geom/TestPresetGeometries.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/geom/TestPresetGeometries.java Mon Nov
 7 09:12:16 2011
@@ -21,11 +21,7 @@ public class TestPresetGeometries extend
 
         for(String name : shapes.keySet()) {
             CustomGeometry geom = shapes.get(name);
-            Context ctx = new Context(geom, new IAdjustableShape() {
-                public Rectangle2D getAnchor() {
-                    return new Rectangle2D.Double(0, 0, 100, 100);
-                }
-
+            Context ctx = new Context(geom, new Rectangle2D.Double(0, 0, 100, 100), new IAdjustableShape()
{
                 public Guide getAdjustValue(String name) {
                     return null;
                 }

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestPPTX2PNG.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestPPTX2PNG.java?rev=1198658&r1=1198657&r2=1198658&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestPPTX2PNG.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestPPTX2PNG.java Mon Nov
 7 09:12:16 2011
@@ -34,7 +34,7 @@ import java.awt.image.BufferedImage;
 public class TestPPTX2PNG extends TestCase {
     public void testRender(){
         String[] testFiles = {"layouts.pptx", "sample.pptx", "shapes.pptx",
-                "45541_Header.pptx", "backgrounds.pptx"};
+                "themes.pptx", "backgrounds.pptx"};
         for(String sampleFile : testFiles){
             XMLSlideShow pptx = XSLFTestDataSamples.openSampleDocument(sampleFile);
             Dimension pg = pptx.getPageSize();

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFAutoShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFAutoShape.java?rev=1198658&r1=1198657&r2=1198658&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFAutoShape.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFAutoShape.java Mon
Nov  7 09:12:16 2011
@@ -34,38 +34,38 @@ public class TestXSLFAutoShape extends T
         shape.addNewTextParagraph().addNewTextRun().setText("POI");
 
         // default margins from slide master
-        assertEquals(3.6, shape.getMarginBottom());
-        assertEquals(3.6, shape.getMarginTop());
-        assertEquals(7.2, shape.getMarginLeft());
-        assertEquals(7.2, shape.getMarginRight());
-
-        shape.setMarginBottom(1.0);
-        assertEquals(1.0, shape.getMarginBottom());
-        shape.setMarginTop(2.0);
-        assertEquals(2.0, shape.getMarginTop());
-        shape.setMarginLeft(3.0);
-        assertEquals(3.0, shape.getMarginLeft());
-        shape.setMarginRight(4.0);
-        assertEquals(4.0, shape.getMarginRight());
-
-        shape.setMarginBottom(0.0);
-        assertEquals(0.0, shape.getMarginBottom());
-        shape.setMarginTop(0.0);
-        assertEquals(0.0, shape.getMarginTop());
-        shape.setMarginLeft(0.0);
-        assertEquals(0.0, shape.getMarginLeft());
-        shape.setMarginRight(0.0);
-        assertEquals(0.0, shape.getMarginRight());
+        assertEquals(3.6, shape.getBottomInset());
+        assertEquals(3.6, shape.getTopInset());
+        assertEquals(7.2, shape.getLeftInset());
+        assertEquals(7.2, shape.getRightInset());
+
+        shape.setBottomInset(1.0);
+        assertEquals(1.0, shape.getBottomInset());
+        shape.setTopInset(2.0);
+        assertEquals(2.0, shape.getTopInset());
+        shape.setLeftInset(3.0);
+        assertEquals(3.0, shape.getLeftInset());
+        shape.setRightInset(4.0);
+        assertEquals(4.0, shape.getRightInset());
+
+        shape.setBottomInset(0.0);
+        assertEquals(0.0, shape.getBottomInset());
+        shape.setTopInset(0.0);
+        assertEquals(0.0, shape.getTopInset());
+        shape.setLeftInset(0.0);
+        assertEquals(0.0, shape.getLeftInset());
+        shape.setRightInset(0.0);
+        assertEquals(0.0, shape.getRightInset());
 
         // unset to defauls
-        shape.setMarginBottom(-1);
-        assertEquals(3.6, shape.getMarginBottom());
-        shape.setMarginTop(-1);
-        assertEquals(3.6, shape.getMarginTop());
-        shape.setMarginLeft(-1);
-        assertEquals(7.2, shape.getMarginLeft());
-        shape.setMarginRight(-1);
-        assertEquals(7.2, shape.getMarginRight());
+        shape.setBottomInset(-1);
+        assertEquals(3.6, shape.getBottomInset());
+        shape.setTopInset(-1);
+        assertEquals(3.6, shape.getTopInset());
+        shape.setLeftInset(-1);
+        assertEquals(7.2, shape.getLeftInset());
+        shape.setRightInset(-1);
+        assertEquals(7.2, shape.getRightInset());
 
         // shape
         assertTrue(shape.getWordWrap());

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFColor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFColor.java?rev=1198658&r1=1198657&r2=1198658&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFColor.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFColor.java Mon Nov
 7 09:12:16 2011
@@ -37,7 +37,7 @@ public class TestXSLFColor extends TestC
         CTSRgbColor c = xml.addNewSrgbClr();
         c.setVal(new byte[]{(byte)0xFF, 0, 0});
 
-        XSLFColor color = new XSLFColor(xml, null);
+        XSLFColor color = new XSLFColor(xml, null, null);
 
         assertEquals(-1, color.getAlpha());
         c.addNewAlpha().setVal(50000);
@@ -99,7 +99,7 @@ public class TestXSLFColor extends TestC
         c.setSat2(100000);
         c.setLum2(50000);
 
-        XSLFColor color = new XSLFColor(xml, null);
+        XSLFColor color = new XSLFColor(xml, null, null);
         assertEquals(new Color(128, 00, 00), color.getColor());
     }
 
@@ -107,7 +107,7 @@ public class TestXSLFColor extends TestC
         CTColor xml = CTColor.Factory.newInstance();
         xml.addNewSrgbClr().setVal(new byte[]{ (byte)0xFF, (byte)0xFF, 0});
 
-        XSLFColor color = new XSLFColor(xml, null);
+        XSLFColor color = new XSLFColor(xml, null, null);
         assertEquals(new Color(0xFF, 0xFF, 0), color.getColor());
     }
 
@@ -118,19 +118,19 @@ public class TestXSLFColor extends TestC
         CTColor xml = CTColor.Factory.newInstance();
         xml.addNewSchemeClr().setVal(STSchemeColorVal.ACCENT_2);
 
-        XSLFColor color = new XSLFColor(xml, theme);
+        XSLFColor color = new XSLFColor(xml, theme, null);
         // accent2 is theme1.xml is <a:srgbClr val="C0504D"/>
         assertEquals(Color.decode("0xC0504D"), color.getColor());
 
         xml = CTColor.Factory.newInstance();
         xml.addNewSchemeClr().setVal(STSchemeColorVal.LT_1);
-        color = new XSLFColor(xml, theme);
+        color = new XSLFColor(xml, theme, null);
         // <a:sysClr val="window" lastClr="FFFFFF"/>
         assertEquals(Color.decode("0xFFFFFF"), color.getColor());
 
         xml = CTColor.Factory.newInstance();
         xml.addNewSchemeClr().setVal(STSchemeColorVal.DK_1);
-        color = new XSLFColor(xml, theme);
+        color = new XSLFColor(xml, theme, null);
         // <a:sysClr val="windowText" lastClr="000000"/>
         assertEquals(Color.decode("0x000000"), color.getColor());
     }
@@ -138,7 +138,7 @@ public class TestXSLFColor extends TestC
     public void testPresetColor() {
         CTColor xml = CTColor.Factory.newInstance();
         xml.addNewPrstClr().setVal(STPresetColorVal.AQUAMARINE);
-        XSLFColor color = new XSLFColor(xml, null);
+        XSLFColor color = new XSLFColor(xml, null, null);
         assertEquals(new Color(127, 255, 212), color.getColor());
 
 
@@ -147,7 +147,7 @@ public class TestXSLFColor extends TestC
             STPresetColorVal.Enum val = STPresetColorVal.Enum.forString(colorName);
             assertNotNull(colorName, val);
             xml.addNewPrstClr().setVal(val);
-            color = new XSLFColor(xml, null);
+            color = new XSLFColor(xml, null, null);
             assertEquals(XSLFColor.presetColors.get(colorName), color.getColor());
         }
     }

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSlide.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSlide.java?rev=1198658&r1=1198657&r2=1198658&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSlide.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSlide.java Mon Nov
 7 09:12:16 2011
@@ -19,9 +19,6 @@ package org.apache.poi.xslf.usermodel;
 import junit.framework.TestCase;
 
 import org.apache.poi.xslf.XSLFTestDataSamples;
-import org.apache.poi.POIXMLDocumentPart;
-
-import java.util.List;
 
 /**
  * @author Yegor Kozlov
@@ -99,11 +96,11 @@ public class TestXSLFSlide extends TestC
         assertEquals(0, ppt.getSlides().length);
 
         XSLFSlide slide = ppt.createSlide();
-        assertTrue(slide.getFollowMasterBackground());
-        slide.setFollowMasterBackground(false);
-        assertFalse(slide.getFollowMasterBackground());
-        slide.setFollowMasterBackground(true);
-        assertTrue(slide.getFollowMasterBackground());
+        assertTrue(slide.getFollowMasterGraphics());
+        slide.setFollowMasterGraphics(false);
+        assertFalse(slide.getFollowMasterGraphics());
+        slide.setFollowMasterGraphics(true);
+        assertTrue(slide.getFollowMasterGraphics());
     }
 
 }
\ No newline at end of file

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSlideShow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSlideShow.java?rev=1198658&r1=1198657&r2=1198658&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSlideShow.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSlideShow.java Mon
Nov  7 09:12:16 2011
@@ -38,7 +38,7 @@ public class TestXSLFSlideShow extends T
 
         List<POIXMLDocumentPart> rels =  slide1.getRelations();
         assertEquals(1, rels.size());
-        assertEquals(slide1.getMasterSheet().getLayout("blank"), rels.get(0));
+        assertEquals(slide1.getSlideMaster().getLayout(SlideLayout.BLANK), rels.get(0));
 
         XSLFSlide slide2 = ppt.createSlide();
         assertEquals(2, ppt.getSlides().length);
@@ -91,7 +91,7 @@ public class TestXSLFSlideShow extends T
         assertEquals(1, masters.length);
 
         XSLFSlide slide = ppt.createSlide();
-        assertSame(masters[0], slide.getMasterSheet());
+        assertSame(masters[0], slide.getSlideMaster());
     }
 
     public void testSlideLayout(){

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java?rev=1198658&r1=1198657&r2=1198658&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java Mon
Nov  7 09:12:16 2011
@@ -65,10 +65,10 @@ public class TestXSLFTextShape extends T
                 !bodyPr1.isSetBIns() && !bodyPr1.isSetTIns() &&
                 !bodyPr1.isSetAnchor()
         );
-        assertEquals(7.2, shape1.getMarginLeft());  // 0.1"
-        assertEquals(7.2, shape1.getMarginRight()); // 0.1"
-        assertEquals(3.6, shape1.getMarginTop());  // 0.05"
-        assertEquals(3.6, shape1.getMarginBottom()); // 0.05"
+        assertEquals(7.2, shape1.getLeftInset());  // 0.1"
+        assertEquals(7.2, shape1.getRightInset()); // 0.1"
+        assertEquals(3.6, shape1.getTopInset());  // 0.05"
+        assertEquals(3.6, shape1.getBottomInset()); // 0.05"
         assertEquals(VerticalAlignment.MIDDLE, shape1.getVerticalAlignment());
 
         // now check text properties
@@ -95,10 +95,10 @@ public class TestXSLFTextShape extends T
                 !bodyPr2.isSetBIns() && !bodyPr2.isSetTIns() &&
                 !bodyPr2.isSetAnchor()
         );
-        assertEquals(7.2, shape2.getMarginLeft());  // 0.1"
-        assertEquals(7.2, shape2.getMarginRight()); // 0.1"
-        assertEquals(3.6, shape2.getMarginTop());  // 0.05"
-        assertEquals(3.6, shape2.getMarginBottom()); // 0.05"
+        assertEquals(7.2, shape2.getLeftInset());  // 0.1"
+        assertEquals(7.2, shape2.getRightInset()); // 0.1"
+        assertEquals(3.6, shape2.getTopInset());  // 0.05"
+        assertEquals(3.6, shape2.getBottomInset()); // 0.05"
         assertEquals(VerticalAlignment.TOP, shape2.getVerticalAlignment());
 
         assertEquals("subtitle", shape2.getText());
@@ -134,10 +134,10 @@ public class TestXSLFTextShape extends T
                 !bodyPr1.isSetBIns() && !bodyPr1.isSetTIns() &&
                 !bodyPr1.isSetAnchor()
         );
-        assertEquals(7.2, shape1.getMarginLeft());  // 0.1"
-        assertEquals(7.2, shape1.getMarginRight()); // 0.1"
-        assertEquals(3.6, shape1.getMarginTop());  // 0.05"
-        assertEquals(3.6, shape1.getMarginBottom()); // 0.05"
+        assertEquals(7.2, shape1.getLeftInset());  // 0.1"
+        assertEquals(7.2, shape1.getRightInset()); // 0.1"
+        assertEquals(3.6, shape1.getTopInset());  // 0.05"
+        assertEquals(3.6, shape1.getBottomInset()); // 0.05"
         assertEquals(VerticalAlignment.MIDDLE, shape1.getVerticalAlignment());
 
         // now check text properties
@@ -169,10 +169,10 @@ public class TestXSLFTextShape extends T
                 !bodyPr2.isSetBIns() && !bodyPr2.isSetTIns() &&
                 !bodyPr2.isSetAnchor()
         );
-        assertEquals(7.2, shape2.getMarginLeft());  // 0.1"
-        assertEquals(7.2, shape2.getMarginRight()); // 0.1"
-        assertEquals(3.6, shape2.getMarginTop());  // 0.05"
-        assertEquals(3.6, shape2.getMarginBottom()); // 0.05"
+        assertEquals(7.2, shape2.getLeftInset());  // 0.1"
+        assertEquals(7.2, shape2.getRightInset()); // 0.1"
+        assertEquals(3.6, shape2.getTopInset());  // 0.05"
+        assertEquals(3.6, shape2.getBottomInset()); // 0.05"
         assertEquals(VerticalAlignment.TOP, shape2.getVerticalAlignment());
 
         XSLFTextRun pr1 = shape2.getTextParagraphs().get(0).getTextRuns().get(0);
@@ -244,10 +244,10 @@ public class TestXSLFTextShape extends T
                 !bodyPr1.isSetBIns() && !bodyPr1.isSetTIns() &&
                 !bodyPr1.isSetAnchor()
         );
-        assertEquals(7.2, shape1.getMarginLeft());  // 0.1"
-        assertEquals(7.2, shape1.getMarginRight()); // 0.1"
-        assertEquals(3.6, shape1.getMarginTop());  // 0.05"
-        assertEquals(3.6, shape1.getMarginBottom()); // 0.05"
+        assertEquals(7.2, shape1.getLeftInset());  // 0.1"
+        assertEquals(7.2, shape1.getRightInset()); // 0.1"
+        assertEquals(3.6, shape1.getTopInset());  // 0.05"
+        assertEquals(3.6, shape1.getBottomInset()); // 0.05"
         assertEquals(VerticalAlignment.TOP, shape1.getVerticalAlignment());
 
         // now check text properties
@@ -278,10 +278,10 @@ public class TestXSLFTextShape extends T
                 !bodyPr2.isSetBIns() && !bodyPr2.isSetTIns() &&
                 !bodyPr2.isSetAnchor()
         );
-        assertEquals(7.2, shape2.getMarginLeft());  // 0.1"
-        assertEquals(7.2, shape2.getMarginRight()); // 0.1"
-        assertEquals(3.6, shape2.getMarginTop());  // 0.05"
-        assertEquals(3.6, shape2.getMarginBottom()); // 0.05"
+        assertEquals(7.2, shape2.getLeftInset());  // 0.1"
+        assertEquals(7.2, shape2.getRightInset()); // 0.1"
+        assertEquals(3.6, shape2.getTopInset());  // 0.05"
+        assertEquals(3.6, shape2.getBottomInset()); // 0.05"
         assertEquals(VerticalAlignment.BOTTOM, shape2.getVerticalAlignment());
 
         assertEquals("Section Header", shape2.getText());
@@ -318,10 +318,10 @@ public class TestXSLFTextShape extends T
                 !bodyPr1.isSetBIns() && !bodyPr1.isSetTIns() &&
                 !bodyPr1.isSetAnchor()
         );
-        assertEquals(7.2, shape1.getMarginLeft());  // 0.1"
-        assertEquals(7.2, shape1.getMarginRight()); // 0.1"
-        assertEquals(3.6, shape1.getMarginTop());  // 0.05"
-        assertEquals(3.6, shape1.getMarginBottom()); // 0.05"
+        assertEquals(7.2, shape1.getLeftInset());  // 0.1"
+        assertEquals(7.2, shape1.getRightInset()); // 0.1"
+        assertEquals(3.6, shape1.getTopInset());  // 0.05"
+        assertEquals(3.6, shape1.getBottomInset()); // 0.05"
         assertEquals(VerticalAlignment.MIDDLE, shape1.getVerticalAlignment());
 
         // now check text properties
@@ -351,10 +351,10 @@ public class TestXSLFTextShape extends T
                 !bodyPr2.isSetBIns() && !bodyPr2.isSetTIns() &&
                 !bodyPr2.isSetAnchor()
         );
-        assertEquals(7.2, shape2.getMarginLeft());  // 0.1"
-        assertEquals(7.2, shape2.getMarginRight()); // 0.1"
-        assertEquals(3.6, shape2.getMarginTop());  // 0.05"
-        assertEquals(3.6, shape2.getMarginBottom()); // 0.05"
+        assertEquals(7.2, shape2.getLeftInset());  // 0.1"
+        assertEquals(7.2, shape2.getRightInset()); // 0.1"
+        assertEquals(3.6, shape2.getTopInset());  // 0.05"
+        assertEquals(3.6, shape2.getBottomInset()); // 0.05"
         assertEquals(VerticalAlignment.TOP, shape2.getVerticalAlignment());
 
         XSLFTextRun pr1 = shape2.getTextParagraphs().get(0).getTextRuns().get(0);
@@ -425,10 +425,10 @@ public class TestXSLFTextShape extends T
                 !bodyPr1.isSetBIns() && !bodyPr1.isSetTIns() &&
                 !bodyPr1.isSetAnchor()
         );
-        assertEquals(7.2, shape1.getMarginLeft());  // 0.1"
-        assertEquals(7.2, shape1.getMarginRight()); // 0.1"
-        assertEquals(3.6, shape1.getMarginTop());  // 0.05"
-        assertEquals(3.6, shape1.getMarginBottom()); // 0.05"
+        assertEquals(7.2, shape1.getLeftInset());  // 0.1"
+        assertEquals(7.2, shape1.getRightInset()); // 0.1"
+        assertEquals(3.6, shape1.getTopInset());  // 0.05"
+        assertEquals(3.6, shape1.getBottomInset()); // 0.05"
         assertEquals(VerticalAlignment.MIDDLE, shape1.getVerticalAlignment());
 
         // now check text properties
@@ -449,10 +449,10 @@ public class TestXSLFTextShape extends T
                 !bodyPr2.isSetBIns() && !bodyPr2.isSetTIns() &&
                 !bodyPr2.isSetAnchor()
         );
-        assertEquals(7.2, shape2.getMarginLeft());  // 0.1"
-        assertEquals(7.2, shape2.getMarginRight()); // 0.1"
-        assertEquals(3.6, shape2.getMarginTop());  // 0.05"
-        assertEquals(3.6, shape2.getMarginBottom()); // 0.05"
+        assertEquals(7.2, shape2.getLeftInset());  // 0.1"
+        assertEquals(7.2, shape2.getRightInset()); // 0.1"
+        assertEquals(3.6, shape2.getTopInset());  // 0.05"
+        assertEquals(3.6, shape2.getBottomInset()); // 0.05"
         assertEquals(VerticalAlignment.TOP, shape2.getVerticalAlignment());
 
         XSLFTextRun pr1 = shape2.getTextParagraphs().get(0).getTextRuns().get(0);
@@ -498,10 +498,10 @@ public class TestXSLFTextShape extends T
                 !bodyPr1.isSetBIns() && !bodyPr1.isSetTIns() &&
                 !bodyPr1.isSetAnchor()
         );
-        assertEquals(7.2, shape1.getMarginLeft());  // 0.1"
-        assertEquals(7.2, shape1.getMarginRight()); // 0.1"
-        assertEquals(3.6, shape1.getMarginTop());  // 0.05"
-        assertEquals(3.6, shape1.getMarginBottom()); // 0.05"
+        assertEquals(7.2, shape1.getLeftInset());  // 0.1"
+        assertEquals(7.2, shape1.getRightInset()); // 0.1"
+        assertEquals(3.6, shape1.getTopInset());  // 0.05"
+        assertEquals(3.6, shape1.getBottomInset()); // 0.05"
         assertEquals(VerticalAlignment.BOTTOM, shape1.getVerticalAlignment());
 
         // now check text properties
@@ -532,10 +532,10 @@ public class TestXSLFTextShape extends T
                 !bodyPr2.isSetBIns() && !bodyPr2.isSetTIns() &&
                 !bodyPr2.isSetAnchor()
         );
-        assertEquals(7.2, shape2.getMarginLeft());  // 0.1"
-        assertEquals(7.2, shape2.getMarginRight()); // 0.1"
-        assertEquals(3.6, shape2.getMarginTop());  // 0.05"
-        assertEquals(3.6, shape2.getMarginBottom()); // 0.05"
+        assertEquals(7.2, shape2.getLeftInset());  // 0.1"
+        assertEquals(7.2, shape2.getRightInset()); // 0.1"
+        assertEquals(3.6, shape2.getTopInset());  // 0.05"
+        assertEquals(3.6, shape2.getBottomInset()); // 0.05"
         assertEquals(VerticalAlignment.TOP, shape2.getVerticalAlignment());
 
         XSLFTextRun pr1 = shape2.getTextParagraphs().get(0).getTextRuns().get(0);

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTheme.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTheme.java?rev=1198658&r1=1198657&r2=1198658&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTheme.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTheme.java Mon Nov
 7 09:12:16 2011
@@ -18,22 +18,141 @@ package org.apache.poi.xslf.usermodel;
 
 import junit.framework.TestCase;
 
+
 import org.apache.poi.xslf.XSLFTestDataSamples;
 
+import java.awt.Color;
+import java.awt.TexturePaint;
+
 /**
- * test common properties for sheets (slides, masters, layouts, etc.)
+ * test reading properties from a multi-theme and multi-master document
  *
  * @author Yegor Kozlov
  */
 public class TestXSLFTheme extends TestCase {
     public void testRead(){
-        XMLSlideShow ppt = new XMLSlideShow();
-        XSLFSlide slide = ppt.createSlide();
-        XSLFTheme theme = slide.getSlideLayout().getSlideMaster().getTheme();
-        assertNotNull(theme);
-        
+        XMLSlideShow ppt = XSLFTestDataSamples.openSampleDocument("themes.pptx");
+        XSLFSlide[] slides = ppt.getSlides();
+
+        slide1(slides[0]);
+        slide2(slides[1]);
+        slide3(slides[2]);
+        slide4(slides[3]);
+        slide5(slides[4]);
+        slide6(slides[5]);
+        slide7(slides[6]);
+        slide8(slides[7]);
+        slide9(slides[8]);
+        slide10(slides[9]);
+    }
+
+    private XSLFShape getShape(XSLFSheet sheet, String name){
+        for(XSLFShape sh : sheet.getShapes()){
+            if(sh.getShapeName().equals(name)) return sh;
+        }
+        throw new IllegalArgumentException("Shape not found: " + name);
+    }
+
+    void slide1(XSLFSlide slide){
+        assertEquals(Color.white, slide.getBackground().getFillColor());
+
+        XSLFTheme theme = slide.getTheme();
         assertEquals("Office Theme", theme.getName());
-        //XSLFColor accent1 = theme.getColor("accent1");
-        //assertNotNull(accent1);
+
+        XSLFTextShape sh1 = (XSLFTextShape)getShape(slide, "Rectangle 3");
+        RenderableShape rsh1 = new RenderableShape(sh1);
+        XSLFTextRun run1 = sh1.getTextParagraphs().get(0).getTextRuns().get(0);
+        assertEquals(Color.white, run1.getFontColor());
+        assertEquals(new Color(79, 129, 189), sh1.getFillColor());
+        assertTrue(rsh1.getFillPaint(null) instanceof Color) ;   // solid fill
+
+    }
+
+    void slide2(XSLFSlide slide){
+        // Background 2, darker 10%
+        // YK: PPT shows slightly different color: new Color(221, 217, 195)
+        assertEquals(new Color(214, 212, 203), slide.getBackground().getFillColor());
+    }
+
+    void slide3(XSLFSlide slide){
+        assertNull(slide.getBackground().getFillColor());
+        assertTrue(slide.getBackground().getPaint(null).getClass().getName().indexOf("Gradient")
> 0);
+    }
+
+    void slide4(XSLFSlide slide){
+        assertNull(slide.getBackground().getFillColor());
+        assertTrue(slide.getBackground().getPaint(null).getClass().getName().indexOf("Gradient")
> 0);
+
+        XSLFTextShape sh1 = (XSLFTextShape)getShape(slide, "Rectangle 4");
+        RenderableShape rsh1 = new RenderableShape(sh1);
+        XSLFTextRun run1 = sh1.getTextParagraphs().get(0).getTextRuns().get(0);
+        assertEquals(Color.white, run1.getFontColor());
+        assertEquals(new Color(148, 198, 0), sh1.getFillColor());
+        assertTrue(rsh1.getFillPaint(null) instanceof Color) ;   // solid fill
+
+        XSLFTextShape sh2 = (XSLFTextShape)getShape(slide, "Title 3");
+        XSLFTextRun run2 = sh2.getTextParagraphs().get(0).getTextRuns().get(0);
+        assertEquals(new Color(148, 198, 0), run2.getFontColor());
+        assertNull(sh2.getFillColor());  // no fill
+
+        assertTrue(slide.getSlideLayout().getFollowMasterGraphics());
+    }
+
+    void slide5(XSLFSlide slide){
+        assertTrue(slide.getBackground().getPaint(null) instanceof TexturePaint);
+
+        XSLFTextShape sh2 = (XSLFTextShape)getShape(slide, "Title 1");
+        XSLFTextRun run2 = sh2.getTextParagraphs().get(0).getTextRuns().get(0);
+        assertEquals(new Color(148, 198, 0), run2.getFontColor());
+        assertNull(sh2.getFillColor());  // no fill
+        // font size is 40pt and scale factor is 90%
+        assertEquals(36.0, run2.getFontSize());
+
+        assertTrue(slide.getSlideLayout().getFollowMasterGraphics());
+    }
+
+    void slide6(XSLFSlide slide){
+
+        XSLFTextShape sh1 = (XSLFTextShape)getShape(slide, "Subtitle 3");
+        XSLFTextRun run1 = sh1.getTextParagraphs().get(0).getTextRuns().get(0);
+        assertEquals(new Color(66, 66, 66), run1.getFontColor());
+        assertNull(sh1.getFillColor());  // no fill
+
+        XSLFTextShape sh2 = (XSLFTextShape)getShape(slide, "Title 2");
+        XSLFTextRun run2 = sh2.getTextParagraphs().get(0).getTextRuns().get(0);
+        assertEquals(new Color(148, 198, 0), run2.getFontColor());
+        assertNull(sh2.getFillColor());  // no fill
+
+        assertFalse(slide.getSlideLayout().getFollowMasterGraphics());
+    }
+
+    void slide7(XSLFSlide slide){
+
+        //YK: PPT reports a slightly different color: r=189,g=239,b=87
+        assertEquals(new Color(182, 218, 108), slide.getBackground().getFillColor());
+
+        assertFalse(slide.getFollowMasterGraphics());
+    }
+
+    void slide8(XSLFSlide slide){
+        assertTrue(slide.getBackground().getPaint(null) instanceof TexturePaint);
+    }
+
+    void slide9(XSLFSlide slide){
+        assertTrue(slide.getBackground().getPaint(null) instanceof TexturePaint);
+    }
+
+    void slide10(XSLFSlide slide){
+        assertTrue(slide.getBackground().getPaint(null).getClass().getName().indexOf("Gradient")
> 0);
+
+        XSLFTextShape sh1 = (XSLFTextShape)getShape(slide, "Title 3");
+        XSLFTextRun run1 = sh1.getTextParagraphs().get(0).getTextRuns().get(0);
+        assertEquals(Color.white, run1.getFontColor());
+        assertNull(sh1.getFillColor());  // no fill
+
+        XSLFTextShape sh2 = (XSLFTextShape)getShape(slide, "Subtitle 4");
+        XSLFTextRun run2 = sh2.getTextParagraphs().get(0).getTextRuns().get(0);
+        assertEquals(Color.white, run2.getFontColor());
+        assertNull(sh2.getFillColor());  // no fill
     }
 }

Added: poi/trunk/src/resources/ooxml/org/apache/poi/xslf/usermodel/empty.pptx
URL: http://svn.apache.org/viewvc/poi/trunk/src/resources/ooxml/org/apache/poi/xslf/usermodel/empty.pptx?rev=1198658&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/src/resources/ooxml/org/apache/poi/xslf/usermodel/empty.pptx
------------------------------------------------------------------------------
    svn:executable = *

Propchange: poi/trunk/src/resources/ooxml/org/apache/poi/xslf/usermodel/empty.pptx
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



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


Mime
View raw message