use of org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties 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();
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties in project poi by apache.
the class XSLFTextParagraph method addTabStop.
public void addTabStop(double value) {
CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr();
CTTextTabStopList tabStops = pr.isSetTabLst() ? pr.getTabLst() : pr.addNewTabLst();
tabStops.addNewTab().setPos(Units.toEMU(value));
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties in project poi by apache.
the class XSLFTextParagraph method getSpaceBefore.
@Override
public Double getSpaceBefore() {
ParagraphPropertyFetcher<Double> fetcher = new ParagraphPropertyFetcher<Double>(getIndentLevel()) {
public boolean fetch(CTTextParagraphProperties props) {
if (props.isSetSpcBef()) {
CTTextSpacing spc = props.getSpcBef();
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.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties in project poi by apache.
the class XSLFTextParagraph method setBulletAutoNumber.
/**
* Specifies that automatic numbered bullet points should be applied to this paragraph
*
* @param scheme type of auto-numbering
* @param startAt the number that will start number for a given sequence of automatically
numbered bullets (1-based).
*/
public void setBulletAutoNumber(AutoNumberingScheme scheme, int startAt) {
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));
lst.setStartAt(startAt);
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties in project poi by apache.
the class XSLFTextRun method fetchCharacterProperty.
private boolean fetchCharacterProperty(CharacterPropertyFetcher<?> fetcher) {
XSLFTextShape shape = _p.getParentShape();
XSLFSheet sheet = shape.getSheet();
CTTextCharacterProperties rPr = getRPr(false);
if (rPr != null && fetcher.fetch(rPr)) {
return true;
}
if (shape.fetchShapeProperty(fetcher)) {
return true;
}
CTPlaceholder ph = shape.getCTPlaceholder();
if (ph == null) {
// if it is a plain text box then take defaults from presentation.xml
@SuppressWarnings("resource") XMLSlideShow ppt = sheet.getSlideShow();
// TODO: determine master shape
CTTextParagraphProperties themeProps = ppt.getDefaultParagraphStyle(_p.getIndentLevel());
if (themeProps != null && fetcher.fetch(themeProps)) {
return true;
}
}
// TODO: determine master shape
CTTextParagraphProperties defaultProps = _p.getDefaultMasterStyle();
if (defaultProps != null && fetcher.fetch(defaultProps)) {
return true;
}
return false;
}
Aggregations