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:
parent
ab19d2e09c
commit
042aab4030
@ -324,7 +324,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
|
||||
* @see org.apache.poi.xwpf.usermodel.IBody#getTableArray(int)
|
||||
*/
|
||||
public XWPFTable getTableArray(int pos) {
|
||||
if(pos > 0 && pos < tables.size()){
|
||||
if (pos > 0 && pos < tables.size()){
|
||||
return tables.get(pos);
|
||||
}
|
||||
return null;
|
||||
@ -813,14 +813,14 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
|
||||
* @return true if removing was successfully, else return false
|
||||
*/
|
||||
public boolean removeBodyElement(int pos) {
|
||||
if(pos >= 0 && pos < bodyElements.size()) {
|
||||
if (pos >= 0 && pos < bodyElements.size()) {
|
||||
BodyElementType type = bodyElements.get(pos).getElementType();
|
||||
if(type == BodyElementType.TABLE){
|
||||
if (type == BodyElementType.TABLE){
|
||||
int tablePos = getTablePos(pos);
|
||||
tables.remove(tablePos);
|
||||
ctDocument.getBody().removeTbl(tablePos);
|
||||
}
|
||||
if(type == BodyElementType.PARAGRAPH) {
|
||||
if (type == BodyElementType.PARAGRAPH) {
|
||||
int paraPos = getParagraphPos(pos);
|
||||
paragraphs.remove(paraPos);
|
||||
ctDocument.getBody().removeP(paraPos);
|
||||
@ -1280,7 +1280,6 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public Iterator<XWPFTable> getTablesIterator() {
|
||||
return tables.iterator();
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public class XWPFFootnotes extends POIXMLDocumentPart {
|
||||
throw new POIXMLException();
|
||||
}
|
||||
|
||||
//get any Footnote
|
||||
// Find our footnotes
|
||||
for(CTFtnEdn note : ctFootnotes.getFootnoteList()) {
|
||||
listFootnote.add(new XWPFFootnote(note, this));
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
|
||||
CTHdrFtr headerFooter;
|
||||
XWPFDocument document;
|
||||
|
||||
XWPFHeaderFooter(XWPFDocument doc, CTHdrFtr hdrFtr){
|
||||
XWPFHeaderFooter(XWPFDocument doc, CTHdrFtr hdrFtr) {
|
||||
if (doc==null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
@ -517,4 +517,4 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
|
||||
public POIXMLDocumentPart getPart() {
|
||||
return this;
|
||||
}
|
||||
}//end class
|
||||
}
|
||||
|
@ -55,7 +55,11 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.STOnOff;
|
||||
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 {
|
||||
private final CTP paragraph;
|
||||
@ -193,9 +197,9 @@ public class XWPFParagraph implements IBodyElement {
|
||||
* if not, null will be returned
|
||||
* @return styleID as String
|
||||
*/
|
||||
public String getStyleID(){
|
||||
if (paragraph.getPPr() != null){
|
||||
if(paragraph.getPPr().getPStyle()!= null){
|
||||
public String getStyleID() {
|
||||
if (paragraph.getPPr() != null) {
|
||||
if(paragraph.getPPr().getPStyle()!= null) {
|
||||
if (paragraph.getPPr().getPStyle().getVal()!= null)
|
||||
return paragraph.getPPr().getPStyle().getVal();
|
||||
}
|
||||
@ -1162,8 +1166,7 @@ public class XWPFParagraph implements IBodyElement {
|
||||
* @param searched
|
||||
* @param startPos
|
||||
*/
|
||||
public TextSegement searchText(String searched,PositionInParagraph startPos){
|
||||
|
||||
public TextSegement searchText(String searched,PositionInParagraph startPos) {
|
||||
int startRun = startPos.getRun(),
|
||||
startText = startPos.getText(),
|
||||
startChar = startPos.getChar();
|
||||
@ -1183,6 +1186,7 @@ public class XWPFParagraph implements IBodyElement {
|
||||
charPos= startChar;
|
||||
else
|
||||
charPos = 0;
|
||||
|
||||
for(; charPos<candidate.length(); charPos++){
|
||||
if((candidate.charAt(charPos)==searched.charAt(0))&&(candCharPos==0)){
|
||||
beginTextPos = textPos;
|
||||
@ -1204,10 +1208,11 @@ public class XWPFParagraph implements IBodyElement {
|
||||
return segement;
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
candCharPos=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
textPos++;
|
||||
}
|
||||
else if(o instanceof CTProofErr){
|
||||
@ -1239,8 +1244,6 @@ public class XWPFParagraph implements IBodyElement {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* get a Text
|
||||
* @param segment
|
||||
@ -1280,7 +1283,7 @@ public class XWPFParagraph implements IBodyElement {
|
||||
* @return true if the run was removed
|
||||
*/
|
||||
public boolean removeRun(int pos){
|
||||
if (pos >= 0 && pos < paragraph.sizeOfRArray()){
|
||||
if (pos >= 0 && pos < paragraph.sizeOfRArray()) {
|
||||
getCTP().removeR(pos);
|
||||
runs.remove(pos);
|
||||
return true;
|
||||
@ -1345,5 +1348,4 @@ public class XWPFParagraph implements IBodyElement {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -583,8 +583,7 @@ public class XWPFTable implements IBodyElement {
|
||||
return BodyElementType.TABLE;
|
||||
}
|
||||
|
||||
public IBody getBody()
|
||||
{
|
||||
public IBody getBody() {
|
||||
return part;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user