Class: MTextSelection

Declaration: TextSelectionCore.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

None.

Inherited By:

TDocumentTextSelection TSimpleTextSelection

Purpose:

MTextSelection is an abstract base class which specifies data on text representations. It contains a TTextArea and delegates the access API to that area. All text command objects descend from TCommandOn<MTextSelection>.

Instantiation:

Mixin class; do not instantiate.

Deriving Classes:

MTextSelection is an abstract base class whose principal derived classes are TSimpleTextSelection and TDocumentTextSelection. These derived classes are created for different text representations. Derived classes must override the pure virtual functions GetTextForWriting, GetTextForReading, CopyTextSelection, and GetRepresentation.

Concurrency:

The level of concurrency is determined by the derived classes.

Resource Use:

No special requirements.

Other Considerations:

None.

Member Function: MTextSelection::~MTextSelection

virtual ~ MTextSelection ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Typically not called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

The level of concurrency is determined by the derived classes.

Other Considerations:

None.

Member Function: MTextSelection::GetTextArea

const TTextArea & GetTextArea () const

Interface Category:

API.

Purpose:

Access function which returns the TTextArea member variable. Called to determine the TTextArea for this selection.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

A const reference to the TTextArea.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

The level of concurrency is determined by the derived classes.

Other Considerations:

None.

Member Function: MTextSelection::SetTextArea

virtual void SetTextArea (const TTextArea & area)

Interface Category:

API.

Purpose:

Sets the TTextArea member variable to the specified selection area. This object delegates access functions (SetInsertionOffset, SetRegion, GetRegion, etc.) to the area. That is, for each of these functions, it calls the area's corresponding member function.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

The level of concurrency is determined by the derived classes.

Other Considerations:

None.

Member Function: MTextSelection::SetInsertionOffset

virtual void SetInsertionOffset (const TInsertionOffset & point)

Interface Category:

API.

Purpose:

Sets this selection to an insertion point selection at the specified offset. Does this by calling the SetInsertionOffset function of this object's TTextArea member variable .

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

The level of concurrency is determined by the derived classes.

Other Considerations:

None.

Member Function: MTextSelection::SetRegion

virtual void SetRegion (const TTextRegion & range)

Interface Category:

API.

Purpose:

Specifies the text region to be represented by this selection. Does this by calling the SetRegion function of this object's TTextArea member variable.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

The level of concurrency is determined by the derived classes.

Other Considerations:

None.

Member Function: MTextSelection::GetInsertionOffset

virtual void GetInsertionOffset (TInsertionOffset & insertionPoint) const

Interface Category:

API.

Purpose:

Returns the insertion offset of this selection. Does this by calling the GetInsertionOffset function of this object's TTextArea member variable. Note that if the current selection is a range, the insertion offset returned is the last offset in that range. If the current selection is a region, the insertion offset returned is the last offset in the last range of that region.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

The level of concurrency is determined by the derived classes.

Other Considerations:

None.

Member Function: MTextSelection::GetRegion

virtual void GetRegion (TTextRegion & region) const

Interface Category:

API.

Purpose:

Returns the region of text specified by this selection. Does this by calling the GetRegion function of this object's TTextArea member variable.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

The level of concurrency is determined by the derived classes.

Other Considerations:

None.

Member Function: MTextSelection::GetCount

virtual TTextCount GetCount () const

Interface Category:

API.

Purpose:

Returns the number of characters in this selection. Does this by calling the GetCount function of this object's TTextArea member variable. Returns zero if this selection is an insertion point. Called to get the number of characters in this selection. Called by operations that may do different things based on the length of a selection.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

A TTextCount object containing the number of characters in this selection.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

The level of concurrency is determined by the derived classes.

Other Considerations:

None.

Member Function: MTextSelection::IsInsertionPoint

virtual bool IsInsertionPoint () const

Interface Category:

API.

Purpose:

Returns true if the selection is an insertion point selection. Does this by calling the IsInsertionPoint function of this object's TTextArea member variable. Called to determine whether or not the selection is an insertion point selection.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

Returns true if this selection is an insertion point selection.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

The level of concurrency is determined by the derived classes.

Other Considerations:

None.

Member Function: MTextSelection::SelectAllText

virtual void SelectAllText ()

Interface Category:

API.

