Class: TChangeStylesCommand

Declaration: TextCommandsCore.h

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.

Member Function: TChangeStylesCommand::~TChangeStylesCommand

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.

Member Function: TChangeStylesCommand::SetStyles

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:

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.

Member Function: TChangeStylesCommand::GetStyles

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:

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.

Member Function: TChangeStylesCommand::operator>>=

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

Interface Category:

API.

Purpose:

Stream-out operator.

Calling Context:

Call this function directly.

Parameters:

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.

Member Function: TChangeStylesCommand::operator<<=

virtual TStream & operator <<= (TStream &)

Interface Category:

API.

Purpose:

Stream-in operator.

Calling Context:

Call this function directly.

Parameters:

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.

Member Function: TChangeStylesCommand::operator=

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.

Member Function: TChangeStylesCommand::TChangeStylesCommand

  1. TChangeStylesCommand ()
  2. TChangeStylesCommand (const TStyleSet & styles)
  3. TChangeStylesCommand (const TChangeStylesCommand &)

Interface Category:

API.

Purpose:

  1. Default constructor. This constructor is protected.
  2. Constructs a command that will apply the specified character styles to the target selection. This constructor is protected.
  3. Copy constructor. This constructor is protected.

Calling Context:

  1. Called by the stream-in operators.
  2. Call to construct this command with a particular style set. Called when creating the menus for the view.
  3. 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.

Member Function: TChangeStylesCommand::HandleDoBegin

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.

Member Function: TChangeStylesCommand::HandleUndo

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.

Member Function: TChangeStylesCommand::HandleRedo

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:

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.

Member Function: TChangeStylesCommand::HandleChangeStyles

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:

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.