Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
TCommandOn
Inherited By:
TAddStylesCommand
TRemoveStylesCommand
TReplaceStylesCommand
Purpose:
TChangeStylesCommand, derived from the template class TCommandOn<MTextSelection>, is the abstract base class for all style changing commands. Derived classes of this command can be used to change either character or paragraph styles. If no style category is given, it defaults to character styles.
Instantiation:
Abstract class; do not instantiate directly.
Deriving Classes:
The classes derived from this abstract base class are: TAddStylesCommand, TRemoveStylesCommand, and TChangeStylesCommand. They each override the assignment operator and the HandleChangeStyles member function.
Concurrency:
This command's functions assume that any required locks have already been acquired by the client.
Resource Use:
No special requirements.
Other Considerations:
None.
virtual ~ TChangeStylesCommand ()
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:
This command's functions assume that any required locks have already been acquired by the client.
Other Considerations:
None.
virtual void SetStyles (const TStyleSet & styles)
Interface Category:
API.
Purpose:
Specifies the set of styles for this command to apply to the target selection. Call to specify a style set for this command after construction of the command.
Calling Context:
Call this function directly.
Parameters:
- const TStyleSet & styles -The set of styles for this command to apply to the target selection.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
This command's functions assume that any required locks have already been acquired by the client.
Other Considerations:
None.
virtual void GetStyles (TStyleSet & styles) const
Interface Category:
API.
Purpose:
Returns the set of styles this command is set to apply to the target selection. Call to get the styles for this command to apply.
Calling Context:
Call this function directly.
Parameters:
- TStyleSet & styles -Receives the set of styles for this command to apply to the target selection.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
This command's functions assume that any required locks have already been acquired by the client.
Other Considerations:
None.
virtual TStream & operator >>=(TStream &) const
Interface Category:
API.
Purpose:
Stream-out operator.
Calling Context:
Call this function directly.
Parameters:
- TStream & -The stream the object streams itself out to.
Return Value:
Returns a reference to the stream the object streams itself out to.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
This command's functions assume that any required locks have already been acquired by the client.
Other Considerations:
None.
virtual TStream & operator <<= (TStream &)
Interface Category:
API.
Purpose:
Stream-in operator.
Calling Context:
Call this function directly.
Parameters:
- TStream & -The stream the object streams itself in from.
Return Value:
Returns a reference to the stream the object streams itself in from.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
This command's functions assume that any required locks have already been acquired by the client.
Other Considerations:
None.
TChangeStylesCommand & operator =(const TChangeStylesCommand &)
Interface Category:
API.
Purpose:
Assignment operator.
Calling Context:
Call this function directly.
Parameters:
Return Value:
A non-const reference to the left-hand side object.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
This command's functions assume that any required locks have already been acquired by the client.
Other Considerations:
None.
- TChangeStylesCommand ()
- TChangeStylesCommand (const TStyleSet & styles)
- TChangeStylesCommand (const TChangeStylesCommand &)
Interface Category:
API.
Purpose:
- Default constructor. This constructor is protected.
- Constructs a command that will apply the specified character styles to the target selection. This constructor is protected.
- Copy constructor. This constructor is protected.
Calling Context:
- Called by the stream-in operators.
- Call to construct this command with a particular style set. Called when creating the menus for the view.
- Called to copy an object.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
This command's functions assume that any required locks have already been acquired by the client.
Other Considerations:
None.
virtual void HandleDoBegin (MTextSelection &)
Interface Category:
API.
Purpose:
Executes the command. This function gets a pointer to the representation, stores the undo information, and calls HandleChangeStyles to apply the style change to the selected text in the text representation.
Calling Context:
Called by the Text Framework classes. Typically not called directly by clients.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
This command's functions assume that any required locks have already been acquired by the client.
Other Considerations:
This protected function overrides the inherited TCommandOn function.
virtual void HandleUndo (MTextSelection &)
Interface Category:
API.
Purpose:
Undoes the command by restoring the text to its state before the command was executed. Called by the framework when this command is undone.
Calling Context:
Called by the Text Framework classes. Typically not called directly by clients.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
This command's functions assume that any required locks have already been acquired by the client.
Other Considerations:
This protected function overrides the inherited TCommandOn function.
virtual void HandleRedo (MTextSelection &)
Interface Category:
API.
Purpose:
Redoes the command by adding the styles to the selected text once again.
Calling Context:
Called by the Text Framework classes. Typically not called directly by clients.
Parameters:
- TTextSelection & -The target selection for this command.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
This command's functions assume that any required locks have already been acquired by the client.
Other Considerations:
This protected function overrides the inherited TCommandOn function.
virtual void HandleChangeStyles (MTextRepresentation * textToChange, const TStyleSet & styleToChange, const TTextArea & whereToChange, const TStyleKind & kind =TCharacterStyleRuns :: GetStyleKind ())
Interface Category:
API.
Purpose:
This is a pure virtual function called by HandleDoBegin to change the styles. Derived classes must override to call the appropriate style changing function on the representation (that is, AddStyles, ReplaceStyles, or RemoveStyles).
Calling Context:
Called by the Text Framework classes. Typically not called directly by clients.
Parameters:
- MTextRepresentation * textToChange -The text representation for the text whose style(s) will be changed.
- const TStyleSet & styleToChange -The set of styles to apply.
- const TTextArea & whereToChange -The selection of text whose style(s) will be changed.
- const TStyleKind & kind =TCharacterStyleRuns :: GetStyleKind () -The category of style to be changed (default: character).
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
This command's functions assume that any required locks have already been acquired by the client.
Other Considerations:
This is a pure virtual function and needs to be overridden.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.