use of org.apache.poi.hslf.model.textproperties.TextProp in project poi by apache.
the class TextStyleListing method showTextProps.
public static void showTextProps(TextPropCollection tpc) {
List<TextProp> textProps = tpc.getTextPropList();
System.out.println(" Contains " + textProps.size() + " TextProps");
for (int i = 0; i < textProps.size(); i++) {
TextProp tp = textProps.get(i);
System.out.println(" " + i + " - " + tp.getName());
System.out.println(" = " + tp.getValue());
System.out.println(" @ " + tp.getMask());
if (tp instanceof BitMaskTextProp) {
BitMaskTextProp bmtp = (BitMaskTextProp) tp;
String[] subPropNames = bmtp.getSubPropNames();
boolean[] subPropMatches = bmtp.getSubPropMatches();
for (int j = 0; j < subPropNames.length; j++) {
System.out.println(" -> " + j + " - " + subPropNames[j]);
System.out.println(" " + j + " = " + subPropMatches[j]);
}
}
}
}
use of org.apache.poi.hslf.model.textproperties.TextProp in project poi by apache.
the class HSLFTextParagraph method getPctOrPoints.
private Double getPctOrPoints(String propName) {
TextProp tp = getPropVal(_paragraphStyle, _masterStyle, propName);
if (tp == null) {
return null;
}
int val = tp.getValue();
return (val < 0) ? Units.masterToPoints(val) : val;
}
use of org.apache.poi.hslf.model.textproperties.TextProp in project poi by apache.
the class HSLFTextParagraph method getBulletColor.
/**
* Returns the bullet color
*/
public Color getBulletColor() {
TextProp tp = getPropVal(_paragraphStyle, _masterStyle, "bullet.color");
boolean hasColor = getFlag(ParagraphFlagsTextProp.BULLET_HARDCOLOR_IDX);
if (tp == null || !hasColor) {
// if bullet color is undefined, return color of first run
if (_runs.isEmpty()) {
return null;
}
SolidPaint sp = _runs.get(0).getFontColor();
if (sp == null) {
return null;
}
return DrawPaint.applyColorTransform(sp.getSolidColor());
}
return getColorFromColorIndexStruct(tp.getValue(), _sheet);
}
use of org.apache.poi.hslf.model.textproperties.TextProp in project poi by apache.
the class HSLFTextParagraph method setPropVal.
/**
* Returns the named TextProp, either by fetching it (if it exists) or
* adding it (if it didn't)
*
* @param props the TextPropCollection to fetch from / add into
* @param name the name of the TextProp to fetch/add
* @param val the value, null if unset
*/
protected void setPropVal(TextPropCollection props, TextPropCollection masterProps, String name, Integer val) {
TextPropCollection pc = props;
if (getSheet() instanceof MasterSheet && masterProps != null) {
pc = masterProps;
}
if (val == null) {
pc.removeByName(name);
return;
}
// Fetch / Add the TextProp
TextProp tp = pc.addWithName(name);
tp.setValue(val);
}
use of org.apache.poi.hslf.model.textproperties.TextProp in project poi by apache.
the class TestTxMasterStyleAtom method checkOtherType.
/**
* Test styles for type=TextHeaderAtom.OTHER_TYPE
*/
private void checkOtherType(TxMasterStyleAtom txmaster) {
TextPropCollection props;
TextProp prop;
//paragraph styles
props = txmaster.getParagraphStyles().get(0);
prop = props.findByName("alignment");
assertEquals(0, prop.getValue());
//character styles
props = txmaster.getCharacterStyles().get(0);
prop = props.findByName("font.color");
assertEquals(0x1000000, prop.getValue());
prop = props.findByName("font.index");
assertEquals(0, prop.getValue());
prop = props.findByName("font.size");
assertEquals(18, prop.getValue());
}
Aggregations