poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ye...@apache.org
Subject svn commit: r1291730 - in /poi/trunk/src: documentation/content/xdocs/status.xml ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFPictureShape.java
Date Tue, 21 Feb 2012 12:13:40 GMT
Author: yegor
Date: Tue Feb 21 12:13:39 2012
New Revision: 1291730

URL: http://svn.apache.org/viewvc?rev=1291730&view=rev
Log:
fixed importing pictures having associated custom tags, see Bugzilla 52687

Modified:
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFPictureShape.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=1291730&r1=1291729&r2=1291730&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Tue Feb 21 12:13:39 2012
@@ -34,6 +34,7 @@
 
     <changes>
         <release version="3.8-beta6" date="2012-??-??">
+           <action dev="poi-developers" type="fix">52687 - fixed merging slides with
pictures with associated custom tags</action>
            <action dev="poi-developers" type="add"> allow runtime registration of functions
in FormulaEvaluator</action>
            <action dev="poi-developers" type="fix">52665 - When reading from a ZipFileZipEntrySource
that has already been closed, give IllegalArgumentException rather than NPE</action>
            <action dev="poi-developers" type="fix">52664 - MAPIMessage may not always
have name chunks when checking for 7 bit encodings</action>

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java?rev=1291730&r1=1291729&r2=1291730&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java Tue Feb 21
12:13:39 2012
@@ -29,6 +29,7 @@ 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.STShapeType;
+import org.openxmlformats.schemas.presentationml.x2006.main.CTApplicationNonVisualDrawingProps;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTPicture;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTPictureNonVisual;
 
@@ -147,5 +148,11 @@ public class XSLFPictureShape extends XS
         CTBlip blip = ct.getBlipFill().getBlip();
         blip.setEmbed(relId);
 
+        CTApplicationNonVisualDrawingProps nvPr = ct.getNvPicPr().getNvPr();
+        if(nvPr.isSetCustDataLst()) {
+            // discard any custom tags associated with the picture being copied
+            nvPr.unsetCustDataLst();
+        }
+
     }
 }

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFPictureShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFPictureShape.java?rev=1291730&r1=1291729&r2=1291730&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFPictureShape.java
(original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFPictureShape.java
Tue Feb 21 12:13:39 2012
@@ -18,6 +18,7 @@ package org.apache.poi.xslf.usermodel;
 
 import junit.framework.TestCase;
 import org.apache.poi.xslf.XSLFTestDataSamples;
+import org.openxmlformats.schemas.presentationml.x2006.main.CTPicture;
 
 import java.io.IOException;
 import java.util.Arrays;
@@ -130,4 +131,26 @@ public class TestXSLFPictureShape extend
         XSLFSlide slide2 = ppt.createSlide();
 
     }
+
+    public void testMerge() {
+        XMLSlideShow ppt1 = new XMLSlideShow();
+        byte[] data1 = new byte[100];
+        int idx1 = ppt1.addPicture(data1, XSLFPictureData.PICTURE_TYPE_JPEG);
+
+        XSLFSlide slide1 = ppt1.createSlide();
+        XSLFPictureShape shape1 = slide1.createPicture(idx1);
+        CTPicture ctPic1 = (CTPicture)shape1.getXmlObject();
+        ctPic1.getNvPicPr().getNvPr().addNewCustDataLst().addNewTags().setId("rId99");
+
+        XMLSlideShow ppt2 = new XMLSlideShow();
+
+        XSLFSlide slide2 = ppt2.createSlide().importContent(slide1);
+        XSLFPictureShape shape2 = (XSLFPictureShape)slide2.getShapes()[0];
+
+        assertTrue(Arrays.equals(data1, shape2.getPictureData().getData()));
+
+        CTPicture ctPic2 = (CTPicture)shape2.getXmlObject();
+        assertFalse(ctPic2.getNvPicPr().getNvPr().isSetCustDataLst());
+
+    }
 }
\ No newline at end of file



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


Mime
View raw message