Top Inners Fields Constructors Methods
org.apache.poi.sl.draw

public Class DrawTextParagraph

extends Object
implements Drawable
Class Inheritance
All Implemented Interfaces
org.apache.poi.sl.draw.Drawable
Static Imports
org.apache.logging.log4j.util.Unbox.box

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
DrawTextParagraph.XlinkAttribute

Defines an attribute used for storing the hyperlink associated with some renderable text.

Field Summary

Modifier and TypeField and Description
protected int
protected DrawTextFragment
protected boolean
protected List<DrawTextFragment>
private static final Logger
protected TextParagraph<?, ?, ?>
protected String
pack-priv double
x

pack-priv double
y

Constructor Summary

AccessConstructor and Description
public
DrawTextParagraph(TextParagraph<?, ?, ?> paragraph)

Method Summary

Modifier and TypeMethod and Description
public void
applyTransform(Graphics2D
the graphics whose transform matrix will be modified
graphics
)

Implements org.apache.poi.sl.draw.Drawable.applyTransform.

Apply 2-D transforms before drawing this shape.

protected void
breakText(Graphics2D
The drawing context for computing text-lengths.
graphics
)

break text into lines, each representing a line of text that fits in the wrapping width

public void
draw(Graphics2D
the graphics to draw into
graphics
)

Implements org.apache.poi.sl.draw.Drawable.draw.

Draw this shape into the supplied canvas

public void
drawContent(Graphics2D
the graphics to draw into
graphics
)

Implements org.apache.poi.sl.draw.Drawable.drawContent.

draw any content within this shape (image, text, etc.).

protected List<DrawTextParagraph.AttributedStringData>
protected DrawTextFragment
public float
public float
public float
private PlaceableShape<?, ?>
getParagraphShape()

Helper method for paint style relative to bounds, e.g. gradient paint

protected String
public String
protected double

Returns:

wrapping width in points
getWrappingWidth
(boolean
whether the first line is breaking
firstLine
,
Graphics2D graphics)

Returns wrapping width to break lines in this paragraph

public double
getY()

public boolean
protected boolean
protected boolean

Returns:

true if the HSLF implementation is used
isHSLF
()

private static int
nextPart(Font fontMapped, String runText, int beginPart, int endPart, boolean isDisplayed)

private void
processGlyphs(Graphics2D graphics, DrawFontManager dfm, List<DrawTextParagraph.AttributedStringData> attList, final int beginIndex, TextRun run, String runText)

Processing the glyphs is done in two steps:

  • 1. determine the font group - a text run can have different font groups.
  • 2. Depending on the chars, the correct font group needs to be used
public void
setAutoNumberingIdx(int
the auto numbering index
index
)

Sets the auto numbering index of the handled paragraph

protected void
setFirstParagraph(boolean firstParagraph)

public void
setPosition(double x, double y)

private String
tab2space(TextRun tr)

Replace a tab with the effective number of white spaces.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

autoNbrIdxback to summary
protected int autoNbrIdx
bulletback to summary
protected DrawTextFragment bullet
firstParagraphback to summary
protected boolean firstParagraph
linesback to summary
protected List<DrawTextFragment> lines
LOGback to summary
private static final Logger LOG
paragraphback to summary
protected TextParagraph<?, ?, ?> paragraph
rawTextback to summary
protected String rawText
xback to summary
pack-priv double x
yback to summary
pack-priv double y

Constructor Detail

DrawTextParagraphback to summary
public DrawTextParagraph(TextParagraph<?, ?, ?> paragraph)

Method Detail

applyTransformback to summary
public void applyTransform(Graphics2D graphics)

Implements org.apache.poi.sl.draw.Drawable.applyTransform.

Doc from org.apache.poi.sl.draw.Drawable.applyTransform.

Apply 2-D transforms before drawing this shape. This includes rotation and flipping.

Parameters
graphics:Graphics2D

the graphics whose transform matrix will be modified

Annotations
@Override
breakTextback to summary
protected void breakText(Graphics2D graphics)

break text into lines, each representing a line of text that fits in the wrapping width

Parameters
graphics:Graphics2D

The drawing context for computing text-lengths.

drawback to summary
public void draw(Graphics2D graphics)

Implements org.apache.poi.sl.draw.Drawable.draw.

Doc from org.apache.poi.sl.draw.Drawable.draw.

Draw this shape into the supplied canvas

Parameters
graphics:Graphics2D

the graphics to draw into

Annotations
@Override
drawContentback to summary
public void drawContent(Graphics2D graphics)

Implements org.apache.poi.sl.draw.Drawable.drawContent.

Doc from org.apache.poi.sl.draw.Drawable.drawContent.

