public abstract class HSLFTextShape extends HSLFSimpleShape implements TextShape<HSLFShape,HSLFTextParagraph>
TextShape.TextAutofit, TextShape.TextDirection
Modifier and Type | Field and Description |
---|---|
protected static java.awt.font.FontRenderContext |
_frc
Used to calculate text bounds
|
protected java.util.List<HSLFTextParagraph> |
_paragraphs
TextRun object which holds actual text and format data
|
protected EscherTextboxWrapper |
_txtbox
Escher container which holds text attributes such as
TextHeaderAtom, TextBytesAtom ot TextCharsAtom, StyleTextPropAtom etc.
|
static int |
WrapByPoints |
static int |
WrapNone |
static int |
WrapSquare
How to wrap the text
|
static int |
WrapThrough |
static int |
WrapTopBottom |
_clientData, _clientRecords, DEFAULT_LINE_WIDTH
Modifier | Constructor and Description |
---|---|
|
HSLFTextShape()
Create a new TextBox.
|
protected |
HSLFTextShape(EscherContainerRecord escherRecord,
ShapeContainer<HSLFShape,HSLFTextParagraph> parent)
Create a TextBox object and initialize it from the supplied Record container.
|
|
HSLFTextShape(ShapeContainer<HSLFShape,HSLFTextParagraph> parent)
Create a new TextBox.
|
Modifier and Type | Method and Description |
---|---|
protected void |
afterInsert(HSLFSheet sh)
When a textbox is added to a sheet we need to tell upper-level
PPDrawing about it. |
HSLFTextRun |
appendText(java.lang.String text,
boolean newParagraph)
Adds the supplied text onto the end of the TextParagraphs,
creating a new RichTextRun for it to sit in.
|
double |
getBottomInset()
Returns the distance (in points) between the bottom of the text frame
and the bottom of the inscribed rectangle of the shape that contains the text.
|
protected EscherTextboxWrapper |
getEscherTextboxWrapper() |
java.util.List<HSLFHyperlink> |
getHyperlinks()
Returns the array of all hyperlinks in this text run
|
Insets2D |
getInsets() |
double |
getLeftInset()
Returns the distance (in points) between the left edge of the text frame
and the left edge of the inscribed rectangle of the shape that contains
the text.
|
OEPlaceholderAtom |
getPlaceholderAtom()
Return
OEPlaceholderAtom , the atom that describes a placeholder. |
java.lang.String |
getRawText()
Returns the raw text content of the shape.
|
double |
getRightInset()
Returns the distance (in points) between the right edge of the
text frame and the right edge of the inscribed rectangle of the shape
that contains the text.
|
int |
getRunType()
Returns the type of the text, from the TextHeaderAtom.
|
java.lang.String |
getText()
Returns the text contained in this text frame, which has been made safe
for printing and other use.
|
TextShape.TextDirection |
getTextDirection() |
double |
getTextHeight()
Compute the cumulative height occupied by the text
|
int |
getTextId() |
java.util.List<HSLFTextParagraph> |
getTextParagraphs() |
double |
getTopInset()
Returns the distance (in points) between the top of the text frame
and the top of the inscribed rectangle of the shape that contains the text.
|
VerticalAlignment |
getVerticalAlignment()
Returns the type of vertical alignment for the text.
|
boolean |
getWordWrap() |
int |
getWordWrapEx()
Returns the value indicating word wrap.
|
boolean |
isAlignToBaseline() |
boolean |
isHorizontalCentered()
Returns if the text is centered.
|
boolean |
isPlaceholder() |
java.util.Iterator<HSLFTextParagraph> |
iterator() |
java.awt.geom.Rectangle2D |
resizeToFitText()
Adjust the size of the shape so it encompasses the text inside it.
|
void |
setAlignToBaseline(boolean alignToBaseline)
Sets the vertical alignment relative to the baseline
|
void |
setBottomInset(double margin)
Sets the botom margin.
|
protected void |
setDefaultTextProperties(HSLFTextParagraph _txtrun)
Set default properties for the TextRun.
|
void |
setHorizontalCentered(java.lang.Boolean isCentered)
Sets if the paragraphs are horizontal centered
|
void |
setHyperlink(int linkId,
int beginIndex,
int endIndex)
Assigns a hyperlink to this text shape
|
void |
setLeftInset(double margin)
Sets the left margin.
|
void |
setRightInset(double margin)
Sets the right margin.
|
void |
setRunType(int type)
Changes the type of the text.
|
void |
setSheet(HSLFSheet sheet)
Assign the
SlideShow this shape belongs to |
HSLFTextRun |
setText(java.lang.String text)
Sets (overwrites) the current text.
|
void |
setTextId(int id)
Sets text ID
|
void |
setTopInset(double margin)
Sets the top margin.
|
void |
setVerticalAlignment(VerticalAlignment vAlign) |
void |
setWordWrap(int wrap)
Specifies how the text should be wrapped
|
protected void |
storeText()
Saves the modified paragraphs/textrun to the records.
|
createSpContainer, getAdjustValue, getClientDataRecord, getClientRecords, getFillColor, getGeometry, getLineColor, getLineCompound, getLineDashing, getLineDecoration, getLineWidth, getShadow, getShadowAngle, getShadowColor, getShadowDistance, getStrokeStyle, setFillColor, setHyperlink, setLineColor, setLineCompound, setLineDashing, setLineWidth, updateClientData
draw, getAnchor, getEscherChild, getEscherChild, getEscherOptRecord, getEscherProperty, getEscherProperty, getEscherProperty, getFill, getFillStyle, getFlipHorizontal, getFlipVertical, getHyperlink, getParent, getRotation, getShapeId, getShapeName, getShapeType, getSheet, getSpContainer, moveTo, setAnchor, setEscherProperty, setEscherProperty, setFlipHorizontal, setFlipVertical, setRotation, setShapeId, setShapeType
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFillStyle, getGeometry, getLineDecoration, getShadow, getShapeType, getStrokeStyle
getAdjustValue
getAnchor, getFlipHorizontal, getFlipVertical, getParent, getRotation, setAnchor, setFlipHorizontal, setFlipVertical, setRotation
public static final int WrapSquare
public static final int WrapByPoints
public static final int WrapNone
public static final int WrapTopBottom
public static final int WrapThrough
protected java.util.List<HSLFTextParagraph> _paragraphs
protected EscherTextboxWrapper _txtbox
protected static final java.awt.font.FontRenderContext _frc
protected HSLFTextShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape,HSLFTextParagraph> parent)
escherRecord
- EscherSpContainer
container which holds information about this shapeparent
- the parent of the shapepublic HSLFTextShape(ShapeContainer<HSLFShape,HSLFTextParagraph> parent)
parent
- the parent of this Shape. For example, if this text box is a cell
in a table then the parent is Table.public HSLFTextShape()
protected void setDefaultTextProperties(HSLFTextParagraph _txtrun)
protected void afterInsert(HSLFSheet sh)
PPDrawing
about it.afterInsert
in class HSLFShape
sh
- the sheet we are adding toprotected EscherTextboxWrapper getEscherTextboxWrapper()
public java.awt.geom.Rectangle2D resizeToFitText()
Rectangle2D
that is the bounds of this shape.public int getRunType()
TextHeaderAtom
public void setRunType(int type)
TextHeaderAtom
public VerticalAlignment getVerticalAlignment()
TextShape
getVerticalAlignment
in interface TextShape<HSLFShape,HSLFTextParagraph>
public boolean isAlignToBaseline()
public void setAlignToBaseline(boolean alignToBaseline)
alignToBaseline
- if true, vertical alignment is relative to baselinepublic boolean isHorizontalCentered()
TextShape
isHorizontalCentered
in interface TextShape<HSLFShape,HSLFTextParagraph>
public void setVerticalAlignment(VerticalAlignment vAlign)
public void setHorizontalCentered(java.lang.Boolean isCentered)
isCentered
- true, if the paragraphs are horizontal centered
A null
values unsets this property.TextShape.isHorizontalCentered()
public double getBottomInset()
public void setBottomInset(double margin)
margin
- the bottom margingetBottomInset()
public double getLeftInset()
public void setLeftInset(double margin)
margin
- the left margingetLeftInset()
public double getRightInset()
public void setRightInset(double margin)
margin
- the right margingetRightInset()
public double getTopInset()
public void setTopInset(double margin)
margin
- the top margingetTopInset()
public boolean getWordWrap()
getWordWrap
in interface TextShape<HSLFShape,HSLFTextParagraph>
public int getWordWrapEx()
Wrap*
constants defined in this class.public void setWordWrap(int wrap)
wrap
- the value indicating how the text should be wrapped.
Must be one of the Wrap*
constants defined in this class.public int getTextId()
public void setTextId(int id)
id
- of the textpublic java.util.List<HSLFTextParagraph> getTextParagraphs()
getTextParagraphs
in interface TextShape<HSLFShape,HSLFTextParagraph>
public void setSheet(HSLFSheet sheet)
HSLFShape
SlideShow
this shape belongs topublic OEPlaceholderAtom getPlaceholderAtom()
OEPlaceholderAtom
, the atom that describes a placeholder.OEPlaceholderAtom
or null
if not foundpublic void setHyperlink(int linkId, int beginIndex, int endIndex)
linkId
- id of the hyperlink, @see org.apache.poi.hslf.usermodel.SlideShow#addHyperlink(Hyperlink)beginIndex
- the beginning index, inclusive.endIndex
- the ending index, exclusive.HSLFSlideShow.addHyperlink(HSLFHyperlink)
public boolean isPlaceholder()
isPlaceholder
in interface SimpleShape<HSLFShape,HSLFTextParagraph>
isPlaceholder
in class HSLFShape
public java.util.Iterator<HSLFTextParagraph> iterator()
iterator
in interface java.lang.Iterable<HSLFTextParagraph>
public Insets2D getInsets()
getInsets
in interface TextShape<HSLFShape,HSLFTextParagraph>
public double getTextHeight()
TextShape
getTextHeight
in interface TextShape<HSLFShape,HSLFTextParagraph>
public TextShape.TextDirection getTextDirection()
getTextDirection
in interface TextShape<HSLFShape,HSLFTextParagraph>
public java.lang.String getRawText()
public java.lang.String getText()
public HSLFTextRun appendText(java.lang.String text, boolean newParagraph)
text
- the text string used by this object.public HSLFTextRun setText(java.lang.String text)
text
- the text string used by this object.protected void storeText()
public java.util.List<HSLFHyperlink> getHyperlinks()
null
if not found.Copyright 2016 The Apache Software Foundation or its licensors, as applicable.