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/11/29 17:17:30 UTC
svn commit: r1717087 - in /poi/trunk/src/ooxml:
java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java
java/org/apache/poi/xslf/usermodel/XSLFSheet.java
testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java
Author: kiwiwings
Date: Sun Nov 29 16:17:29 2015
New Revision: 1717087
URL: http://svn.apache.org/viewvc?rev=1717087&view=rev
Log:
XSLF: tables can now be removed from sheets/groups
Modified:
poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java
poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java?rev=1717087&r1=1717086&r2=1717087&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java Sun Nov 29 16:17:29 2015
@@ -41,6 +41,7 @@ import org.openxmlformats.schemas.drawin
import org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D;
import org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D;
import org.openxmlformats.schemas.presentationml.x2006.main.CTConnector;
+import org.openxmlformats.schemas.presentationml.x2006.main.CTGraphicalObjectFrame;
import org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape;
import org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShapeNonVisual;
import org.openxmlformats.schemas.presentationml.x2006.main.CTPicture;
@@ -174,6 +175,8 @@ implements XSLFShapeContainer, GroupShap
grpSp.getGrpSpList().remove(obj);
} else if (obj instanceof CTConnector){
grpSp.getCxnSpList().remove(obj);
+ } else if (obj instanceof CTGraphicalObjectFrame) {
+ grpSp.getGraphicFrameList().remove(obj);
} else if (obj instanceof CTPicture) {
XSLFPictureShape ps = (XSLFPictureShape)xShape;
XSLFSheet sh = getSheet();
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java?rev=1717087&r1=1717086&r2=1717087&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java Sun Nov 29 16:17:29 2015
@@ -278,10 +278,12 @@ implements XSLFShapeContainer, Sheet<XSL
CTGroupShape spTree = getSpTree();
if(obj instanceof CTShape){
spTree.getSpList().remove(obj);
- } else if (obj instanceof CTGroupShape){
+ } else if (obj instanceof CTGroupShape) {
spTree.getGrpSpList().remove(obj);
- } else if (obj instanceof CTConnector){
+ } else if (obj instanceof CTConnector) {
spTree.getCxnSpList().remove(obj);
+ } else if (obj instanceof CTGraphicalObjectFrame) {
+ spTree.getGraphicFrameList().remove(obj);
} else if (obj instanceof CTPicture) {
XSLFPictureShape ps = (XSLFPictureShape)xShape;
removePictureRelation(ps);
Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java?rev=1717087&r1=1717086&r2=1717087&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java Sun Nov 29 16:17:29 2015
@@ -17,6 +17,7 @@
package org.apache.poi.xslf.usermodel;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
@@ -146,4 +147,22 @@ public class TestXSLFTable {
ppt.close();
}
+
+ @Test
+ public void removeTable() throws IOException {
+ XMLSlideShow ss = XSLFTestDataSamples.openSampleDocument("shapes.pptx");
+ XSLFSlide sl = ss.getSlides().get(0);
+ XSLFTable tab = (XSLFTable)sl.getShapes().get(4);
+ sl.removeShape(tab);
+
+ XMLSlideShow ss2 = XSLFTestDataSamples.writeOutAndReadBack(ss);
+ ss.close();
+
+ sl = ss2.getSlides().get(0);
+ for (XSLFShape s : sl.getShapes()) {
+ assertFalse(s instanceof XSLFTable);
+ }
+
+ ss2.close();
+ }
}
\ 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