You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ye...@apache.org on 2012/02/22 14:23:32 UTC

svn commit: r1292273 - in /poi/trunk: src/documentation/content/xdocs/ src/scratchpad/src/org/apache/poi/hslf/model/ src/scratchpad/testcases/org/apache/poi/hslf/model/ test-data/slideshow/

Author: yegor
Date: Wed Feb 22 13:23:31 2012
New Revision: 1292273

URL: http://svn.apache.org/viewvc?rev=1292273&view=rev
Log:
Bugzilla 52599 - avoid duplicate text when rendering slides in HSLF

Added:
    poi/trunk/test-data/slideshow/52599.ppt   (with props)
Modified:
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Slide.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextShape.java

Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=1292273&r1=1292272&r2=1292273&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Wed Feb 22 13:23:31 2012
@@ -34,6 +34,7 @@
 
     <changes>
         <release version="3.8-beta6" date="2012-??-??">
+           <action dev="poi-developers" type="fix">52599 - avoid duplicate text when rendering slides in HSLF</action>
            <action dev="poi-developers" type="fix">52598 - respect slide background when rendering slides in HSLF</action>
            <action dev="poi-developers" type="fix">51731 - fixed painting shape outlines in HSLF</action>
            <action dev="poi-developers" type="fix">52701 - fixed seting vertical alignment for XSLFTableCell</action>

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Slide.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Slide.java?rev=1292273&r1=1292272&r2=1292273&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Slide.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Slide.java Wed Feb 22 13:23:31 2012
@@ -91,6 +91,7 @@ public final class Slide extends Sheet
 		for(int k=0; k<_otherRuns.length; i++, k++) {
 			_runs[i] = _otherRuns[k];
             _runs[i].setSheet(this);
+            _runs[i].setIndex(-1); // runs found in PPDrawing are not linked with SlideListWithTexts
 		}
 	}
 

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java?rev=1292273&r1=1292272&r2=1292273&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java Wed Feb 22 13:23:31 2012
@@ -48,7 +48,7 @@ public final class TextRun
 	private SlideShow slideShow;
     private Sheet _sheet;
     private int shapeId;
-    private int slwtIndex; //position in the owning SlideListWithText
+    private int slwtIndex = -1; //position in the owning SlideListWithText
     /**
      * all text run records that follow TextHeaderAtom.
      * (there can be misc InteractiveInfo, TxInteractiveInfo and other records)

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextShape.java?rev=1292273&r1=1292272&r2=1292273&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextShape.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextShape.java Wed Feb 22 13:23:31 2012
@@ -47,7 +47,7 @@ public final class TestTextShape extends
         assertNotNull(shape.getEscherTextboxWrapper());
         assertEquals("", shape.getText());
         assertSame(run, shape.createTextRun());
-
+        assertEquals(-1, run.getIndex());
     }
 
     public void testCreateTextBox(){
@@ -195,4 +195,24 @@ public final class TestTextShape extends
         assertEquals(0.05, tx.getMarginTop()*Shape.EMU_PER_POINT/Shape.EMU_PER_INCH, 0.01);
         assertEquals(0.05, tx.getMarginBottom()*Shape.EMU_PER_POINT/Shape.EMU_PER_INCH, 0.01);
     }
+
+    public void test52599() throws IOException {
+        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("52599.ppt"));
+
+        Slide slide = ppt.getSlides()[0];
+        Shape[] sh = slide.getShapes();
+        assertEquals(3, sh.length);
+
+        TextShape sh0 = (TextShape)sh[0];
+        assertEquals(null, sh0.getText());
+        assertEquals(null, sh0.getTextRun());
+
+        TextShape sh1 = (TextShape)sh[1];
+        assertEquals(null, sh1.getText());
+        assertEquals(null, sh1.getTextRun());
+
+        TextShape sh2 = (TextShape)sh[2];
+        assertEquals("this box should be shown just once", sh2.getText());
+        assertEquals(-1, sh2.getTextRun().getIndex());
+    }
 }

Added: poi/trunk/test-data/slideshow/52599.ppt
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/slideshow/52599.ppt?rev=1292273&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/slideshow/52599.ppt
------------------------------------------------------------------------------
    svn:mime-type = application/msword



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