use of org.apache.poi.hslf.model.textproperties.BitMaskTextProp 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.BitMaskTextProp in project poi by apache.
the class HSLFTextRun method getFlag.
protected boolean getFlag(int index) {
if (characterStyle == null) {
return false;
}
BitMaskTextProp prop = (BitMaskTextProp) characterStyle.findByName(CharFlagsTextProp.NAME);
if (prop == null || !prop.getSubPropMatches()[index]) {
int txtype = parentParagraph.getRunType();
HSLFSheet sheet = parentParagraph.getSheet();
if (sheet != null) {
HSLFMasterSheet master = sheet.getMasterSheet();
if (master != null) {
prop = (BitMaskTextProp) master.getStyleAttribute(txtype, parentParagraph.getIndentLevel(), CharFlagsTextProp.NAME, true);
}
} else {
logger.log(POILogger.WARN, "MasterSheet is not available");
}
}
return prop == null ? false : prop.getSubValue(index);
}
use of org.apache.poi.hslf.model.textproperties.BitMaskTextProp in project poi by apache.
the class HSLFTextRun method setFlag.
protected void setFlag(int index, boolean value) {
BitMaskTextProp prop = (BitMaskTextProp) characterStyle.addWithName(CharFlagsTextProp.NAME);
prop.setSubValue(value, index);
}
use of org.apache.poi.hslf.model.textproperties.BitMaskTextProp 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.BitMaskTextProp in project poi by apache.
the class HSLFTextParagraph method setFlag.
private void setFlag(int index, boolean value) {
BitMaskTextProp tp = (BitMaskTextProp) _paragraphStyle.addWithName(ParagraphFlagsTextProp.NAME);
tp.setSubValue(value, index);
setDirty();
}
Aggregations