public abstract class TextSparseStream extends TextStream
The sparse stream represents a displayable stream whose content and rendering are loaded on demand when needed, rather than up front. Outwardly it behaves like any other displayable stream, allowing the client to use the rich AXTE editing API for manipulating its content.
The client must derive its own implementation class from this abstract base class, in order to handle the content access events.
DEFAULT_STREAMLEVEL_CORRECT_SPACING, LEVEL_NORMAL, LEVEL_V6| Constructor and Description |
|---|
TextSparseStream()
Default constructor.
|
TextSparseStream(String sSource)
Constructor with source text string.
|
TextSparseStream(TextSparseStream oSource)
Copy constructor.
|
| Modifier and Type | Method and Description |
|---|---|
TextFrame |
appendFrame(TextFrame oFrame) |
TextFrame |
appendFrame(TextFrame oFrame,
TextLayout poLayout)
Append a new frame at the end of the stream.
|
void |
appendFrameRef(TextFrame oFrame) |
void |
appendFrameRef(TextFrame poFrame,
TextLayout poLayout)
Append a new frame at the end of the stream.
|
TextDisplay |
createDisplay()
Create display with optional scroller and graphic environment.
|
int |
defaultDirection()
Obtain the direction override for this stream.
|
void |
defaultDirection(int eNewDirection)
Change the default direction override for this stream.
|
TextFrame |
forceFrame(int nIndex) |
TextFrame |
forceFrame(int nIndex,
boolean bReflow) |
TextContext |
getContext()
Get the stream's text context object.
|
TextFrame |
getFrame(int nIndex)
Retrieve a specific frame from the stream.
|
int |
getFrameCount()
Return the number of frames in the stream.
|
TextFrame |
insertFrame(int nIndex,
TextFrame oFrame,
TextLayout poLayout)
Insert a new frame into the stream.
|
void |
insertFrameRef(int nIndex,
TextFrame poFrame,
TextLayout poLayout)
Insert a new frame into the stream.
|
void |
onFrameRemoved(int nIndex)
Post-removal callback.
|
abstract TextFrame |
onLoadFrame(int nIndex)
Client-implemented event handler to load a frame's content.
|
TextFrame |
onNewFrame()
Notify the client that a new frame must be created at the end of the
stream to handle content overflow.
|
void |
onRemoveFrame(int nIndex,
boolean bForced,
boolean bRemoveContent)
Notify the client that a frame is about to be removed.
|
void |
removeFrame(int nIndex) |
void |
removeFrame(int nIndex,
boolean bRemoveContent)
Remove a frame from a sparse stream.
|
void |
setContext(TextContext poContext)
Set the display context.
|
TextFrame |
setFrame(int nIndex,
TextFrame oFrame,
TextLayout poLayout)
Change the definition of a frame.
|
void |
setFrameCount(int nFrames)
Set the number of frames in the sparse stream.
|
void |
setFrameRef(int nIndex,
TextFrame poFrame,
TextLayout poLayout)
Change the definition of a frame.
|
allowNewLines, allowNewLines, anyNewLines, append, append, append, append, append, append, cascadeLegacyLevel, coalesceMarker, contiguousText, copyFrom, currentSize, debug, display, enumEmbed, enumField, enumMarker, equals, find, find, findRangeMarkerOver, fontService, fontService, gfxSource, gfxSource, hashCode, isDescendentOf, isDescendentOf, legacyPositioning, markup, markup, markup, markup, markup, maxSize, maxSize, notEqual, position, posnCount, posnInsert, posnInsert, posnInsertPara, posnNext, posnNextAttr, posnNextChar, posnNextEmbed, posnNextField, posnNextType, posnNextType, posnPrev, posnPrevAttr, posnPrevChar, posnPrevEmbed, posnPrevField, posnPrevType, posnPrevType, posnUpdateStreamLoc, rangeEnumMarker, rangeMarker, rangeMarkerInternal, removeMarker, setText, spaceLeft, splitMarker, suppressFormat, text, text, updateNotificationgetLegacyLevel, hasCorrectPositioning, hasLegacyPositioning, hasNormalPositioning, setLegacyLevelpublic TextSparseStream()
public TextSparseStream(TextSparseStream oSource)
oSource - - Source sparse stream to copy.public TextSparseStream(String sSource)
Create a text stream whose initial content is copied from the given string. The text stream initially has no attribute pool association. The display is not automatically created.
sSource - - String whose contents are to be copied to the text
stream.public void setContext(TextContext poContext)
A text context allows several text streams to share a number of objects used in creating text displays. By sharing these objects, they need not be created for each stream, an expensive operation.
poContext - - Shared context to use. Context objects follow the
text reference counting model, so if the caller creates the context
on the stack, it must ensure the context continues to exist at least
until the text stream is destroyed.public TextContext getContext()
Overridden from the TextStream base class, this method returns a pointer to the stream's text context.
getContext in class TextStreampublic void setFrameCount(int nFrames)
If the given number is greater than the number of frames currently in the stream, null frames are added to round out the number. If the new number is smaller, frames (null and non-null) are removed from the end of the stream.
nFrames - - New number of frames to be contained in the stream.public int getFrameCount()
public TextFrame getFrame(int nIndex)
nIndex - - Index of the desired frame.
Pointer to the requested frame. A null value indicates a null frame.public TextFrame insertFrame(int nIndex, TextFrame oFrame, TextLayout poLayout)
nIndex - - Insertion index. Effectively, the existing frame
with this index number and all that come after it have their indexes
incremented by one. The new frame gets this index number. If the
given index is beyond the end of the set of frames, the new frame is
appended at the end.oFrame - - New frame to append. AXTE makes a clone of this
object.poLayout - - Pointer to layout to load into the frame. If this
pointer is not null, the content in this layout object is added to
the sparse stream, and the frames layout is generated from this
layout object. If the pointer is null, the streams content from this
frame on is reflowed to account for the new frame. This might cause
the removal of frames at the end of the stream.public void insertFrameRef(int nIndex,
TextFrame poFrame,
TextLayout poLayout)
nIndex - - Insertion index. Effectively, the existing frame
with this index number and all that come after it have their indexes
incremented by one. The new frame gets this index number. If the
given index is beyond the end of the set of frames, the new frame is
appended at the end.poFrame - - New frame to insert. This object is assumed to be
reference counted and AXTE adds its own reference.poLayout - - Pointer to layout to load into the frame. If this
pointer is not null, the content in this layout object is added to
the sparse stream, and the frames layout is generated from this
layout object. If the pointer is null, the streams content from this
frame on is reflowed to account for the new frame. This might cause
the removal of frames at the end of the stream.public TextFrame appendFrame(TextFrame oFrame, TextLayout poLayout)
oFrame - - New frame to append. AXTE makes a clone of this
object.poLayout - - Pointer to layout to load into the frame. If this
pointer is not null, the content in this layout object is added to
the sparse stream, and the frames layout is generated from this
layout object. If the pointer is null, the streams content from this
frame on is reflowed to account for the new frame. Note: it doesnt
really make sense to pass a null pointer, as any attempt at reflow
will not generate content for the frame and it will be automatically
removed.public void appendFrameRef(TextFrame poFrame, TextLayout poLayout)
poFrame - - New frame to insert. This object is assumed to be
reference counted and AXTE adds its own reference.poLayout - - Pointer to layout to load into the frame. If this
pointer is not null, the content in this layout object is added to
the sparse stream, and the frames layout is generated from this
layout object. If the pointer is null, the streams content from this
frame on is reflowed to account for the new frame. Note: it doesnt
really make sense to pass a null pointer, as any attempt at reflow
will not generate content for the frame and it will be automatically
removed.public void appendFrameRef(TextFrame oFrame)
public TextFrame setFrame(int nIndex, TextFrame oFrame, TextLayout poLayout)
This method serves three purposes:
nIndex - - Index of the frame to update. It is an error if this
number is out of range.oFrame - - New frame to set. AXTE makes a clone of this object.poLayout - - Pointer to layout to load into the frame. If this
pointer is not null, the content in this layout object replaces the
former frames content, and the frames layout is regenerated from this
layout object. If the frame was previously null, this effectively
loads the frame. If this parameter is null, the streams content from
this frame on is reflowed to account for the new frame. This might
cause the addition or removal of frames at the end of the stream.public void setFrameRef(int nIndex,
TextFrame poFrame,
TextLayout poLayout)
This method serves three purposes:
nIndex - - Index of the frame to update. It is an error if this
number is out of range.poFrame - - New frame to set. This object is assumed to be
reference counted and AXTE adds its own reference.poLayout - - Pointer to layout to load into the frame. If this
pointer is not null, the content in this layout object replaces the
former frames content, and the frames layout is regenerated from this
layout object. If the frame was previously null, this effectively
loads the frame. If this parameter is null, the streams content from
this frame on is reflowed to account for the new frame. This might
cause the addition or removal of frames at the end of the stream.public void removeFrame(int nIndex,
boolean bRemoveContent)
This can simply remove the frame definition from the streams flow, or it can also remove the corresponding content from the stream.
nIndex - - Index of the frame to remove. It is an error if this
number is out of range.bRemoveContent - - True if the corresponding content is to be
removed from the stream. False if this frame is to be removed from
the stream and text reflowed in the remaining frames. In this case,
AXTE may need to create new frames at the end of the stream.public void removeFrame(int nIndex)
public int defaultDirection()
A displayable stream can have a default (paragraph) direction set, which determines what side to start on and influences word ordering in true bidirectional text. If this value is neutral, the default paragraph direction is determined from the attributes in effect at the start of the text.
public void defaultDirection(int eNewDirection)
See the first overload of this method for how the default text direction is used.
eNewDirection - - New direction to set for this stream.public TextDisplay createDisplay()
THis method allows the caller to create the stream's display by passing optional scroller and graphic environment. Once the display has been created, it exists until the displayable stream is deleted. Subsequent calls to this method simply return the pointer to the display that already exists.
public abstract TextFrame onLoadFrame(int nIndex)
The client implementation is expected to call SetFrame() or SetFrameRef() before returning.
nIndex - - Index number of frame to load. The client can assume
that the frame is currently null.public TextFrame onNewFrame()
This method is called if editing pushes content beyond the set of frames established by the client.
public void onRemoveFrame(int nIndex,
boolean bForced,
boolean bRemoveContent)
This call is made before the frame is removed.
nIndex - - Index number of frame about to be removed.bForced - - True if this is the result of a call to
RemoveFrame() or SetFrameCount(); false if the frame is being removed
from the end of the stream because of reflow.bRemoveContent - - True if the corresponding content is to be
removed from the stream (can occur only if this is a forced removal).
False if this frame is to be removed from the stream and text
reflowed in the remaining frames. Note that this parameter is
provided for informational purposes only. AXTE will take care of
removing the content.public void onFrameRemoved(int nIndex)
AXTE calls this method after a frame has been removed, but before AXTE's reference is released.
nIndex - - Index number of frame about to be removed.public TextFrame forceFrame(int nIndex, boolean bReflow)
public TextFrame forceFrame(int nIndex)
Copyright © 2010 - 2020 Adobe. All Rights Reserved