Methods Summary |
---|
public org.apache.poi.hslf.model.textproperties.TextPropCollection | _getRawCharacterStyle()Internal Use Only - get the underlying character style collection.
For normal use, use the friendly setters and getters return characterStyle;
|
public org.apache.poi.hslf.model.textproperties.TextPropCollection | _getRawParagraphStyle()Internal Use Only - get the underlying paragraph style collection.
For normal use, use the friendly setters and getters return paragraphStyle;
|
public boolean | _isCharacterStyleShared()Internal Use Only - are the Character styles shared? return sharingCharacterStyle;
|
public boolean | _isParagraphStyleShared()Internal Use Only - are the Paragraph styles shared? return sharingParagraphStyle;
|
private org.apache.poi.hslf.model.textproperties.TextProp | fetchOrAddTextProp(org.apache.poi.hslf.model.textproperties.TextPropCollection textPropCol, java.lang.String textPropName)Returns the named TextProp, either by fetching it (if it exists) or adding it
(if it didn't)
// Fetch / Add the TextProp
TextProp tp = textPropCol.findByName(textPropName);
if(tp == null) {
tp = textPropCol.addWithName(textPropName);
}
return tp;
|
public int | getAlignment()Returns the type of horizontal alignment for the text.
One of the Align* constants defined in the TextBox class.
return getParaTextPropVal("alignment");
|
public char | getBulletChar()Returns the bullet character
return (char)getParaTextPropVal("bullet.char");
|
public int | getBulletOffset()Returns the bullet offset
return getParaTextPropVal("bullet.offset")*Shape.POINT_DPI/Shape.MASTER_DPI;
|
private int | getCharTextPropVal(java.lang.String propName)Fetch the value of the given Character related TextProp.
Returns -1 if that TextProp isn't present.
If the TextProp isn't present, the value from the appropriate
Master Sheet will apply.
TextProp prop = null;
if (characterStyle != null){
prop = characterStyle.findByName(propName);
}
if (prop == null){
Sheet sheet = parentRun.getSheet();
int txtype = parentRun.getRunType();
MasterSheet master = sheet.getMasterSheet();
if (master != null)
prop = master.getStyleAttribute(txtype, getIndentLevel(), propName, true);
}
return prop == null ? -1 : prop.getValue();
|
private boolean | getFlag(boolean isCharacter, int index)
TextPropCollection props;
String propname;
if (isCharacter){
props = characterStyle;
propname = CharFlagsTextProp.NAME;
} else {
props = paragraphStyle;
propname = ParagraphFlagsTextProp.NAME;
}
BitMaskTextProp prop = null;
if (props != null){
prop = (BitMaskTextProp)props.findByName(propname);
}
if (prop == null){
Sheet sheet = parentRun.getSheet();
int txtype = parentRun.getRunType();
MasterSheet master = sheet.getMasterSheet();
if (master != null)
prop = (BitMaskTextProp)master.getStyleAttribute(txtype, getIndentLevel(), propname, isCharacter);
}
return prop == null ? false : prop.getSubValue(index);
|
public java.awt.Color | getFontColor()
int rgb = getCharTextPropVal("font.color");
if (rgb >= 0x8000000) {
int idx = rgb % 0x8000000;
ColorSchemeAtom ca = parentRun.getSheet().getColorScheme();
if(idx >= 0 && idx <= 7) rgb = ca.getColor(idx);
}
Color tmp = new Color(rgb, true);
return new Color(tmp.getBlue(), tmp.getGreen(), tmp.getRed());
|
public java.lang.String | getFontName()
if (slideShow == null) {
return _fontname;
} else {
int fontIdx = getCharTextPropVal("font.index");
if(fontIdx == -1) { return null; }
return slideShow.getFontCollection().getFontWithId(fontIdx);
}
|
public int | getFontSize()
return getCharTextPropVal("font.size");
|
public int | getIndentLevel()
return paragraphStyle == null ? 0 : paragraphStyle.getReservedField();
|
public int | getLength()Get the length of the text
return length;
|
private int | getParaTextPropVal(java.lang.String propName)Fetch the value of the given Paragraph related TextProp.
Returns -1 if that TextProp isn't present.
If the TextProp isn't present, the value from the appropriate
Master Sheet will apply.
TextProp prop = null;
if (paragraphStyle != null){
prop = paragraphStyle.findByName(propName);
}
if (prop == null){
Sheet sheet = parentRun.getSheet();
int txtype = parentRun.getRunType();
MasterSheet master = sheet.getMasterSheet();
if (master != null)
prop = master.getStyleAttribute(txtype, getIndentLevel(), propName, false);
}
return prop == null ? -1 : prop.getValue();
|
public java.lang.String | getRawText()Fetch the text, in raw storage form
return parentRun.getRawText().substring(startPos, startPos+length);
|
public java.lang.String | getText()Fetch the text, in output suitable form
return parentRun.getText().substring(startPos, startPos+length);
|
public int | getTextOffset()Returns the text offset
return getParaTextPropVal("text.offset")*Shape.POINT_DPI/Shape.MASTER_DPI;
|
public boolean | isBold()
return isCharFlagsTextPropVal(CharFlagsTextProp.BOLD_IDX);
|
public boolean | isBullet()Returns whether this rich text run has bullets
return getFlag(false, ParagraphFlagsTextProp.BULLET_IDX);
|
private boolean | isCharFlagsTextPropVal(int index)Fetch the value of the given flag in the CharFlagsTextProp.
Returns false if the CharFlagsTextProp isn't present, since the
text property won't be set if there's no CharFlagsTextProp.
return getFlag(true, index);
|
public boolean | isItalic()
return isCharFlagsTextPropVal(CharFlagsTextProp.ITALIC_IDX);
|
public boolean | isUnderlined()
return isCharFlagsTextPropVal(CharFlagsTextProp.UNDERLINE_IDX);
|
public void | setAlignment(int align)Sets the type of horizontal alignment for the text.
One of the Align* constants defined in the TextBox class.
setParaTextPropVal("alignment", align);
|
public void | setBold(boolean bold)
setCharFlagsTextPropVal(CharFlagsTextProp.BOLD_IDX, bold);
|
public void | setBullet(boolean flag)Sets whether this rich text run has bullets
setFlag(false, ParagraphFlagsTextProp.BULLET_IDX, flag);
|
public void | setBulletChar(char c)Sets the bullet character
setParaTextPropVal("bullet.char", c);
|
public void | setBulletOffset(int offset)Sets the bullet offset
setParaTextPropVal("bullet.offset", offset*Shape.MASTER_DPI/Shape.POINT_DPI);
|
private void | setCharFlagsTextPropVal(int index, boolean value)Set the value of the given flag in the CharFlagsTextProp, adding
it if required.
setFlag(true, index, value);
|
private void | setCharTextPropVal(java.lang.String propName, int val)Sets the value of the given Paragraph TextProp, add if required
// Ensure we have the StyleTextProp atom we're going to need
if(characterStyle == null) {
parentRun.ensureStyleAtomPresent();
// characterStyle will now be defined
}
TextProp tp = fetchOrAddTextProp(characterStyle, propName);
tp.setValue(val);
|
private void | setFlag(boolean isCharacter, int index, boolean value)
TextPropCollection props;
String propname;
if (isCharacter){
props = characterStyle;
propname = CharFlagsTextProp.NAME;
} else {
props = paragraphStyle;
propname = ParagraphFlagsTextProp.NAME;
}
// Ensure we have the StyleTextProp atom we're going to need
if(props == null) {
parentRun.ensureStyleAtomPresent();
props = isCharacter ? characterStyle : paragraphStyle;
}
BitMaskTextProp prop = (BitMaskTextProp) fetchOrAddTextProp(props, propname);
prop.setSubValue(value,index);
|
public void | setFontColor(int bgr)Sets color of the text, as a int bgr.
(PowerPoint stores as BlueGreenRed, not the more
usual RedGreenBlue)
setCharTextPropVal("font.color", bgr);
|
public void | setFontColor(java.awt.Color color)Sets color of the text, as a java.awt.Color
// In PowerPont RGB bytes are swapped, as BGR
int rgb = new Color(color.getBlue(), color.getGreen(), color.getRed(), 254).getRGB();
setFontColor(rgb);
|
public void | setFontName(java.lang.String fontName)
if (slideShow == null) {
//we can't set font since slideshow is not assigned yet
_fontname = fontName;
} else {
// Get the index for this font (adding if needed)
int fontIdx = slideShow.getFontCollection().addFont(fontName);
setCharTextPropVal("font.index", fontIdx);
}
|
public void | setFontSize(int fontSize)
setCharTextPropVal("font.size", fontSize);
|
public void | setItalic(boolean italic)
setCharFlagsTextPropVal(CharFlagsTextProp.ITALIC_IDX, italic);
|
private void | setParaTextPropVal(java.lang.String propName, int val)Sets the value of the given Character TextProp, add if required
// Ensure we have the StyleTextProp atom we're going to need
if(paragraphStyle == null) {
parentRun.ensureStyleAtomPresent();
// paragraphStyle will now be defined
}
TextProp tp = fetchOrAddTextProp(paragraphStyle, propName);
tp.setValue(val);
|
public void | setText(java.lang.String text)Change the text
length = text.length();
parentRun.changeTextInRichTextRun(this,text);
|
public void | setTextOffset(int offset)Sets the text offset
setParaTextPropVal("text.offset", offset*Shape.MASTER_DPI/Shape.POINT_DPI);
|
public void | setUnderlined(boolean underlined)
setCharFlagsTextPropVal(CharFlagsTextProp.UNDERLINE_IDX, underlined);
|
public void | supplySlideShow(org.apache.poi.hslf.usermodel.SlideShow ss)Supply the SlideShow we belong to
slideShow = ss;
if (_fontname != null) {
setFontName(_fontname);
_fontname = null;
}
|
public void | supplyTextProps(org.apache.poi.hslf.model.textproperties.TextPropCollection pStyle, org.apache.poi.hslf.model.textproperties.TextPropCollection cStyle, boolean pShared, boolean cShared)Supply (normally default) textprops, and if they're shared,
when a run gets them
if(paragraphStyle != null || characterStyle != null) {
throw new IllegalStateException("Can't call supplyTextProps if run already has some");
}
paragraphStyle = pStyle;
characterStyle = cStyle;
sharingParagraphStyle = pShared;
sharingCharacterStyle = cShared;
|
public void | updateStartPosition(int startAt)Tells the RichTextRun its new position in the parent TextRun
startPos = startAt;
|