Class TextFrame
- java.lang.Object
-
- com.adobe.xfa.text.TextFrame
-
- All Implemented Interfaces:
GFXContext
,GFXModelContext
- Direct Known Subclasses:
TextNullFrame
,TextPanel
public abstract class TextFrame extends java.lang.Object implements GFXModelContext
The text frame class represents the geometry and eventually layout of a single frame.The client creates all frame instances, either to pass to the sparse stream API or as a result of its implementation of the sparse stream event handling methods. The client must populate its created frames with geometry information. A future implementation may allow the client to set text attributes for a frame as well.
Once the client passes a frame instance to the sparse stream, AXTE takes over and populates its layout. The layout may come from a client-supplied layout object, or it may be generated by AXTE as the result of a reflow operation.
Frames are reference counted objects, allowing the client to retain handles to objects that are managed by AXTE.
While frames have width and height geometry, it is up to the client to decide how to map frames into its rendering space. AXTE treats the top-left corner of each frame as its origin.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
alignHPoint()
Query whether horizontal alignment occurs at a point.boolean
alignVPoint()
Query whether vertical alignment occurs at a point.abstract TextFrame
cloneFrame()
Create a copy (deep clone) of this frame object.int
combCells()
void
copyFrom(TextFrame oSource)
Assignment operator.TextLayout
format(boolean bAllowCharGlyphs)
Generate a text layout object from this frame's layout.int
getLayoutOrientation()
Return the frame's layout orientation.int
getLineCount()
void
gfxDraw(GFXEnv poGfxEnv)
void
gfxDraw(GFXEnv poGfxEnv, Rect poInvalid)
void
gfxDraw(GFXEnv poGfxEnv, Rect poInvalid, TextSelection poSelection)
void
gfxDraw(GFXEnv poGfxEnv, Rect poInvalid, TextSelection poSelection, int eOpt)
Render the frame's content.void
gfxDraw(TextDrawInfo oDrawInfo)
Render the frame contents, using the properties provided.boolean
isDirty()
Query whether this frame is "dirty".abstract UnitSpan
maxHeight()
Return the frame's maximum height.abstract UnitSpan
maxWidth()
Return the frame's maximum width.abstract UnitSpan
minHeight()
Return the frame's minimum height.abstract UnitSpan
minWidth()
Return the frame's minimum width.void
releaseDisposableMaps(com.adobe.xfa.text.DispMapSet poMaps)
void
setDirty(boolean bDirty)
Set the frame's dirty flag.boolean
unlimitedHeight()
Query whether the stream has an unlimited height.boolean
unlimitedWidth()
Query whether the stream has an unlimited width.
-
-
-
Constructor Detail
-
TextFrame
public TextFrame()
Default constructor.
-
TextFrame
public TextFrame(TextFrame oSource)
Copy constructor.- Parameters:
oSource
- - Source frame to copy.
-
-
Method Detail
-
alignVPoint
public boolean alignVPoint()
Query whether vertical alignment occurs at a point.The text label class performs vertical alignment at a point. The text block and region have a nominal height. Vertical alignment occurs within this height. This method asks the stream what sort of vertical alignment it supports.
- Returns:
- TRUE if the stream aligns vertically at a point; FALSE if it aligns vertically within a nominal height.
-
alignHPoint
public boolean alignHPoint()
Query whether horizontal alignment occurs at a point.The text label class performs horizontal alignment at a point. The text block and region have a nominal width. Horizontal alignment occurs within this width. This method asks the stream what sort of horizontal alignment it supports.
- Returns:
- TRUE if the stream aligns horizontally at a point; FALSE if it aligns horizontally within a nominal width.
-
unlimitedWidth
public boolean unlimitedWidth()
Query whether the stream has an unlimited width.The text label can grow arbitrarily in X. A text region may have a maximum width, or it may allow unlimited horizontal growth. This method asks the object whether it has an unlimited width.
- Returns:
- TRUE if the width is unlimited; FALSE if there is a limit on the width.
-
unlimitedHeight
public boolean unlimitedHeight()
Query whether the stream has an unlimited height.The text label can grow arbitrarily in Y. A text region may have a maximum height, or it may allow unlimited vertical growth. This method asks the object whether it has an unlimited height.
- Returns:
- TRUE if the height is unlimited; FALSE if there is a limit on the height.
-
isDirty
public boolean isDirty()
Query whether this frame is "dirty".A frame is considered dirty if a layout operation changes any of its lines. Any frame that contains a content change or any frame thereafter whose lines change due to reflow will be considered dirty. When a frame is initially loaded with layout through any of the TextSparse stream call-backs, it starts out not being dirty. The application can use this method to determine whether to write the frame's content on save.
- Returns:
- True if the frame is dirty; false if not.
-
setDirty
public void setDirty(boolean bDirty)
Set the frame's dirty flag.- Parameters:
bDirty
- - New value for the frame's dirty flag.
-
gfxDraw
public void gfxDraw(TextDrawInfo oDrawInfo)
Render the frame contents, using the properties provided.Given a set of rendering properties in an instance of class
TextDrawInfo
, this method performs the appropriate rendering.- Parameters:
oDrawInfo
- - Rendering properties. For more information, please see the description ofTextDrawInfo
.
-
gfxDraw
public void gfxDraw(GFXEnv poGfxEnv, Rect poInvalid, TextSelection poSelection, int eOpt)
Render the frame's content.This method is provided so that the application can render a single frame's content in an application-controlled environment. The top left corner of the frame is mapped to (0,0) in relative coordinates, so the application may need to push an offset before calling this method.
- Parameters:
poGfxEnv
- - Graphic environment in which to do the rendering.poInvalid
- - Pointer to invalidation rectangle (in frame coordinates). If NULL, the frame uses its maximum width and height.poSelection
- - Optional text selection. If non-null, this represents a range and alternate colours for drawing of selected text. Note that a single selection instance can be used across all frames in the sparse stream.eOpt
- - Run optimization flag. Enumeration values are in class TextPrefOpt. OPT_UNKNOWN or OPT_CHAR produces the most accurate behaviour, where each character is individually positioned. OPT_WORD will result in the first character of each word being positioned, and the graphic driver positioning the remaining characters based on the character advances. OPT_LINE extends the word concept to entire lines. Reducing the number of positioning operations performed by the display improves display performance, but it may result in a loss of accuracy when font sizes are rounded, depending on the abilities of the underlying graphics environment. Note that AGM- and PDF-based environments can use OPT_LINE for maximum performance without losing accuracy.
-
gfxDraw
public void gfxDraw(GFXEnv poGfxEnv, Rect poInvalid, TextSelection poSelection)
-
gfxDraw
public void gfxDraw(GFXEnv poGfxEnv)
-
format
public TextLayout format(boolean bAllowCharGlyphs)
Generate a text layout object from this frame's layout.- Parameters:
bAllowCharGlyphs
- - True if glyph IDs can be replaced with their corresponding Unicode character IDs where such corresponding characters exist. False if all output glyphs are to be represented by glyph IDs.- Returns:
- Text layout object with the layout of this frame.
-
getLayoutOrientation
public int getLayoutOrientation()
Return the frame's layout orientation.- Returns:
- The layout orientation in effect for this text frame. Orienation may be horizontal, vertical RTL or vertical RTL.
-
copyFrom
public void copyFrom(TextFrame oSource)
Assignment operator.- Parameters:
oSource
- - Source frame to copy.
-
minWidth
public abstract UnitSpan minWidth()
Return the frame's minimum width.All frames have both a minimum and maximum width, which may or may not be the same. This method returns the minimum width.
- Returns:
- Minimum width allowed for the frame. A value of zero is possible, as is a value less than zero. In the latter case, it indicates that the frame is horizontally aligned at a point, though callers should use the AlignHPoint() method to test for this.
-
minHeight
public abstract UnitSpan minHeight()
Return the frame's minimum height.All frames have both a minimum and maximum height, which may or may not be the same. This method returns the minimum height.
- Returns:
- Minimum height allowed for the frame. A value of zero is possible, as is a value less than zero. In the latter case, it indicates that the frame is verrically aligned at a point, though callers should use the AlignVPoint() method to test for this.
-
maxWidth
public abstract UnitSpan maxWidth()
Return the frame's maximum width.All frames have both a minimum and maximum width, which may or may not be the same. This method returns the maximum width.
- Returns:
- maximum width allowed for the frame. A value of zero is possible, as is a value less than zero. In the latter case, it indicates that the frame has unlimited width, though callers should use the UnlimitedWidth() method to test for this.
-
maxHeight
public abstract UnitSpan maxHeight()
Return the frame's maximum height.All frames have both a minimum and maximum height, which may or may not be the same. This method returns the maximum height.
- Returns:
- maximum height allowed for the frame. A value of zero is possible, as is a value less than zero. In the latter case, it indicates that the frame has unlimited height, though callers should use the Unlimitedheight() method to test for this.
-
cloneFrame
public abstract TextFrame cloneFrame()
Create a copy (deep clone) of this frame object.The copy must have the same geometry as this object. It is up to AXTE to subsequently manage the clones layout and relationship to content.
- Returns:
- Cloned copy of the frame. The lifetime of this object will be managed with reference counting.
-
releaseDisposableMaps
public void releaseDisposableMaps(com.adobe.xfa.text.DispMapSet poMaps)
-
getLineCount
public int getLineCount()
-
combCells
public int combCells()
-
-