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

svn commit: r1711171 [3/5] - in /poi: site/src/documentation/content/xdocs/ trunk/src/examples/src/org/apache/poi/hslf/examples/ trunk/src/examples/src/org/apache/poi/xslf/usermodel/ trunk/src/java/org/apache/poi/sl/draw/ trunk/src/java/org/apache/poi/...

Modified: poi/trunk/src/java/org/apache/poi/sl/usermodel/TableCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/sl/usermodel/TableCell.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/sl/usermodel/TableCell.java (original)
+++ poi/trunk/src/java/org/apache/poi/sl/usermodel/TableCell.java Thu Oct 29 01:05:27 2015
@@ -17,9 +17,70 @@
 
 package org.apache.poi.sl.usermodel;
 
+import java.awt.Color;
+
+import org.apache.poi.sl.usermodel.StrokeStyle.LineCompound;
+import org.apache.poi.sl.usermodel.StrokeStyle.LineDash;
+
 public interface TableCell<
     S extends Shape<S,P>,
     P extends TextParagraph<S,P,?>
 > extends TextShape<S,P> {
+    enum BorderEdge { bottom, left, top, right };
+    
+    /**
+     * Return line style of given edge or {@code null} if border is not defined
+     *
+     * @param edge the border edge
+     * @return line style of given edge or {@code null} if border is not defined
+     */
+    StrokeStyle getBorderStyle(BorderEdge edge);
+    
+    /**
+     * Sets the {@link StrokeStyle} of the given border edge.
+     * A {@code null} property of the style is ignored.
+     *
+     * @param edge border edge
+     * @param style the new stroke style
+     */
+    void setBorderStyle(BorderEdge edge, StrokeStyle style);
+    
+    /**
+     * Convenience method for setting the border width.
+     *
+     * @param edge border edge
+     * @param width the new border width
+     */
+    void setBorderWidth(BorderEdge edge, double width);
+
+    /**
+     * Convenience method for setting the border color.
+     *
+     * @param edge border edge
+     * @param color the new border color
+     */
+    void setBorderColor(BorderEdge edge, Color color);
+
+    /**
+     * Convenience method for setting the border line compound.
+     *
+     * @param edge border edge
+     * @param compound the new border line compound
+     */
+    void setBorderCompound(BorderEdge edge, LineCompound compound);
 
+    /**
+     * Convenience method for setting the border line dash.
+     *
+     * @param edge border edge
+     * @param dash the new border line dash
+     */
+    void setBorderDash(BorderEdge edge, LineDash dash);
+    
+    /**
+     * Remove all line attributes of the given border edge
+     *
+     * @param edge the border edge to be cleared
+     */
+    void removeBorder(BorderEdge edge);
 }

Modified: poi/trunk/src/java/org/apache/poi/sl/usermodel/TableShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/sl/usermodel/TableShape.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/sl/usermodel/TableShape.java (original)
+++ poi/trunk/src/java/org/apache/poi/sl/usermodel/TableShape.java Thu Oct 29 01:05:27 2015
@@ -21,5 +21,25 @@ public interface TableShape<
     S extends Shape<S,P>,
     P extends TextParagraph<S,P,?>
 > extends Shape<S,P>, PlaceableShape<S,P> {
-    // to be defined ...
+    int getNumberOfColumns();
+    
+    int getNumberOfRows();
+    
+    TableCell<S,P> getCell(int row, int col);
+    
+    /**
+     * Sets the width (in points) of the n-th column
+     *
+     * @param idx the column index (0-based)
+     * @param width the width (in points)
+     */
+    void setColumnWidth(int idx, double width);
+
+    /**
+     * Sets the row height.
+     *
+     * @param row the row index (0-based)
+     * @param height the height to set (in points)
+     */
+    void setRowHeight(int row, double height);
 }

Modified: poi/trunk/src/java/org/apache/poi/sl/usermodel/TextBox.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/sl/usermodel/TextBox.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/sl/usermodel/TextBox.java (original)
+++ poi/trunk/src/java/org/apache/poi/sl/usermodel/TextBox.java Thu Oct 29 01:05:27 2015
@@ -17,6 +17,13 @@
 
 package org.apache.poi.sl.usermodel;
 
+/**
+ * Represents a TextFrame shape in PowerPoint.
+ * <p>
+ * Contains the text in a text frame as well as the properties and methods
+ * that control alignment and anchoring of the text.
+ * </p>
+ */
 public interface TextBox<
     S extends Shape<S,P>,
     P extends TextParagraph<S,P,?>

Modified: poi/trunk/src/java/org/apache/poi/sl/usermodel/TextParagraph.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/sl/usermodel/TextParagraph.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/sl/usermodel/TextParagraph.java (original)
+++ poi/trunk/src/java/org/apache/poi/sl/usermodel/TextParagraph.java Thu Oct 29 01:05:27 2015
@@ -18,6 +18,7 @@
 package org.apache.poi.sl.usermodel;
 
 import java.awt.Color;
+import java.util.List;
 
 
 
@@ -339,4 +340,9 @@ public interface TextParagraph<
 
     
     TextShape<S,P> getParentShape();
+    
+    /**
+     * Fetch the text runs that are contained within this block of text
+     */
+    List<T> getTextRuns();
 }

Modified: poi/trunk/src/java/org/apache/poi/sl/usermodel/TextRun.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/sl/usermodel/TextRun.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/sl/usermodel/TextRun.java (original)
+++ poi/trunk/src/java/org/apache/poi/sl/usermodel/TextRun.java Thu Oct 29 01:05:27 2015
@@ -30,23 +30,23 @@ public interface TextRun {
         SMALL,
         ALL
     }
-    
+
     String getRawText();
-	void setText(String text);
+    void setText(String text);
 
-	TextCap getTextCap();
-	
-	/**
-	 * Returns the font color.
-	 * This usually returns a {@link SolidPaint}, but but also other classes are possible
-	 * 
-	 * @return the font color/paint
-	 * 
+    TextCap getTextCap();
+
+    /**
+     * Returns the font color.
+     * This usually returns a {@link SolidPaint}, but but also other classes are possible
+     *
+     * @return the font color/paint
+     *
      * @see org.apache.poi.sl.draw.DrawPaint#getPaint(java.awt.Graphics2D, PaintStyle)
      * @see SolidPaint#getSolidColor()
-	 * @see org.apache.poi.sl.draw.DrawPaint#applyColorTransform(ColorStyle)
-	 */
-	PaintStyle getFontColor();
+     * @see org.apache.poi.sl.draw.DrawPaint#applyColorTransform(ColorStyle)
+     */
+    PaintStyle getFontColor();
 
     /**
      * Sets the (solid) font color - convenience function
@@ -56,41 +56,104 @@ public interface TextRun {
     void setFontColor(Color color);
 
     /**
-	 * Sets the font color
-	 *
-	 * @param color the color
-	 * 
-	 * @see org.apache.poi.sl.draw.DrawPaint#createSolidPaint(Color)
-	 */
-	void setFontColor(PaintStyle color);
-	
-	
+     * Sets the font color
+     *
+     * @param color the color
+     *
+     * @see org.apache.poi.sl.draw.DrawPaint#createSolidPaint(Color)
+     */
+    void setFontColor(PaintStyle color);
+
+
     /**
      * Returns the font size which is either set directly on this text run or
      * given from the slide layout
-     * 
+     *
      * @return font size in points or null if font size is not set.
      */
-	Double getFontSize();
+    Double getFontSize();
 
     /**
      * Sets the font size directly on this text run, if null is given, the
      * font size defaults to the values given from the slide layout
-     * 
+     *
      * @param fontSize font size in points, if null the underlying fontsize will be unset
      */
-	void setFontSize(Double fontSize);
-	String getFontFamily();
-	
-	boolean isBold();
-	boolean isItalic();
-	boolean isUnderlined();
-	boolean isStrikethrough();
-	boolean isSubscript();
-	boolean isSuperscript();
-	
-	/**
-	 * @return the pitch and family id or -1 if not applicable
-	 */
-	byte getPitchAndFamily();
+    void setFontSize(Double fontSize);
+
+    /**
+     * @return  font family or null if not set
+     */
+    String getFontFamily();
+
+    /**
+     * Specifies the typeface, or name of the font that is to be used for this text run.
+     *
+     * @param typeface  the font to apply to this text run.
+     * The value of <code>null</code> unsets the Typeface attrubute from the underlying xml.
+     */
+    void setFontFamily(String typeface);
+
+    /**
+     * @return true, if text is bold
+     */
+    boolean isBold();
+
+    /**
+     * Sets the bold state
+     *
+     * @param bold set to true for bold text, false for normal weight
+     */
+    void setBold(boolean bold);
+    
+    /**
+     * @return true, if text is italic
+     */
+    boolean isItalic();
+
+    /**
+     * Sets the italic state
+     *
+     * @param italic set to true for italic text, false for non-italics
+     */
+    void setItalic(boolean italic);
+
+    /**
+     * @return true, if text is underlined
+     */
+    boolean isUnderlined();
+
+    /**
+     * Sets the underlined state
+     *
+     * @param underlined set to true for underlined text, false for no underlining
+     */
+    void setUnderlined(boolean underlined);
+
+    /**
+     * @return true, if text is stroked
+     */
+    boolean isStrikethrough();
+
+    /**
+     * Sets the strikethrough state
+     *
+     * @param stroked set to true for stroked text, false for no stroking
+     */
+    void setStrikethrough(boolean stroked);
+
+    /**
+     * @return true, if text is sub scripted
+     */
+    boolean isSubscript();
+
+    /**
+     * @return true, if text is super scripted
+     */
+    boolean isSuperscript();
+
+    /**
+     * @return the pitch and family id or -1 if not applicable
+     */
+    byte getPitchAndFamily();
 }

