You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2010/09/14 13:34:34 UTC

svn commit: r996849 - in /poi/trunk/src: documentation/content/xdocs/ ooxml/java/org/apache/poi/xwpf/usermodel/ ooxml/testcases/org/apache/poi/xwpf/usermodel/

Author: nick
Date: Tue Sep 14 11:34:33 2010
New Revision: 996849

URL: http://svn.apache.org/viewvc?rev=996849&view=rev
Log:
Add a getBodyElements() method to XWPF IBody, to make access to embedded paragraphs and tables easier, and a few tidy-ups

Modified:
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/IBody.java
    poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
    poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java
    poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFStyle.java
    poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTable.java
    poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFParagraph.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=996849&r1=996848&r2=996849&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Tue Sep 14 11:34:33 2010
@@ -34,6 +34,7 @@
 
     <changes>
         <release version="3.7-beta3" date="2010-??-??">
+           <action dev="poi-developers" type="add">Add a getBodyElements() method to XWPF IBody, to make access to embedded paragraphs and tables easier</action>
            <action dev="poi-developers" type="add">More XSLFRelation entries for common .pptx file parts</action>
            <action dev="poi-developers" type="fix">49872 - avoid exception in XSSFFormulaEvaluator.evaluateInCell when evaluating shared formulas</action>
            <action dev="poi-developers" type="fix">49895 - avoid corruption of XSSFWorkbook after removing all merged cells from sheet</action>

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/IBody.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/IBody.java?rev=996849&r1=996848&r2=996849&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/IBody.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/IBody.java Tue Sep 14 11:34:33 2010
@@ -50,6 +50,13 @@ public interface IBody {
 	 * @return
 	 */
 	BodyType getPartType();
+	
+   /**
+    * Returns an Iterator with paragraphs and tables, 
+    *  in the order that they occur in the text.
+    */
+   public List<IBodyElement> getBodyElements();
+
 	/**
 	 * Returns the paragraph(s) that holds
 	 *  the text of the header or footer.

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java?rev=996849&r1=996848&r2=996849&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java Tue Sep 14 11:34:33 2010
@@ -52,7 +52,6 @@ import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTableRow;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTComment;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocument1;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn;

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java?rev=996849&r1=996848&r2=996849&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java Tue Sep 14 11:34:33 2010
@@ -70,6 +70,10 @@ public abstract class XWPFHeaderFooter e
 		return headerFooter;
 	}
 
+   public List<IBodyElement> getBodyElements(){
+        return Collections.unmodifiableList(bodyElements);
+   }
+    
 	/**
 	 * Returns the paragraph(s) that holds
 	 *  the text of the header or footer.

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFStyle.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFStyle.java?rev=996849&r1=996848&r2=996849&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFStyle.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFStyle.java Tue Sep 14 11:34:33 2010
@@ -129,6 +129,12 @@ public class XWPFStyle {
 			return null;
 	 }
 	 
+	 public String getName() {
+	    if(ctStyle.isSetName()) 
+	       return ctStyle.getName().getVal();
+	    return null;
+	 }
+	 
 	 /**
 	  * compares the names of the Styles 
 	  * @param compStyle

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTable.java?rev=996849&r1=996848&r2=996849&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTable.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTable.java Tue Sep 14 11:34:33 2010
@@ -46,7 +46,6 @@ public class XWPFTable implements IBodyE
     protected List<XWPFTableRow> tableRows;
     protected List<String> styleIDs;
     protected IBody part;
-	private XWPFDocument document;
 
     public XWPFTable(CTTbl table, IBody part, int row, int col) {
         this(table, part);

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java?rev=996849&r1=996848&r2=996849&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java Tue Sep 14 11:34:33 2010
@@ -74,6 +74,15 @@ public class XWPFTableCell implements IB
         return ctTc;
     }
 
+    /**
+     * returns an Iterator with paragraphs and tables
+     * @see org.apache.poi.xwpf.usermodel.IBody#getBodyElements()
+     * @return
+     */
+    public List<IBodyElement> getBodyElements(){
+      return Collections.unmodifiableList(bodyElements);
+    }
+    
     public void setParagraph(XWPFParagraph p) {
         if (ctTc.sizeOfPArray() == 0) {
             ctTc.addNewP();

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFParagraph.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFParagraph.java?rev=996849&r1=996848&r2=996849&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFParagraph.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFParagraph.java Tue Sep 14 11:34:33 2010
@@ -236,6 +236,9 @@ public final class TestXWPFParagraph ext
         assertEquals(0, paragraph.getCTP().sizeOfBookmarkEndArray());
         CTBookmark ctBookmark = paragraph.getCTP().getBookmarkStartArray(0);
         assertEquals("poi", ctBookmark.getName());
+        for(CTBookmark bookmark : paragraph.getCTP().getBookmarkStartList()) {
+           assertEquals("poi", bookmark.getName());
+        }
     }
 
     public void testGetSetNumID() {



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