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

svn commit: r1684773 [1/3] - in /poi/branches/common_sl: src/examples/src/org/apache/poi/hslf/examples/ src/java/org/apache/poi/ddf/ src/java/org/apache/poi/hssf/usermodel/ src/ooxml/java/org/apache/poi/xslf/usermodel/ src/scratchpad/src/org/apache/poi...

Author: kiwiwings
Date: Wed Jun 10 22:23:47 2015
New Revision: 1684773

URL: http://svn.apache.org/r1684773
Log:
Fixed TextRun handling and various junit tests

Added:
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTable.java
      - copied, changed from r1678838, poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Table.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTableCell.java
      - copied, changed from r1678838, poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TableCell.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawGroupShape.java
      - copied, changed from r1678838, poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawShapeGroup.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/GroupShape.java
      - copied, changed from r1678838, poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeGroup.java
    poi/branches/common_sl/test-data/slideshow/54541_cropped_bitmap2.ppt   (with props)
    poi/branches/common_sl/test-data/slideshow/sample_pptx_grouping_issues.pptx   (with props)
Removed:
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/BitmapPainter.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/blip/ImagePainter.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Table.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TableCell.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawShapeGroup.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeGroup.java
    poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestImagePainter.java
Modified:
    poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/ApacheconEU08.java
    poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/Graphics2DDemo.java
    poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/TableDemo.java
    poi/branches/common_sl/src/java/org/apache/poi/ddf/EscherChildAnchorRecord.java
    poi/branches/common_sl/src/java/org/apache/poi/ddf/EscherProperties.java
    poi/branches/common_sl/src/java/org/apache/poi/ddf/EscherTextboxRecord.java
    poi/branches/common_sl/src/java/org/apache/poi/hssf/usermodel/DummyGraphics2d.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java
    poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Line.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPropCollection.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/EscherTextboxWrapper.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/RecordContainer.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/SlideListWithText.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFill.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFNotes.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureData.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapeFactory.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSheet.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlide.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideMaster.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextParagraph.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTitleMaster.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawFactory.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/DrawShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/Drawable.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/ImageRenderer.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PictureShape.java
    poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Sheet.java
    poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/AllHSLFModelTests.java
    poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java
    poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestAddingSlides.java
    poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java
    poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestFontRendering.java
    poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestNumberedList3.java
    poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPicture.java
    poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPictures.java
    poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTable.java
    poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTextRun.java

Modified: poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/ApacheconEU08.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/ApacheconEU08.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/ApacheconEU08.java (original)
+++ poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/ApacheconEU08.java Wed Jun 10 22:23:47 2015
@@ -146,10 +146,10 @@ public final class ApacheconEU08 {
             {"Note"},
             {"This presentation was created programmatically using POI HSLF"}
         };
