public abstract class TextShape extends SimpleShape
Modifier and Type | Field and Description |
---|---|
protected static FontRenderContext |
_frc
Used to calculate text bounds
|
protected EscherTextboxWrapper |
_txtbox
Escher container which holds text attributes such as
TextHeaderAtom, TextBytesAtom ot TextCharsAtom, StyleTextPropAtom etc.
|
protected TextRun |
_txtrun
TextRun object which holds actual text and format data
|
static int |
AlignCenter |
static int |
AlignJustify |
static int |
AlignLeft
How to align the text
|
static int |
AlignRight |
static int |
AnchorBottom |
static int |
AnchorBottomBaseline |
static int |
AnchorBottomCentered |
static int |
AnchorBottomCenteredBaseline |
static int |
AnchorMiddle |
static int |
AnchorMiddleCentered |
static int |
AnchorTop
How to anchor the text
|
static int |
AnchorTopBaseline |
static int |
AnchorTopCentered |
static int |
AnchorTopCenteredBaseline |
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
_escherContainer, _fill, _parent, _sheet, EMU_PER_CENTIMETER, EMU_PER_INCH, EMU_PER_POINT, logger, MASTER_DPI, PIXEL_DPI, POINT_DPI
Modifier | Constructor and Description |
---|---|
|
TextShape()
Create a new TextBox.
|
protected |
TextShape(EscherContainerRecord escherRecord,
Shape parent)
Create a TextBox object and initialize it from the supplied Record container.
|
|
TextShape(Shape parent)
Create a new TextBox.
|
Modifier and Type | Method and Description |
---|---|
protected void |
afterInsert(Sheet sh)
When a textbox is added to a sheet we need to tell upper-level
PPDrawing about it. |
TextRun |
createTextRun() |
void |
draw(Graphics2D graphics) |
protected EscherTextboxWrapper |
getEscherTextboxWrapper() |
int |
getHorizontalAlignment()
Gets the type of horizontal alignment for the text.
|
float |
getMarginBottom()
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.
|
float |
getMarginLeft()
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.
|
float |
getMarginRight()
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.
|
float |
getMarginTop()
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.
|
OEPlaceholderAtom |
getPlaceholderAtom()
Return
OEPlaceholderAtom , the atom that describes a placeholder. |
String |
getText()
Returns the text contained in this text frame.
|
int |
getTextId() |
TextRun |
getTextRun() |
int |
getVerticalAlignment()
Returns the type of vertical alignment for the text.
|
int |
getWordWrap()
Returns the value indicating word wrap.
|
protected void |
initTextRun() |
Rectangle2D |
resizeToFitText()
Adjust the size of the TextShape so it encompasses the text inside it.
|
protected void |
setDefaultTextProperties(TextRun _txtrun)
Set default properties for the TextRun.
|
void |
setHorizontalAlignment(int align)
Sets the type of horizontal alignment for the text.
|
void |
setHyperlink(int linkId,
int beginIndex,
int endIndex)
Assigns a hyperlink to this text shape
|
void |
setMarginBottom(float margin)
Sets the botom margin.
|
void |
setMarginLeft(float margin)
Sets the left margin.
|
void |
setMarginRight(float margin)
Sets the right margin.
|
void |
setMarginTop(float margin)
Sets the top margin.
|
void |
setSheet(Sheet sheet)
Assign the
SlideShow this shape belongs to |
void |
setText(String text)
Sets the text contained in this text frame.
|
void |
setTextId(int id)
Sets text ID
|
void |
setVerticalAlignment(int align)
Sets the type of vertical alignment for the text.
|
void |
setWordWrap(int wrap)
Specifies how the text should be wrapped
|
createSpContainer, getClientDataRecord, getClientRecords, getFillColor, getFlipHorizontal, getFlipVertical, getLineColor, getLineDashing, getLineStyle, getLineWidth, getLogicalAnchor2D, getRotation, setFillColor, setHyperlink, setLineColor, setLineDashing, setLineStyle, setLineWidth, setRotation, updateClientData
getAnchor, getAnchor2D, getEscherChild, getEscherProperty, getEscherProperty, getEscherProperty, getFill, getHyperlink, getOutline, getParent, getShapeId, getShapeName, getShapeType, getSheet, getSpContainer, moveTo, setAnchor, setEscherProperty, setEscherProperty, setShapeId, setShapeType
public static final int AnchorTop
public static final int AnchorMiddle
public static final int AnchorBottom
public static final int AnchorTopCentered
public static final int AnchorMiddleCentered
public static final int AnchorBottomCentered
public static final int AnchorTopBaseline
public static final int AnchorBottomBaseline
public static final int AnchorTopCenteredBaseline
public static final int AnchorBottomCenteredBaseline
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
public static final int AlignLeft
public static final int AlignCenter
public static final int AlignRight
public static final int AlignJustify
protected TextRun _txtrun
protected EscherTextboxWrapper _txtbox
protected static final FontRenderContext _frc
protected TextShape(EscherContainerRecord escherRecord, Shape parent)
escherRecord
- EscherSpContainer
container which holds information about this shapeparent
- the parent of the shapepublic TextShape(Shape 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 TextShape()
public TextRun createTextRun()
protected void setDefaultTextProperties(TextRun _txtrun)
public String getText()
public void setText(String text)
text
- the text string used by this object.protected void afterInsert(Sheet sh)
PPDrawing
about it.afterInsert
in class Shape
sh
- the sheet we are adding toprotected EscherTextboxWrapper getEscherTextboxWrapper()
public Rectangle2D resizeToFitText()
Rectangle2D
that is the bounds of this TextShape
.public int getVerticalAlignment()
Anchor*
constants defined in this class.public void setVerticalAlignment(int align)
Anchor*
constants defined in this class.align
- - the type of alignmentpublic void setHorizontalAlignment(int align)
Align*
constants defined in this class.align
- - the type of horizontal alignmentpublic int getHorizontalAlignment()
Align*
constants defined in this class.public float getMarginBottom()
public void setMarginBottom(float margin)
margin
- the bottom margingetMarginBottom()
public float getMarginLeft()
public void setMarginLeft(float margin)
margin
- the left margingetMarginLeft()
public float getMarginRight()
public void setMarginRight(float margin)
margin
- the right margingetMarginRight()
public float getMarginTop()
public void setMarginTop(float margin)
margin
- the top margingetMarginTop()
public int getWordWrap()
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 TextRun getTextRun()
public void setSheet(Sheet sheet)
Shape
SlideShow
this shape belongs toprotected void initTextRun()
public void draw(Graphics2D graphics)
draw
in class SimpleShape
public 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.zkoss.poi.hslf.usermodel.SlideShow#addHyperlink(Hyperlink)beginIndex
- the beginning index, inclusive.endIndex
- the ending index, exclusive.SlideShow.addHyperlink(Hyperlink)
Copyright © 2020. All rights reserved.