org.apache.poi.hslf.usermodel
Class RichTextRun

java.lang.Object
  extended by org.apache.poi.hslf.usermodel.RichTextRun

public final class RichTextRun
extends java.lang.Object

Represents a run of text, all with the same style


Field Summary
protected  POILogger logger
           
 
Constructor Summary
RichTextRun(TextRun parent, int startAt, int len)
          Create a new wrapper around a (currently not) rich text string
RichTextRun(TextRun parent, int startAt, int len, TextPropCollection pStyle, TextPropCollection cStyle, boolean pShared, boolean cShared)
          Create a new wrapper around a rich text string
 
Method Summary
 TextPropCollection _getRawCharacterStyle()
          Internal Use Only - get the underlying character style collection.
 TextPropCollection _getRawParagraphStyle()
          Internal Use Only - get the underlying paragraph style collection.
 boolean _isCharacterStyleShared()
          Internal Use Only - are the Character styles shared?
 boolean _isParagraphStyleShared()
          Internal Use Only - are the Paragraph styles shared?
 int getAlignment()
          Returns the type of horizontal alignment for the text.
 char getBulletChar()
          Returns the bullet character
 java.awt.Color getBulletColor()
          Returns the bullet color
 int getBulletFont()
          Returns the bullet font
 int getBulletOffset()
          Returns the bullet offset
 int getBulletSize()
          Returns the bullet size
 int getEndIndex()
          The ending index, exclusive.
 java.awt.Color getFontColor()
           
 int getFontIndex()
          Gets the font index
 java.lang.String getFontName()
          Gets the font name
 int getFontSize()
          Gets the font size
 int getIndentLevel()
           
 int getLength()
          Get the length of the text
 int getLineSpacing()
          Returns the line spacing
 java.lang.String getRawText()
          Fetch the text, in raw storage form
 int getSpaceAfter()
          Returns spacing after a paragraph
 int getSpaceBefore()
          Returns spacing before a paragraph
 int getStartIndex()
          The beginning index, inclusive.
 int getSuperscript()
          Gets the subscript/superscript option
 java.lang.String getText()
          Fetch the text, in output suitable form
 int getTextOffset()
          Returns the text offset
 boolean isBold()
          Is the text bold?
 boolean isBullet()
          Returns whether this rich text run has bullets
 boolean isBulletHard()
          Returns whether this rich text run has bullets
 boolean isEmbossed()
          Is this text embossed?
 boolean isItalic()
          Is the text italic?
 boolean isShadowed()
          Does the text have a shadow?
 boolean isStrikethrough()
          Gets the strikethrough flag
 boolean isUnderlined()
          Is the text underlined?
 void setAlignment(int align)
          Sets the type of horizontal alignment for the text.
 void setBold(boolean bold)
          Is the text bold?
 void setBullet(boolean flag)
          Sets whether this rich text run has bullets
 void setBulletChar(char c)
          Sets the bullet character
 void setBulletColor(java.awt.Color color)
          Sets the bullet color
 void setBulletFont(int idx)
          Sets the bullet font
 void setBulletOffset(int offset)
          Sets the bullet offset
 void setBulletSize(int size)
          Sets the bullet size
 void setCharTextPropVal(java.lang.String propName, int val)
          Sets the value of the given Paragraph TextProp, add if required
 void setEmbossed(boolean flag)
          Is this text embossed?
 void setFlag(boolean isCharacter, int index, boolean value)
           
 void setFontColor(java.awt.Color color)
          Sets color of the text, as a java.awt.Color
 void setFontColor(int bgr)
          Sets color of the text, as a int bgr.
 void setFontIndex(int idx)
          Sets the font index
 void setFontName(java.lang.String fontName)
          Sets the font name to use
 void setFontSize(int fontSize)
          Sets the font size
 void setIndentLevel(int level)
          Sets indentation level
 void setItalic(boolean italic)
          Is the text italic?
 void setLineSpacing(int val)
          Sets the line spacing.
 void setParaTextPropVal(java.lang.String propName, int val)
          Sets the value of the given Character TextProp, add if required
 void setRawText(java.lang.String text)
          Change the text
 void setShadowed(boolean flag)
          Does the text have a shadow?
 void setSpaceAfter(int val)
          Sets spacing after a paragraph.
 void setSpaceBefore(int val)
          Sets spacing before a paragraph.
 void setStrikethrough(boolean flag)
          Sets the strikethrough flag
 void setSuperscript(int val)
          Sets the subscript/superscript option
 void setText(java.lang.String text)
          Change the text
 void setTextOffset(int offset)
          Sets the text offset
 void setUnderlined(boolean underlined)
          Is the text underlined?
 void supplySlideShow(SlideShow ss)
          Supply the SlideShow we belong to
 void supplyTextProps(TextPropCollection pStyle, TextPropCollection cStyle, boolean pShared, boolean cShared)
          Supply (normally default) textprops, and if they're shared, when a run gets them
 void updateStartPosition(int startAt)
          Tells the RichTextRun its new position in the parent TextRun
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected POILogger logger
Constructor Detail