Modified: poi/trunk/src/java/org/apache/poi/sl/usermodel/TextShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/sl/usermodel/TextShape.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/sl/usermodel/TextShape.java (original)
+++ poi/trunk/src/java/org/apache/poi/sl/usermodel/TextShape.java Thu Oct 29 01:05:27 2015
@@ -26,7 +26,7 @@ public interface TextShape<
     /**
      * Vertical Text Types
      */
-    public enum TextDirection {
+    enum TextDirection {
         /**
          * Horizontal text. This should be default.
          */
@@ -59,7 +59,7 @@ public interface TextShape<
      * Auto-fitting is when text within a shape is scaled in order to contain all the text inside
      * </p>
      */
-    public enum TextAutofit {
+    enum TextAutofit {
         /**
          * Specifies that text within the text body should not be auto-fit to the bounding box.
          * Auto-fitting is when text within a text box is scaled in order to remain inside
@@ -89,6 +89,46 @@ public interface TextShape<
          */
         SHAPE
     }
+
+    /**
+     * This enum represents a compromise for the handling of
+     * HSLF run types (see org.apache.poi.hslf.record.TextHeaderAtom) and
+     * XSLF placeholders (see org.apache.poi.xslf.usermodel.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.
+     * 
+     * This enum and the handling around it may change significantly in future releases
+     */
+    enum TextPlaceholder {
+        /** Title placeholder shape text */
+        TITLE,
+        /** Body placeholder shape text */
+        BODY,
+        /** Center title placeholder shape text */
+        CENTER_TITLE,
+        /** Center body placeholder shape text */
+        CENTER_BODY,
+        /** Half-sized body placeholder shape text */
+        HALF_BODY,
+        /** Quarter-sized body placeholder shape text */
+        QUARTER_BODY,
+        /** Notes placeholder shape text */
+        NOTES,
+        /** Any other text */
+        OTHER
+    }
+
+    /**
+     * Sets (overwrites) the current text.
+     * Uses the properties of the first paragraph / textrun.
+     * Text paragraphs are split by \\r or \\n.
+     * New lines within text run are split by \\u000b
+     * 
+     * @param text the text string used by this object.
+     * 
+     * @return the last text run of the - potential split - text
+     */
+    TextRun setText(String text);
     
     /**
      * @return the TextParagraphs for this text box
@@ -99,6 +139,13 @@ public interface TextShape<
      * @return text shape margin
      */
     Insets2D getInsets();
+    
+    /**
+     * Sets the shape margins
+     *
+     * @param insets the new shape margins
+     */
+    void setInsets(Insets2D insets);
 
     /**
      * Compute the cumulative height occupied by the text
@@ -113,6 +160,14 @@ public interface TextShape<
     VerticalAlignment getVerticalAlignment();
 
     /**
+     * Sets the type of vertical alignment for the text.
+     *
+     * @param vAlign - the type of alignment.
+     * A {@code null} values unsets this property.
+     */
+    void setVerticalAlignment(VerticalAlignment vAlign);
+    
+    /**
      * Returns if the text is centered.
      * If true and if the individual paragraph settings allow it,
      * the whole text block will be displayed centered, i.e. its left and right
@@ -123,12 +178,35 @@ public interface TextShape<
     boolean isHorizontalCentered();
 
     /**
+     * Sets if the paragraphs are horizontal centered
+     *
+     * @param isCentered true, if the paragraphs are horizontal centered
+     * A {@code null} values unsets this property.
+     */
+    void setHorizontalCentered(Boolean isCentered);
+    
+    /**
      * @return whether to wrap words within the bounding rectangle
      */
     boolean getWordWrap();
 
     /**
+     * @param wrap whether to wrap words within the bounding rectangle
+     */
+    void setWordWrap(boolean wrap);
+    
+    /**
      * @return vertical orientation of the text
      */
     TextDirection getTextDirection();
+    
+    /**
+     * Sets the text placeholder
+     */
+    void setTextPlaceholder(TextPlaceholder placeholder);
+    
+    /**
+     * @return the text placeholder
+     */
+    TextPlaceholder getTextPlaceholder();
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java Thu Oct 29 01:05:27 2015
@@ -41,7 +41,6 @@ import org.apache.poi.sl.usermodel.Pictu
 import org.apache.poi.sl.usermodel.Resources;
 import org.apache.poi.sl.usermodel.SlideShow;
 import org.apache.poi.util.Beta;
-import org.apache.poi.util.DocumentHelper;
 import org.apache.poi.util.IOUtils;
 import org.apache.poi.util.Internal;
 import org.apache.poi.util.LittleEndian;
@@ -404,11 +403,7 @@ implements SlideShow<XSLFShape,XSLFTextP
         return slide;
     }
     
-    /**
-     * Returns the current page size
-     *
-     * @return the page size
-     */
+    @Override
     public Dimension getPageSize(){
         CTSlideSize sz = _presentation.getSldSz();
         int cx = sz.getCx();
@@ -416,11 +411,7 @@ implements SlideShow<XSLFShape,XSLFTextP
         return new Dimension((int)Units.toPoints(cx), (int)Units.toPoints(cy));
     }
 
-    /**
-     * Sets the page size to the given <code>Dimension</code> object.
-     *
-     * @param pgSize page size
-     */
+    @Override
     public void setPageSize(Dimension pgSize){
         CTSlideSize sz = CTSlideSize.Factory.newInstance();
         sz.setCx(Units.toEMU(pgSize.getWidth()));

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFAutoShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFAutoShape.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFAutoShape.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFAutoShape.java Thu Oct 29 01:05:27 2015
@@ -25,7 +25,12 @@ import org.openxmlformats.schemas.drawin
 import org.openxmlformats.schemas.drawingml.x2006.main.CTPresetGeometry2D;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBodyProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph;
 import org.openxmlformats.schemas.drawingml.x2006.main.STShapeType;
+import org.openxmlformats.schemas.drawingml.x2006.main.STTextAlignType;
+import org.openxmlformats.schemas.drawingml.x2006.main.STTextAnchoringType;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTShape;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTShapeNonVisual;
 
@@ -71,14 +76,26 @@ public class XSLFAutoShape extends XSLFT
         prst.addNewAvLst();
         return ct;
     }
+    
+    protected static void initTextBody(CTTextBody txBody) {
+        CTTextBodyProperties bodypr = txBody.addNewBodyPr();
+        bodypr.setAnchor(STTextAnchoringType.T);
+        bodypr.setRtlCol(false);
+        CTTextParagraph p = txBody.addNewP();
+        p.addNewPPr().setAlgn(STTextAlignType.L);
+        CTTextCharacterProperties endPr = p.addNewEndParaRPr();
+        endPr.setLang("en-US");
+        endPr.setSz(1100);   
+        p.addNewR().setT("");
+        txBody.addNewLstStyle();
+    }
 
     protected CTTextBody getTextBody(boolean create){
         CTShape shape = (CTShape)getXmlObject();
         CTTextBody txBody = shape.getTxBody();
         if (txBody == null && create) {
             txBody = shape.addNewTxBody();
-            txBody.addNewBodyPr();
-            txBody.addNewLstStyle();
+            initTextBody(txBody);
         }
         return txBody;
     }

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=1711171&r1=1711170&r2=1711171&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 Thu Oct 29 01:05:27 2015
@@ -33,6 +33,7 @@ import org.apache.poi.sl.usermodel.Paint
 import org.apache.poi.sl.usermodel.PaintStyle.GradientPaint;
 import org.apache.poi.sl.usermodel.PaintStyle.TexturePaint;
 import org.apache.poi.sl.usermodel.PlaceableShape;
+import org.apache.poi.sl.usermodel.SimpleShape.Placeholder;
 import org.apache.poi.sl.usermodel.Shape;
 import org.apache.poi.util.Beta;
 import org.apache.poi.util.Internal;

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java Thu Oct 29 01:05:27 2015
@@ -39,6 +39,7 @@ import org.apache.poi.sl.draw.DrawFactor
 import org.apache.poi.sl.draw.DrawPictureShape;
 import org.apache.poi.sl.draw.Drawable;
 import org.apache.poi.sl.usermodel.PictureData;
+import org.apache.poi.sl.usermodel.SimpleShape.Placeholder;
 import org.apache.poi.sl.usermodel.Sheet;
 import org.apache.poi.util.Beta;
 import org.apache.poi.util.IOUtils;

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java Thu Oct 29 01:05:27 2015
@@ -88,25 +88,23 @@ public abstract class XSLFSimpleShape ex
         super(shape,sheet);
     }
 
-    /**
-     *
-     * @param type
-     */
-    public void setShapeType(ShapeType type){
+    @Override
+    public void setShapeType(ShapeType type) {
         STShapeType.Enum geom = STShapeType.Enum.forInt(type.ooxmlId);
         getSpPr().getPrstGeom().setPrst(geom);
     }
 
+    @Override
     public ShapeType getShapeType(){
         STShapeType.Enum geom = getSpPr().getPrstGeom().getPrst();
         return ShapeType.forId(geom.intValue(), true);
     }
-    
+
     protected CTTransform2D getSafeXfrm() {
         CTTransform2D xfrm = getXfrm();
         return (xfrm == null ? getSpPr().addNewXfrm() : xfrm);
     }
-    
+
     protected CTTransform2D getXfrm() {
         PropertyFetcher<CTTransform2D> fetcher = new PropertyFetcher<CTTransform2D>() {
             public boolean fetch(XSLFShape shape) {
@@ -151,7 +149,7 @@ public abstract class XSLFSimpleShape ex
         ext.setCx(cx);
         ext.setCy(cy);
     }
-    
+
     @Override
     public void setRotation(double theta) {
         getSafeXfrm().setRot((int) (theta * 60000));
@@ -185,7 +183,7 @@ public abstract class XSLFSimpleShape ex
         return (xfrm == null || !xfrm.isSetFlipV()) ? false : getXfrm().getFlipV();
     }
 
-    
+
     /**
      * Get default line properties defined in the theme (if any).
      * Used internally to resolve shape properties.
@@ -199,7 +197,7 @@ public abstract class XSLFSimpleShape ex
         if (lnRef == null) return null;
         // 1-based index of a line style within the style matrix
         int idx = (int)lnRef.getIdx();
-        
+
         XSLFTheme theme = getSheet().getTheme();
         if (theme == null) return null;
         CTBaseStyles styles = theme.getXmlObject().getThemeElements();
@@ -208,7 +206,7 @@ public abstract class XSLFSimpleShape ex
         if (styleMatrix == null) return null;
         CTLineStyleList lineStyles = styleMatrix.getLnStyleLst();
         if (lineStyles == null || lineStyles.sizeOfLnArray() < idx) return null;
-        
+
         return lineStyles.getLnArray(idx - 1);
     }
 
@@ -262,7 +260,7 @@ public abstract class XSLFSimpleShape ex
                         setValue(null); // use it as 'nofill' value
                         return true;
                     }
-                    
+
                     PaintStyle paint = null;
                     PackagePart pp = getSheet().getPackagePart();
                     for (XmlObject obj : spPr.selectPath("*")) {
@@ -290,11 +288,11 @@ public abstract class XSLFSimpleShape ex
 
         PaintStyle paint = fetcher.getValue();
         if (paint != null) return paint;
-        
+
         // line color was not found, check if it is defined in the theme
         CTShapeStyle style = getSpStyle();
         if (style == null) return null;
-        
+
         // get a reference to a line style within the style matrix.
         CTStyleMatrixReference lnRef = style.getLnRef();
         int idx = (int)lnRef.getIdx();
@@ -308,7 +306,7 @@ public abstract class XSLFSimpleShape ex
 
         return paint;
     }
-    
+
     /**
      *
      * @param width line width in points. <code>0</code> means no line
@@ -362,6 +360,40 @@ public abstract class XSLFSimpleShape ex
         return lineWidth;
     }
 
+
+    /**
+     * @param compound set the line compound style
+     */
+    public void setLineCompound(LineCompound compound) {
+        CTShapeProperties spPr = getSpPr();
+        if (compound == null) {
+            if (spPr.isSetLn() && spPr.getLn().isSetCmpd())
+                spPr.getLn().unsetCmpd();
+        } else {
+            CTLineProperties ln = spPr.isSetLn() ? spPr.getLn() : spPr.addNewLn();
+            STCompoundLine.Enum xCmpd;
+            switch (compound) {
+                default:
+                case SINGLE:
+                    xCmpd = STCompoundLine.SNG;
+                    break;
+                case DOUBLE:
+                    xCmpd = STCompoundLine.DBL;
+                    break;
+                case THICK_THIN:
+                    xCmpd = STCompoundLine.THICK_THIN;
+                    break;
+                case THIN_THICK:
+                    xCmpd = STCompoundLine.THIN_THICK;
+                    break;
+                case TRIPLE:
+                    xCmpd = STCompoundLine.TRI;
+                    break;
+            }
+            ln.setCmpd(xCmpd);
+        }
+    }
+
     /**
      * @return the line compound
      */
@@ -392,7 +424,7 @@ public abstract class XSLFSimpleShape ex
                 }
             }
         }
-        
+
         if (cmpd == null) return null;
 
         switch (cmpd) {
@@ -417,15 +449,12 @@ public abstract class XSLFSimpleShape ex
     public void setLineDash(LineDash dash) {
         CTShapeProperties spPr = getSpPr();
         if (dash == null) {
-            if (spPr.isSetLn() &&  spPr.getLn().isSetPrstDash())
+            if (spPr.isSetLn() && spPr.getLn().isSetPrstDash())
                 spPr.getLn().unsetPrstDash();
         } else {
-            CTPresetLineDashProperties val = CTPresetLineDashProperties.Factory
-                    .newInstance();
-            val.setVal(STPresetLineDashVal.Enum.forInt(dash.ooxmlId));
-            CTLineProperties ln = spPr.isSetLn() ? spPr.getLn() : spPr
-                    .addNewLn();
-            ln.setPrstDash(val);
+            CTLineProperties ln = spPr.isSetLn() ? spPr.getLn() : spPr.addNewLn();
+            CTPresetLineDashProperties ldp = ln.isSetPrstDash() ? ln.getPrstDash() : ln.addNewPrstDash();
+            ldp.setVal(STPresetLineDashVal.Enum.forInt(dash.ooxmlId));
         }
     }
 
@@ -513,13 +542,7 @@ public abstract class XSLFSimpleShape ex
         return cap;
     }
 
-    /**
-     * Specifies a solid color fill. The shape is filled entirely with the
-     * specified color.
-     *
-     * @param color the solid color fill. The value of <code>null</code> unsets
-     *              the solidFIll attribute from the underlying xml
-     */
+    @Override
     public void setFillColor(Color color) {
         CTShapeProperties spPr = getSpPr();
         if (color == null) {
@@ -545,10 +568,7 @@ public abstract class XSLFSimpleShape ex
         }
     }
 
-    /**
-     * @return solid fill color of null if not set or fill color
-     * is not solid (pattern or gradient)
-     */
+    @Override
     public Color getFillColor() {
         PaintStyle ps = getFillPaint();
         if (ps instanceof SolidPaint) {
@@ -615,7 +635,7 @@ public abstract class XSLFSimpleShape ex
         }
         return geom;
     }
-    
+
     @Override
     void copy(XSLFShape sh){
         super.copy(sh);
@@ -635,7 +655,7 @@ public abstract class XSLFSimpleShape ex
             String relId = getSheet().importBlip(blipId, s.getSheet().getPackagePart());
             blip.setEmbed(relId);
         }
-        
+
         Color srcLineColor = s.getLineColor();
         Color tgtLineColor = getLineColor();
         if(srcLineColor != null && !srcLineColor.equals(tgtLineColor)) {
@@ -871,7 +891,31 @@ public abstract class XSLFSimpleShape ex
             public LineCompound getLineCompound() {
                 return XSLFSimpleShape.this.getLineCompound();
             }
-            
+
         };
     }
