use of org.apache.poi.xslf.model.ParagraphPropertyFetcher in project poi by apache.
the class XSLFTextParagraph method getBulletFontColor.
/**
*
* @return the color of bullet characters within a given paragraph.
* A <code>null</code> value means to use the text font color.
*/
public PaintStyle getBulletFontColor() {
final XSLFTheme theme = getParentShape().getSheet().getTheme();
ParagraphPropertyFetcher<Color> fetcher = new ParagraphPropertyFetcher<Color>(getIndentLevel()) {
public boolean fetch(CTTextParagraphProperties props) {
if (props.isSetBuClr()) {
XSLFColor c = new XSLFColor(props.getBuClr(), theme, null);
setValue(c.getColor());
return true;
}
return false;
}
};
fetchParagraphProperty(fetcher);
Color col = fetcher.getValue();
return (col == null) ? null : DrawPaint.createSolidPaint(col);
}
use of org.apache.poi.xslf.model.ParagraphPropertyFetcher in project poi by apache.
the class XSLFTextParagraph method getSpaceAfter.
@Override
public Double getSpaceAfter() {
ParagraphPropertyFetcher<Double> fetcher = new ParagraphPropertyFetcher<Double>(getIndentLevel()) {
public boolean fetch(CTTextParagraphProperties props) {
if (props.isSetSpcAft()) {
CTTextSpacing spc = props.getSpcAft();
if (spc.isSetSpcPct())
setValue(spc.getSpcPct().getVal() * 0.001);
else if (spc.isSetSpcPts())
setValue(-spc.getSpcPts().getVal() * 0.01);
return true;
}
return false;
}
};
fetchParagraphProperty(fetcher);
return fetcher.getValue();
}
use of org.apache.poi.xslf.model.ParagraphPropertyFetcher in project poi by apache.
the class XSLFTextParagraph method getTabStop.
public double getTabStop(final int idx) {
ParagraphPropertyFetcher<Double> fetcher = new ParagraphPropertyFetcher<Double>(getIndentLevel()) {
public boolean fetch(CTTextParagraphProperties props) {
if (props.isSetTabLst()) {
CTTextTabStopList tabStops = props.getTabLst();
if (idx < tabStops.sizeOfTabArray()) {
CTTextTabStop ts = tabStops.getTabArray(idx);
double val = Units.toPoints(ts.getPos());
setValue(val);
return true;
}
}
return false;
}
};
fetchParagraphProperty(fetcher);
return fetcher.getValue() == null ? 0. : fetcher.getValue();
}
use of org.apache.poi.xslf.model.ParagraphPropertyFetcher in project poi by apache.
the class XSLFTextParagraph method getLineSpacing.
@Override
public Double getLineSpacing() {
ParagraphPropertyFetcher<Double> fetcher = new ParagraphPropertyFetcher<Double>(getIndentLevel()) {
public boolean fetch(CTTextParagraphProperties props) {
if (props.isSetLnSpc()) {
CTTextSpacing spc = props.getLnSpc();
if (spc.isSetSpcPct())
setValue(spc.getSpcPct().getVal() * 0.001);
else if (spc.isSetSpcPts())
setValue(-spc.getSpcPts().getVal() * 0.01);
return true;
}
return false;
}
};
fetchParagraphProperty(fetcher);
Double lnSpc = fetcher.getValue();
if (lnSpc != null && lnSpc > 0) {
// check if the percentage value is scaled
CTTextNormalAutofit normAutofit = getParentShape().getTextBodyPr().getNormAutofit();
if (normAutofit != null) {
double scale = 1 - (double) normAutofit.getLnSpcReduction() / 100000;
lnSpc *= scale;
}
}
return lnSpc;
}
use of org.apache.poi.xslf.model.ParagraphPropertyFetcher in project poi by apache.
the class XSLFTextParagraph method getAutoNumberingScheme.
/**
* @return the auto numbering scheme, or null if not defined
*/
public AutoNumberingScheme getAutoNumberingScheme() {
ParagraphPropertyFetcher<AutoNumberingScheme> fetcher = new ParagraphPropertyFetcher<AutoNumberingScheme>(getIndentLevel()) {
public boolean fetch(CTTextParagraphProperties props) {
if (props.isSetBuAutoNum()) {
AutoNumberingScheme ans = AutoNumberingScheme.forOoxmlID(props.getBuAutoNum().getType().intValue());
if (ans != null) {
setValue(ans);
return true;
}
}
return false;
}
};
fetchParagraphProperty(fetcher);
return fetcher.getValue();
}
Aggregations