RichTextRun

public RichTextRun(TextRun parent,
                   int startAt,
                   int len)
Create a new wrapper around a (currently not) rich text string

Parameters:
parent -
startAt -
len -

RichTextRun

public RichTextRun(TextRun parent,
                   int startAt,
                   int len,
                   TextPropCollection pStyle,
                   TextPropCollection cStyle,
                   boolean pShared,
                   boolean cShared)
Create a new wrapper around a rich text string

Parameters:
parent - The parent TextRun
startAt - The start position of this run
len - The length of this run
pStyle - The paragraph style property collection
cStyle - The character style property collection
pShared - The paragraph styles are shared with other runs
cShared - The character styles are shared with other runs
Method Detail

supplyTextProps

public void supplyTextProps(TextPropCollection pStyle,
                            TextPropCollection cStyle,
                            boolean pShared,
                            boolean cShared)
Supply (normally default) textprops, and if they're shared, when a run gets them


supplySlideShow

public void supplySlideShow(SlideShow ss)
Supply the SlideShow we belong to


getLength

public int getLength()
Get the length of the text


getStartIndex

public int getStartIndex()
The beginning index, inclusive.

Returns:
the beginning index, inclusive.

getEndIndex

public int getEndIndex()
The ending index, exclusive.

Returns:
the ending index, exclusive.

getText

public java.lang.String getText()
Fetch the text, in output suitable form


getRawText

public java.lang.String getRawText()
Fetch the text, in raw storage form


setText

public void setText(java.lang.String text)
Change the text


setRawText

public void setRawText(java.lang.String text)
Change the text


updateStartPosition

public void updateStartPosition(int startAt)
Tells the RichTextRun its new position in the parent TextRun

Parameters:
startAt -

setFlag

public void setFlag(boolean isCharacter,
                    int index,
                    boolean value)

setParaTextPropVal

public void setParaTextPropVal(java.lang.String propName,
                               int val)
Sets the value of the given Character TextProp, add if required

Parameters:
propName - The name of the Character TextProp
val - The value to set for the TextProp

setCharTextPropVal

public void setCharTextPropVal(java.lang.String propName,
                               int val)
Sets the value of the given Paragraph TextProp, add if required

Parameters:
propName - The name of the Paragraph TextProp
val - The value to set for the TextProp

isBold

public boolean isBold()
Is the text bold?


setBold

public void setBold(boolean bold)
Is the text bold?


isItalic

public boolean isItalic()
Is the text italic?


setItalic

public void setItalic(boolean italic)
Is the text italic?


isUnderlined

public boolean isUnderlined()
Is the text underlined?


setUnderlined

public void setUnderlined(boolean underlined)
Is the text underlined?


isShadowed

public boolean isShadowed()
Does the text have a shadow?


setShadowed

public void setShadowed(boolean flag)
Does the text have a shadow?


isEmbossed

public boolean isEmbossed()
Is this text embossed?


setEmbossed

public void setEmbossed(boolean flag)
Is this text embossed?


isStrikethrough

public boolean isStrikethrough()
Gets the strikethrough flag


setStrikethrough

public void setStrikethrough(boolean flag)
Sets the strikethrough flag


getSuperscript

public int getSuperscript()
Gets the subscript/superscript option

Returns:
the percentage of the font size. If the value is positive, it is superscript, otherwise it is subscript

setSuperscript

public void setSuperscript(int val)
Sets the subscript/superscript option

Parameters:
val - the percentage of the font size. If the value is positive, it is superscript, otherwise it is subscript

getFontSize

public int getFontSize()
Gets the font size


setFontSize

public void setFontSize(int fontSize)
Sets the font size


getFontIndex

public int getFontIndex()
Gets the font index


setFontIndex

public void setFontIndex(int idx)
Sets the font index