+
+    @Override
+    public void setStrokeStyle(Object... styles) {
+        if (styles.length == 0) {
+            // remove stroke
+            setLineColor(null);
+            return;
+        }
+        
+        // TODO: handle PaintStyle
+        for (Object st : styles) {
+            if (st instanceof Number) {
+                setLineWidth(((Number)st).doubleValue());
+            } else if (st instanceof LineCap) {
+                setLineCap((LineCap)st);
+            } else if (st instanceof LineDash) {
+                setLineDash((LineDash)st);
+            } else if (st instanceof LineCompound) {
+                setLineCompound((LineCompound)st);
+            } else if (st instanceof Color) {
+                setLineColor((Color)st);
+            }
+        }
+    }
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java Thu Oct 29 01:05:27 2015
@@ -25,9 +25,9 @@ import org.apache.poi.openxml4j.opc.Pack
 import org.apache.poi.sl.draw.DrawFactory;
 import org.apache.poi.sl.draw.Drawable;
 import org.apache.poi.sl.usermodel.Notes;
+import org.apache.poi.sl.usermodel.SimpleShape.Placeholder;
 import org.apache.poi.sl.usermodel.Slide;
 import org.apache.poi.util.Beta;
-import org.apache.poi.util.DocumentHelper;
 import org.apache.xmlbeans.XmlException;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTBlip;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTGroupShapeProperties;

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideLayout.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideLayout.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideLayout.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideLayout.java Thu Oct 29 01:05:27 2015
@@ -22,8 +22,8 @@ import org.apache.poi.POIXMLDocumentPart
 import org.apache.poi.openxml4j.opc.PackagePart;
 import org.apache.poi.openxml4j.opc.PackageRelationship;
 import org.apache.poi.sl.usermodel.MasterSheet;
+import org.apache.poi.sl.usermodel.SimpleShape.Placeholder;
 import org.apache.poi.util.Beta;
-import org.apache.poi.util.DocumentHelper;
 import org.apache.poi.util.Internal;
 import org.apache.xmlbeans.XmlException;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTBackground;

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java Thu Oct 29 01:05:27 2015
@@ -25,8 +25,8 @@ import org.apache.poi.POIXMLDocumentPart
 import org.apache.poi.openxml4j.opc.PackagePart;
 import org.apache.poi.openxml4j.opc.PackageRelationship;
 import org.apache.poi.sl.usermodel.MasterSheet;
+import org.apache.poi.sl.usermodel.SimpleShape.Placeholder;
 import org.apache.poi.util.Beta;
-import org.apache.poi.util.DocumentHelper;
 import org.apache.xmlbeans.XmlException;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTColorMapping;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTTextListStyle;

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java Thu Oct 29 01:05:27 2015
@@ -80,15 +80,22 @@ public class XSLFTable extends XSLFGraph
         for(CTTableRow row : trArray) _rows.add(new XSLFTableRow(row, this));
     }
 
+    @Override
+    public XSLFTableCell getCell(int row, int col) {
+        return getRows().get(row).getCells().get(col);
+    }
+    
     @Internal
     public CTTable getCTTable(){
         return _table;
     }
 
+    @Override
     public int getNumberOfColumns() {
         return _table.getTblGrid().sizeOfGridColArray();
     }
 
+    @Override
     public int getNumberOfRows() {
         return _table.sizeOfTrArray();
     }
@@ -98,10 +105,16 @@ public class XSLFTable extends XSLFGraph
                 _table.getTblGrid().getGridColArray(idx).getW());
     }
 
