public class TextStream extends TextLegacy
Modifier and Type | Field and Description |
---|---|
static TextStream |
DEFAULT_STREAM |
LEVEL_CORRECT_SPACING, LEVEL_NORMAL, LEVEL_V6
Constructor and Description |
---|
TextStream()
Default constructor.
|
TextStream(String sSource)
Constructor with source text string.
|
TextStream(TextStream oSource) |
TextStream(TextStream oSource,
TextGfxSource poPool)
Copy constructor with graphics source information.
|
Modifier and Type | Method and Description |
---|---|
boolean |
allowNewLines()
Does the text stream allow new line characters.
|
void |
allowNewLines(boolean bNewAllow)
Does the text stream allow new line characters.
|
boolean |
anyNewLines()
Does the text stream contain any new line characters
|
void |
append(String sText)
Add text to the end of the stream.
|
void |
append(TextAttr oAttr)
Add an attribute to the end of the stream.
|
void |
append(TextEmbed poEmbed)
Add an embedded object to the end of the stream.
|
void |
append(TextField poField)
Add an embedded field to the end of the stream.
|
void |
append(TextMarker oMarker)
Add a position marker at the end of the stream.
|
void |
append(TextStream oText)
Add rich text to the end of the stream.
|
void |
cascadeLegacyLevel(int eLevel)
Set legacy positioning by level enumeration and cascade to descendent
streams and objects.
|
boolean |
coalesceMarker(TextMarker poFirst,
TextMarker poOther) |
void |
contiguousText(List<TextRange> oRanges)
Return a set of ranges corresponding to the chunks of raw text in the
stream.
|
void |
copyFrom(TextStream oSource)
Assign this stream's content from the given stream.
|
int |
currentSize()
Return the current content size of the stream
|
void |
debug() |
TextDisplay |
display()
Obtain a pointer to the stream's display object.
|
void |
enumEmbed(List<TextEmbed> oEmbeds)
Enumerate embeded objects in the stream.
|
void |
enumField(List<TextField> oFields)
Enumerate embeded fields in the stream.
|
void |
enumMarker(List<TextMarker> oMarkers,
boolean bPositionMarkers,
boolean bRangeMarkers)
Enumerate all markers on the stream.
|
boolean |
equals(Object object)
Compare text streams for content equality.
|
boolean |
find(String sSearch) |
boolean |
find(String sSearch,
TextPosnBase poFoundPosn)
Search the stream for a given string.
|
TextMarker |
findRangeMarkerOver(int nIndex,
int nSpan) |
FontService |
fontService() |
void |
fontService(FontService poNewFontService) |
TextContext |
getContext()
Get the stream's text context object.
|
TextGfxSource |
gfxSource()
Obtain graphic source information used by the stream.
|
void |
gfxSource(TextGfxSource newSource) |
int |
hashCode() |
boolean |
isDescendentOf(TextStream poAncestor) |
boolean |
isDescendentOf(TextStream poAncestor,
TextPosnBase poPosn)
Determine if this stream is contained under a given stream.
|
void |
legacyPositioning(boolean bLegacyPositioning)
Set the value of the legacy positioning flag.
|
void |
markup(MarkupIn oMarkup)
Replace this streams content by processing the given markup.
|
void |
markup(MarkupOut oMarkup) |
void |
markup(MarkupOut oMarkup,
TextAttr poInitAttr) |
void |
markup(MarkupOut oMarkup,
TextAttr poInitAttr,
boolean bDefaultInitAttr) |
void |
markup(MarkupOut oMarkup,
TextAttr poInitAttr,
boolean bDefaultInitAttr,
boolean bFlattenFields)
Convert the string contents to markup.
|
int |
maxSize()
Query the stream's current maximum content size.
|
void |
maxSize(int nNewSize,
boolean bAllowExistingOverflow)
Change the stream's maximum content size.
|
boolean |
notEqual(TextStream oCompare)
Compare text streams for content inequality.
|
TextPosn |
position()
Get this stream's position in its parent stream.
|
int |
posnCount() |
void |
posnInsert(TextPosnBase oPosn,
TextEmbed poEmbed) |
void |
posnInsert(TextPosnBase oPosn,
TextStream oInsert) |
void |
posnInsertPara(TextPosnBase oPosn) |
int[] |
posnNext(TextPosnBase oPosn,
int eNullFrameMode,
boolean bTestOnly) |
TextAttr |
posnNextAttr(TextPosnBase oPosn,
boolean bTestOnly) |
int |
posnNextChar(TextPosnBase oPosn,
boolean bTestOnly) |
TextEmbed |
posnNextEmbed(TextPosnBase oPosn,
boolean bTestOnly) |
TextField |
posnNextField(TextPosnBase oPosn,
boolean bTestOnly) |
int |
posnNextType(TextPosnBase oPosn,
int eNullFrameMode) |
int |
posnNextType(TextPosnBase oPosn,
int eNullFrameMode,
boolean bTestOnly) |
int[] |
posnPrev(TextPosnBase oPosn,
int eNullFrameMode,
boolean bTestOnly) |
TextAttr |
posnPrevAttr(TextPosnBase oPosn,
boolean bTestOnly) |
int |
posnPrevChar(TextPosnBase oPosn,
boolean bTestOnly) |
TextEmbed |
posnPrevEmbed(TextPosnBase oPosn,
boolean bTestOnly) |
TextField |
posnPrevField(TextPosnBase oPosn,
boolean bTestOnly) |
int |
posnPrevType(TextPosnBase oPosn,
int eNullFrameMode) |
int |
posnPrevType(TextPosnBase oPosn,
int eNullFrameMode,
boolean bTestOnly) |
void |
posnUpdateStreamLoc(TextPosnBase oPosn,
int nIndex) |
void |
rangeEnumMarker(TextPosnBase oStart,
TextPosnBase oEnd,
List<TextMarker> oMarkers,
boolean bPositionMarkers,
boolean bRangeMarkers,
boolean bSubsetOnly) |
TextMarker |
rangeMarker(TextPosn oStart,
TextPosn oEnd,
TextMarker poMarker) |
void |
rangeMarkerInternal(TextPosnBase oStart,
TextPosnBase oEnd,
TextMarker poMarker) |
void |
removeMarker(TextMarker poRemove,
boolean bEditOnly) |
void |
setText(String sText)
Replace the stream's text with the given text.
|
int |
spaceLeft()
Return the amount of content size left in the stream.
|
TextMarker |
splitMarker(TextMarker poSource,
int nSplitStart,
int nSplitEnd,
int eMarkerSplitReason) |
void |
suppressFormat(boolean bSuppress)
Suppress reformatting of the display for faster multiple updates.
|
String |
text() |
String |
text(boolean bIncludeFields)
Obtain the raw (unformatted) text of the stream.
|
void |
updateNotification()
Notify derived class of content change.
|
getLegacyLevel, hasCorrectPositioning, hasLegacyPositioning, hasNormalPositioning, setLegacyLevel
public static final TextStream DEFAULT_STREAM
public TextStream()
The text stream contains no content and has no pool/mapping assocotiation.
public TextStream(TextStream oSource, TextGfxSource poPool)
Copy all stream content from the source stream, using optional graphic attribute pool.
oSource
- Source text stream to copy content from.poPool
- Graphic attribute pool to use.public TextStream(TextStream oSource)
public TextStream(String sSource)
Create a text stream whose initial content is copied from the given string. The text stream initially has no attribute pool association.
sSource
- String whose contents are to be copied to the text
stream.public void enumEmbed(List<TextEmbed> oEmbeds)
Populates an array with pointers to all embedded objects in the stream. This is a flat enumeration (i.e., it doesn't descend into embedded fields looking for embedded objects). These embedded objects remain property of the text stream and must not be deleted by the caller.
oEmbeds
- Array to contain the resultant set of pointers. The
array size is set to zero before repopulating.public void enumField(List<TextField> oFields)
Populates an array with pointers to all embedded fields in the stream. This is a flat enumeration (i.e., it doesn't descend into those embedded fields looking for further embedded fields). These embedded fields remain property of the text stream and must not be deleted by the caller. The array size is set to zero before repopulating.
oFields
- Array to contain the resultant set of pointers. The
array size is set to zero before repopulating.public void enumMarker(List<TextMarker> oMarkers, boolean bPositionMarkers, boolean bRangeMarkers)
Populates an array with pointers to all markers on the stream. This is a flat enumeration (i.e., it doesn't descend into embedded fields looking for additional markers). These markers remain property of the text stream and must not be deleted by the caller, though the client can cache pointers to these markers provide that it participates in the marker reference counting mechanism. The array size is set to zero before repopulating.
oMarkers
- - Array to contain pointers to the enumerated
markers. Any previous contents are removed by the call. Even though
the returned array contains non-const pointers to markers, those
markers are owned by AXTE and must not be deleted by the client.bPositionMarkers
- - True (default) if all position markers are
to be included in the array. False if position markers are to be
excluded.bRangeMarkers
- - True (default) if all range markers are to be
included in the array. False if range markers are to be excluded.public String text(boolean bIncludeFields)
Return a string containing all the text in the stream. Optionally descend into embedded fields when constructing the string.
bIncludeFields
- (default TRUE) Indicates that the text
retrieval is to recurse into embedded fields, if TRUE. Otherwise,
only the text of the specified stream is returned.public String text()
public void contiguousText(List<TextRange> oRanges)
This method returns an array of text ranges. Each such range corresponds to one chunk of contiguous raw text (i.e., between attributes, embedded objects and fields) in the stream.
oRanges
- Resultant array of text ranges. For some reason,
this is not emptied before repopulating.public void setText(String sText)
Replace all text in the stream with the contents of the given string. This also has the effect of removing any embedded objects and fields from the stream. If the stream contains embedded attribute changes, only the attributes in effect at the start remain in effect after the call.
sText
- New text to place in the stream.public void append(String sText)
The various Append() methods allow the caller to build up a text stream sequentially, without having to resort to using text position objects. This overload adds text to the end of the stream. Whatever attributes were in effect at the end of the stream before the call apply to the newly added text.
sText
- Text string to add to the end of the stream.public void append(TextAttr oAttr)
The various Append() methods allow the caller to build up a text stream sequentially, without having to resort to using text position objects. This overload adds an attribute change to the end of the stream. Note that attributes are somewhat transient. If the next call on the stream appends text, that text will inherit the new attributes. However most other manipulations will cause the newly added attributes to be deemed redundant and removed from the stream.
oAttr
- Attribute object to add to the end of the stream.public void append(TextField poField)
The various Append() methods allow the caller to build up a text stream sequentially, without having to resort to using text position objects. This overload adds an embedded field to the end of the stream. Whatever attributes were in effect at the end of the stream before the call apply to the field (unless it starts with its own attributes).
poField
- Field to add to the end of the stream. The method
clones a copy, so ownership of the object passed in remains with the
caller.public void append(TextEmbed poEmbed)
The various Append() methods allow the caller to build up a text stream sequentially, without having to resort to using text position objects. This overload adds an embedded object to the end of the stream.
poEmbed
- Object to embed at the end of the stream. The
method clones a copy, so ownership of the object passed in remains
with the caller.public void append(TextMarker oMarker)
Note that there is no way to append a range marker through the text stream API. Generally markers are inserted through operations on text position and range objects.
oMarker
- - Pointer to marker to add. Note that markers are
always cloned on insertion, so a copy actually gets inserted. The
caller continues to retain ownership of the instance referred to by
this parameter, and can delete it any time after the call.public void append(TextStream oText)
The various Append() methods allow the caller to build up a text stream sequentially, without having to resort to using text position objects. This overload adds rich text to the end of the stream. If the given rich text does not start with an attribute, then whatever attributes were in effect at the end of this stream before the call apply to the start of the newly added rich text.
oText
- Rich text to add to the end of the stream.public TextDisplay display()
Return a pointer to the stream's associated text display object. Note that this method makes sense for embedded fields, as well as the root displayable stream. All streams in a hiearchy will refer to the same text display object. Client code that manages the editing of a field doesn't need to track down the root displayable stream in order to find the field's display.
public void suppressFormat(boolean bSuppress)
If an application plans to make multiple changes to the same stream, it doesn't want to incur the overhead of reformatting on each call. This method allows it to turn off formatting and then turn it on later when all the changes are done. It is only when turned on again that the formatting occurs.
bSuppress
- TRUE is suppressing formatting, FALSE if restoring
it. Note that calls are actually "stacked", so that two consecutive
calls with TRUE will require two calls with FALSE to resume
formatting. This allows code to attempt to turn formatting off and
back on without having to worry about subverting the caller's use of
this method.public FontService fontService()
public void fontService(FontService poNewFontService)
public TextGfxSource gfxSource()
AXTE collects the various sources and pools of graphic information (Gfx attribute pools, and font service) into a text graphic source object (TextGfxSource). This method returns the current graphic source of the stream.
public void gfxSource(TextGfxSource newSource)
public int maxSize()
Any text stream can have an optional maximum number of characters. This number actually is the maximum number of characters, paragraph marks and embedded objects. This method returns the current maximum size of the stream.
public void maxSize(int nNewSize, boolean bAllowExistingOverflow)
Any text stream can have an optional maximum number of characters. This number actually is the maximum number of characters, paragraph marks and embedded objects. This method sets a new maximum size for the stream.
nNewSize
- New maximum content size for the stream. A value
of zero indicates the size is to be unlimited.bAllowExistingOverflow
- Controls behaviour when the current
content of the stream exceeds its new maximum size. If TRUE, the
size is changed and the existing overflow is retained, but it is not
treated as an error. If FALSE, the content is retained, the maximum
size is not changed and an exception is thrown.public int currentSize()
public int spaceLeft()
Any text stream can have an optional maximum number of characters. This number actually is the maximum number of characters, paragraph marks and embedded objects. This method returns the number of characters that can still be added to the stream before its maximum content size is exceeded param return Number of characters that can still be added. If the maximum content size is unlimited, UINT_MAX is returned. If the current content already exceeds the maximum size, zero is returned.
public boolean allowNewLines()
In form-filling applications, it often doesn't make sense to allow new-line characters in fields. A stream can be told not to allow new-lines. Note that paragraph marks are not considered new-lines. This method returns a flag that indicates whether the stream allows new-lines.
public void allowNewLines(boolean bNewAllow)
In form-filling applications, it often doesn't make sense to allow new-line characters in fields. Note that paragraph marks are not considered new-lines. This method tells the stream whether or not to allow new-lines.
bNewAllow
- TRUE if the stream is to allow new-lines; FALSE if
it not. If the stream already contains one or more new-lines when
this value is set to FALSE, an exception is thrown.public boolean anyNewLines()
public boolean find(String sSearch, TextPosnBase poFoundPosn)
This method scans the string for the exact Unicode character match to a given string. It optionally returns a text position that points to the start of the match. Embedded attribute changes are ignored during the search, but embedded objects and fields are treated as non-matching characters.
sSearch
- String to search for. Note that an empty search
string always fails to match.poFoundPosn
- Optional pointer to position object to receive
the location of the start of the match. A NULL pointer (default
value) may be passed when the caller isn't interested in the
position.public boolean find(String sSearch)
public void markup(MarkupOut oMarkup, TextAttr poInitAttr, boolean bDefaultInitAttr, boolean bFlattenFields)
Convert the entire stream contents to a markup language. The particular language is determined by which derived class of TextMkOut is passed. The caller may request that fields are flattened into stream content in the markup, or retained as references.
oMarkup
- Output markup engine to generate the markup
language.poInitAttr
- Optional ambient/initial attributes. This
parameter, if not NULL, works in concert with the bDefaultInitAttr
parameter. If it indicates ambient attributes, it represents default
attributes that need not be written to the markup if they apply to
the stream. If it indicates initial attributes, all enabled values
are written to the markup. If NULL (default value) it is ignored.bDefaultInitAttr
- Optional. If FALSE (default), parameter
poInitAttr represents initial attributes to write. If TRUE,
poInitAttr represents ambient attributes as described above.bFlattenFields
- Optional. If TRUE, embedded field content is
written to the markup as if it was part of (this) root stream. If
FALSE (default) field references are written to the markup.public void markup(MarkupOut oMarkup)
public void markup(MarkupIn oMarkup)
Process source in a given markup language and replace the stream's content with content described by the markup source. The particular language is determined by which derived class of TextMkOut is passed.
oMarkup
- Markup engine to process the markup. Note that this
pre-populated with the markup source text.public boolean isDescendentOf(TextStream poAncestor, TextPosnBase poPosn)
poPosn
- Optional position object to describe the position of
this stream (or its penultimate ancestor) in the ancestor stream. If
the ancestor is this stream or is not an ancestor, the position
object is not modified.public boolean isDescendentOf(TextStream poAncestor)
public void legacyPositioning(boolean bLegacyPositioning)
For compatibility with version 6 layout idiosyncracies, legacy positioning mode can be enabled for a text stream (actually, it really makes sense only for displayable streams; see class TextDispStr). This method sets the flag for the stream and cascades it to all embedded fields and objects. It currently does not cause a relayout; therefore legacy positioning must be set before the display is created.
bLegacyPositioning
- - TRUE if legacy positioning enabled for
this stream; FALSE (default) if not.public void cascadeLegacyLevel(int eLevel)
eLevel
- - New legacy level to set.public void copyFrom(TextStream oSource)
Replace this stream's content with a copy of the content of the given stream. The graphic source information is not copied. In other words, fonts will be re-mapped in this stream's font service and attributes will be re-pooled in any attribute pool associated with this stream.
oSource
- Stream containing source content to copy.public boolean equals(Object object)
Compare this stream against the one passed on the parameter oCompare for content equality. The graphics sources of the streams are not compared. To be equal, the streams' content must match in all aspects: raw text, attributes, embedded field content, and so on.
public boolean notEqual(TextStream oCompare)
Compare this stream against the one passed on the parameter oCompare for content inequality. The graphics sources of the streams are not compared. This is the exact opposite of the equality comparison.
oCompare
- Stream to compare againstpublic TextContext getContext()
The text context allows multiple streams to share common objects that are used at layout time, thereby reducing resource usage. This method returns a pointer to the text context in effect for this stream. Only displayable streams (see class TextDispStr) carry contexts. The default implementation of this virtual method looks back up through the stream containment hierarchy for a displayable stream and returns its context.
public TextPosn position()
This virtual method is overridden by class TextField, the embedded field class. It returns a text position object associated with the parent stream that represent's the field's position in its parent. With this method, the caller can traverse back up the ancestry hierarchy toward the root. The default implementation returns a NULL pointer, indicating that stream is not embedded in another stream.
public void updateNotification()
When an API call changes the content of the stream, it calls this method to notify any derived class that changes have occurred. The default implementation does nothing. Currently, none of the derived classes implemented in Text Services use this feature.
public int posnCount()
public int[] posnNext(TextPosnBase oPosn, int eNullFrameMode, boolean bTestOnly)
public int posnNextType(TextPosnBase oPosn, int eNullFrameMode, boolean bTestOnly)
public int posnNextType(TextPosnBase oPosn, int eNullFrameMode)
public int[] posnPrev(TextPosnBase oPosn, int eNullFrameMode, boolean bTestOnly)
public int posnPrevType(TextPosnBase oPosn, int eNullFrameMode, boolean bTestOnly)
public int posnPrevType(TextPosnBase oPosn, int eNullFrameMode)
public int posnNextChar(TextPosnBase oPosn, boolean bTestOnly)
public int posnPrevChar(TextPosnBase oPosn, boolean bTestOnly)
public TextField posnNextField(TextPosnBase oPosn, boolean bTestOnly)
public TextField posnPrevField(TextPosnBase oPosn, boolean bTestOnly)
public TextEmbed posnNextEmbed(TextPosnBase oPosn, boolean bTestOnly)
public TextEmbed posnPrevEmbed(TextPosnBase oPosn, boolean bTestOnly)
public TextAttr posnNextAttr(TextPosnBase oPosn, boolean bTestOnly)
public TextAttr posnPrevAttr(TextPosnBase oPosn, boolean bTestOnly)
public void posnInsert(TextPosnBase oPosn, TextStream oInsert)
public void posnInsert(TextPosnBase oPosn, TextEmbed poEmbed)
public void posnInsertPara(TextPosnBase oPosn)
public void posnUpdateStreamLoc(TextPosnBase oPosn, int nIndex)
public TextMarker rangeMarker(TextPosn oStart, TextPosn oEnd, TextMarker poMarker)
public void rangeMarkerInternal(TextPosnBase oStart, TextPosnBase oEnd, TextMarker poMarker)
public void rangeEnumMarker(TextPosnBase oStart, TextPosnBase oEnd, List<TextMarker> oMarkers, boolean bPositionMarkers, boolean bRangeMarkers, boolean bSubsetOnly)
public TextMarker splitMarker(TextMarker poSource, int nSplitStart, int nSplitEnd, int eMarkerSplitReason)
public boolean coalesceMarker(TextMarker poFirst, TextMarker poOther)
public void removeMarker(TextMarker poRemove, boolean bEditOnly)
public TextMarker findRangeMarkerOver(int nIndex, int nSpan)
public void debug()
Copyright © 2010 - 2020 Adobe. All Rights Reserved