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@1492818 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2013-06-13 18:52:03 +00:00
parent abd6675bcf
commit d246052993
9 changed files with 598 additions and 598 deletions

View File

@ -324,7 +324,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
* @see org.apache.poi.xwpf.usermodel.IBody#getTableArray(int) * @see org.apache.poi.xwpf.usermodel.IBody#getTableArray(int)
*/ */
public XWPFTable getTableArray(int pos) { public XWPFTable getTableArray(int pos) {
if(pos > 0 && pos < tables.size()){ if (pos > 0 && pos < tables.size()){
return tables.get(pos); return tables.get(pos);
} }
return null; return null;
@ -813,14 +813,14 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
* @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){
int tablePos = getTablePos(pos); int tablePos = getTablePos(pos);
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);
@ -1280,7 +1280,6 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
return null; return null;
} }
public Iterator<XWPFTable> getTablesIterator() { public Iterator<XWPFTable> getTablesIterator() {
return tables.iterator(); return tables.iterator();
} }

View File

@ -78,7 +78,7 @@ public class XWPFFootnotes extends POIXMLDocumentPart {
throw new POIXMLException(); throw new POIXMLException();
} }
//get any Footnote // Find our footnotes
for(CTFtnEdn note : ctFootnotes.getFootnoteList()) { for(CTFtnEdn note : ctFootnotes.getFootnoteList()) {
listFootnote.add(new XWPFFootnote(note, this)); listFootnote.add(new XWPFFootnote(note, this));
} }

View File

@ -53,7 +53,7 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
CTHdrFtr headerFooter; CTHdrFtr headerFooter;
XWPFDocument document; XWPFDocument document;
XWPFHeaderFooter(XWPFDocument doc, CTHdrFtr hdrFtr){ XWPFHeaderFooter(XWPFDocument doc, CTHdrFtr hdrFtr) {
if (doc==null) { if (doc==null) {
throw new NullPointerException(); throw new NullPointerException();
} }
@ -517,4 +517,4 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
public POIXMLDocumentPart getPart() { public POIXMLDocumentPart getPart() {
return this; return this;
} }
}//end class }

View File

@ -55,7 +55,11 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.STOnOff;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTextAlignment; import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTextAlignment;
/** /**
* Sketch of XWPF paragraph class * <p>A Paragraph within a Document, Table, Header etc.</p>
*
* <p>A paragraph has a lot of styling information, but the
* actual text (possibly along with more styling) is held on
* the child {@link XWPFRun}s.</p>
*/ */
public class XWPFParagraph implements IBodyElement { public class XWPFParagraph implements IBodyElement {
private final CTP paragraph; private final CTP paragraph;
@ -193,9 +197,9 @@ public class XWPFParagraph implements IBodyElement {
* if not, null will be returned * if not, null will be returned
* @return styleID as String * @return styleID as String
*/ */
public String getStyleID(){ public String getStyleID() {
if (paragraph.getPPr() != null){ if (paragraph.getPPr() != null) {
if(paragraph.getPPr().getPStyle()!= null){ if(paragraph.getPPr().getPStyle()!= null) {
if (paragraph.getPPr().getPStyle().getVal()!= null) if (paragraph.getPPr().getPStyle().getVal()!= null)
return paragraph.getPPr().getPStyle().getVal(); return paragraph.getPPr().getPStyle().getVal();
} }
@ -1162,8 +1166,7 @@ public class XWPFParagraph implements IBodyElement {
* @param searched * @param searched
* @param startPos * @param startPos
*/ */
public TextSegement searchText(String searched,PositionInParagraph startPos){ public TextSegement searchText(String searched,PositionInParagraph startPos) {
int startRun = startPos.getRun(), int startRun = startPos.getRun(),
startText = startPos.getText(), startText = startPos.getText(),
startChar = startPos.getChar(); startChar = startPos.getChar();
@ -1183,6 +1186,7 @@ public class XWPFParagraph implements IBodyElement {
charPos= startChar; charPos= startChar;
else else
charPos = 0; charPos = 0;
for(; charPos<candidate.length(); charPos++){ for(; charPos<candidate.length(); charPos++){
if((candidate.charAt(charPos)==searched.charAt(0))&&(candCharPos==0)){ if((candidate.charAt(charPos)==searched.charAt(0))&&(candCharPos==0)){
beginTextPos = textPos; beginTextPos = textPos;
@ -1204,10 +1208,11 @@ public class XWPFParagraph implements IBodyElement {
return segement; return segement;
} }
} }
else else {
candCharPos=0; candCharPos=0;
} }
} }
}
textPos++; textPos++;
} }
else if(o instanceof CTProofErr){ else if(o instanceof CTProofErr){
@ -1239,8 +1244,6 @@ public class XWPFParagraph implements IBodyElement {
return null; return null;
} }
/** /**
* get a Text * get a Text
* @param segment * @param segment
@ -1280,7 +1283,7 @@ public class XWPFParagraph implements IBodyElement {
* @return true if the run was removed * @return true if the run was removed
*/ */
public boolean removeRun(int pos){ public boolean removeRun(int pos){
if (pos >= 0 && pos < paragraph.sizeOfRArray()){ if (pos >= 0 && pos < paragraph.sizeOfRArray()) {
getCTP().removeR(pos); getCTP().removeR(pos);
runs.remove(pos); runs.remove(pos);
return true; return true;
@ -1345,5 +1348,4 @@ public class XWPFParagraph implements IBodyElement {
} }
return null; return null;
} }
} }

View File

@ -583,8 +583,7 @@ public class XWPFTable implements IBodyElement {
return BodyElementType.TABLE; return BodyElementType.TABLE;
} }
public IBody getBody() public IBody getBody() {
{
return part; return part;
} }