-    public void setColumnWidth(int idx, double width){
+    @Override
+    public void setColumnWidth(int idx, double width) {
         _table.getTblGrid().getGridColArray(idx).setW(Units.toEMU(width));
     }
 
+    @Override
+    public void setRowHeight(int row, double height) {
+        _table.getTrArray(row).setH(Units.toEMU(height));
+    }
+    
     public Iterator<XSLFTableRow> iterator(){
         return _rows.iterator();
     }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java Thu Oct 29 01:05:27 2015
@@ -21,6 +21,12 @@ package org.apache.poi.xslf.usermodel;
 
 import java.awt.Color;
 
+import org.apache.poi.sl.draw.DrawPaint;
+import org.apache.poi.sl.usermodel.PaintStyle;
+import org.apache.poi.sl.usermodel.StrokeStyle;
+import org.apache.poi.sl.usermodel.StrokeStyle.LineCap;
+import org.apache.poi.sl.usermodel.StrokeStyle.LineCompound;
+import org.apache.poi.sl.usermodel.StrokeStyle.LineDash;
 import org.apache.poi.sl.usermodel.TableCell;
 import org.apache.poi.sl.usermodel.VerticalAlignment;
 import org.apache.poi.util.Units;
@@ -44,7 +50,6 @@ import org.openxmlformats.schemas.drawin
  * Represents a cell of a table in a .pptx presentation
  */
 public class XSLFTableCell extends XSLFTextShape implements TableCell<XSLFShape,XSLFTextParagraph> {
-    static double defaultBorderWidth = 1.0;
     private CTTableCellProperties _tcPr = null;
 
     /*package*/ XSLFTableCell(CTTableCell cell, XSLFSheet sheet){
@@ -57,8 +62,7 @@ public class XSLFTableCell extends XSLFT
         CTTextBody txBody = cell.getTxBody();
         if (txBody == null && create) {
             txBody = cell.addNewTxBody();
-            txBody.addNewBodyPr();
-            txBody.addNewLstStyle();
+            XSLFAutoShape.initTextBody(txBody);
         }
         return txBody;
     }
@@ -83,7 +87,7 @@ public class XSLFTableCell extends XSLFT
         }
         return _tcPr;
     }
-    
+
     @Override
     public void setLeftInset(double margin){
         CTTableCellProperties pr = getCellProperties(true);
@@ -108,67 +112,174 @@ public class XSLFTableCell extends XSLFT
         pr.setMarB(Units.toEMU(margin));
     }
 
