Fix and update JavaDoc entries, and correct areas with wildy inconsistent whitespace / style to the surrounding code

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1492802 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2013-06-13 18:29:08 +00:00
parent 19ade4ae64
commit d323b0054c
2 changed files with 337 additions and 343 deletions

View File

@ -26,15 +26,12 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc;
/** /**
* <p> * <p>An IBody represents the different parts of the document which
* 8 Jan 2010 * can contain collections of Paragraphs and Tables. It provides a
* common way to work with these and their contents.</p>
* <p>Typically, this is something like a XWPFDocument, or one of
* the parts in it like XWPFHeader, XWPFFooter, XWPFTableCell
* </p> * </p>
* <p>
* // This Interface represents an object, which is able to have a collection of paragraphs and tables
* this can be XWFPDocument, XWPFHeader, XWPFFooter, XWPFTableCell
* </p>
* @author Philipp Epp
*
*/ */
public interface IBody { public interface IBody {
/** /**
@ -43,14 +40,14 @@ public interface IBody {
* belongs. * belongs.
* @return the Part, to which the body belongs * @return the Part, to which the body belongs
*/ */
POIXMLDocumentPart getPart(); public POIXMLDocumentPart getPart();
/** /**
* get the PartType of the body, for example * get the PartType of the body, for example
* DOCUMENT, HEADER, FOOTER, FOOTNOTE, * DOCUMENT, HEADER, FOOTER, FOOTNOTE,
* @return the PartType of the body * @return the PartType of the body
*/ */
BodyType getPartType(); public BodyType getPartType();
/** /**
* Returns an Iterator with paragraphs and tables, * Returns an Iterator with paragraphs and tables,
@ -122,12 +119,10 @@ public interface IBody {
* returns the TableCell to which the Table belongs * returns the TableCell to which the Table belongs
* @param cell * @param cell
*/ */
XWPFTableCell getTableCell(CTTc cell); public XWPFTableCell getTableCell(CTTc cell);
/** /**
* Return XWPFDocument * Return XWPFDocument
*/ */
public XWPFDocument getXWPFDocument(); public XWPFDocument getXWPFDocument();
} }

View File

@ -74,18 +74,18 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.STDocProtect;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.StylesDocument; import org.openxmlformats.schemas.wordprocessingml.x2006.main.StylesDocument;
/** /**
* Experimental class to do low level processing * <p>High(ish) level class for working with .docx files.</p>
* of docx files.
* *
* If you're using these low level classes, then you * <p>This class tries to hide some of the complexity
* will almost certainly need to refer to the OOXML * of the underlying file format, but as it's not a
* specifications from * mature and stable API yet, certain parts of the
* XML structure come through. You'll therefore almost
* certainly need to refer to the OOXML specifications
* from
* http://www.ecma-international.org/publications/standards/Ecma-376.htm * http://www.ecma-international.org/publications/standards/Ecma-376.htm
* * at some point in your use.</p>
* WARNING - APIs expected to change rapidly
*/ */
public class XWPFDocument extends POIXMLDocument implements Document, IBody { public class XWPFDocument extends POIXMLDocument implements Document, IBody {
private CTDocument1 ctDocument; private CTDocument1 ctDocument;
private XWPFSettings settings; private XWPFSettings settings;
/** /**
@ -298,7 +298,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
* returns an Iterator with paragraphs and tables * returns an Iterator with paragraphs and tables
* @see org.apache.poi.xwpf.usermodel.IBody#getBodyElements() * @see org.apache.poi.xwpf.usermodel.IBody#getBodyElements()
*/ */
public List<IBodyElement> getBodyElements(){ public List<IBodyElement> getBodyElements() {
return Collections.unmodifiableList(bodyElements); return Collections.unmodifiableList(bodyElements);
} }
@ -692,7 +692,6 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
*/ */
@Override @Override
protected void commit() throws IOException { protected void commit() throws IOException {
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS); XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTDocument1.type.getName().getNamespaceURI(), "document")); xmlOptions.setSaveSyntheticDocumentElement(new QName(CTDocument1.type.getName().getNamespaceURI(), "document"));
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<String, String>();
@ -813,7 +812,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
* @param pos * @param pos
* @return true if removing was successfully, else return false * @return true if removing was successfully, else return false
*/ */
public boolean removeBodyElement(int pos){ public boolean removeBodyElement(int pos) {
if(pos >= 0 && pos < bodyElements.size()) { if(pos >= 0 && pos < bodyElements.size()) {
BodyElementType type = bodyElements.get(pos).getElementType(); BodyElementType type = bodyElements.get(pos).getElementType();
if(type == BodyElementType.TABLE){ if(type == BodyElementType.TABLE){
@ -821,7 +820,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
tables.remove(tablePos); tables.remove(tablePos);
ctDocument.getBody().removeTbl(tablePos); ctDocument.getBody().removeTbl(tablePos);
} }
if(type == BodyElementType.PARAGRAPH){ if(type == BodyElementType.PARAGRAPH) {
int paraPos = getParagraphPos(pos); int paraPos = getParagraphPos(pos);
paragraphs.remove(paraPos); paragraphs.remove(paraPos);
ctDocument.getBody().removeP(paraPos); ctDocument.getBody().removeP(paraPos);
@ -1355,4 +1354,4 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
public XWPFDocument getXWPFDocument() { public XWPFDocument getXWPFDocument() {
return this; return this;
} }
} // end class }