Fix JavaDoc warnings

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1872361 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Alain Béarez 2020-01-05 23:54:06 +00:00
parent d66af200eb
commit fbf12935d3
3 changed files with 139 additions and 62 deletions

View File

@ -143,10 +143,13 @@ public class XDDFBarChartData extends XDDFChartData {
}
/**
* Minimum inclusive: -100
* <br/>
* Maximum inclusive: 100
* @param overlap
* <dl>
* <dt>Minimum inclusive =</dt>
* <dd>-100</dd>
* <dt>Maximum inclusive =</dt>
* <dd>100</dd>
* </dl>
*/
public void setOverlap(Byte overlap) {
if (overlap == null) {

View File

@ -376,8 +376,8 @@ public class XDDFTextRun {
* <dt>Minimum inclusive =</dt>
* <dd>1</dd>
* <dt>Maximum inclusive =</dt>
* <dd>400</dd></dt>
*
* <dd>400</dd>
* </dl>
*/
public void setFontSize(Double size) {
getOrCreateProperties().setFontSize(size);
@ -402,7 +402,8 @@ public class XDDFTextRun {
* <dt>Minimum inclusive =</dt>
* <dd>0</dd>
* <dt>Maximum inclusive =</dt>
* <dd>4000</dd></dt>
* <dd>4000</dd>
* </dl>
*/
public void setCharacterKerning(Double kerning) {
getOrCreateProperties().setCharacterKerning(kerning);
@ -435,7 +436,8 @@ public class XDDFTextRun {
* <dt>Minimum inclusive =</dt>
* <dd>-4000</dd>
* <dt>Maximum inclusive =</dt>
* <dd>4000</dd></dt>
* <dd>4000</dd>
* </dl>
*/
public void setCharacterSpacing(Double spacing) {
getOrCreateProperties().setCharacterSpacing(spacing);

View File

@ -93,6 +93,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
return _p;
}
@Override
public XSLFTextShape getParentShape() {
return _shape;
@ -103,6 +104,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
return _runs;
}
@Override
public Iterator<XSLFTextRun> iterator(){
return _runs.iterator();
}
@ -149,6 +151,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
@Override
public TextAlign getTextAlign(){
ParagraphPropertyFetcher<TextAlign> fetcher = new ParagraphPropertyFetcher<TextAlign>(getIndentLevel()){
@Override
public boolean fetch(CTTextParagraphProperties props){
if(props.isSetAlgn()){
TextAlign val = TextAlign.values()[props.getAlgn().intValue() - 1];
@ -166,7 +169,9 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
public void setTextAlign(TextAlign align) {
CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr();
if(align == null) {
if(pr.isSetAlgn()) pr.unsetAlgn();
if(pr.isSetAlgn()) {
pr.unsetAlgn();
}
} else {
pr.setAlgn(STTextAlignType.Enum.forInt(align.ordinal() + 1));
}
@ -175,6 +180,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
@Override
public FontAlign getFontAlign(){
ParagraphPropertyFetcher<FontAlign> fetcher = new ParagraphPropertyFetcher<FontAlign>(getIndentLevel()){
@Override
public boolean fetch(CTTextParagraphProperties props){
if(props.isSetFontAlgn()){
FontAlign val = FontAlign.values()[props.getFontAlgn().intValue() - 1];
@ -199,13 +205,15 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
public void setFontAlign(FontAlign align){
CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr();
if(align == null) {
if(pr.isSetFontAlgn()) pr.unsetFontAlgn();
if(pr.isSetFontAlgn()) {
pr.unsetFontAlgn();
}
} else {
pr.setFontAlgn(STTextFontAlignType.Enum.forInt(align.ordinal() + 1));
}
}
/**
* @return the font to be used on bullet characters within a given paragraph
@ -213,6 +221,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
@SuppressWarnings("WeakerAccess")
public String getBulletFont(){
ParagraphPropertyFetcher<String> fetcher = new ParagraphPropertyFetcher<String>(getIndentLevel()){
@Override
public boolean fetch(CTTextParagraphProperties props){
if(props.isSetBuFont()){
setValue(props.getBuFont().getTypeface());
@ -238,6 +247,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
@SuppressWarnings("WeakerAccess")
public String getBulletCharacter(){
ParagraphPropertyFetcher<String> fetcher = new ParagraphPropertyFetcher<String>(getIndentLevel()){
@Override
public boolean fetch(CTTextParagraphProperties props){
if(props.isSetBuChar()){
setValue(props.getBuChar().getChar());
@ -266,6 +276,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
public PaintStyle getBulletFontColor(){
final XSLFTheme theme = getParentShape().getSheet().getTheme();
ParagraphPropertyFetcher<Color> fetcher = new ParagraphPropertyFetcher<Color>(getIndentLevel()){
@Override
public boolean fetch(CTTextParagraphProperties props){
if(props.isSetBuClr()){
XSLFColor c = new XSLFColor(props.getBuClr(), theme, null);
@ -284,8 +295,8 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
public void setBulletFontColor(Color color) {
setBulletFontColor(DrawPaint.createSolidPaint(color));
}
/**
* Set the color to be used on bullet characters within a given paragraph.
*
@ -300,7 +311,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
// TODO: implement setting bullet color to null
SolidPaint sp = (SolidPaint)color;
Color col = DrawPaint.applyColorTransform(sp.getSolidColor());
CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr();
CTColor c = pr.isSetBuClr() ? pr.getBuClr() : pr.addNewBuClr();
CTSRgbColor clr = c.isSetSrgbClr() ? c.getSrgbClr() : c.addNewSrgbClr();
@ -311,8 +322,8 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
* Returns the bullet size that is to be used within a paragraph.
* This may be specified in two different ways, percentage spacing and font point spacing:
* <p>
* If bulletSize >= 0, then bulletSize is a percentage of the font size.
* If bulletSize < 0, then it specifies the size in points
* If bulletSize &gt;= 0, then bulletSize is a percentage of the font size.
* If bulletSize &lt; 0, then it specifies the size in points
* </p>
*
* @return the bullet size
@ -320,6 +331,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
@SuppressWarnings("WeakerAccess")
public Double getBulletFontSize(){
ParagraphPropertyFetcher<Double> fetcher = new ParagraphPropertyFetcher<Double>(getIndentLevel()){
@Override
public boolean fetch(CTTextParagraphProperties props){
if(props.isSetBuSzPct()){
setValue(props.getBuSzPct().getVal() * 0.001);
@ -340,8 +352,8 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
* Sets the bullet size that is to be used within a paragraph.
* This may be specified in two different ways, percentage spacing and font point spacing:
* <p>
* If bulletSize >= 0, then bulletSize is a percentage of the font size.
* If bulletSize < 0, then it specifies the size in points
* If bulletSize &gt;= 0, then bulletSize is a percentage of the font size.
* If bulletSize &lt; 0, then it specifies the size in points
* </p>
*/
@SuppressWarnings("WeakerAccess")
@ -351,11 +363,15 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
if(bulletSize >= 0) {
CTTextBulletSizePercent pt = pr.isSetBuSzPct() ? pr.getBuSzPct() : pr.addNewBuSzPct();
pt.setVal((int)(bulletSize*1000));
if(pr.isSetBuSzPts()) pr.unsetBuSzPts();
if(pr.isSetBuSzPts()) {
pr.unsetBuSzPts();
}
} else {
CTTextBulletSizePoint pt = pr.isSetBuSzPts() ? pr.getBuSzPts() : pr.addNewBuSzPts();
pt.setVal((int)(-bulletSize*100));
if(pr.isSetBuSzPct()) pr.unsetBuSzPct();
if(pr.isSetBuSzPct()) {
pr.unsetBuSzPct();
}
}
}
@ -365,6 +381,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
@SuppressWarnings("WeakerAccess")
public AutoNumberingScheme getAutoNumberingScheme() {
ParagraphPropertyFetcher<AutoNumberingScheme> fetcher = new ParagraphPropertyFetcher<AutoNumberingScheme>(getIndentLevel()) {
@Override
public boolean fetch(CTTextParagraphProperties props) {
if (props.isSetBuAutoNum()) {
AutoNumberingScheme ans = AutoNumberingScheme.forOoxmlID(props.getBuAutoNum().getType().intValue());
@ -386,6 +403,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
@SuppressWarnings("WeakerAccess")
public Integer getAutoNumberingStartAt() {
ParagraphPropertyFetcher<Integer> fetcher = new ParagraphPropertyFetcher<Integer>(getIndentLevel()) {
@Override
public boolean fetch(CTTextParagraphProperties props) {
if (props.isSetBuAutoNum()) {
if (props.getBuAutoNum().isSetStartAt()) {
@ -399,14 +417,18 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
fetchParagraphProperty(fetcher);
return fetcher.getValue();
}
@Override
public void setIndent(Double indent){
if ((indent == null) && !_p.isSetPPr()) return;
if ((indent == null) && !_p.isSetPPr()) {
return;
}
CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr();
if(indent == null) {
if(pr.isSetIndent()) pr.unsetIndent();
if(pr.isSetIndent()) {
pr.unsetIndent();
}
} else {
pr.setIndent(Units.toEMU(indent));
}
@ -416,6 +438,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
public Double getIndent() {
ParagraphPropertyFetcher<Double> fetcher = new ParagraphPropertyFetcher<Double>(getIndentLevel()){
@Override
public boolean fetch(CTTextParagraphProperties props){
if(props.isSetIndent()){
setValue(Units.toPoints(props.getIndent()));
@ -431,10 +454,14 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
@Override
public void setLeftMargin(Double leftMargin){
if (leftMargin == null && !_p.isSetPPr()) return;
if (leftMargin == null && !_p.isSetPPr()) {
return;
}
CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr();
if (leftMargin == null) {
if(pr.isSetMarL()) pr.unsetMarL();
if(pr.isSetMarL()) {
pr.unsetMarL();
}
} else {
pr.setMarL(Units.toEMU(leftMargin));
}
@ -447,6 +474,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
@Override
public Double getLeftMargin(){
ParagraphPropertyFetcher<Double> fetcher = new ParagraphPropertyFetcher<Double>(getIndentLevel()){
@Override
public boolean fetch(CTTextParagraphProperties props){
if(props.isSetMarL()){
double val = Units.toPoints(props.getMarL());
@ -463,10 +491,14 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
@Override
public void setRightMargin(Double rightMargin){
if (rightMargin == null && !_p.isSetPPr()) return;
if (rightMargin == null && !_p.isSetPPr()) {
return;
}
CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr();
if(rightMargin == null) {
if(pr.isSetMarR()) pr.unsetMarR();
if(pr.isSetMarR()) {
pr.unsetMarR();
}
} else {
pr.setMarR(Units.toEMU(rightMargin));
}
@ -479,6 +511,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
@Override
public Double getRightMargin(){
ParagraphPropertyFetcher<Double> fetcher = new ParagraphPropertyFetcher<Double>(getIndentLevel()){
@Override
public boolean fetch(CTTextParagraphProperties props){
if(props.isSetMarR()){
double val = Units.toPoints(props.getMarR());
@ -495,6 +528,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
@Override
public Double getDefaultTabSize(){
ParagraphPropertyFetcher<Double> fetcher = new ParagraphPropertyFetcher<Double>(getIndentLevel()){
@Override
public boolean fetch(CTTextParagraphProperties props){
if(props.isSetDefTabSz()){
double val = Units.toPoints(props.getDefTabSz());
@ -511,6 +545,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
@SuppressWarnings("WeakerAccess")
public double getTabStop(final int idx) {
ParagraphPropertyFetcher<Double> fetcher = new ParagraphPropertyFetcher<Double>(getIndentLevel()){
@Override
public boolean fetch(CTTextParagraphProperties props){
if (props.isSetTabLst()) {
CTTextTabStopList tabStops = props.getTabLst();
@ -551,7 +586,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
return lnSpc * scale;
}
}
return lnSpc;
}
@ -616,6 +651,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
private Double getSpacing(final Function<CTTextParagraphProperties,Supplier<CTTextSpacing>> getSpc) {
final ParagraphPropertyFetcher<Double> fetcher = new ParagraphPropertyFetcher<Double>(getIndentLevel()){
@Override
public boolean fetch(final CTTextParagraphProperties props){
final CTTextSpacing spc = getSpc.apply(props).get();
@ -657,6 +693,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
*/
public boolean isBullet() {
ParagraphPropertyFetcher<Boolean> fetcher = new ParagraphPropertyFetcher<Boolean>(getIndentLevel()){
@Override
public boolean fetch(CTTextParagraphProperties props){
if(props.isSetBuNone()) {
setValue(false);
@ -678,24 +715,48 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
* @param flag whether text in this paragraph has bullets
*/
public void setBullet(boolean flag) {
if(isBullet() == flag) return;
if(isBullet() == flag) {
return;
}
CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr();
if(flag) {
pr.addNewBuFont().setTypeface("Arial");
pr.addNewBuChar().setChar("\u2022");
} else {
if (pr.isSetBuFont()) pr.unsetBuFont();
if (pr.isSetBuChar()) pr.unsetBuChar();
if (pr.isSetBuAutoNum()) pr.unsetBuAutoNum();
if (pr.isSetBuBlip()) pr.unsetBuBlip();
if (pr.isSetBuClr()) pr.unsetBuClr();
if (pr.isSetBuClrTx()) pr.unsetBuClrTx();
if (pr.isSetBuFont()) pr.unsetBuFont();
if (pr.isSetBuFontTx()) pr.unsetBuFontTx();
if (pr.isSetBuSzPct()) pr.unsetBuSzPct();
if (pr.isSetBuSzPts()) pr.unsetBuSzPts();
if (pr.isSetBuSzTx()) pr.unsetBuSzTx();
if (pr.isSetBuFont()) {
pr.unsetBuFont();
}
if (pr.isSetBuChar()) {
pr.unsetBuChar();
}
if (pr.isSetBuAutoNum()) {
pr.unsetBuAutoNum();
}
if (pr.isSetBuBlip()) {
pr.unsetBuBlip();
}
if (pr.isSetBuClr()) {
pr.unsetBuClr();
}
if (pr.isSetBuClrTx()) {
pr.unsetBuClrTx();
}
if (pr.isSetBuFont()) {
pr.unsetBuFont();
}
if (pr.isSetBuFontTx()) {
pr.unsetBuFontTx();
}
if (pr.isSetBuSzPct()) {
pr.unsetBuSzPct();
}
if (pr.isSetBuSzPts()) {
pr.unsetBuSzPts();
}
if (pr.isSetBuSzTx()) {
pr.unsetBuSzTx();
}
pr.addNewBuNone();
}
}
@ -709,7 +770,9 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
*/
@SuppressWarnings("WeakerAccess")
public void setBulletAutoNumber(AutoNumberingScheme scheme, int startAt) {
if(startAt < 1) throw new IllegalArgumentException("Start Number must be greater or equal that 1") ;
if(startAt < 1) {
throw new IllegalArgumentException("Start Number must be greater or equal that 1") ;
}
CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr();
CTTextAutonumberBullet lst = pr.isSetBuAutoNum() ? pr.getBuAutoNum() : pr.addNewBuAutoNum();
lst.setType(STTextAutonumberScheme.Enum.forInt(scheme.ooxmlId));
@ -723,12 +786,12 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
/**
* @return master style text paragraph properties, or <code>null</code> if
* @return master style text paragraph properties, or <code>null</code> if
* there are no master slides or the master slides do not contain a text paragraph
*/
private CTTextParagraphProperties getDefaultMasterStyle(){
CTPlaceholder ph = _shape.getPlaceholderDetails().getCTPlaceholder(false);
String defaultStyleSelector;
String defaultStyleSelector;
switch(ph == null ? -1 : ph.getType().intValue()) {
case STPlaceholderType.INT_TITLE:
case STPlaceholderType.INT_CTR_TITLE:
@ -770,19 +833,19 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
cur.dispose();
}
}
return null;
}
private void fetchParagraphProperty(final ParagraphPropertyFetcher<?> visitor){
final XSLFTextShape shape = getParentShape();
final XSLFSheet sheet = shape.getSheet();
if (!(sheet instanceof XSLFSlideMaster)) {
if (_p.isSetPPr() && visitor.fetch(_p.getPPr())) {
return;
}
if (shape.fetchShapeProperty(visitor)) {
return;
}
@ -819,14 +882,20 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
}
void copy(XSLFTextParagraph other){
if (other == this) return;
if (other == this) {
return;
}
CTTextParagraph thisP = getXmlObject();
CTTextParagraph otherP = other.getXmlObject();
if (thisP.isSetPPr()) thisP.unsetPPr();
if (thisP.isSetEndParaRPr()) thisP.unsetEndParaRPr();
if (thisP.isSetPPr()) {
thisP.unsetPPr();
}
if (thisP.isSetEndParaRPr()) {
thisP.unsetEndParaRPr();
}
_runs.clear();
for (int i=thisP.sizeOfBrArray(); i>0; i--) {
thisP.removeBr(i-1);
@ -844,7 +913,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
otherC.copyXmlContents(thisC);
otherC.dispose();
thisC.dispose();
for (XSLFTextRun tr : other.getTextRuns()) {
XmlObject xo = tr.getXmlObject();
XSLFTextRun run = (xo instanceof CTTextLineBreak)
@ -898,12 +967,12 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
if (doubleNotEquals(spaceAfter, getSpaceAfter())) {
setSpaceAfter(spaceAfter);
}
Double spaceBefore = other.getSpaceBefore();
if (doubleNotEquals(spaceBefore, getSpaceBefore())) {
setSpaceBefore(spaceBefore);
}
Double lineSpacing = other.getLineSpacing();
if (doubleNotEquals(lineSpacing, getLineSpacing())) {
setLineSpacing(lineSpacing);
@ -913,7 +982,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
private static boolean doubleNotEquals(Double d1, Double d2) {
return !Objects.equals(d1, d2);
}
@Override
public Double getDefaultFontSize() {
CTTextCharacterProperties endPr = _p.getEndParaRPr();
@ -934,7 +1003,9 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
@Override
public BulletStyle getBulletStyle() {
if (!isBullet()) return null;
if (!isBullet()) {
return null;
}
return new BulletStyle(){
@Override
public String getBulletCharacter() {
@ -955,7 +1026,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
public PaintStyle getBulletFontColor() {
return XSLFTextParagraph.this.getBulletFontColor();
}
@Override
public void setBulletFontColor(Color color) {
setBulletFontColor(DrawPaint.createSolidPaint(color));
@ -965,7 +1036,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
public void setBulletFontColor(PaintStyle color) {
XSLFTextParagraph.this.setBulletFontColor(color);
}
@Override
public AutoNumberingScheme getAutoNumberingScheme() {
return XSLFTextParagraph.this.getAutoNumberingScheme();
@ -1004,6 +1075,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
@Override
public List<XSLFTabStop> getTabStops() {
ParagraphPropertyFetcher<List<XSLFTabStop>> fetcher = new ParagraphPropertyFetcher<List<XSLFTabStop>>(getIndentLevel()){
@Override
public boolean fetch(CTTextParagraphProperties props) {
if (props.isSetTabLst()) {
final List<XSLFTabStop> list = new ArrayList<>();
@ -1018,7 +1090,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
}
};
fetchParagraphProperty(fetcher);
return fetcher.getValue();
return fetcher.getValue();
}
@Override
@ -1099,9 +1171,9 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
* Helper method to allow subclasses to provide their own text run
*
* @param r the xml reference
*
*
* @return a new text paragraph
*
*
* @since POI 3.15-beta2
*/
protected XSLFTextRun newTextRun(XmlObject r) {