org.apache.poi.hslf.usermodel
Class HSLFTextRun

java.lang.Object
  extended by org.apache.poi.hslf.usermodel.HSLFTextRun
All Implemented Interfaces:
TextRun

public final class HSLFTextRun
extends java.lang.Object
implements TextRun

Represents a run of text, all with the same style


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.poi.sl.usermodel.TextRun
TextRun.TextCap
 
Field Summary
protected  POILogger logger
           
 
Constructor Summary
HSLFTextRun(HSLFTextParagraph parentParagraph)
          Create a new wrapper around a rich text string
 
Method Summary
 TextPropCollection getCharacterStyle()
           
protected  boolean getFlag(int index)
           
 PaintStyle.SolidPaint getFontColor()
          Returns the font color.
 java.lang.String getFontFamily()
          Gets the font name
 int getFontIndex()
          Gets the font index
 java.lang.Double getFontSize()
           
 int getLength()
          Get the length of the text
 byte getPitchAndFamily()
           
 java.lang.String getRawText()
          Fetch the text, in raw storage form
 int getSuperscript()
          Gets the subscript/superscript option
 TextRun.TextCap getTextCap()
           
 HSLFTextParagraph getTextParagraph()
           
 boolean isBold()
          Is the text bold?
 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 isSubscript()
           
 boolean isSuperscript()
           
 boolean isUnderlined()
          Is the text underlined?
 void setBold(boolean bold)
          Is the text bold?
 void setCharacterStyle(TextPropCollection characterStyle)
           
 void setCharTextPropVal(java.lang.String propName, java.lang.Integer val)
          Sets the value of the given Paragraph TextProp, add if required
 void setEmbossed(boolean flag)
          Is this text embossed?
protected  void setFlag(int index, boolean value)
           
 void setFontColor(java.awt.Color color)
          Sets the (solid) font color - convenience function
 void setFontColor(int bgr)
          Sets color of the text, as a int bgr.
 void setFontColor(PaintStyle color)
          Sets the font color
 void setFontFamily(java.lang.String fontFamily)
          Sets the font name to use
 void setFontIndex(int idx)
          Sets the font index
 void setFontSize(java.lang.Double fontSize)
           
 void setItalic(boolean italic)
          Is the text italic?
 void setShadowed(boolean flag)
          Does the text have a shadow?
 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 setUnderlined(boolean underlined)
          Is the text underlined?
 void updateSheet()
          Supply the SlideShow we belong to
 
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

HSLFTextRun

public HSLFTextRun(HSLFTextParagraph parentParagraph)
Create a new wrapper around a rich text string

Parameters:
parentParagraph - the parent paragraph
Method Detail

getCharacterStyle

public TextPropCollection getCharacterStyle()

setCharacterStyle

public void setCharacterStyle(TextPropCollection characterStyle)

updateSheet

public void updateSheet()
Supply the SlideShow we belong to


getLength

public int getLength()
Get the length of the text


getRawText

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

Specified by:
getRawText in interface TextRun

setText

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

Specified by:
setText in interface TextRun

getFlag

protected boolean getFlag(int index)

setCharTextPropVal

public void setCharTextPropVal(java.lang.String propName,
                               java.lang.Integer 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?

Specified by:
isBold in interface TextRun

setBold

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


isItalic

public boolean isItalic()
Is the text italic?

Specified by:
isItalic in interface TextRun

setItalic

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


isUnderlined

public boolean isUnderlined()
Is the text underlined?

Specified by:
isUnderlined in interface TextRun

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

Specified by:
isStrikethrough in interface TextRun

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 java.lang.Double getFontSize()
Specified by:
getFontSize in interface TextRun
Returns:
font size in points or null if font size is not set.

setFontSize

public void setFontSize(java.lang.Double fontSize)
Specified by:
setFontSize in interface TextRun
Parameters:
fontSize - font size in points, if null the underlying fontsize will be unset

getFontIndex

public int getFontIndex()
Gets the font index


setFontIndex

public void setFontIndex(int idx)
Sets the font index


setFontFamily

public void setFontFamily(java.lang.String fontFamily)
Sets the font name to use


getFontFamily

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

Specified by:
getFontFamily in interface TextRun

getFontColor

public PaintStyle.SolidPaint getFontColor()
Description copied from interface: TextRun
Returns the font color. This usually returns a PaintStyle.SolidPaint, but but also other classes are possible

Specified by:
getFontColor in interface TextRun
Returns:
font color as PaintStyle
See Also:
DrawPaint.getPaint(java.awt.Graphics2D, PaintStyle), PaintStyle.SolidPaint.getSolidColor(), DrawPaint.applyColorTransform(ColorStyle)

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)
Description copied from interface: TextRun
Sets the (solid) font color - convenience function

Specified by:
setFontColor in interface TextRun
Parameters:
color - the color

setFontColor

public void setFontColor(PaintStyle color)
Description copied from interface: TextRun
Sets the font color

Specified by:
setFontColor in interface TextRun
Parameters:
color - the color
See Also:
DrawPaint.createSolidPaint(Color)

setFlag

protected void setFlag(int index,
                       boolean value)

getTextParagraph

public HSLFTextParagraph getTextParagraph()

getTextCap

public TextRun.TextCap getTextCap()
Specified by:
getTextCap in interface TextRun

isSubscript

public boolean isSubscript()
Specified by:
isSubscript in interface TextRun

isSuperscript

public boolean isSuperscript()
Specified by:
isSuperscript in interface TextRun

getPitchAndFamily

public byte getPitchAndFamily()
Specified by:
getPitchAndFamily in interface TextRun
Returns:
the pitch and family id or -1 if not applicable


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