draw any content within this shape (image, text, etc.).

Parameters
graphics:Graphics2D

the graphics to draw into

Annotations
@Override
getAttributedStringback to summary
protected List<DrawTextParagraph.AttributedStringData> getAttributedString(Graphics2D graphics, StringBuilder text)
getBulletback to summary
protected DrawTextFragment getBullet(Graphics2D graphics, AttributedCharacterIterator firstLineAttr)
getFirstLineHeightback to summary
public float getFirstLineHeight()
getFirstLineLeadingback to summary
public float getFirstLineLeading()
getLastLineHeightback to summary
public float getLastLineHeight()
getParagraphShapeback to summary
private PlaceableShape<?, ?> getParagraphShape()

Helper method for paint style relative to bounds, e.g. gradient paint

getRenderableTextback to summary
protected String getRenderableText(Graphics2D graphics, TextRun tr)
getRenderableTextback to summary
public String getRenderableText(final TextRun tr)
Annotations
@Internal
getWrappingWidthback to summary
protected double getWrappingWidth(boolean firstLine, Graphics2D graphics)

Returns wrapping width to break lines in this paragraph

Parameters
firstLine:boolean

whether the first line is breaking

Returns:double

wrapping width in points

getYback to summary
public double getY()
isEmptyParagraphback to summary
public boolean isEmptyParagraph()
isFirstParagraphback to summary
protected boolean isFirstParagraph()
isHSLFback to summary
protected boolean isHSLF()
Returns:boolean

true if the HSLF implementation is used

nextPartback to summary
private static int nextPart(Font fontMapped, String runText, int beginPart, int endPart, boolean isDisplayed)
processGlyphsback to summary
private void processGlyphs(Graphics2D graphics, DrawFontManager dfm, List<DrawTextParagraph.AttributedStringData> attList, final int beginIndex, TextRun run, String runText)

Processing the glyphs is done in two steps:

  • 1. determine the font group - a text run can have different font groups.
  • 2. Depending on the chars, the correct font group needs to be used
See Also
Office Open XML Themes, Schemes, and Fonts
setAutoNumberingIdxback to summary
public void setAutoNumberingIdx(int index)

Sets the auto numbering index of the handled paragraph

Parameters
index:int

the auto numbering index

setFirstParagraphback to summary
protected void setFirstParagraph(boolean firstParagraph)
setPositionback to summary
public void setPosition(double x, double y)
tab2spaceback to summary
private String tab2space(TextRun tr)

Replace a tab with the effective number of white spaces.

org.apache.poi.sl.draw back to summary

private Class DrawTextParagraph.AttributedStringData

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.poi.sl.draw.DrawTextParagraph.AttributedStringData

Field Summary

Modifier and TypeField and Description
pack-priv AttributedCharacterIterator.Attribute
pack-priv int
pack-priv int
pack-priv Object

Constructor Summary

AccessConstructor and Description
pack-priv
AttributedStringData(AttributedCharacterIterator.Attribute attribute, Object value, int beginIndex, int endIndex)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributeback to summary
pack-priv AttributedCharacterIterator.Attribute attribute
beginIndexback to summary
pack-priv int beginIndex
endIndexback to summary
pack-priv int endIndex
valueback to summary
pack-priv Object value

Constructor Detail

AttributedStringDataback to summary
pack-priv AttributedStringData(AttributedCharacterIterator.Attribute attribute, Object value, int beginIndex, int endIndex)
org.apache.poi.sl.draw back to summary

private Class DrawTextParagraph.XlinkAttribute

extends Attribute
Class Inheritance

Defines an attribute used for storing the hyperlink associated with some renderable text.

Field Summary

Inherited from java.text.AttributedCharacterIterator.Attribute:
INPUT_METHOD_SEGMENTLANGUAGEREADING

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected Object
readResolve()

Overrides java.text.AttributedCharacterIterator.Attribute.readResolve.

Resolves instances being deserialized to the predefined constants.

Inherited from java.text.AttributedCharacterIterator.Attribute:
equalsgetNamehashCodetoString

Constructor Detail

XlinkAttributeback to summary
pack-priv XlinkAttribute(String name)

Method Detail

readResolveback to summary
protected Object readResolve() throws InvalidObjectException

Overrides java.text.AttributedCharacterIterator.Attribute.readResolve.

Resolves instances being deserialized to the predefined constants.

Returns:Object

Doc from java.text.AttributedCharacterIterator.Attribute.readResolve.

the resolved Attribute object

Annotations
@Override
Exceptions
InvalidObjectException:

Doc from java.text.AttributedCharacterIterator.Attribute.readResolve.

if the object to resolve is not an instance of Attribute