SonarCube fixes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1774557 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3ab0097cdc
commit
94a81f7e68
@ -828,10 +828,10 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
|
|||||||
*/
|
*/
|
||||||
public boolean isPageBreak() {
|
public boolean isPageBreak() {
|
||||||
CTPPr ppr = getCTPPr();
|
CTPPr ppr = getCTPPr();
|
||||||
CTOnOff ct_pageBreak = ppr.isSetPageBreakBefore() ? ppr
|
CTOnOff ctPageBreak = ppr.isSetPageBreakBefore() ? ppr
|
||||||
.getPageBreakBefore() : null;
|
.getPageBreakBefore() : null;
|
||||||
if (ct_pageBreak != null
|
if (ctPageBreak != null
|
||||||
&& ct_pageBreak.getVal().intValue() == STOnOff.INT_TRUE) {
|
&& ctPageBreak.getVal().intValue() == STOnOff.INT_TRUE) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -855,12 +855,12 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
|
|||||||
*/
|
*/
|
||||||
public void setPageBreak(boolean pageBreak) {
|
public void setPageBreak(boolean pageBreak) {
|
||||||
CTPPr ppr = getCTPPr();
|
CTPPr ppr = getCTPPr();
|
||||||
CTOnOff ct_pageBreak = ppr.isSetPageBreakBefore() ? ppr
|
CTOnOff ctPageBreak = ppr.isSetPageBreakBefore() ? ppr
|
||||||
.getPageBreakBefore() : ppr.addNewPageBreakBefore();
|
.getPageBreakBefore() : ppr.addNewPageBreakBefore();
|
||||||
if (pageBreak)
|
if (pageBreak)
|
||||||
ct_pageBreak.setVal(STOnOff.TRUE);
|
ctPageBreak.setVal(STOnOff.TRUE);
|
||||||
else
|
else
|
||||||
ct_pageBreak.setVal(STOnOff.FALSE);
|
ctPageBreak.setVal(STOnOff.FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1463,10 +1463,11 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
|
|||||||
if (o instanceof CTText) {
|
if (o instanceof CTText) {
|
||||||
if (textPos >= startText) {
|
if (textPos >= startText) {
|
||||||
String candidate = ((CTText) o).getStringValue();
|
String candidate = ((CTText) o).getStringValue();
|
||||||
if (runPos == startRun)
|
if (runPos == startRun) {
|
||||||
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)) {
|
||||||
@ -1476,9 +1477,9 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
|
|||||||
newList = true;
|
newList = true;
|
||||||
}
|
}
|
||||||
if (candidate.charAt(charPos) == searched.charAt(candCharPos)) {
|
if (candidate.charAt(charPos) == searched.charAt(candCharPos)) {
|
||||||
if (candCharPos + 1 < searched.length())
|
if (candCharPos + 1 < searched.length()) {
|
||||||
candCharPos++;
|
candCharPos++;
|
||||||
else if (newList) {
|
} else if (newList) {
|
||||||
TextSegement segement = new TextSegement();
|
TextSegement segement = new TextSegement();
|
||||||
segement.setBeginRun(beginRunPos);
|
segement.setBeginRun(beginRunPos);
|
||||||
segement.setBeginText(beginTextPos);
|
segement.setBeginText(beginTextPos);
|
||||||
@ -1496,11 +1497,12 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
|
|||||||
textPos++;
|
textPos++;
|
||||||
} else if (o instanceof CTProofErr) {
|
} else if (o instanceof CTProofErr) {
|
||||||
c.removeXml();
|
c.removeXml();
|
||||||
} else if (o instanceof CTRPr) ;
|
} else if (o instanceof CTRPr) {
|
||||||
//do nothing
|
//do nothing
|
||||||
else
|
} else {
|
||||||
candCharPos = 0;
|
candCharPos = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
c.dispose();
|
c.dispose();
|
||||||
}
|
}
|
||||||
@ -1525,10 +1527,12 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
|
|||||||
for (int i = runBegin; i <= runEnd; i++) {
|
for (int i = runBegin; i <= runEnd; i++) {
|
||||||
CTText[] tArray = rArray[i].getTArray();
|
CTText[] tArray = rArray[i].getTArray();
|
||||||
int startText = 0, endText = tArray.length - 1;
|
int startText = 0, endText = tArray.length - 1;
|
||||||
if (i == runBegin)
|
if (i == runBegin) {
|
||||||
startText = textBegin;
|
startText = textBegin;
|
||||||
if (i == runEnd)
|
}
|
||||||
|
if (i == runEnd) {
|
||||||
endText = textEnd;
|
endText = textEnd;
|
||||||
|
}
|
||||||
for (int j = startText; j <= endText; j++) {
|
for (int j = startText; j <= endText; j++) {
|
||||||
String tmpText = tArray[j].getStringValue();
|
String tmpText = tArray[j].getStringValue();
|
||||||
int startChar = 0, endChar = tmpText.length() - 1;
|
int startChar = 0, endChar = tmpText.length() - 1;
|
||||||
@ -1566,9 +1570,10 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
|
|||||||
int rPos = 0;
|
int rPos = 0;
|
||||||
for(int i=0;i<pos;i++) {
|
for(int i=0;i<pos;i++) {
|
||||||
XWPFRun currRun = runs.get(i);
|
XWPFRun currRun = runs.get(i);
|
||||||
if(!(currRun instanceof XWPFHyperlinkRun || currRun instanceof XWPFFieldRun))
|
if(!(currRun instanceof XWPFHyperlinkRun || currRun instanceof XWPFFieldRun)) {
|
||||||
rPos++;
|
rPos++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
getCTP().removeR(rPos);
|
getCTP().removeR(rPos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user