Purpose:

Sets this selection to select all the text. Does this by calling the SelectAllText function of this object's TTextArea member variable. Called to sets this selection to include all the text data in the underlying text representation.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

The level of concurrency is determined by the derived classes.

Other Considerations:

None.

Member Function: MTextSelection::DeselectAllText

virtual void DeselectAllText ()

Interface Category:

API.

Purpose:

Deselects all the text; sets the range of this selection to be empty. Does this by calling the DeselectAllText function of this object's TTextArea member variable. Called to deselect text data and leave the insertion offset in the same place.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

The level of concurrency is determined by the derived classes.

Other Considerations:

None.

Member Function: MTextSelection::ExtendTextSelectionToStart

virtual void ExtendTextSelectionToStart ()

Interface Category:

API.

Purpose:

Extends this selection to include all the text from the beginning of the text representation to the end of the current selection. Does this by calling the ExtendTextSelectionToStart function of this object's TTextArea member variable.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

The level of concurrency is determined by the derived classes.

Other Considerations:

None.

Member Function: MTextSelection::ExtendTextSelectionToEnd

virtual void ExtendTextSelectionToEnd ()

Interface Category:

API.

Purpose:

Extends this selection to include all the text from the beginning of the current selection to the end of the text representation. Does this by calling the ExtendTextSelectionToEnd function of this object's TTextArea member variable.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

The level of concurrency is determined by the derived classes.

Other Considerations:

None.

Member Function: MTextSelection::operator=

MTextSelection & operator =(const MTextSelection &)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

A non-const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

The level of concurrency is determined by the derived classes.

Other Considerations:

None.

Member Function: MTextSelection::operator>>=

virtual TStream & operator >>=(TStream & towhere) const

Interface Category:

API.

Purpose:

Stream-out operator.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself out to.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

The level of concurrency is determined by the derived classes.

Other Considerations:

None.

Member Function: MTextSelection::operator<<=

virtual TStream & operator <<= (TStream & fromwhere)

Interface Category:

API.

Purpose:

Stream-in operator.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself in from.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

The level of concurrency is determined by the derived classes.

Other Considerations:

None.

Member Function: MTextSelection::GetTextForWriting

virtual MTextRepresentation * GetTextForWriting ()

Interface Category:

API.

Purpose:

Returns a pointer to the MTextRepresentation representation bound to this selection.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

A pointer to the MTextRepresentation.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

The level of concurrency is determined by the derived classes.

Other Considerations:

This is a pure virtual function and needs to be overridden.

Member Function: MTextSelection::GetTextForReading

virtual const TText * GetTextForReading () const

Interface Category:

API.

Purpose:

Returns the text object contained by the representation bound to this selection.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

A pointer to the text object contained by the representation bound to this selection.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

The level of concurrency is determined by the derived classes.

Other Considerations:

This is a pure virtual function and needs to be overridden.

Member Function: MTextSelection::MTextSelection

  1. MTextSelection (const MTextSelection & selection)
  2. MTextSelection ()

Interface Category:

API.

Purpose:

  1. Copy constructor.
  2. Default constructor.

Calling Context:

  1. May be called directly by derived classes.
  2. May be called directly by derived classes. Called by the stream-in operators.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

The level of concurrency is determined by the derived classes.

Other Considerations:

None.

Member Function: MTextSelection::CopyTextSelection

virtual MTextSelection * CopyTextSelection () const

Interface Category:

API.

Purpose:

Returns a copy of this selection object.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

A pointer to the newly created copy of this selection object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

The level of concurrency is determined by the derived classes.

Other Considerations:

This protected function is a pure virtual function and needs to be overridden.

Member Function: MTextSelection::GetRepresentation

virtual MTextRepresentation * GetRepresentation ()

Interface Category:

API.

Purpose:

Returns the text representation bound to this selection. Called to get access to the representation bound to this selection.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

A pointer to the representation bound to this selection.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

The level of concurrency is determined by the derived classes.

Other Considerations:

This protected function is a pure virtual function and needs to be overridden.

Member Function: MTextSelection::SetRange

virtual void SetRange (const TTextRange & range)

Interface Category:

API.

Purpose:

Set the range of text that this selection specifies.

Calling Context:

May be called directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

The level of concurrency is determined.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.