use of org.apache.poi.hslf.model.textproperties.TextProp in project poi by apache.
the class HSLFTextParagraph method getMasterPropVal.
private TextProp getMasterPropVal(TextPropCollection props, TextPropCollection masterProps, String propName) {
boolean isChar = props.getTextPropType() == TextPropType.character;
// check if we can delegate to master for the property
if (!isChar) {
BitMaskTextProp maskProp = (BitMaskTextProp) props.findByName(ParagraphFlagsTextProp.NAME);
boolean hardAttribute = (maskProp != null && maskProp.getValue() == 0);
if (hardAttribute) {
return null;
}
}
String[] propNames = propName.split(",");
if (masterProps == null) {
HSLFSheet sheet = getSheet();
int txtype = getRunType();
HSLFMasterSheet master = sheet.getMasterSheet();
if (master == null) {
logger.log(POILogger.WARN, "MasterSheet is not available");
return null;
}
for (String pn : propNames) {
TextProp prop = master.getStyleAttribute(txtype, getIndentLevel(), pn, isChar);
if (prop != null) {
return prop;
}
}
} else {
for (String pn : propNames) {
TextProp prop = masterProps.findByName(pn);
if (prop != null) {
return prop;
}
}
}
return null;
}
use of org.apache.poi.hslf.model.textproperties.TextProp in project poi by apache.
the class TestTxMasterStyleAtom method checkNotesType.
/**
* Test styles for type=TextHeaderAtom.NOTES_TYPE
*/
private void checkNotesType(TxMasterStyleAtom txmaster) {
TextPropCollection props;
TextProp prop;
//paragraph styles
props = txmaster.getParagraphStyles().get(0);
prop = props.findByName("alignment");
//title has center 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(12, prop.getValue());
}
use of org.apache.poi.hslf.model.textproperties.TextProp in project poi by apache.
the class TestTxMasterStyleAtom method checkBodyType.
/**
* Test styles for type=TextHeaderAtom.BODY_TYPE
*/
private void checkBodyType(TxMasterStyleAtom txmaster) {
TextPropCollection props;
TextProp prop;
List<TextPropCollection> prstyles = txmaster.getParagraphStyles();
List<TextPropCollection> chstyles = txmaster.getCharacterStyles();
assertEquals("TxMasterStyleAtom for TextHeaderAtom.BODY_TYPE " + "must contain styles for 5 indentation levels", 5, prstyles.size());
assertEquals("TxMasterStyleAtom for TextHeaderAtom.BODY_TYPE " + "must contain styles for 5 indentation levels", 5, chstyles.size());
//paragraph styles
props = prstyles.get(0);
prop = props.findByName("alignment");
assertEquals(0, prop.getValue());
for (int i = 0; i < prstyles.size(); i++) {
assertNotNull("text.offset is null for indentation level " + i, prstyles.get(i).findByName("text.offset"));
assertNotNull("bullet.offset is null for indentation level " + i, prstyles.get(i).findByName("bullet.offset"));
}
//character styles
props = chstyles.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(32, prop.getValue());
}
Aggregations