use of org.apache.poi.hslf.model.textproperties.TextProp in project poi by apache.
the class TestTxMasterStyleAtom method checkTitleType.
/**
* Test styles for type=TextHeaderAtom.TITLE_TYPE
*/
private void checkTitleType(TxMasterStyleAtom txmaster) {
TextPropCollection props;
TextProp prop;
//paragraph styles
props = txmaster.getParagraphStyles().get(0);
prop = props.findByName("alignment");
//title has center alignment
assertEquals(1, prop.getValue());
//character styles
props = txmaster.getCharacterStyles().get(0);
prop = props.findByName("font.color");
assertEquals(0x3000000, prop.getValue());
prop = props.findByName("font.index");
assertEquals(0, prop.getValue());
prop = props.findByName("font.size");
assertEquals(44, prop.getValue());
}
use of org.apache.poi.hslf.model.textproperties.TextProp in project poi by apache.
the class HSLFSlideMaster method getStyleAttribute.
/**
* Pickup a style attribute from the master.
* This is the "workhorse" which returns the default style attributes.
*/
@Override
public TextProp getStyleAttribute(int txtype, int level, String name, boolean isCharacter) {
if (_txmaster.length <= txtype) {
return null;
}
TxMasterStyleAtom t = _txmaster[txtype];
List<TextPropCollection> styles = isCharacter ? t.getCharacterStyles() : t.getParagraphStyles();
TextProp prop = null;
for (int i = Math.min(level, styles.size() - 1); prop == null && i >= 0; i--) {
prop = styles.get(i).findByName(name);
}
if (prop != null) {
return prop;
}
switch(txtype) {
case TextHeaderAtom.CENTRE_BODY_TYPE:
case TextHeaderAtom.HALF_BODY_TYPE:
case TextHeaderAtom.QUARTER_BODY_TYPE:
txtype = TextHeaderAtom.BODY_TYPE;
break;
case TextHeaderAtom.CENTER_TITLE_TYPE:
txtype = TextHeaderAtom.TITLE_TYPE;
break;
default:
return null;
}
return getStyleAttribute(txtype, level, name, isCharacter);
}
use of org.apache.poi.hslf.model.textproperties.TextProp in project poi by apache.
the class HSLFTextRun method getFontColor.
/**
* @return font color as PaintStyle
*/
@Override
public SolidPaint getFontColor() {
TextProp tp = getTextParagraph().getPropVal(characterStyle, masterStyle, "font.color");
if (tp == null) {
return null;
}
Color color = HSLFTextParagraph.getColorFromColorIndexStruct(tp.getValue(), parentParagraph.getSheet());
SolidPaint ps = DrawPaint.createSolidPaint(color);
return ps;
}
use of org.apache.poi.hslf.model.textproperties.TextProp in project poi by apache.
the class HSLFTextRun method getFontFamily.
@Override
public String getFontFamily() {
HSLFSheet sheet = parentParagraph.getSheet();
@SuppressWarnings("resource") HSLFSlideShow slideShow = (sheet == null) ? null : sheet.getSlideShow();
if (sheet == null || slideShow == null) {
return _fontFamily;
}
TextProp tp = getTextParagraph().getPropVal(characterStyle, masterStyle, "font.index,asian.font.index,ansi.font.index,symbol.font.index");
if (tp == null) {
return null;
}
return slideShow.getFontCollection().getFontWithId(tp.getValue());
}
use of org.apache.poi.hslf.model.textproperties.TextProp in project poi by apache.
the class HSLFTextParagraph method getBulletFont.
/**
* Returns the bullet font
*/
public String getBulletFont() {
TextProp tp = getPropVal(_paragraphStyle, _masterStyle, "bullet.font");
boolean hasFont = getFlag(ParagraphFlagsTextProp.BULLET_HARDFONT_IDX);
if (tp == null || !hasFont) {
return getDefaultFontFamily();
}
PPFont ppFont = getSheet().getSlideShow().getFont(tp.getValue());
assert (ppFont != null);
return ppFont.getFontName();
}
Aggregations