InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ICommandSequence Class Reference

#include <ICommandSequence.h>

Inheritance diagram for ICommandSequence:
I_Base_CommandSequence

Additional Inherited Members

- Public Member Functions inherited from I_Base_CommandSequence
virtual ICommand::Undoability GetUndoability () const =0
 
virtual void SetUndoability (ICommand::Undoability newUndoability)=0
 
virtual void GetName (PMString *name) const =0
 
virtual void SetName (const PMString &newName)=0
 
virtual void AddReference ()=0
 
virtual void ReleaseReference ()=0
 
virtual const char * GetTrackingData ()=0
 

Detailed Description

A regular command sequence groups any number of commands to a single undoable 

step in the command history. When the sequence ends, the changes made by 

the commands within the sequence are committed if the global error code is 

kSuccess, otherwise the database is rolled back to its state before the 

sequence started.



Stack-based helper classes CmdUtils::SequencePtr and CmdUtils::SequenceContext

make it easier to write a sequence and avoid having to call

CmdUtils::BeginCommandSequence() and CmdUtils::EndCommandSequence(ICommandSequence *)

yourself. For example:

<pre>

{

The SequencePtr constructor creates a new sequence. SequencePtr seq; seq->SetName(PMString("Your Sequence Name")); if (ProcessFirstCommand() == kSuccess)) { ProcessSecondCommand(); } When the SequencePtr object goes out of scope the destructor ends the sequence. }

Alternatively call CmdUtils::BeginCommandSequence() to create a new sequence. After you are done with processing commands call CmdUtils::EndCommandSequence(ICommandSequence *). Do not use the sequence again afterwards.

See Also
CmdUtils::SequenceContext
CmdUtils::SequencePtr
CmdUtils::BeginCommandSequence
CmdUtils::EndCommandSequence(ICommandSequence *)
ErrorUtils::PMGetGlobalErrorCode
ICmdHistory
ICommand
CmdUtils