-    private CTLineProperties getCTLine(char bltr, boolean create) {
+    private CTLineProperties getCTLine(BorderEdge edge, boolean create) {
+        if (edge == null) {
+            throw new IllegalArgumentException("BorderEdge needs to be specified.");
+        }
+
         CTTableCellProperties pr = getCellProperties(create);
         if (pr == null) return null;
-        
-        switch (bltr) {
-            case 'b':
+
+        switch (edge) {
+            case bottom:
                 return (pr.isSetLnB()) ? pr.getLnB() : (create ? pr.addNewLnB() : null);
-            case 'l':
+            case left:
                 return (pr.isSetLnL()) ? pr.getLnL() : (create ? pr.addNewLnL() : null);
-            case 't':
+            case top:
                 return (pr.isSetLnT()) ? pr.getLnT() : (create ? pr.addNewLnT() : null);
-            case 'r':
+            case right:
                 return (pr.isSetLnR()) ? pr.getLnR() : (create ? pr.addNewLnR() : null);
             default:
                 return null;
         }
     }
+
+    @Override
+    public void removeBorder(BorderEdge edge) {
+        CTTableCellProperties pr = getCellProperties(false);
+        if (pr == null) return;
+        switch (edge) {
+            case bottom:
+                if (pr.isSetLnB()) {
+                    pr.unsetLnB();
+                }
+                break;
+            case left:
+                if (pr.isSetLnL()) {
+                    pr.unsetLnL();
+                }
+                break;
+            case top:
+                if (pr.isSetLnT()) {
+                    pr.unsetLnT();
+                }
+                break;
+            case right:
+                if (pr.isSetLnR()) {
+                    pr.unsetLnB();
+                }
+                break;
+            default:
+                throw new IllegalArgumentException();
+        }
+    }
+
+    @Override
+    public StrokeStyle getBorderStyle(final BorderEdge edge) {
+        final Double width = getBorderWidth(edge);
+        return (width == null) ? null : new StrokeStyle() {
+            public PaintStyle getPaint() {
+                return DrawPaint.createSolidPaint(getBorderColor(edge));
+            }
+
+            public LineCap getLineCap() {
+                return getBorderCap(edge);
+            }
+
+            public LineDash getLineDash() {
+                return getBorderDash(edge);
+            }
+
+            public LineCompound getLineCompound() {
+                return getBorderCompound(edge);
+            }
+
+            public double getLineWidth() {
+                return width;
+            }
+        };
+    }
     
-    private void setBorderWidth(char bltr, double width) {
-        CTLineProperties ln = getCTLine(bltr, true);
-        ln.setW(Units.toEMU(width));
+    @Override
+    public void setBorderStyle(BorderEdge edge, StrokeStyle style) {
+        if (style == null) {
+            throw new IllegalArgumentException("StrokeStyle needs to be specified.");
+        }
+        
+        LineCap cap = style.getLineCap();
+        if (cap != null) {
+            setBorderCap(edge, cap);
+        }
+        
+        LineCompound compound = style.getLineCompound();
+        if (compound != null) {
+            setBorderCompound(edge, compound);
+        }
+        
+        LineDash dash = style.getLineDash();
+        if (dash != null) {
+            setBorderDash(edge, dash);
+        }
+        
+        double width = style.getLineWidth();
+        setBorderWidth(edge, width);
     }
 
-    private double getBorderWidth(char bltr) {
-        CTLineProperties ln = getCTLine(bltr, false);
-        return (ln == null || !ln.isSetW()) ? defaultBorderWidth : Units.toPoints(ln.getW());
+    public Double getBorderWidth(BorderEdge edge) {
+        CTLineProperties ln = getCTLine(edge, false);
+        return (ln == null || !ln.isSetW()) ? null : Units.toPoints(ln.getW());
     }
 
-    private void setBorderColor(char bltr, Color color) {
-        CTLineProperties ln = getCTLine(bltr, true);
+    @Override
+    public void setBorderWidth(BorderEdge edge, double width) {
+        CTLineProperties ln = getCTLine(edge, true);
+        ln.setW(Units.toEMU(width));
+    }
 
-        if(color == null){
-            ln.addNewNoFill();
-            if(ln.isSetSolidFill()) ln.unsetSolidFill();
-        } else {
-            if(ln.isSetNoFill()) ln.unsetNoFill();
+    private CTLineProperties setBorderDefaults(BorderEdge edge) {
+        CTLineProperties ln = getCTLine(edge, true);
+        if (ln.isSetNoFill()) {
+            ln.unsetNoFill();
+        }
 
-            if(!ln.isSetPrstDash()) ln.addNewPrstDash().setVal(STPresetLineDashVal.SOLID);
+        if(!ln.isSetPrstDash()) {
+            ln.addNewPrstDash().setVal(STPresetLineDashVal.SOLID);
+        }
+        if (!ln.isSetCmpd()) {
             ln.setCmpd(STCompoundLine.SNG);
+        }
+        if (!ln.isSetAlgn()) {
             ln.setAlgn(STPenAlignment.CTR);
+        }
+        if (!ln.isSetCap()) {
             ln.setCap(STLineCap.FLAT);
+        }
+        if (!ln.isSetRound()) {
             ln.addNewRound();
+        }
 
+        if (!ln.isSetHeadEnd()) {
             CTLineEndProperties hd = ln.addNewHeadEnd();
             hd.setType(STLineEndType.NONE);
             hd.setW(STLineEndWidth.MED);
             hd.setLen(STLineEndLength.MED);
+        }
 
+        if (!ln.isSetTailEnd()) {
             CTLineEndProperties tl = ln.addNewTailEnd();
             tl.setType(STLineEndType.NONE);
             tl.setW(STLineEndWidth.MED);
             tl.setLen(STLineEndLength.MED);
+        }
 
-            CTSRgbColor rgb = CTSRgbColor.Factory.newInstance();
-            rgb.setVal(new byte[]{(byte)color.getRed(), (byte)color.getGreen(), (byte)color.getBlue()});
-            ln.addNewSolidFill().setSrgbClr(rgb);
+        return ln;
+    }
+
+    @Override
+    public void setBorderColor(BorderEdge edge, Color color) {
+        if (color == null) {
+            throw new IllegalArgumentException("Colors need to be specified.");
         }
-    }    
-    
-    private Color getBorderColor(char bltr) {
-        CTLineProperties ln = getCTLine(bltr,false);
+
+        CTLineProperties ln = setBorderDefaults(edge);
+
+        CTSRgbColor rgb = CTSRgbColor.Factory.newInstance();
+        rgb.setVal(new byte[]{(byte)color.getRed(), (byte)color.getGreen(), (byte)color.getBlue()});
+        ln.addNewSolidFill().setSrgbClr(rgb);
+    }
+
+    public Color getBorderColor(BorderEdge edge) {
+        CTLineProperties ln = getCTLine(edge, false);
         if (ln == null || ln.isSetNoFill() || !ln.isSetSolidFill()) return null;
 
         CTSolidColorFillProperties fill = ln.getSolidFill();
@@ -178,71 +289,65 @@ public class XSLFTableCell extends XSLFT
         }
         byte[] val = fill.getSrgbClr().getVal();
         return new Color(0xFF & val[0], 0xFF & val[1], 0xFF & val[2]);
-    }    
-    
-    public void setBorderLeft(double width) {
-        setBorderWidth('l', width);
     }
 
-    public double getBorderLeft() {
-        return getBorderWidth('l');
-    }
-
-    public void setBorderLeftColor(Color color) {
-        setBorderColor('l', color);
-    }
-
-    public Color getBorderLeftColor() {
-        return getBorderColor('l');
-    }
+    public LineCompound getBorderCompound(BorderEdge edge) {
+        CTLineProperties ln = getCTLine(edge, false);
+        if (ln == null || ln.isSetNoFill() || !ln.isSetSolidFill() || !ln.isSetCmpd()) {
+            return null;
+        }
 
-    public void setBorderRight(double width) {
-        setBorderWidth('r', width);
+        return LineCompound.fromOoxmlId(ln.getCmpd().intValue());
     }
 
-    public double getBorderRight() {
-        return getBorderWidth('r');
-    }
+    @Override
+    public void setBorderCompound(BorderEdge edge, LineCompound compound) {
+        if (compound == null) {
+            throw new IllegalArgumentException("LineCompound need to be specified.");
+        }
 
-    public void setBorderRightColor(Color color) {
-        setBorderColor('r', color);
+        CTLineProperties ln = setBorderDefaults(edge);
+        ln.setCmpd(STCompoundLine.Enum.forInt(compound.ooxmlId));
     }
 
-    public Color getBorderRightColor() {
-        return getBorderColor('r');
-    }
+    public LineDash getBorderDash(BorderEdge edge) {
+        CTLineProperties ln = getCTLine(edge, false);
+        if (ln == null || ln.isSetNoFill() || !ln.isSetSolidFill() || !ln.isSetPrstDash()) {
+            return null;
+        }
 
-    public void setBorderTop(double width) {
-        setBorderWidth('t', width);
+        return LineDash.fromOoxmlId(ln.getPrstDash().getVal().intValue());
     }
 
-    public double getBorderTop() {
-        return getBorderWidth('t');
-    }
+    @Override
+    public void setBorderDash(BorderEdge edge, LineDash dash) {
+        if (dash == null) {
+            throw new IllegalArgumentException("LineDash need to be specified.");
+        }
 
-    public void setBorderTopColor(Color color) {
-        setBorderColor('t', color);
+        CTLineProperties ln = setBorderDefaults(edge);
+        ln.getPrstDash().setVal(STPresetLineDashVal.Enum.forInt(dash.ooxmlId));
     }
 
-    public Color getBorderTopColor() {
-        return getBorderColor('t');
+    public LineCap getBorderCap(BorderEdge edge) {
+        CTLineProperties ln = getCTLine(edge, false);
+        if (ln == null || ln.isSetNoFill() || !ln.isSetSolidFill() || !ln.isSetCap()) {
+            return null;
+        }
+        
+        return LineCap.fromOoxmlId(ln.getCap().intValue());
     }
 
-    public void setBorderBottom(double width) {
-        setBorderWidth('b', width);
-    }
+    public void setBorderCap(BorderEdge edge, LineCap cap) {
+        if (cap == null) {
+            throw new IllegalArgumentException("LineCap need to be specified.");
+        }
 
-    public double getBorderBottom() {
-        return getBorderWidth('b');
+        CTLineProperties ln = setBorderDefaults(edge);
+        ln.setCap(STLineCap.Enum.forInt(cap.ooxmlId));
     }
 
-    public void setBorderBottomColor(Color color) {
-        setBorderColor('b', color);
-    }
 
-    public Color getBorderBottomColor(){
-        return getBorderColor('b');
-    }
 
     /**
      * Specifies a solid color fill. The shape is filled entirely with the specified color.
@@ -299,7 +404,7 @@ public class XSLFTableCell extends XSLFT
     void setVMerge(boolean merge_) {
         ((CTTableCell)getXmlObject()).setVMerge(merge_);
     }
-    
+
     @Override
     public void setVerticalAlignment(VerticalAlignment anchor){
     	CTTableCellProperties cellProps = getCellProperties(true);

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextBox.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextBox.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextBox.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextBox.java Thu Oct 29 01:05:27 2015
@@ -54,8 +54,7 @@ public class XSLFTextBox extends XSLFAut
         prst.setPrst(STShapeType.RECT);
         prst.addNewAvLst();
         CTTextBody txBody = ct.addNewTxBody();
-        txBody.addNewBodyPr();
-        txBody.addNewLstStyle();
+        XSLFAutoShape.initTextBody(txBody);
 
         return ct;
     }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java Thu Oct 29 01:05:27 2015
@@ -32,7 +32,26 @@ import org.apache.poi.util.Units;
 import org.apache.poi.xslf.model.ParagraphPropertyFetcher;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlObject;
-import org.openxmlformats.schemas.drawingml.x2006.main.*;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTColor;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTRegularTextRun;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextAutonumberBullet;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBulletSizePercent;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBulletSizePoint;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharBullet;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextField;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextFont;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextLineBreak;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextNormalAutofit;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextSpacing;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextTabStop;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextTabStopList;
+import org.openxmlformats.schemas.drawingml.x2006.main.STTextAlignType;
+import org.openxmlformats.schemas.drawingml.x2006.main.STTextAutonumberScheme;
+import org.openxmlformats.schemas.drawingml.x2006.main.STTextFontAlignType;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder;
 import org.openxmlformats.schemas.presentationml.x2006.main.STPlaceholderType;
 
@@ -100,6 +119,7 @@ public class XSLFTextParagraph implement
 
     }
 
+    @Override
     public List<XSLFTextRun> getTextRuns(){
         return _runs;
     }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java Thu Oct 29 01:05:27 2015
@@ -206,12 +206,7 @@ public class XSLFTextRun implements Text
         }
     }
 
-    /**
-     * Specifies the typeface, or name of the font that is to be used for this text run.
-     *
-     * @param typeface  the font to apply to this text run.
-     * The value of <code>null</code> unsets the Typeface attrubute from the underlying xml.
-     */
+    @Override
     public void setFontFamily(String typeface){
         setFontFamily(typeface, (byte)-1, (byte)-1, false);
     }
@@ -236,9 +231,7 @@ public class XSLFTextRun implements Text
         }
     }
 
-    /**
-     * @return  font family or null if not set
-     */
+    @Override
     public String getFontFamily(){
         final XSLFTheme theme = _p.getParentShape().getSheet().getTheme();
 
@@ -281,18 +274,12 @@ public class XSLFTextRun implements Text
         return  visitor.getValue() == null ? 0 : visitor.getValue();
     }
 
-    /**
-     * Specifies whether a run of text will be formatted as strikethrough text.
-     *
-     * @param strike whether a run of text will be formatted as strikethrough text.
-     */
+    @Override
     public void setStrikethrough(boolean strike) {
         getRPr().setStrike(strike ? STTextStrikeType.SNG_STRIKE : STTextStrikeType.NO_STRIKE);
     }
 
-    /**
-     * @return whether a run of text will be formatted as strikethrough text. Default is false.
-     */
+    @Override
     public boolean isStrikethrough() {
         CharacterPropertyFetcher<Boolean> fetcher = new CharacterPropertyFetcher<Boolean>(_p.getIndentLevel()){
             public boolean fetch(CTTextCharacterProperties props){
@@ -307,9 +294,7 @@ public class XSLFTextRun implements Text
         return fetcher.getValue() == null ? false : fetcher.getValue();
     }
 
-    /**
-     * @return whether a run of text will be formatted as a superscript text. Default is false.
-     */
+    @Override
     public boolean isSuperscript() {
         CharacterPropertyFetcher<Boolean> fetcher = new CharacterPropertyFetcher<Boolean>(_p.getIndentLevel()){
             public boolean fetch(CTTextCharacterProperties props){
@@ -357,9 +342,7 @@ public class XSLFTextRun implements Text
         setBaselineOffset(flag ? -25.0 : 0.);
     }
 
-    /**
-     * @return whether a run of text will be formatted as a superscript text. Default is false.
-     */
+    @Override
     public boolean isSubscript() {
         CharacterPropertyFetcher<Boolean> fetcher = new CharacterPropertyFetcher<Boolean>(_p.getIndentLevel()){
             public boolean fetch(CTTextCharacterProperties props){
@@ -392,18 +375,12 @@ public class XSLFTextRun implements Text
         return fetcher.getValue() == null ? TextCap.NONE : fetcher.getValue();
     }
 
-    /**
-     * Specifies whether this run of text will be formatted as bold text
-     *
-     * @param bold whether this run of text will be formatted as bold text
-     */
+    @Override
     public void setBold(boolean bold){
         getRPr().setB(bold);
     }
 
-    /**
-     * @return whether this run of text is formatted as bold text
-     */
+    @Override
     public boolean isBold(){
         CharacterPropertyFetcher<Boolean> fetcher = new CharacterPropertyFetcher<Boolean>(_p.getIndentLevel()){
             public boolean fetch(CTTextCharacterProperties props){
@@ -418,16 +395,12 @@ public class XSLFTextRun implements Text
         return fetcher.getValue() == null ? false : fetcher.getValue();
     }
 
-    /**
-     * @param italic whether this run of text is formatted as italic text
-     */
+    @Override
     public void setItalic(boolean italic){
         getRPr().setI(italic);
     }
 
-    /**
-     * @return whether this run of text is formatted as italic text
-     */
+    @Override
     public boolean isItalic(){
         CharacterPropertyFetcher<Boolean> fetcher = new CharacterPropertyFetcher<Boolean>(_p.getIndentLevel()){
             public boolean fetch(CTTextCharacterProperties props){
@@ -442,16 +415,12 @@ public class XSLFTextRun implements Text
         return fetcher.getValue() == null ? false : fetcher.getValue();
     }
 
-    /**
-     * @param underline whether this run of text is formatted as underlined text
-     */
-    public void setUnderline(boolean underline) {
+    @Override
+    public void setUnderlined(boolean underline) {
         getRPr().setU(underline ? STTextUnderlineType.SNG : STTextUnderlineType.NONE);
     }
 
-    /**
-     * @return whether this run of text is formatted as underlined text
-     */
+    @Override
     public boolean isUnderlined(){
         CharacterPropertyFetcher<Boolean> fetcher = new CharacterPropertyFetcher<Boolean>(_p.getIndentLevel()){
             public boolean fetch(CTTextCharacterProperties props){
@@ -501,6 +470,7 @@ public class XSLFTextRun implements Text
         CTPlaceholder ph = shape.getCTPlaceholder();
         if (ph == null){
             // if it is a plain text box then take defaults from presentation.xml
+            @SuppressWarnings("resource")
             XMLSlideShow ppt = sheet.getSlideShow();
             CTTextParagraphProperties themeProps = ppt.getDefaultParagraphStyle(_p.getIndentLevel());
             if (themeProps != null) {
@@ -543,7 +513,7 @@ public class XSLFTextRun implements Text
         if(italic != isItalic()) setItalic(italic);
 
         boolean underline = r.isUnderlined();
-        if(underline != isUnderlined()) setUnderline(underline);
+        if(underline != isUnderlined()) setUnderlined(underline);
 
         boolean strike = r.isStrikethrough();
         if(strike != isStrikethrough()) setStrikethrough(strike);

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=1711171&r1=1711170&r2=1711171&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 Thu Oct 29 01:05:27 2015
@@ -37,8 +37,10 @@ import org.apache.poi.xslf.model.TextBod
 import org.apache.xmlbeans.XmlObject;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBodyProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTTextListStyle;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties;
 import org.openxmlformats.schemas.drawingml.x2006.main.STTextAnchoringType;
 import org.openxmlformats.schemas.drawingml.x2006.main.STTextVerticalType;
 import org.openxmlformats.schemas.drawingml.x2006.main.STTextWrappingType;
@@ -91,10 +93,52 @@ public abstract class XSLFTextShape exte
         txBody.setPArray(null); // remove any existing paragraphs
     }
 
-    public void setText(String text){
-        clearText();
+    @Override
+    public XSLFTextRun setText(String text) {
+        // copy properties from first paragraph / textrun
+        CTTextParagraphProperties pPr = null;
+        CTTextCharacterProperties rPr = null;
+        if (!_paragraphs.isEmpty()) {
+            XSLFTextParagraph p0 = _paragraphs.get(0);
+            pPr = p0.getXmlObject().getPPr();
+            if (!p0.getTextRuns().isEmpty()) {
+                XSLFTextRun r0 = p0.getTextRuns().get(0);
+                rPr = r0.getXmlObject().getRPr();
+            }
+        }
 
-        addNewTextParagraph().addNewTextRun().setText(text);
+        // can't call clearText otherwise we receive a XmlValueDisconnectedException
+        _paragraphs.clear();
+        CTTextBody txBody = getTextBody(true);
+        int cntPs = txBody.sizeOfPArray();
+        
+        // split text by paragraph and new line char
+        XSLFTextRun r = null;
+        for (String paraText : text.split("\\r\\n?|\\n")) {
+            XSLFTextParagraph para = addNewTextParagraph();
+            if (pPr != null) {
+                para.getXmlObject().setPPr(pPr);
+            }
+            boolean first = true;
+            for (String runText : paraText.split("[\u000b]")) {
+                if (!first) {
+                    para.addLineBreak();
+                }
+                r = para.addNewTextRun();
+                r.setText(runText);
+                if (rPr != null) {
+                    r.getXmlObject().setRPr(rPr);
+                }
+                first = false;
+            }
+        }
+        
+        // simply setting a new pArray leads to XmlValueDisconnectedException
+        for (int i = cntPs-1; i >= 0; i--) {
+            txBody.removeP(i);
+        }
+        
+        return r;
     }
 
     @Override
@@ -115,13 +159,7 @@ public abstract class XSLFTextShape exte
         return paragraph;
     }
 
-
-    /**
-     * Sets the type of vertical alignment for the text.
-     *
-     * @param anchor - the type of alignment.
-     * A {@code null} values unsets this property.
-     */
+    @Override
     public void setVerticalAlignment(VerticalAlignment anchor){
         CTTextBodyProperties bodyPr = getTextBodyPr();
         if (bodyPr != null) {
@@ -133,11 +171,7 @@ public abstract class XSLFTextShape exte
         }
     }
 
-    /**
-     * Returns the type of vertical alignment for the text.
-     *
-     * @return the type of vertical alignment
-     */
+    @Override
     public VerticalAlignment getVerticalAlignment(){
         PropertyFetcher<VerticalAlignment> fetcher = new TextBodyPropertyFetcher<VerticalAlignment>(){
             public boolean fetch(CTTextBodyProperties props){
@@ -153,14 +187,7 @@ public abstract class XSLFTextShape exte
         return fetcher.getValue() == null ? VerticalAlignment.TOP : fetcher.getValue();
     }
 
-    /**
-     * Sets if the paragraphs are horizontal centered
-     *
-     * @param isCentered true, if the paragraphs are horizontal centered
-     * A {@code null} values unsets this property.
-     * 
-     * @see TextShape#isHorizontalCentered()
-     */
+    @Override
     public void setHorizontalCentered(Boolean isCentered){
         CTTextBodyProperties bodyPr = getTextBodyPr();
         if (bodyPr != null) {
@@ -369,10 +396,15 @@ public abstract class XSLFTextShape exte
         return insets;
     }
     
-    
-    /**
-     * @return whether to wrap words within the bounding rectangle
-     */
+    @Override
+    public void setInsets(Insets2D insets) {
+        setTopInset(insets.top);
+        setLeftInset(insets.left);
+        setBottomInset(insets.bottom);
+        setRightInset(insets.right);
+    }
+   
+    @Override
     public boolean getWordWrap(){
         PropertyFetcher<Boolean> fetcher = new TextBodyPropertyFetcher<Boolean>(){
             public boolean fetch(CTTextBodyProperties props){
@@ -387,10 +419,7 @@ public abstract class XSLFTextShape exte
         return fetcher.getValue() == null ? true : fetcher.getValue();
     }
 
-    /**
-     *
-     * @param wrap  whether to wrap words within the bounding rectangle
-     */
+    @Override
     public void setWordWrap(boolean wrap){
         CTTextBodyProperties bodyPr = getTextBodyPr();
         if (bodyPr != null) {
@@ -532,4 +561,45 @@ public abstract class XSLFTextShape exte
             tgtP.copy(srcP);
         }
     }
+
+    @Override
+    public void setTextPlaceholder(TextPlaceholder placeholder) {
+        switch (placeholder) {
+            default:
+            case NOTES:
+            case HALF_BODY:
+            case QUARTER_BODY: 
+            case BODY:
+                setPlaceholder(Placeholder.BODY);
+                break;
+            case TITLE:
+                setPlaceholder(Placeholder.TITLE);
+                break;
+            case CENTER_BODY:
+                setPlaceholder(Placeholder.BODY);
+                setHorizontalCentered(true);
+                break;
+            case CENTER_TITLE:
+                setPlaceholder(Placeholder.CENTERED_TITLE);
+                break;
+            case OTHER:
+                setPlaceholder(Placeholder.CONTENT);
+                break;
+        }
+    }
+
+    @Override
+    public TextPlaceholder getTextPlaceholder() {
+        Placeholder ph = getTextType();
+        if (ph == null) return TextPlaceholder.BODY;
+        switch (ph) {
+        case BODY: return TextPlaceholder.BODY;
+        case TITLE: return TextPlaceholder.TITLE;
+        case CENTERED_TITLE: return TextPlaceholder.CENTER_TITLE;
+        default:
+        case CONTENT: return TextPlaceholder.OTHER;
+        }        
+    }
+    
+    
 }
\ No newline at end of file

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=1711171&r1=1711170&r2=1711171&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 Thu Oct 29 01:05:27 2015
@@ -268,7 +268,7 @@ public class TestXSLFAutoShape {
 
         assertFalse(r.isUnderlined());
         assertFalse(r.getXmlObject().getRPr().isSetU());
-        r.setUnderline(true);
+        r.setUnderlined(true);
         assertTrue(r.isUnderlined());
         assertEquals(STTextUnderlineType.SNG, r.getXmlObject().getRPr().getU());
 

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFNotes.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFNotes.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFNotes.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFNotes.java Thu Oct 29 01:05:27 2015
@@ -20,13 +20,16 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
+import java.io.IOException;
+
+import org.apache.poi.sl.usermodel.SimpleShape.Placeholder;
 import org.apache.poi.xslf.XSLFTestDataSamples;
 import org.junit.Test;
 
 public class TestXSLFNotes {
 
     @Test
-    public void createNewNote() {
+    public void createNewNote() throws IOException {
 
         XMLSlideShow ppt = new XMLSlideShow();
         XSLFSlide slide1 = ppt.createSlide();
@@ -48,10 +51,12 @@ public class TestXSLFNotes {
         }
         assertNotNull(note);
         assertEquals("New Note", note);
+        
+        ppt.close();
     }
 
     @Test
-    public void addNote() {
+    public void addNote() throws IOException {
 
         XMLSlideShow ppt = XSLFTestDataSamples.openSampleDocument("sample.pptx");
 
@@ -69,10 +74,12 @@ public class TestXSLFNotes {
         }
         assertNotNull(note);
         assertEquals("New Note", note);
+        
+        ppt.close();
     }
 
     @Test
-    public void replaceNotes() {
+    public void replaceNotes() throws IOException {
 
         XMLSlideShow ppt = XSLFTestDataSamples.openSampleDocument("sample.pptx");
 
@@ -93,5 +100,7 @@ public class TestXSLFNotes {
             assertNotNull(note);
             assertEquals("New Note", note);
         }
+        
+        ppt.close();
     }
 }

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSimpleShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSimpleShape.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSimpleShape.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSimpleShape.java Thu Oct 29 01:05:27 2015
@@ -28,6 +28,7 @@ import java.io.IOException;
 import java.util.List;
 
 import org.apache.poi.sl.draw.geom.TestPresetGeometries;
+import org.apache.poi.sl.usermodel.SimpleShape.Placeholder;
 import org.apache.poi.sl.usermodel.StrokeStyle.LineCap;
 import org.apache.poi.sl.usermodel.StrokeStyle.LineDash;
 import org.apache.poi.util.Units;
@@ -168,7 +169,7 @@ public class TestXSLFSimpleShape {
     }
 
     @Test
-    public void testDefaultProperties() {
+    public void testDefaultProperties() throws IOException {
         XMLSlideShow ppt = XSLFTestDataSamples.openSampleDocument("shapes.pptx");
 
         XSLFSlide slide6 = ppt.getSlides().get(5);
@@ -234,10 +235,12 @@ public class TestXSLFSimpleShape {
         assertEquals(50000, ref5.getLumModArray(0).getVal());
         assertEquals("accent1", ref5.getVal().toString());
         assertEquals(new Color(79, 129, 189), s5.getFillColor());
+        
+        ppt.close();
     }
 
     @Test
-    public void testAnchor(){
+    public void testAnchor() throws IOException {
         XMLSlideShow ppt = XSLFTestDataSamples.openSampleDocument("shapes.pptx");
         List<XSLFSlide> slide = ppt.getSlides();
 
@@ -267,6 +270,7 @@ public class TestXSLFSimpleShape {
         assertNotNull(layout5.getSlideMaster().getTextShapeByType(Placeholder.TITLE).getSpPr().getXfrm());
         assertEquals(shTitle.getAnchor(), layout5.getSlideMaster().getTextShapeByType(Placeholder.TITLE).getAnchor());
 
+        ppt.close();
     }
 
     @SuppressWarnings({ "deprecation", "unused" })

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java Thu Oct 29 01:05:27 2015
@@ -16,23 +16,29 @@
 ==================================================================== */
 package org.apache.poi.xslf.usermodel;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
 
+import java.awt.Color;
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.poi.sl.usermodel.TableCell.BorderEdge;
 import org.apache.poi.sl.usermodel.VerticalAlignment;
 import org.apache.poi.xslf.XSLFTestDataSamples;
 import org.junit.Test;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTTableCell;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTGraphicalObjectFrame;
 
-import java.awt.Color;
-import java.util.List;
-
 /**
  * @author Yegor Kozlov
  */
 public class TestXSLFTable {
     @Test
-    public void testRead(){
+    public void testRead() throws IOException {
         XMLSlideShow  ppt = XSLFTestDataSamples.openSampleDocument("shapes.pptx");
 
         XSLFSlide slide = ppt.getSlides().get(3);
@@ -69,10 +75,12 @@ public class TestXSLFTable {
         assertEquals("A1", cells1.get(0).getText());
         assertEquals("B1", cells1.get(1).getText());
         assertEquals("C1", cells1.get(2).getText());
+        
+        ppt.close();
     }
 
     @Test
-    public void testCreate() {
+    public void testCreate() throws IOException {
         XMLSlideShow ppt = new XMLSlideShow();
         XSLFSlide slide = ppt.createSlide();
 
@@ -121,38 +129,21 @@ public class TestXSLFTable {
         cell1.addNewTextParagraph().addNewTextRun().setText("Apache");
         assertEquals("Apache", cell1.getText());
 
-        assertEquals(1.0, cell1.getBorderBottom(), 0);
-        cell1.setBorderBottom(2.0);
-        assertEquals(2.0, cell1.getBorderBottom(), 0);
-        assertNull(cell1.getBorderBottomColor());
-        cell1.setBorderBottomColor(Color.yellow);
-        assertEquals(Color.yellow, cell1.getBorderBottomColor());
-
-        assertEquals(1.0, cell1.getBorderTop(), 0);
-        cell1.setBorderTop(2.0);
-        assertEquals(2.0, cell1.getBorderTop(), 0);
-        assertNull(cell1.getBorderTopColor());
-        cell1.setBorderTopColor(Color.yellow);
-        assertEquals(Color.yellow, cell1.getBorderTopColor());
-
-        assertEquals(1.0, cell1.getBorderLeft(), 0);
-        cell1.setBorderLeft(2.0);
-        assertEquals(2.0, cell1.getBorderLeft(), 0);
-        assertNull(cell1.getBorderLeftColor());
-        cell1.setBorderLeftColor(Color.yellow);
-        assertEquals(Color.yellow, cell1.getBorderLeftColor());
-
-        assertEquals(1.0, cell1.getBorderRight(), 0);
-        cell1.setBorderRight(2.0);
-        assertEquals(2.0, cell1.getBorderRight(), 0);
-        assertNull(cell1.getBorderRightColor());
-        cell1.setBorderRightColor(Color.yellow);
-        assertEquals(Color.yellow, cell1.getBorderRightColor());
+        for (BorderEdge edge : BorderEdge.values()) {
+            assertNull(cell1.getBorderWidth(edge));
+            cell1.setBorderWidth(edge, 2.0);
+            assertEquals(2.0, cell1.getBorderWidth(edge), 0);
+            assertNull(cell1.getBorderColor(edge));
+            cell1.setBorderColor(edge, Color.yellow);
+            assertEquals(Color.yellow, cell1.getBorderColor(edge));
+        }
 
         assertEquals(VerticalAlignment.TOP, cell1.getVerticalAlignment());
         cell1.setVerticalAlignment(VerticalAlignment.MIDDLE);
         assertEquals(VerticalAlignment.MIDDLE, cell1.getVerticalAlignment());
         cell1.setVerticalAlignment(null);
         assertEquals(VerticalAlignment.TOP, cell1.getVerticalAlignment());
+        
+        ppt.close();
     }
 }
\ No newline at end of file

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextBox.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextBox.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextBox.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextBox.java Thu Oct 29 01:05:27 2015
@@ -19,6 +19,9 @@ package org.apache.poi.xslf.usermodel;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 
+import java.io.IOException;
+
+import org.apache.poi.sl.usermodel.SimpleShape.Placeholder;
 import org.junit.Test;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties;
 
@@ -28,7 +31,7 @@ import org.openxmlformats.schemas.drawin
 public class TestXSLFTextBox {
 
     @Test
-    public void testPlaceholder() {
+    public void testPlaceholder() throws IOException {
         XMLSlideShow ppt = new XMLSlideShow();
         XSLFSlide slide = ppt.createSlide();
 
@@ -39,13 +42,15 @@ public class TestXSLFTextBox {
         shape.setPlaceholder(null);
         assertNull(shape.getTextType());
         shape.setText("Apache POI");
+        
+        ppt.close();
     }
 
     /**
      * text box inherits default text proeprties from presentation.xml
      */
     @Test
-    public void testDefaultTextStyle() {
+    public void testDefaultTextStyle() throws IOException {
         XMLSlideShow ppt = new XMLSlideShow();
         XSLFSlide slide = ppt.createSlide();
 
@@ -79,5 +84,7 @@ public class TestXSLFTextBox {
 
         pPr.unsetSz();  // Should never be
         assertNull(r.getFontSize());
+        
+        ppt.close();
     }
 }
\ No newline at end of file

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=1711171&r1=1711170&r2=1711171&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 Thu Oct 29 01:05:27 2015
@@ -28,6 +28,7 @@ import java.awt.Color;
 import java.io.IOException;
 import java.util.List;
 
+import org.apache.poi.sl.usermodel.SimpleShape.Placeholder;
 import org.apache.poi.sl.usermodel.TextParagraph.TextAlign;
 import org.apache.poi.sl.usermodel.VerticalAlignment;
 import org.apache.poi.xslf.XSLFTestDataSamples;
@@ -45,7 +46,7 @@ import org.openxmlformats.schemas.presen
 public class TestXSLFTextShape {
 
     @Test
-    public void testLayouts(){
+    public void testLayouts() throws IOException {
         XMLSlideShow ppt = XSLFTestDataSamples.openSampleDocument("layouts.pptx");
 
         List<XSLFSlide> slide = ppt.getSlides();
@@ -57,6 +58,8 @@ public class TestXSLFTextShape {
         verifySlide7(slide.get(6));
         verifySlide8(slide.get(7));
         verifySlide10(slide.get(9));
+        
+        ppt.close();
     }
 
     void verifySlide1(XSLFSlide slide){

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java Thu Oct 29 01:05:27 2015
@@ -297,7 +297,7 @@ public final class PPGraphics2D extends
         txt.setTopInset(0);
         txt.setLeftInset(0);
         txt.setRightInset(0);
-        txt.setWordWrap(HSLFTextBox.WrapNone);
+        txt.setWordWrap(false);
         txt.setHorizontalCentered(false);
         txt.setVerticalAlignment(VerticalAlignment.MIDDLE);
 
@@ -1826,7 +1826,7 @@ public final class PPGraphics2D extends
             float[] dash = bs.getDashArray();
             if (dash != null) {
                 //TODO: implement more dashing styles
-                shape.setLineDashing(StrokeStyle.LineDash.DASH);
+                shape.setLineDash(StrokeStyle.LineDash.DASH);
             }
         }
     }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFAutoShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFAutoShape.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFAutoShape.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFAutoShape.java Thu Oct 29 01:05:27 2015
@@ -67,7 +67,7 @@ public class HSLFAutoShape extends HSLFT
     protected void setDefaultTextProperties(HSLFTextParagraph _txtrun){
         setVerticalAlignment(VerticalAlignment.MIDDLE);
         setHorizontalCentered(true);
-        setWordWrap(HSLFTextBox.WrapNone);
+        setWordWrap(false);
     }
 
     /**

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java?rev=1711171&r1=1711170&r2=1711171&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java Thu Oct 29 01:05:27 2015
@@ -43,7 +43,6 @@ import org.apache.poi.util.Units;
  */
 public class HSLFGroupShape extends HSLFShape
 implements HSLFShapeContainer, GroupShape<HSLFShape,HSLFTextParagraph> {
-
     /**
       * Create a new ShapeGroup. This constructor is used when a new shape is created.
       *
@@ -73,34 +72,16 @@ implements HSLFShapeContainer, GroupShap
         super(escherRecord, parent);
     }
 
-    /**
-     * Sets the anchor (the bounding box rectangle) of this shape.
-     * All coordinates should be expressed in Master units (576 dpi).
-     *
-     * @param anchor new anchor
-     */
-    public void setAnchor(java.awt.Rectangle anchor){
-
+    @Override
+    public void setAnchor(Rectangle anchor) {
         EscherClientAnchorRecord clientAnchor = getEscherChild(EscherClientAnchorRecord.RECORD_ID);
-        //hack. internal variable EscherClientAnchorRecord.shortRecord can be
-        //initialized only in fillFields(). We need to set shortRecord=false;
-        byte[] header = new byte[16];
-        LittleEndian.putUShort(header, 0, 0);
-        LittleEndian.putUShort(header, 2, 0);
-        LittleEndian.putInt(header, 4, 8);
-        clientAnchor.fillFields(header, 0, null);
-
-        clientAnchor.setFlag((short)Units.pointsToMaster(anchor.y));
-        clientAnchor.setCol1((short)Units.pointsToMaster(anchor.x));
-        clientAnchor.setDx1((short)Units.pointsToMaster(anchor.width + anchor.x));
-        clientAnchor.setRow1((short)Units.pointsToMaster(anchor.height + anchor.y));
-
-        EscherSpgrRecord spgr = getEscherChild(EscherSpgrRecord.RECORD_ID);
-
-        spgr.setRectX1(Units.pointsToMaster(anchor.x));
-        spgr.setRectY1(Units.pointsToMaster(anchor.y));
-        spgr.setRectX2(Units.pointsToMaster(anchor.x + anchor.width));
-        spgr.setRectY2(Units.pointsToMaster(anchor.y + anchor.height));
+        boolean isInitialized = !(clientAnchor.getDx1() == 0 && clientAnchor.getRow1() == 0);
+        
+        if (isInitialized) {
+            moveAndScale(anchor);
+        } else {
+            setExteriorAnchor(anchor);
+        }
     }
 
     @Override
@@ -116,7 +97,6 @@ implements HSLFShapeContainer, GroupShap
         spgr.setRectY1(y1);
         spgr.setRectX2(x2);
         spgr.setRectY2(y2);
-
     }
 
     @Override
@@ -129,6 +109,27 @@ implements HSLFShapeContainer, GroupShap
         return new Rectangle(x1,y1,x2-x1,y2-y1);
     }
 
+    protected void setExteriorAnchor(Rectangle anchor) {
+        EscherClientAnchorRecord clientAnchor = getEscherChild(EscherClientAnchorRecord.RECORD_ID);
+        
+        //hack. internal variable EscherClientAnchorRecord.shortRecord can be
+        //initialized only in fillFields(). We need to set shortRecord=false;
+        byte[] header = new byte[16];
+        LittleEndian.putUShort(header, 0, 0);
+        LittleEndian.putUShort(header, 2, 0);
+        LittleEndian.putInt(header, 4, 8);
+        clientAnchor.fillFields(header, 0, null);
+
+        // All coordinates need to be converted to Master units (576 dpi)
+        clientAnchor.setFlag((short)Units.pointsToMaster(anchor.y));
+        clientAnchor.setCol1((short)Units.pointsToMaster(anchor.x));
+        clientAnchor.setDx1((short)Units.pointsToMaster(anchor.width + anchor.x));
+        clientAnchor.setRow1((short)Units.pointsToMaster(anchor.height + anchor.y));
+
+        // TODO: does this make sense?
+        setInteriorAnchor(anchor);
+    }
+    
     /**
      * Create a new ShapeGroup and create an instance of <code>EscherSpgrContainer</code> which represents a group of shapes
      */
@@ -174,23 +175,22 @@ implements HSLFShapeContainer, GroupShap
     }
 
     /**
-     * Moves this <code>ShapeGroup</code> to the specified location.
-     * <p>
-     * @param x the x coordinate of the top left corner of the shape in new location
-     * @param y the y coordinate of the top left corner of the shape in new location
-     */
-    public void moveTo(int x, int y){
-        Rectangle anchor = getAnchor();
-        int dx = x - anchor.x;
-        int dy = y - anchor.y;
-        anchor.translate(dx, dy);
-        setAnchor(anchor);
+     * Moves and scales this <code>ShapeGroup</code> to the specified anchor.
+     */
+    protected void moveAndScale(Rectangle anchorDest){
+        Rectangle anchorSrc = getAnchor();
+        double scaleX = (anchorSrc.width == 0) ? 0 : anchorDest.width / (double)anchorSrc.width;
+        double scaleY = (anchorSrc.height == 0) ? 0 : anchorDest.height / (double)anchorSrc.height;
 
+        setExteriorAnchor(anchorDest);
         
         for (HSLFShape shape : getShapes()) {
             Rectangle chanchor = shape.getAnchor();
-            chanchor.translate(dx, dy);
-            shape.setAnchor(chanchor);
+            int x = (int)Math.rint(anchorDest.x+(chanchor.x-anchorSrc.x)*scaleX);
+            int y = (int)Math.rint(anchorDest.y+(chanchor.y-anchorSrc.y)*scaleY);
+            int width = (int)Math.rint(chanchor.width*scaleX);
+            int height = (int)Math.rint(chanchor.height*scaleY);
+            shape.setAnchor(new Rectangle(x, y, width, height));
         }
     }
 
@@ -262,9 +262,6 @@ implements HSLFShapeContainer, GroupShap
         throw new UnsupportedOperationException();
     }
 
-    /**
-     * @return the shapes contained in this group container
-     */
     @Override
     public List<HSLFShape> getShapes() {
         // Out escher container record should contain several

Copied: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPlaceholder.java (from r1707403, poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Placeholder.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPlaceholder.java?p2=poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPlaceholder.java&p1=poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Placeholder.java&r1=1707403&r2=1711171&rev=1711171&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Placeholder.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPlaceholder.java Thu Oct 29 01:05:27 2015
@@ -15,34 +15,28 @@
    limitations under the License.
 ==================================================================== */
 
-package org.apache.poi.hslf.model;
+package org.apache.poi.hslf.usermodel;
 
-import org.apache.poi.ddf.*;
-import org.apache.poi.hslf.record.OEPlaceholderAtom;
-import org.apache.poi.hslf.usermodel.HSLFShape;
-import org.apache.poi.hslf.usermodel.HSLFTextBox;
-import org.apache.poi.hslf.usermodel.HSLFTextParagraph;
-import org.apache.poi.hslf.exceptions.HSLFException;
+import org.apache.poi.ddf.EscherContainerRecord;
+import org.apache.poi.sl.usermodel.SimpleShape.Placeholder;
 import org.apache.poi.sl.usermodel.ShapeContainer;
 
-import java.io.ByteArrayOutputStream;
-
 /**
  * Represents a Placeholder in PowerPoint.
  *
  * @author Yegor Kozlov
  */
-public final class Placeholder extends HSLFTextBox {
+public final class HSLFPlaceholder extends HSLFTextBox {
 
-    protected Placeholder(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
+    protected HSLFPlaceholder(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
         super(escherRecord, parent);
     }
 
-    public Placeholder(ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
+    public HSLFPlaceholder(ShapeContainer<HSLFShape,HSLFTextParagraph> parent){
         super(parent);
     }
 
-    public Placeholder(){
+    public HSLFPlaceholder(){
         super();
     }
 
@@ -53,43 +47,8 @@ public final class Placeholder extends H
      */
     protected EscherContainerRecord createSpContainer(boolean isChild){
         _escherContainer = super.createSpContainer(isChild);
-
-        EscherSpRecord spRecord = _escherContainer.getChildById(EscherSpRecord.RECORD_ID);
-        spRecord.setFlags(EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HAVEMASTER);
-
-        EscherClientDataRecord cldata = new EscherClientDataRecord();
-        cldata.setOptions((short)15);
-
-        AbstractEscherOptRecord opt = getEscherOptRecord();
-
-        //Placeholders can't be grouped
-        setEscherProperty(opt, EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 262144);
-
-        //OEPlaceholderAtom tells powerpoint that this shape is a placeholder
-        //
-        OEPlaceholderAtom oep = new OEPlaceholderAtom();
-        /**
-         * Extarct from MSDN:
-         *
-         * There is a special case when the placeholder does not have a position in the layout.
-         * This occurs when the user has moved the placeholder from its original position.
-         * In this case the placeholder ID is -1.
-         */
-        oep.setPlacementId(-1);
-
-        oep.setPlaceholderId(OEPlaceholderAtom.Body);
-
-        //convert hslf into ddf record
-        ByteArrayOutputStream out = new ByteArrayOutputStream();
-        try {
-            oep.writeOut(out);
-        } catch(Exception e){
-            throw new HSLFException(e);
-        }
-        cldata.setRemainingData(out.toByteArray());
-
-        //append placeholder container before EscherTextboxRecord
-        _escherContainer.addChildBefore(cldata, EscherTextboxRecord.RECORD_ID);
+        
+        setPlaceholder(Placeholder.BODY);
 
         return _escherContainer;
     }



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