setFontName

public void setFontName(java.lang.String fontName)
Sets the font name to use


getFontName

public java.lang.String getFontName()
Gets the font name


getFontColor

public java.awt.Color getFontColor()
Returns:
font color as RGB value
See Also:
Color

setFontColor

public void setFontColor(int bgr)
Sets color of the text, as a int bgr. (PowerPoint stores as BlueGreenRed, not the more usual RedGreenBlue)

See Also:
Color

setFontColor

public void setFontColor(java.awt.Color color)
Sets color of the text, as a java.awt.Color


setAlignment

public void setAlignment(int align)
Sets the type of horizontal alignment for the text. One of the Align* constants defined in the TextBox class.

Parameters:
align - - the type of alignment

getAlignment

public int getAlignment()
Returns the type of horizontal alignment for the text. One of the Align* constants defined in the TextBox class.

Returns:
the type of alignment

getIndentLevel

public int getIndentLevel()
Returns:
indentation level

setIndentLevel

public void setIndentLevel(int level)
Sets indentation level

Parameters:
level - indentation level. Must be in the range [0, 4]

setBullet

public void setBullet(boolean flag)
Sets whether this rich text run has bullets


isBullet

public boolean isBullet()
Returns whether this rich text run has bullets


isBulletHard

public boolean isBulletHard()
Returns whether this rich text run has bullets


setBulletChar

public void setBulletChar(char c)
Sets the bullet character


getBulletChar

public char getBulletChar()
Returns the bullet character


setBulletOffset

public void setBulletOffset(int offset)
Sets the bullet offset


getBulletOffset

public int getBulletOffset()
Returns the bullet offset


setTextOffset

public void setTextOffset(int offset)
Sets the text offset


getTextOffset

public int getTextOffset()
Returns the text offset


setBulletSize

public void setBulletSize(int size)
Sets the bullet size


getBulletSize

public int getBulletSize()
Returns the bullet size


setBulletColor

public void setBulletColor(java.awt.Color color)
Sets the bullet color


getBulletColor

public java.awt.Color getBulletColor()
Returns the bullet color


setBulletFont

public void setBulletFont(int idx)
Sets the bullet font


getBulletFont

public int getBulletFont()
Returns the bullet font


setLineSpacing

public void setLineSpacing(int val)
Sets the line spacing.

If linespacing >= 0, then linespacing is a percentage of normal line height. If linespacing < 0, the absolute value of linespacing is the spacing in master coordinates.


getLineSpacing

public int getLineSpacing()
Returns the line spacing

If linespacing >= 0, then linespacing is a percentage of normal line height. If linespacing < 0, the absolute value of linespacing is the spacing in master coordinates.

Returns:
the spacing between lines

setSpaceBefore

public void setSpaceBefore(int val)
Sets spacing before a paragraph.

If spacebefore >= 0, then spacebefore is a percentage of normal line height. If spacebefore < 0, the absolute value of spacebefore is the spacing in master coordinates.


getSpaceBefore

public int getSpaceBefore()
Returns spacing before a paragraph

If spacebefore >= 0, then spacebefore is a percentage of normal line height. If spacebefore < 0, the absolute value of spacebefore is the spacing in master coordinates.

Returns:
the spacing before a paragraph

setSpaceAfter

public void setSpaceAfter(int val)
Sets spacing after a paragraph.

If spaceafter >= 0, then spaceafter is a percentage of normal line height. If spaceafter < 0, the absolute value of spaceafter is the spacing in master coordinates.


getSpaceAfter

public int getSpaceAfter()
Returns spacing after a paragraph

If spaceafter >= 0, then spaceafter is a percentage of normal line height. If spaceafter < 0, the absolute value of spaceafter is the spacing in master coordinates.

Returns:
the spacing before a paragraph

_getRawParagraphStyle

public TextPropCollection _getRawParagraphStyle()
Internal Use Only - get the underlying paragraph style collection. For normal use, use the friendly setters and getters


_getRawCharacterStyle

public TextPropCollection _getRawCharacterStyle()
Internal Use Only - get the underlying character style collection. For normal use, use the friendly setters and getters


_isParagraphStyleShared

public boolean _isParagraphStyleShared()
Internal Use Only - are the Paragraph styles shared?


_isCharacterStyleShared

public boolean _isCharacterStyleShared()
Internal Use Only - are the Character styles shared?



Copyright 2012 The Apache Software Foundation or its licensors, as applicable.