Class TextSelection
- java.lang.Object
-
- com.adobe.xfa.text.TextRange
-
- com.adobe.xfa.text.TextSelection
-
public class TextSelection extends TextRange
Class TextSelection represents a range of selected text. As such, it extends class TextRange withy selection colour information. One can pass a text selection object to the text drawing method to render text with selection highlighting. Note that a multi-view application would maintain a separate selection for each view.
-
-
Field Summary
-
Fields inherited from class com.adobe.xfa.text.TextRange
POSN_ANCHOR, POSN_END, POSN_LOOSE, POSN_START
-
-
Constructor Summary
Constructors Constructor Description TextSelection()
Default constructor.TextSelection(GFXColour oColour, GFXColour oColourBg, TextStream poStream)
Constructor with colours and stream.TextSelection(TextSelection oSource)
Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GFXColour
colour()
Obtain the current foreground colour of the selection.void
colour(GFXColour oNewColour)
Change the foreground colour of the selection.GFXColour
colourBg()
Obtain the current background colour of the selection.void
colourBg(GFXColour oNewColourBg)
Change the background colour of the selection.void
copyFrom(TextSelection oSource)
Assignment operator.boolean
equals(Object object)
Equality comparison.int
hashCode()
-
Methods inherited from class com.adobe.xfa.text.TextRange
anchor, anchor, anchor, associate, associate, attribute, attribute, attribute, charPosition, charRange, copyFrom, count, countEmbed, countField, countText, delete, delete, end, end, end, enumerateMarkers, enumerateMarkers, getSelectionRectangles, grabLine, grabPara, grabWord, grabWord, insert, isEmpty, loose, loose, loose, markup, markup, notEqual, position, position, position, replace, replace, replace, replace, replace, replace, start, start, start, stream, text, text, text, tighten, union
-
-
-
-
Constructor Detail
-
TextSelection
public TextSelection()
Default constructor.Construct a text selection object with no initial stream association. The default foreground colour is white and the default background colour is black.
-
TextSelection
public TextSelection(TextSelection oSource)
Copy constructor.Copy the source selection object including range and colours.
- Parameters:
oSource
- - Source selection to copy.
-
TextSelection
public TextSelection(GFXColour oColour, GFXColour oColourBg, TextStream poStream)
Constructor with colours and stream.Construct a text selection object associated with the given stream and using the given colours. The selection range initially covers the entire text stream.
- Parameters:
oColour
- - Foreground colour.oColourBg
- - Background colour.poStream
- - (optional) Text stream for association. NULL (default) creates the text selection with no initial association.
-
-
Method Detail
-
colour
public GFXColour colour()
Obtain the current foreground colour of the selection.- Returns:
- Foreground colour.
-
colour
public void colour(GFXColour oNewColour)
Change the foreground colour of the selection.Note: changing the colour does not automatically cause an invalidation of the selected text in any view.
- Parameters:
oNewColour
- - New foreground colour.
-
colourBg
public GFXColour colourBg()
Obtain the current background colour of the selection.- Returns:
- Background colour.
-
colourBg
public void colourBg(GFXColour oNewColourBg)
Change the background colour of the selection.Note: changing the colour does not automatically cause an invalidation of the selected text in any view.
- Parameters:
oNewColourBg
- - New background colour.
-
copyFrom
public void copyFrom(TextSelection oSource)
Assignment operator.Copies all attrbutes of the source selection, including underlying text range and colours.
- Parameters:
oSource
- - Source selection to copy.
-
equals
public boolean equals(Object object)
Equality comparison.Two selections are considered equal of the represent the same range in the same text stream, and have the same foreground and background colours.
-
-