-        Table table1 = new Table(2, 1);
+        HSLFTable table1 = new HSLFTable(2, 1);
         for (int i = 0; i < txt1.length; i++) {
             for (int j = 0; j < txt1[i].length; j++) {
-                TableCell cell = table1.getCell(i, j);
+                HSLFTableCell cell = table1.getCell(i, j);
                 cell.setText(txt1[i][j]);
                 HSLFTextRun rt = cell.getTextParagraphs().get(0).getTextRuns().get(0);
                 rt.setFontSize(10);

Modified: poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/Graphics2DDemo.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/Graphics2DDemo.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/Graphics2DDemo.java (original)
+++ poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/Graphics2DDemo.java Wed Jun 10 22:23:47 2015
@@ -50,7 +50,7 @@ public final class Graphics2DDemo {
         //define position of the drawing in the slide
         Rectangle bounds = new java.awt.Rectangle(200, 100, 350, 300);
         group.setAnchor(bounds);
-        group.setCoordinates(new java.awt.Rectangle(0, 0, 100, 100));
+        group.setInteriorAnchor(new java.awt.Rectangle(0, 0, 100, 100));
         slide.addShape(group);
         Graphics2D graphics = new PPGraphics2D(group);
 
@@ -68,7 +68,7 @@ public final class Graphics2DDemo {
         }
         graphics.setColor(Color.black);
         graphics.setFont(new Font("Arial", Font.BOLD, 14));
-        graphics.draw(group.getCoordinates());
+        graphics.draw(group.getInteriorAnchor());
         graphics.drawString("Performance", x + 30, y + 10);
 
         FileOutputStream out = new FileOutputStream("hslf-graphics.ppt");

Modified: poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/TableDemo.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/TableDemo.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/TableDemo.java (original)
+++ poi/branches/common_sl/src/examples/src/org/apache/poi/hslf/examples/TableDemo.java Wed Jun 10 22:23:47 2015
@@ -49,10 +49,10 @@ public final class TableDemo {
         HSLFSlide slide = ppt.createSlide();
 
         //six rows, two columns
-        Table table1 = new Table(6, 2);
+        HSLFTable table1 = new HSLFTable(6, 2);
         for (int i = 0; i < txt1.length; i++) {
             for (int j = 0; j < txt1[i].length; j++) {
-                TableCell cell = table1.getCell(i, j);
+                HSLFTableCell cell = table1.getCell(i, j);
                 HSLFTextRun rt = cell.getTextParagraphs().get(0).getTextRuns().get(0);
                 rt.setFontFamily("Arial");
                 rt.setFontSize(10);
@@ -88,10 +88,10 @@ public final class TableDemo {
         };
 
         //two rows, one column
-        Table table2 = new Table(2, 1);
+        HSLFTable table2 = new HSLFTable(2, 1);
         for (int i = 0; i < txt2.length; i++) {
             for (int j = 0; j < txt2[i].length; j++) {
-                TableCell cell = table2.getCell(i, j);
+                HSLFTableCell cell = table2.getCell(i, j);
                 HSLFTextRun rt = cell.getTextParagraphs().get(0).getTextRuns().get(0);
                 rt.setFontSize(10);
                 rt.setFontFamily("Arial");

Modified: poi/branches/common_sl/src/java/org/apache/poi/ddf/EscherChildAnchorRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/java/org/apache/poi/ddf/EscherChildAnchorRecord.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/java/org/apache/poi/ddf/EscherChildAnchorRecord.java (original)
+++ poi/branches/common_sl/src/java/org/apache/poi/ddf/EscherChildAnchorRecord.java Wed Jun 10 22:23:47 2015
@@ -40,13 +40,26 @@ public class EscherChildAnchorRecord
     private int field_4_dy2;
 
     public int fillFields(byte[] data, int offset, EscherRecordFactory recordFactory) {
-        /*int bytesRemaining =*/ readHeader( data, offset );
+        int bytesRemaining = readHeader( data, offset );
         int pos            = offset + 8;
         int size           = 0;
-        field_1_dx1    =  LittleEndian.getInt( data, pos + size );size+=4;
-        field_2_dy1    =  LittleEndian.getInt( data, pos + size );size+=4;
-        field_3_dx2  =  LittleEndian.getInt( data, pos + size );size+=4;
-        field_4_dy2 =  LittleEndian.getInt( data, pos + size );size+=4;
+        switch (bytesRemaining) {
+        case 16: // RectStruct
+            field_1_dx1 =  LittleEndian.getInt( data, pos + size );size+=4;
+            field_2_dy1 =  LittleEndian.getInt( data, pos + size );size+=4;
+            field_3_dx2 =  LittleEndian.getInt( data, pos + size );size+=4;
+            field_4_dy2 =  LittleEndian.getInt( data, pos + size );size+=4;
+            break;
+        case 8: // SmallRectStruct
+            field_1_dx1 =  LittleEndian.getShort( data, pos + size );size+=2;
+            field_2_dy1 =  LittleEndian.getShort( data, pos + size );size+=2;
+            field_3_dx2 =  LittleEndian.getShort( data, pos + size );size+=2;
+            field_4_dy2 =  LittleEndian.getShort( data, pos + size );size+=2;
+            break;
+        default:
+            throw new RuntimeException("Invalid EscherChildAnchorRecord - neither 8 nor 16 bytes.");
+        }
+            
         return 8 + size;
     }
 
@@ -58,8 +71,8 @@ public class EscherChildAnchorRecord
         LittleEndian.putInt( data, pos, getRecordSize()-8 );       pos += 4;
         LittleEndian.putInt( data, pos, field_1_dx1 );             pos += 4;
         LittleEndian.putInt( data, pos, field_2_dy1 );             pos += 4;
-        LittleEndian.putInt( data, pos, field_3_dx2 );           pos += 4;
-        LittleEndian.putInt( data, pos, field_4_dy2 );          pos += 4;
+        LittleEndian.putInt( data, pos, field_3_dx2 );             pos += 4;
+        LittleEndian.putInt( data, pos, field_4_dy2 );             pos += 4;
 
         listener.afterRecordSerialize( pos, getRecordId(), pos - offset, this );
         return pos - offset;

Modified: poi/branches/common_sl/src/java/org/apache/poi/ddf/EscherProperties.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/java/org/apache/poi/ddf/EscherProperties.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/java/org/apache/poi/ddf/EscherProperties.java (original)
+++ poi/branches/common_sl/src/java/org/apache/poi/ddf/EscherProperties.java Wed Jun 10 22:23:47 2015
@@ -507,7 +507,7 @@ public final class EscherProperties {
 		addProp(m, SHADOWSTYLE__ORIGINX, "shadowstyle.originx");
 		addProp(m, SHADOWSTYLE__ORIGINY, "shadowstyle.originy");
 		addProp(m, SHADOWSTYLE__SHADOW, "shadowstyle.shadow");
-		addProp(m, SHADOWSTYLE__SHADOWOBSURED, "shadowstyle.shadowobsured");
+		addProp(m, SHADOWSTYLE__SHADOWOBSURED, "shadowstyle.shadowobscured");
 		addProp(m, PERSPECTIVE__TYPE, "perspective.type");
 		addProp(m, PERSPECTIVE__OFFSETX, "perspective.offsetx");
 		addProp(m, PERSPECTIVE__OFFSETY, "perspective.offsety");

Modified: poi/branches/common_sl/src/java/org/apache/poi/ddf/EscherTextboxRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/java/org/apache/poi/ddf/EscherTextboxRecord.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/java/org/apache/poi/ddf/EscherTextboxRecord.java (original)
+++ poi/branches/common_sl/src/java/org/apache/poi/ddf/EscherTextboxRecord.java Wed Jun 10 22:23:47 2015
@@ -17,6 +17,7 @@
 
 package org.apache.poi.ddf;
 
+import org.apache.poi.hslf.record.RecordTypes;
 import org.apache.poi.util.HexDump;
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.RecordFormatException;
@@ -32,7 +33,7 @@ import org.apache.poi.util.RecordFormatE
  */
 public class EscherTextboxRecord extends EscherRecord
 {
-    public static final short RECORD_ID = (short)0xF00D;
+    public static final short RECORD_ID = (short)RecordTypes.EscherClientTextbox;
     public static final String RECORD_DESCRIPTION = "msofbtClientTextbox";
 
     private static final byte[] NO_BYTES = new byte[0];

Modified: poi/branches/common_sl/src/java/org/apache/poi/hssf/usermodel/DummyGraphics2d.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/java/org/apache/poi/hssf/usermodel/DummyGraphics2d.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/java/org/apache/poi/hssf/usermodel/DummyGraphics2d.java (original)
+++ poi/branches/common_sl/src/java/org/apache/poi/hssf/usermodel/DummyGraphics2d.java Wed Jun 10 22:23:47 2015
@@ -28,6 +28,7 @@ import java.awt.image.ImageObserver;
 import java.awt.image.RenderedImage;
 import java.awt.image.renderable.RenderableImage;
 import java.text.AttributedCharacterIterator;
+import java.util.Arrays;
 import java.util.Map;
 
 public class DummyGraphics2d
@@ -262,7 +263,7 @@ public class DummyGraphics2d
 
     public void setPaint( Paint paint )
     {
-        System.out.println( "setPain(Paint):" );
+        System.out.println( "setPaint(Paint):" );
         System.out.println( "paint = " + paint );
         g2D.setPaint( paint );
     }
@@ -285,7 +286,19 @@ public class DummyGraphics2d
     public void setStroke(Stroke s)
     {
         System.out.println( "setStroke(Stoke):" );
-        System.out.println( "s = " + s );
+        if (s instanceof BasicStroke) {
+            BasicStroke bs = (BasicStroke)s;
+            StringBuilder str = new StringBuilder("s = BasicStroke(");
+            str.append("dash[]: "+Arrays.toString(bs.getDashArray())+", ");
+            str.append("dashPhase: "+bs.getDashPhase()+", ");
+            str.append("endCap: "+bs.getEndCap()+", ");
+            str.append("lineJoin: "+bs.getLineJoin()+", ");
+            str.append("width: "+bs.getLineWidth()+", ");
+            str.append("miterLimit: "+bs.getMiterLimit()+")");
+            System.out.println(str.toString());
+        } else {
+            System.out.println( "s = " + s );
+        }
         g2D.setStroke( s );
     }
 

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java Wed Jun 10 22:23:47 2015
@@ -25,8 +25,7 @@ import java.util.List;
 import java.util.regex.Pattern;
 
 import org.apache.poi.openxml4j.opc.*;
-import org.apache.poi.sl.usermodel.PlaceableShape;
-import org.apache.poi.sl.usermodel.ShapeGroup;
+import org.apache.poi.sl.usermodel.GroupShape;
 import org.apache.poi.util.*;
 import org.apache.xmlbeans.XmlObject;
 import org.openxmlformats.schemas.drawingml.x2006.main.*;
@@ -38,7 +37,7 @@ import org.openxmlformats.schemas.presen
  * @author Yegor Kozlov
  */
 @Beta
-public class XSLFGroupShape extends XSLFShape implements XSLFShapeContainer, ShapeGroup<XSLFShape> {
+public class XSLFGroupShape extends XSLFShape implements XSLFShapeContainer, GroupShape<XSLFShape> {
     private static POILogger _logger = POILogFactory.getLogger(XSLFGroupShape.class);
     
     private final List<XSLFShape> _shapes;
@@ -118,7 +117,7 @@ public class XSLFGroupShape extends XSLF
      * used for calculations of grouping, scaling, and rotation
      * behavior of shapes placed within a group.
      */
-    public void setInteriorAnchor(Rectangle2D anchor){
+    public void setInteriorAnchor(Rectangle2D anchor) {
         CTGroupTransform2D xfrm = getSafeXfrm();
         CTPoint2D off = xfrm.isSetChOff() ? xfrm.getChOff() : xfrm.addNewChOff();
         long x = Units.toEMU(anchor.getX());

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java Wed Jun 10 22:23:47 2015
@@ -169,6 +169,7 @@ public class XSLFPictureShape extends XS
         return id;
     }
 
+    @Override
     public Insets getClipping(){
         CTPicture ct = (CTPicture)getXmlObject();
         CTRelativeRect r = ct.getBlipFill().getSrcRect();

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java Wed Jun 10 22:23:47 2015
@@ -481,6 +481,7 @@ public abstract class XSLFSheet extends
      *
      * @param graphics
      */
+    @Override
     public void draw(Graphics2D graphics){
         DrawFactory drawFact = DrawFactory.getInstance(graphics);
         Drawable draw = drawFact.getDrawable(this);

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java Wed Jun 10 22:23:47 2015
@@ -21,7 +21,6 @@ import java.io.IOException;
 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.Notes;
 import org.apache.poi.sl.usermodel.Slide;
 import org.apache.poi.util.Beta;
 import org.apache.xmlbeans.XmlException;

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java Wed Jun 10 22:23:47 2015
@@ -247,8 +247,8 @@ public final class PowerPointExtractor e
 
                 // Table text
                 for (HSLFShape shape : slide.getShapes()){
-                    if (shape instanceof Table){
-                        extractTableText(ret, (Table)shape);
+                    if (shape instanceof HSLFTable){
+                        extractTableText(ret, (HSLFTable)shape);
                     }
                 }
                 // Slide footer, if set
@@ -305,10 +305,10 @@ public final class PowerPointExtractor e
 		return ret.toString();
 	}
 
-    private void extractTableText(StringBuffer ret, Table table) {
+    private void extractTableText(StringBuffer ret, HSLFTable table) {
         for (int row = 0; row < table.getNumberOfRows(); row++){
             for (int col = 0; col < table.getNumberOfColumns(); col++){
-                TableCell cell = table.getCell(row, col);
+                HSLFTableCell cell = table.getCell(row, col);
                 //defensive null checks; don't know if they're necessary
                 if (cell != null){
                     String txt = cell.getText();

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Line.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Line.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Line.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Line.java Wed Jun 10 22:23:47 2015
@@ -22,8 +22,8 @@ import org.apache.poi.hslf.usermodel.*;
 import org.apache.poi.sl.usermodel.ShapeContainer;
 import org.apache.poi.sl.usermodel.ShapeType;
 
-import java.awt.geom.Rectangle2D;
-import java.awt.geom.Line2D;
+import java.awt.geom.*;
+import java.util.ArrayList;
 
 /**
  * Represents a line in a PowerPoint drawing
@@ -69,4 +69,63 @@ public final class Line extends HSLFSimp
         Rectangle2D anchor = getLogicalAnchor2D();
         return new Line2D.Double(anchor.getX(), anchor.getY(), anchor.getX() + anchor.getWidth(), anchor.getY() + anchor.getHeight());
     }
+    
+    /**
+    *
+    * @return 'absolute' anchor of this shape relative to the parent sheet
+    * 
+    * @deprecated TODO: remove the whole class, should work with preset geometries instead
+    */
+   public Rectangle2D getLogicalAnchor2D(){
+       Rectangle2D anchor = getAnchor2D();
+
+       //if it is a groupped shape see if we need to transform the coordinates
+       if (getParent() != null){
+           ArrayList<HSLFGroupShape> lst = new ArrayList<HSLFGroupShape>();
+           for (ShapeContainer<HSLFShape> parent=this.getParent();
+               parent instanceof HSLFGroupShape;
+               parent = ((HSLFGroupShape)parent).getParent()) {
+               lst.add(0, (HSLFGroupShape)parent);
+           }
+           
+           AffineTransform tx = new AffineTransform();
+           for(HSLFGroupShape prnt : lst) {
+               Rectangle2D exterior = prnt.getAnchor2D();
+               Rectangle2D interior = prnt.getInteriorAnchor();
+
+               double scaleX =  exterior.getWidth() / interior.getWidth();
+               double scaleY = exterior.getHeight() / interior.getHeight();
+
+               tx.translate(exterior.getX(), exterior.getY());
+               tx.scale(scaleX, scaleY);
+               tx.translate(-interior.getX(), -interior.getY());
+               
+           }
+           anchor = tx.createTransformedShape(anchor).getBounds2D();
+       }
+
+       double angle = getRotation();
+       if(angle != 0.){
+           double centerX = anchor.getX() + anchor.getWidth()/2;
+           double centerY = anchor.getY() + anchor.getHeight()/2;
+
+           AffineTransform trans = new AffineTransform();
+           trans.translate(centerX, centerY);
+           trans.rotate(Math.toRadians(angle));
+           trans.translate(-centerX, -centerY);
+
+           Rectangle2D rect = trans.createTransformedShape(anchor).getBounds2D();
+           if((anchor.getWidth() < anchor.getHeight() && rect.getWidth() > rect.getHeight()) ||
+               (anchor.getWidth() > anchor.getHeight() && rect.getWidth() < rect.getHeight())    ){
+               trans = new AffineTransform();
+               trans.translate(centerX, centerY);
+               trans.rotate(Math.PI/2);
+               trans.translate(-centerX, -centerY);
+               anchor = trans.createTransformedShape(anchor).getBounds2D();
+           }
+       }
+       return anchor;
+   }
+
+
 }

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPropCollection.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPropCollection.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPropCollection.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPropCollection.java Wed Jun 10 22:23:47 2015
@@ -285,6 +285,7 @@ public class TextPropCollection {
      * Clones the given text properties
      */
 	public void copy(TextPropCollection other) {
+	    if (this == other) return;
         this.charactersCovered = other.charactersCovered;
         this.indentLevel = other.indentLevel;
         this.maskSpecial = other.maskSpecial;

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/EscherTextboxWrapper.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/EscherTextboxWrapper.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/EscherTextboxWrapper.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/EscherTextboxWrapper.java Wed Jun 10 22:23:47 2015
@@ -87,9 +87,7 @@ public final class EscherTextboxWrapper
 
 		// Grab the children's data
 		ByteArrayOutputStream baos = new ByteArrayOutputStream();
-		for(int i=0; i<_children.length; i++) {
-			_children[i].writeOut(baos);
-		}
+		for (Record r : _children) r.writeOut(baos);
 		byte[] data = baos.toByteArray();
 
 		// Save in the escher layer

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java Wed Jun 10 22:23:47 2015
@@ -97,7 +97,7 @@ public final class PPDrawing extends Rec
 		findEscherChildren(erf, contents, 8, len-8, escherChildren);
 		this.childRecords = escherChildren.toArray(new EscherRecord[escherChildren.size()]);
 
-		if (1 == this.childRecords.length && (short)0xf002 == this.childRecords[0].getRecordId() && this.childRecords[0] instanceof EscherContainerRecord) {
+		if (1 == this.childRecords.length && (short)RecordTypes.EscherDgContainer == this.childRecords[0].getRecordId() && this.childRecords[0] instanceof EscherContainerRecord) {
 			this.textboxWrappers = findInDgContainer((EscherContainerRecord) this.childRecords[0]);
 		} else {
 			// Find and EscherTextboxRecord's, and wrap them up
@@ -106,37 +106,30 @@ public final class PPDrawing extends Rec
 			this.textboxWrappers = textboxes.toArray(new EscherTextboxWrapper[textboxes.size()]);
 		}
 	}
-	private EscherTextboxWrapper[] findInDgContainer(final EscherContainerRecord escherContainerF002) {
+	private EscherTextboxWrapper[] findInDgContainer(final EscherContainerRecord dgContainer) {
 		final List<EscherTextboxWrapper> found = new LinkedList<EscherTextboxWrapper>();
-		final EscherContainerRecord SpgrContainer = findFirstEscherContainerRecordOfType((short)0xf003, escherContainerF002);
-		final EscherContainerRecord[] escherContainersF004 = findAllEscherContainerRecordOfType((short)0xf004, SpgrContainer);
-		for (EscherContainerRecord spContainer : escherContainersF004) {
+		final EscherContainerRecord spgrContainer = findFirstEscherContainerRecordOfType((short)RecordTypes.EscherSpgrContainer, dgContainer);
+		final EscherContainerRecord[] spContainers = findAllEscherContainerRecordOfType((short)RecordTypes.EscherSpContainer, spgrContainer);
+		for (EscherContainerRecord spContainer : spContainers) {
 			StyleTextProp9Atom nineAtom = findInSpContainer(spContainer);
-			EscherSpRecord sp = null;
-			final EscherRecord escherContainerF00A = findFirstEscherRecordOfType((short)0xf00a, spContainer);
-			if (null != escherContainerF00A) {
-				if (escherContainerF00A instanceof EscherSpRecord) {
-					sp = (EscherSpRecord) escherContainerF00A;
-				}
-			}
-			final EscherRecord escherContainerF00D = findFirstEscherRecordOfType((short)0xf00d, spContainer);
-			if (null == escherContainerF00D) { continue; }
-			if (escherContainerF00D instanceof EscherTextboxRecord) {
-				EscherTextboxRecord tbr = (EscherTextboxRecord) escherContainerF00D;
-				EscherTextboxWrapper w = new EscherTextboxWrapper(tbr);
-				w.setStyleTextProp9Atom(nineAtom);
-				if (null != sp) {
-					w.setShapeId(sp.getShapeId());
-				}
-				found.add(w);
+			EscherSpRecord sp = (EscherSpRecord)findFirstEscherRecordOfType((short)RecordTypes.EscherSp, spContainer);
+			EscherTextboxRecord clientTextbox = (EscherTextboxRecord)findFirstEscherRecordOfType((short)RecordTypes.EscherClientTextbox, spContainer);
+			if (null == clientTextbox) { continue; }
+
+			EscherTextboxWrapper w = new EscherTextboxWrapper(clientTextbox);
+			w.setStyleTextProp9Atom(nineAtom);
+			if (null != sp) {
+			    w.setShapeId(sp.getShapeId());
 			}
+			found.add(w);
 		}
 		return found.toArray(new EscherTextboxWrapper[found.size()]);
 	}
+	
 	private StyleTextProp9Atom findInSpContainer(final EscherContainerRecord spContainer) {
-		final EscherContainerRecord escherContainerF011 = findFirstEscherContainerRecordOfType((short)0xf011, spContainer);
-		if (null == escherContainerF011) { return null; }
-		final EscherContainerRecord escherContainer1388 = findFirstEscherContainerRecordOfType((short)0x1388, escherContainerF011);
+		EscherContainerRecord clientData = findFirstEscherContainerRecordOfType((short)RecordTypes.EscherClientData, spContainer);
+		if (null == clientData) { return null; }
+		final EscherContainerRecord escherContainer1388 = findFirstEscherContainerRecordOfType((short)0x1388, clientData);
 		if (null == escherContainer1388) { return null; }
 		final EscherContainerRecord escherContainer138A = findFirstEscherContainerRecordOfType((short)0x138A, escherContainer1388);
 		if (null == escherContainer138A) { return null; }

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/RecordContainer.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/RecordContainer.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/RecordContainer.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/RecordContainer.java Wed Jun 10 22:23:47 2015
@@ -294,7 +294,7 @@ public abstract class RecordContainer ex
 			// Write out our header, less the size
 			mout.write(new byte[] {headerA,headerB});
 			byte[] typeB = new byte[2];
-			LittleEndian.putShort(typeB,(short)type);
+			LittleEndian.putShort(typeB, 0, (short)type);
 			mout.write(typeB);
 			mout.write(new byte[4]);
 
@@ -320,7 +320,7 @@ public abstract class RecordContainer ex
 			// Write out our header, less the size
 			baos.write(new byte[] {headerA,headerB});
 			byte[] typeB = new byte[2];
-			LittleEndian.putShort(typeB,(short)type);
+			LittleEndian.putShort(typeB,0,(short)type);
 			baos.write(typeB);
 			baos.write(new byte[] {0,0,0,0});
 

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/SlideListWithText.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/SlideListWithText.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/SlideListWithText.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/record/SlideListWithText.java Wed Jun 10 22:23:47 2015
@@ -93,8 +93,6 @@ public final class SlideListWithText ext
 				}
 
 				int clen = endPos - i - 1;
-				boolean emptySet = false;
-				if(clen == 0) { emptySet = true; }
 
 				// Create a SlideAtomsSets, not caring if they're empty
 				//if(emptySet) { continue; }
@@ -149,7 +147,7 @@ public final class SlideListWithText ext
 	}
 
 	public void setInstance(int inst){
-		LittleEndian.putShort(_header, (short)((inst << 4) | 0xF));
+		LittleEndian.putShort(_header, 0, (short)((inst << 4) | 0xF));
 	}
 
 	/**

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFill.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFill.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFill.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFill.java Wed Jun 10 22:23:47 2015
@@ -128,9 +128,10 @@ public final class HSLFFill {
                         };
                     }
                     case FILL_PICTURE: {
+                        final HSLFPictureData pd = getPictureData();
+                        if (pd == null) break;
+                        
                         return new TexturePaint() {
-                            final HSLFPictureData pd = getPictureData();
-                            
                             public InputStream getImageData() {
                                 return new ByteArrayInputStream(pd.getData());
                             }

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java Wed Jun 10 22:23:47 2015
@@ -21,8 +21,7 @@ import java.awt.geom.Rectangle2D;
 import java.util.*;
 
 import org.apache.poi.ddf.*;
-import org.apache.poi.sl.usermodel.ShapeContainer;
-import org.apache.poi.sl.usermodel.ShapeType;
+import org.apache.poi.sl.usermodel.*;
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.POILogger;
 
@@ -31,7 +30,7 @@ import org.apache.poi.util.POILogger;
  *
  * @author Yegor Kozlov
  */
-public class HSLFGroupShape extends HSLFShape implements ShapeContainer<HSLFShape> {
+public class HSLFGroupShape extends HSLFShape implements GroupShape<HSLFShape> {
 
     /**
       * Create a new ShapeGroup. This constructor is used when a new shape is created.
@@ -87,13 +86,8 @@ public class HSLFGroupShape extends HSLF
         spgr.setRectY2((anchor.y + anchor.height)*MASTER_DPI/POINT_DPI);
     }
 
-    /**
-     * Sets the coordinate space of this group.  All children are constrained
-     * to these coordinates.
-     *
-     * @param anchor the coordinate space of this group
-     */
-    public void setCoordinates(Rectangle2D anchor){
+    @Override
+    public void setInteriorAnchor(Rectangle2D anchor){
         EscherSpgrRecord spgr = getEscherChild(EscherSpgrRecord.RECORD_ID);
 
         int x1 = (int)Math.round(anchor.getX()*MASTER_DPI/POINT_DPI);
@@ -108,22 +102,14 @@ public class HSLFGroupShape extends HSLF
 
     }
 
-    /**
-     * Gets the coordinate space of this group.  All children are constrained
-     * to these coordinates.
-     *
-     * @return the coordinate space of this group
-     */
-    public Rectangle2D getCoordinates(){
-        EscherSpgrRecord spgr = getEscherChild(EscherSpgrRecord.RECORD_ID);
-
-        Rectangle2D.Float anchor = new Rectangle2D.Float();
-        anchor.x = (float)spgr.getRectX1()*POINT_DPI/MASTER_DPI;
-        anchor.y = (float)spgr.getRectY1()*POINT_DPI/MASTER_DPI;
-        anchor.width = (float)(spgr.getRectX2() - spgr.getRectX1())*POINT_DPI/MASTER_DPI;
-        anchor.height = (float)(spgr.getRectY2() - spgr.getRectY1())*POINT_DPI/MASTER_DPI;
-
-        return anchor;
+    @Override
+    public Rectangle2D getInteriorAnchor(){
+        EscherSpgrRecord rec = getEscherChild(EscherSpgrRecord.RECORD_ID);
+        double x = rec.getRectX1()*POINT_DPI/MASTER_DPI;
+        double y = rec.getRectY1()*POINT_DPI/MASTER_DPI;
+        double width = (rec.getRectX2()-rec.getRectX1())*POINT_DPI/MASTER_DPI;
+        double height = (rec.getRectY2()-rec.getRectY1())*POINT_DPI/MASTER_DPI;
+        return new Rectangle2D.Double(x,y,width,height);
     }
 
     /**
@@ -199,21 +185,21 @@ public class HSLFGroupShape extends HSLF
      */
     public Rectangle2D getAnchor2D(){
         EscherClientAnchorRecord clientAnchor = getEscherChild(EscherClientAnchorRecord.RECORD_ID);
-        Rectangle2D.Float anchor = new Rectangle2D.Float();
+        Rectangle2D anchor;
         if(clientAnchor == null){
             logger.log(POILogger.INFO, "EscherClientAnchorRecord was not found for shape group. Searching for EscherChildAnchorRecord.");
             EscherChildAnchorRecord rec = getEscherChild(EscherChildAnchorRecord.RECORD_ID);
-            anchor = new Rectangle2D.Float(
-                (float)rec.getDx1()*POINT_DPI/MASTER_DPI,
-                (float)rec.getDy1()*POINT_DPI/MASTER_DPI,
-                (float)(rec.getDx2()-rec.getDx1())*POINT_DPI/MASTER_DPI,
-                (float)(rec.getDy2()-rec.getDy1())*POINT_DPI/MASTER_DPI
-            );
+            double x = rec.getDx1()*POINT_DPI/MASTER_DPI;
+            double y = rec.getDy1()*POINT_DPI/MASTER_DPI;
+            double width = (rec.getDx2()-rec.getDx1())*POINT_DPI/MASTER_DPI;
+            double height = (rec.getDy2()-rec.getDy1())*POINT_DPI/MASTER_DPI;
+            anchor = new Rectangle2D.Double(x,y,width,height);
         } else {
-            anchor.x = (float)clientAnchor.getCol1()*POINT_DPI/MASTER_DPI;
-            anchor.y = (float)clientAnchor.getFlag()*POINT_DPI/MASTER_DPI;
-            anchor.width = (float)(clientAnchor.getDx1() - clientAnchor.getCol1())*POINT_DPI/MASTER_DPI ;
-            anchor.height = (float)(clientAnchor.getRow1() - clientAnchor.getFlag())*POINT_DPI/MASTER_DPI;
+            double x = clientAnchor.getCol1()*POINT_DPI/MASTER_DPI;
+            double y = clientAnchor.getFlag()*POINT_DPI/MASTER_DPI;
+            double width = (clientAnchor.getDx1() - clientAnchor.getCol1())*POINT_DPI/MASTER_DPI ;
+            double height = (clientAnchor.getRow1() - clientAnchor.getFlag())*POINT_DPI/MASTER_DPI;
+            anchor = new Rectangle2D.Double(x,y,width,height);
         }
 
         return anchor;

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFNotes.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFNotes.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFNotes.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFNotes.java Wed Jun 10 22:23:47 2015
@@ -35,7 +35,7 @@ import org.apache.poi.util.POILogger;
 public final class HSLFNotes extends HSLFSheet implements Notes<HSLFShape, HSLFSlideShow> {
     protected static POILogger logger = POILogFactory.getLogger(HSLFNotes.class);
     
-    private List<List<HSLFTextParagraph>> _runs;
+    private List<List<HSLFTextParagraph>> _paragraphs = new ArrayList<List<HSLFTextParagraph>>();
 
     /**
      * Constructs a Notes Sheet from the given Notes record.
@@ -49,13 +49,16 @@ public final class HSLFNotes extends HSL
         // Now, build up TextRuns from pairs of TextHeaderAtom and
         // one of TextBytesAtom or TextCharsAtom, found inside
         // EscherTextboxWrapper's in the PPDrawing
-        _runs = HSLFTextParagraph.findTextParagraphs(getPPDrawing());
-        if (_runs.isEmpty()) {
+        for (List<HSLFTextParagraph> l : HSLFTextParagraph.findTextParagraphs(getPPDrawing(), this)) {
+            if (!_paragraphs.contains(l)) _paragraphs.add(l);
+        }
+        
+        if (_paragraphs.isEmpty()) {
             logger.log(POILogger.WARN, "No text records found for notes sheet");
         }
 
         // Set the sheet on each TextRun
-        for (List<HSLFTextParagraph> ltp : _runs) {
+        for (List<HSLFTextParagraph> ltp : _paragraphs) {
             for (HSLFTextParagraph tp : ltp) {
                 tp.supplySheet(this);
             }
@@ -67,7 +70,7 @@ public final class HSLFNotes extends HSL
      */
     @Override
     public List<List<HSLFTextParagraph>> getTextParagraphs() {
-        return _runs;
+        return _paragraphs;
     }
 
     /**

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureData.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureData.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureData.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureData.java Wed Jun 10 22:23:47 2015
@@ -17,31 +17,22 @@
 
 package org.apache.poi.hslf.usermodel;
 
-import java.awt.Graphics2D;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.security.MessageDigest;
 
-import org.apache.poi.hslf.blip.BitmapPainter;
-import org.apache.poi.hslf.blip.DIB;
-import org.apache.poi.hslf.blip.EMF;
-import org.apache.poi.hslf.blip.ImagePainter;
-import org.apache.poi.hslf.blip.JPEG;
-import org.apache.poi.hslf.blip.PICT;
-import org.apache.poi.hslf.blip.PNG;
-import org.apache.poi.hslf.blip.WMF;
+import org.apache.poi.hslf.blip.*;
 import org.apache.poi.poifs.crypt.CryptoFunctions;
 import org.apache.poi.poifs.crypt.HashAlgorithm;
-import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
+import org.apache.poi.sl.usermodel.PictureData;
+import org.apache.poi.util.*;
 
 /**
  * A class that represents image data contained in a slide show.
  *
  *  @author Yegor Kozlov
  */
-public abstract class HSLFPictureData {
+public abstract class HSLFPictureData implements PictureData {
 
     protected POILogger logger = POILogFactory.getLogger(this.getClass());
 
@@ -91,13 +82,6 @@ public abstract class HSLFPictureData {
      */
     protected abstract int getSignature();
 
-    protected static final ImagePainter[] painters = new ImagePainter[8];
-    static {
-        HSLFPictureData.setImagePainter(HSLFPictureShape.PNG, new BitmapPainter());
-        HSLFPictureData.setImagePainter(HSLFPictureShape.JPEG, new BitmapPainter());
-        HSLFPictureData.setImagePainter(HSLFPictureShape.DIB, new BitmapPainter());
-    }
-
     /**
      * Returns the raw binary data of this Picture excluding the first 8 bytes
      * which hold image signature and size of the image data.
@@ -233,31 +217,4 @@ public abstract class HSLFPictureData {
     public int getSize(){
         return getData().length;
     }
-
-    public void draw(Graphics2D graphics, HSLFPictureShape parent){
-        ImagePainter painter = painters[getType()];
-        if(painter != null) painter.paint(graphics, this, parent);
-        else logger.log(POILogger.WARN, "Rendering is not supported: " + getClass().getName());
-    }
-
-    /**
-     * Register ImagePainter for the specified image type
-     *
-     * @param type  image type, must be one of the static constants defined in the <code>Picture<code> class.
-     * @param painter
-     */
-    public static void setImagePainter(int type, ImagePainter painter){
-        painters[type] = painter;
-    }
-
-    /**
-     * Return ImagePainter for the specified image type
-     *
-     * @param type blip type, must be one of the static constants defined in the <code>Picture<code> class.
-     * @return ImagePainter for the specified image type
-     */
-    public static ImagePainter getImagePainter(int type){
-        return painters[type];
-    }
-
 }

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureShape.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureShape.java Wed Jun 10 22:23:47 2015
@@ -28,8 +28,7 @@ import javax.imageio.ImageIO;
 import org.apache.poi.ddf.*;
 import org.apache.poi.hslf.blip.Bitmap;
 import org.apache.poi.hslf.record.Document;
-import org.apache.poi.sl.usermodel.ShapeContainer;
-import org.apache.poi.sl.usermodel.ShapeType;
+import org.apache.poi.sl.usermodel.*;
 import org.apache.poi.util.*;
 
 
@@ -38,7 +37,7 @@ import org.apache.poi.util.*;
  *
  * @author Yegor Kozlov
  */
-public class HSLFPictureShape extends HSLFSimpleShape {
+public class HSLFPictureShape extends HSLFSimpleShape implements PictureShape {
 
     /**
     *  Windows Enhanced Metafile (EMF)
@@ -165,11 +164,7 @@ public class HSLFPictureShape extends HS
         }
     }
 
-    /**
-     * Returns the picture data for this picture.
-     *
-     * @return the picture data for this picture.
-     */
+    @Override
     public HSLFPictureData getPictureData(){
         HSLFSlideShow ppt = getSheet().getSlideShow();
         HSLFPictureData[] pict = ppt.getPictureData();
@@ -247,13 +242,11 @@ public class HSLFPictureShape extends HS
     }
 
     /**
-     * Returns the clipping values as percent ratio relatively to the image size.
      * The anchor specified by {@link #getLogicalAnchor2D()} is the displayed size,
      * i.e. the size of the already clipped image
-     * 
-     * @return the clipping as insets converted/scaled to 100000 (=100%) 
      */
-    public Insets getBlipClip() {
+    @Override
+    public Insets getClipping() {
         EscherOptRecord opt = getEscherOptRecord();
         
         double top    = getFractProp(opt, EscherProperties.BLIP__CROPFROMTOP);

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShape.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShape.java Wed Jun 10 22:23:47 2015
@@ -165,14 +165,12 @@ public abstract class HSLFShape implemen
     public Rectangle2D getAnchor2D(){
         EscherSpRecord spRecord = getEscherChild(EscherSpRecord.RECORD_ID);
         int flags = spRecord.getFlags();
-        Rectangle2D anchor=null;
+        Rectangle2D anchor;
         if ((flags & EscherSpRecord.FLAG_CHILD) != 0){
             EscherChildAnchorRecord rec = getEscherChild(EscherChildAnchorRecord.RECORD_ID);
-            anchor = new java.awt.Rectangle();
             if(rec == null){
                 logger.log(POILogger.WARN, "EscherSpRecord.FLAG_CHILD is set but EscherChildAnchorRecord was not found");
                 EscherClientAnchorRecord clrec = getEscherChild(EscherClientAnchorRecord.RECORD_ID);
-                anchor = new java.awt.Rectangle();
                 anchor = new Rectangle2D.Float(
                     (float)clrec.getCol1()*POINT_DPI/MASTER_DPI,
                     (float)clrec.getFlag()*POINT_DPI/MASTER_DPI,
@@ -187,10 +185,8 @@ public abstract class HSLFShape implemen
                     (float)(rec.getDy2()-rec.getDy1())*POINT_DPI/MASTER_DPI
                 );
             }
-        }
-        else {
+        } else {
             EscherClientAnchorRecord rec = getEscherChild(EscherClientAnchorRecord.RECORD_ID);
-            anchor = new java.awt.Rectangle();
             anchor = new Rectangle2D.Float(
                 (float)rec.getCol1()*POINT_DPI/MASTER_DPI,
                 (float)rec.getFlag()*POINT_DPI/MASTER_DPI,
@@ -201,10 +197,6 @@ public abstract class HSLFShape implemen
         return anchor;
     }
 
-    public Rectangle2D getLogicalAnchor2D(){
-        return getAnchor2D();
-    }
-
     /**
      * Sets the anchor (the bounding box rectangle) of this shape.
      * All coordinates should be expressed in points (72 dpi).
@@ -262,8 +254,9 @@ public abstract class HSLFShape implemen
      * @return escher property or <code>null</code> if not found.
      */
      public static <T extends EscherProperty> T getEscherProperty(EscherOptRecord opt, int propId){
-        return opt.lookup(propId);
-    }
+         if (opt == null) return null;
+         return opt.lookup(propId);
+     }
 
     /**
      * Set an escher property for this shape.
@@ -475,15 +468,6 @@ public abstract class HSLFShape implemen
         logger.log(POILogger.INFO, "Rendering " + getShapeName());
     }
 
-    /**
-     * Return shape outline as a java.awt.Shape object
-     *
-     * @return the shape outline
-     */
-    public java.awt.Shape getOutline(){
-        return getLogicalAnchor2D();
-    }
-    
     public EscherOptRecord getEscherOptRecord() {
         EscherOptRecord opt = getEscherChild(EscherOptRecord.RECORD_ID);
         if (opt == null) {
@@ -516,8 +500,7 @@ public abstract class HSLFShape implemen
 
     public double getRotation(){
         int rot = getEscherProperty(EscherProperties.TRANSFORM__ROTATION);
-        double angle = Units.fixedPointToDouble(rot) % 360.0;
-        return angle;
+        return Units.fixedPointToDouble(rot);
     }
     
     public void setRotation(double theta){

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapeFactory.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapeFactory.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapeFactory.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapeFactory.java Wed Jun 10 22:23:47 2015
@@ -69,7 +69,7 @@ public final class HSLFShapeFactory {
                 List<EscherProperty> props = f.createProperties( opt.serialize(), 8, opt.getInstance() );
                 EscherSimpleProperty p = (EscherSimpleProperty)props.get(0);
                 if(p.getPropertyNumber() == 0x39F && p.getPropertyValue() == 1){
-                    group = new Table(spContainer, parent);
+                    group = new HSLFTable(spContainer, parent);
                 } else {
                     group = new HSLFGroupShape(spContainer, parent);
                 }

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSheet.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSheet.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSheet.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSheet.java Wed Jun 10 22:23:47 2015
@@ -22,6 +22,8 @@ import java.util.*;
 
 import org.apache.poi.ddf.*;
 import org.apache.poi.hslf.record.*;
+import org.apache.poi.sl.draw.DrawFactory;
+import org.apache.poi.sl.draw.Drawable;
 import org.apache.poi.sl.usermodel.Sheet;
 import org.apache.poi.util.POILogFactory;
 import org.apache.poi.util.POILogger;
@@ -288,8 +290,11 @@ public abstract class HSLFSheet implemen
         return _background;
     }
 
-    public void draw(Graphics2D graphics){
-
+    @Override
+    public void draw(Graphics2D graphics) {
+        DrawFactory drawFact = DrawFactory.getInstance(graphics);
+        Drawable draw = drawFact.getDrawable(this);
+        draw.draw(graphics);
     }
 
     /**

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java Wed Jun 10 22:23:47 2015
@@ -18,16 +18,15 @@
 package org.apache.poi.hslf.usermodel;
 
 import java.awt.Color;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Rectangle2D;
 import java.io.ByteArrayOutputStream;
-import java.util.ArrayList;
 
 import org.apache.poi.ddf.*;
 import org.apache.poi.hslf.exceptions.HSLFException;
 import org.apache.poi.hslf.record.*;
+import org.apache.poi.sl.draw.DrawPaint;
 import org.apache.poi.sl.draw.geom.*;
 import org.apache.poi.sl.usermodel.*;
+import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint;
 import org.apache.poi.sl.usermodel.StrokeStyle.LineCompound;
 import org.apache.poi.sl.usermodel.StrokeStyle.LineDash;
 import org.apache.poi.util.LittleEndian;
@@ -196,7 +195,7 @@ public abstract class HSLFSimpleShape ex
     public StrokeStyle getStrokeStyle(){
         return new StrokeStyle() {
             public PaintStyle getPaint() {
-                return null;
+                return DrawPaint.createSolidPaint(HSLFSimpleShape.this.getLineColor());
             }
 
             public LineCap getLineCap() {
@@ -204,15 +203,15 @@ public abstract class HSLFSimpleShape ex
             }
 
             public LineDash getLineDash() {
-                return null;
+                return HSLFSimpleShape.this.getLineDashing();
             }
 
             public LineCompound getLineCompound() {
-                return null;
+                return HSLFSimpleShape.this.getLineCompound();
             }
 
             public double getLineWidth() {
-                return 0;
+                return HSLFSimpleShape.this.getLineWidth();
             }
             
         };
@@ -235,61 +234,6 @@ public abstract class HSLFSimpleShape ex
     }
 
     /**
-     *
-     * @return 'absolute' anchor of this shape relative to the parent sheet
-     */
-    public Rectangle2D getLogicalAnchor2D(){
-        Rectangle2D anchor = getAnchor2D();
-
-        //if it is a groupped shape see if we need to transform the coordinates
-        if (getParent() != null){
-            ArrayList<HSLFGroupShape> lst = new ArrayList<HSLFGroupShape>();
-            for (ShapeContainer<HSLFShape> parent=this.getParent();
-                parent instanceof HSLFGroupShape;
-                parent = ((HSLFGroupShape)parent).getParent()) {
-                lst.add(0, (HSLFGroupShape)parent);
-            }
-            
-            AffineTransform tx = new AffineTransform();
-            for(HSLFGroupShape prnt : lst) {
-                Rectangle2D exterior = prnt.getAnchor2D();
-                Rectangle2D interior = prnt.getCoordinates();
-
-                double scaleX =  exterior.getWidth() / interior.getWidth();
-                double scaleY = exterior.getHeight() / interior.getHeight();
-
-                tx.translate(exterior.getX(), exterior.getY());
-                tx.scale(scaleX, scaleY);
-                tx.translate(-interior.getX(), -interior.getY());
-                
-            }
-            anchor = tx.createTransformedShape(anchor).getBounds2D();
-        }
-
-        double angle = getRotation();
-        if(angle != 0.){
-            double centerX = anchor.getX() + anchor.getWidth()/2;
-            double centerY = anchor.getY() + anchor.getHeight()/2;
-
-            AffineTransform trans = new AffineTransform();
-            trans.translate(centerX, centerY);
-            trans.rotate(Math.toRadians(angle));
-            trans.translate(-centerX, -centerY);
-
-            Rectangle2D rect = trans.createTransformedShape(anchor).getBounds2D();
-            if((anchor.getWidth() < anchor.getHeight() && rect.getWidth() > rect.getHeight()) ||
-                (anchor.getWidth() > anchor.getHeight() && rect.getWidth() < rect.getHeight())    ){
-                trans = new AffineTransform();
-                trans.translate(centerX, centerY);
-                trans.rotate(Math.PI/2);
-                trans.translate(-centerX, -centerY);
-                anchor = trans.createTransformedShape(anchor).getBounds2D();
-            }
-        }
-        return anchor;
-    }
-
-    /**
      *  Find a record in the underlying EscherClientDataRecord
      *
      * @param recordType type of the record to search
@@ -424,11 +368,6 @@ public abstract class HSLFSimpleShape ex
         return (adjval == -1) ? null : new Guide(name, "val "+adjval);
     }
 
-    public LineDecoration getLineDecoration() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
     public CustomGeometry getGeometry() {
         ShapeType st = getShapeType();
         String name = st.getOoxmlName();
@@ -442,11 +381,89 @@ public abstract class HSLFSimpleShape ex
         return geom;
     }
 
-    public Shadow getShadow() {
-        // TODO Auto-generated method stub
-        return null;
-    }
 
+    public double getShadowAngle() {
+        EscherOptRecord opt = getEscherOptRecord();
+        EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.SHADOWSTYLE__OFFSETX);
+        int offX = (prop == null) ? 0 : prop.getPropertyValue();
+        prop = getEscherProperty(opt, EscherProperties.SHADOWSTYLE__OFFSETY);
+        int offY = (prop == null) ? 0 : prop.getPropertyValue();
+        return Math.toDegrees(Math.atan2(offY, offX));
+    }
     
+    public double getShadowDistance() {
+        EscherOptRecord opt = getEscherOptRecord();
+        EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.SHADOWSTYLE__OFFSETX);
+        int offX = (prop == null) ? 0 : prop.getPropertyValue();
+        prop = getEscherProperty(opt, EscherProperties.SHADOWSTYLE__OFFSETY);
+        int offY = (prop == null) ? 0 : prop.getPropertyValue();
+        return Units.toPoints((long)Math.hypot(offX, offY));
+    }
+
+    /**
+     * @return color of the line. If color is not set returns <code>java.awt.Color.black</code>
+     */
+    public Color getShadowColor(){
+        Color clr = getColor(EscherProperties.SHADOWSTYLE__COLOR, EscherProperties.SHADOWSTYLE__OPACITY, -1);
+        return clr == null ? Color.black : clr;
+    }    
     
+    public Shadow getShadow() {
+        EscherOptRecord opt = getEscherOptRecord();
+        EscherProperty shadowType = opt.lookup(EscherProperties.SHADOWSTYLE__TYPE);
+        if (shadowType == null) return null;
+        
+        return new Shadow(){
+            public SimpleShape getShadowParent() {
+                return HSLFSimpleShape.this;
+            }
+
+            public double getDistance() {
+                return getShadowDistance();
+            }
+
+            public double getAngle() {
+                return getShadowAngle();
+            }
+
+            public double getBlur() {
+                // TODO Auto-generated method stub
+                return 0;
+            }
+
+            public SolidPaint getFillStyle() {
+                return DrawPaint.createSolidPaint(getShadowColor());
+            }
+            
+        };
+    }
+
+    public LineDecoration getLineDecoration() {
+        return new LineDecoration() {
+
+            public DecorationShape getHeadShape() {
+                return DecorationShape.NONE;
+            }
+
+            public DecorationSize getHeadWidth() {
+                return DecorationSize.MEDIUM;
+            }
+
+            public DecorationSize getHeadLength() {
+                return DecorationSize.MEDIUM;
+            }
+
+            public DecorationShape getTailShape() {
+                return DecorationShape.NONE;
+            }
+
+            public DecorationSize getTailWidth() {
+                return DecorationSize.MEDIUM;
+            }
+
+            public DecorationSize getTailLength() {
+                return DecorationSize.MEDIUM;
+            }
+        };
+    }
 }

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlide.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlide.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlide.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlide.java Wed Jun 10 22:23:47 2015
@@ -72,7 +72,9 @@ public final class HSLFSlide extends HSL
 		}
 
 		// Grab text from slide's PPDrawing
-		_paragraphs.addAll(HSLFTextParagraph.findTextParagraphs(getPPDrawing()));
+		for (List<HSLFTextParagraph> l : HSLFTextParagraph.findTextParagraphs(getPPDrawing(), this)) {
+		    if (!_paragraphs.contains(l)) _paragraphs.add(l);
+		}
 
         for(List<HSLFTextParagraph> ltp : _paragraphs) {
             for (HSLFTextParagraph tp : ltp) {

Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideMaster.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideMaster.java?rev=1684773&r1=1684772&r2=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideMaster.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideMaster.java Wed Jun 10 22:23:47 2015
@@ -32,7 +32,7 @@ import org.apache.poi.hslf.record.*;
  * @author Yegor Kozlov
  */
 public final class HSLFSlideMaster extends HSLFMasterSheet {
-    private final List<List<HSLFTextParagraph>> _runs = new ArrayList<List<HSLFTextParagraph>>();
+    private final List<List<HSLFTextParagraph>> _paragraphs = new ArrayList<List<HSLFTextParagraph>>();
 
     /**
      * all TxMasterStyleAtoms available in this master
@@ -46,8 +46,11 @@ public final class HSLFSlideMaster exten
     public HSLFSlideMaster(MainMaster record, int sheetNo) {
         super(record, sheetNo);
 
-        _runs.addAll(HSLFTextParagraph.findTextParagraphs(getPPDrawing()));
-        for (List<HSLFTextParagraph> p : _runs) {
+        for (List<HSLFTextParagraph> l : HSLFTextParagraph.findTextParagraphs(getPPDrawing(), this)) {
+            if (!_paragraphs.contains(l)) _paragraphs.add(l);
+        }
+
+        for (List<HSLFTextParagraph> p : _paragraphs) {
             for (HSLFTextParagraph htp : p) {
                 htp.supplySheet(this);
             }
@@ -58,7 +61,7 @@ public final class HSLFSlideMaster exten
      * Returns an array of all the TextRuns found
      */
     public List<List<HSLFTextParagraph>> getTextParagraphs() {
-        return _runs;
+        return _paragraphs;
     }
 
     /**
@@ -138,7 +141,7 @@ public final class HSLFSlideMaster exten
 
     protected void onAddTextShape(HSLFTextShape shape) {
         List<HSLFTextParagraph> runs = shape.getTextParagraphs();
-        _runs.add(runs);
+        _paragraphs.add(runs);
     }
 
     public TxMasterStyleAtom[] getTxMasterStyleAtoms(){

Copied: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTable.java (from r1678838, poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Table.java)
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTable.java?p2=poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTable.java&p1=poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Table.java&r1=1678838&r2=1684773&rev=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/Table.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTable.java Wed Jun 10 22:23:47 2015
@@ -15,9 +15,10 @@
    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.model.Line;
 import org.apache.poi.hslf.usermodel.*;
 import org.apache.poi.sl.usermodel.ShapeContainer;
 import org.apache.poi.util.LittleEndian;
@@ -31,7 +32,7 @@ import java.awt.*;
  *
  * @author Yegor Kozlov
  */
-public final class Table extends HSLFGroupShape {
+public final class HSLFTable extends HSLFGroupShape {
 
     protected static final int BORDER_TOP = 1;
     protected static final int BORDER_RIGHT = 2;
@@ -44,7 +45,7 @@ public final class Table extends HSLFGro
     protected static final int BORDERS_NONE = 8;
 
 
-    protected TableCell[][] cells;
+    protected HSLFTableCell[][] cells;
 
     /**
      * Create a new Table of the given number of rows and columns
@@ -52,23 +53,23 @@ public final class Table extends HSLFGro
      * @param numrows the number of rows
      * @param numcols the number of columns
      */
-    public Table(int numrows, int numcols) {
+    public HSLFTable(int numrows, int numcols) {
         super();
 
         if(numrows < 1) throw new IllegalArgumentException("The number of rows must be greater than 1");
         if(numcols < 1) throw new IllegalArgumentException("The number of columns must be greater than 1");
 
         int x=0, y=0, tblWidth=0, tblHeight=0;
-        cells = new TableCell[numrows][numcols];
+        cells = new HSLFTableCell[numrows][numcols];
         for (int i = 0; i < cells.length; i++) {
             x = 0;
             for (int j = 0; j < cells[i].length; j++) {
-                cells[i][j] = new TableCell(this);
-                Rectangle anchor = new Rectangle(x, y, TableCell.DEFAULT_WIDTH, TableCell.DEFAULT_HEIGHT);
+                cells[i][j] = new HSLFTableCell(this);
+                Rectangle anchor = new Rectangle(x, y, HSLFTableCell.DEFAULT_WIDTH, HSLFTableCell.DEFAULT_HEIGHT);
                 cells[i][j].setAnchor(anchor);
-                x += TableCell.DEFAULT_WIDTH;
+                x += HSLFTableCell.DEFAULT_WIDTH;
             }
-            y += TableCell.DEFAULT_HEIGHT;
+            y += HSLFTableCell.DEFAULT_HEIGHT;
         }
         tblWidth = x;
         tblHeight = y;
@@ -94,7 +95,7 @@ public final class Table extends HSLFGro
      * @param escherRecord <code>EscherSpContainer</code> container which holds information about this shape
      * @param parent       the parent of the shape
      */
-    public Table(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent) {
+    public HSLFTable(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent) {
         super(escherRecord, parent);
     }
 
@@ -105,7 +106,7 @@ public final class Table extends HSLFGro
      * @param col the column index (0-based)
      * @return the cell
      */
-    public TableCell getCell(int row, int col) {
+    public HSLFTableCell getCell(int row, int col) {
         return cells[row][col];
     }
 
@@ -124,13 +125,13 @@ public final class Table extends HSLFGro
         EscherOptRecord opt = (EscherOptRecord)lst.get(lst.size()-2);
         EscherArrayProperty p = opt.lookup(0x3A0); 
         for (int i = 0; i < cells.length; i++) {
-            TableCell cell = cells[i][0];
+            HSLFTableCell cell = cells[i][0];
             int rowHeight = cell.getAnchor().height*MASTER_DPI/POINT_DPI;
             byte[] val = new byte[4];
             LittleEndian.putInt(val, 0, rowHeight);
             p.setElement(i, val);
             for (int j = 0; j < cells[i].length; j++) {
-                TableCell c = cells[i][j];
+                HSLFTableCell c = cells[i][j];
                 addShape(c);
 
                 Line bt = c.getBorderTop();
@@ -177,12 +178,12 @@ public final class Table extends HSLFGro
                 maxrowlen = Math.max(maxrowlen, row.size());
             }
         }
-        cells = new TableCell[lst.size()][maxrowlen];
+        cells = new HSLFTableCell[lst.size()][maxrowlen];
         for (int i = 0; i < lst.size(); i++) {
             row = lst.get(i);
             for (int j = 0; j < row.size(); j++) {
                 HSLFTextShape tx = (HSLFTextShape)row.get(j);
-                cells[i][j] = new TableCell(tx.getSpContainer(), getParent());
+                cells[i][j] = new HSLFTableCell(tx.getSpContainer(), getParent());
                 cells[i][j].setSheet(tx.getSheet());
             }
         }
@@ -256,7 +257,7 @@ public final class Table extends HSLFGro
     public void setAllBorders(Line line){
         for (int i = 0; i < cells.length; i++) {
             for (int j = 0; j < cells[i].length; j++) {
-                TableCell cell = cells[i][j];
+                HSLFTableCell cell = cells[i][j];
                 cell.setBorderTop(cloneBorder(line));
                 cell.setBorderLeft(cloneBorder(line));
                 if(j == cells[i].length - 1) cell.setBorderRight(cloneBorder(line));
@@ -273,7 +274,7 @@ public final class Table extends HSLFGro
     public void setOutsideBorders(Line line){
         for (int i = 0; i < cells.length; i++) {
             for (int j = 0; j < cells[i].length; j++) {
-                TableCell cell = cells[i][j];
+                HSLFTableCell cell = cells[i][j];
 
                 if(j == 0) cell.setBorderLeft(cloneBorder(line));
                 if(j == cells[i].length - 1) cell.setBorderRight(cloneBorder(line));
@@ -300,7 +301,7 @@ public final class Table extends HSLFGro
     public void setInsideBorders(Line line){
         for (int i = 0; i < cells.length; i++) {
             for (int j = 0; j < cells[i].length; j++) {
-                TableCell cell = cells[i][j];
+                HSLFTableCell cell = cells[i][j];
 
                 if(j != cells[i].length - 1)
                     cell.setBorderRight(cloneBorder(line));

Copied: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTableCell.java (from r1678838, poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TableCell.java)
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTableCell.java?p2=poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTableCell.java&p1=poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TableCell.java&r1=1678838&r2=1684773&rev=1684773&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/model/TableCell.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTableCell.java Wed Jun 10 22:23:47 2015
@@ -15,15 +15,14 @@
    limitations under the License.
 ==================================================================== */
 
-package org.apache.poi.hslf.model;
+package org.apache.poi.hslf.usermodel;
 
 import java.awt.Rectangle;
 
 import org.apache.poi.ddf.EscherContainerRecord;
 import org.apache.poi.ddf.EscherOptRecord;
 import org.apache.poi.ddf.EscherProperties;
-import org.apache.poi.hslf.usermodel.HSLFShape;
-import org.apache.poi.hslf.usermodel.HSLFTextBox;
+import org.apache.poi.hslf.model.Line;
 import org.apache.poi.sl.usermodel.ShapeContainer;
 import org.apache.poi.sl.usermodel.ShapeType;
 
@@ -32,7 +31,7 @@ import org.apache.poi.sl.usermodel.Shape
  *
  * @author Yegor Kozlov
  */
-public final class TableCell extends HSLFTextBox {
+public final class HSLFTableCell extends HSLFTextBox {
     protected static final int DEFAULT_WIDTH = 100;
     protected static final int DEFAULT_HEIGHT = 40;
 
@@ -47,7 +46,7 @@ public final class TableCell extends HSL
      * @param escherRecord       {@link EscherSpContainer} container which holds information about this shape
      * @param parent    the parent of the shape
      */
-   protected TableCell(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
+   protected HSLFTableCell(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
         super(escherRecord, parent);
     }
 
@@ -57,7 +56,7 @@ public final class TableCell extends HSL
      * @param parent    the parent of this Shape. For example, if this text box is a cell
      * in a table then the parent is Table.
      */
-    public TableCell(ShapeContainer<HSLFShape> parent){
+    public HSLFTableCell(ShapeContainer<HSLFShape> parent){
         super(parent);
 
         setShapeType(ShapeType.RECT);
@@ -81,25 +80,25 @@ public final class TableCell extends HSL
         Rectangle cellAnchor = getAnchor();
         Rectangle lineAnchor = new Rectangle();
         switch(type){
-            case Table.BORDER_TOP:
+            case HSLFTable.BORDER_TOP:
                 lineAnchor.x = cellAnchor.x;
                 lineAnchor.y = cellAnchor.y;
                 lineAnchor.width = cellAnchor.width;
                 lineAnchor.height = 0;
                 break;
-            case Table.BORDER_RIGHT:
+            case HSLFTable.BORDER_RIGHT:
                 lineAnchor.x = cellAnchor.x + cellAnchor.width;
                 lineAnchor.y = cellAnchor.y;
                 lineAnchor.width = 0;
                 lineAnchor.height = cellAnchor.height;
                 break;
-            case Table.BORDER_BOTTOM:
+            case HSLFTable.BORDER_BOTTOM:
                 lineAnchor.x = cellAnchor.x;
                 lineAnchor.y = cellAnchor.y + cellAnchor.height;
                 lineAnchor.width = cellAnchor.width;
                 lineAnchor.height = 0;
                 break;
-            case Table.BORDER_LEFT:
+            case HSLFTable.BORDER_LEFT:
                 lineAnchor.x = cellAnchor.x;
                 lineAnchor.y = cellAnchor.y;
                 lineAnchor.width = 0;
@@ -116,7 +115,7 @@ public final class TableCell extends HSL
     }
 
     public void setBorderLeft(Line line) {
-        if(line != null) anchorBorder(Table.BORDER_LEFT, line);
+        if(line != null) anchorBorder(HSLFTable.BORDER_LEFT, line);
         this.borderLeft = line;
     }
 
@@ -125,7 +124,7 @@ public final class TableCell extends HSL
     }
 
     public void setBorderRight(Line line) {
-        if(line != null) anchorBorder(Table.BORDER_RIGHT, line);
+        if(line != null) anchorBorder(HSLFTable.BORDER_RIGHT, line);
         this.borderRight = line;
     }
 
@@ -134,7 +133,7 @@ public final class TableCell extends HSL
     }
 
     public void setBorderTop(Line line) {
-        if(line != null) anchorBorder(Table.BORDER_TOP, line);
+        if(line != null) anchorBorder(HSLFTable.BORDER_TOP, line);
         this.borderTop = line;
     }
 
@@ -143,16 +142,16 @@ public final class TableCell extends HSL
     }
 
     public void setBorderBottom(Line line) {
-        if(line != null) anchorBorder(Table.BORDER_BOTTOM, line);
+        if(line != null) anchorBorder(HSLFTable.BORDER_BOTTOM, line);
         this.borderBottom = line;
     }
 
     public void setAnchor(Rectangle anchor){
         super.setAnchor(anchor);
 
-        if(borderTop != null) anchorBorder(Table.BORDER_TOP, borderTop);
-        if(borderRight != null) anchorBorder(Table.BORDER_RIGHT, borderRight);
-        if(borderBottom != null) anchorBorder(Table.BORDER_BOTTOM, borderBottom);
-        if(borderLeft != null) anchorBorder(Table.BORDER_LEFT, borderLeft);
+        if(borderTop != null) anchorBorder(HSLFTable.BORDER_TOP, borderTop);
+        if(borderRight != null) anchorBorder(HSLFTable.BORDER_RIGHT, borderRight);
+        if(borderBottom != null) anchorBorder(HSLFTable.BORDER_BOTTOM, borderBottom);
+        if(borderLeft != null) anchorBorder(HSLFTable.BORDER_LEFT, borderLeft);
     }
 }



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