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

#include <CmdUtils.h>

Classes

class  AutoUndoSequencePtr
 
class  SequenceContext
 
class  SequencePtr
 

Static Public Member Functions

static ICommandCreateCommand (ClassID cmdType)
 
static ErrorCode ProcessCommand (ICommand *cmd)
 
static ErrorCode ScheduleCommand (ICommand *cmd, ICommand::Priority priority=ICommand::kLowPriority)
 
static ErrorCode ExecuteDynamicCommand (ICommand *cmd)
 
static ErrorCode ExecuteDynamicCommand (ICommand *cmd, bool16 isActive)
 
static bool16 ProcessScheduledCmds (ICommand::Priority downToPriority=ICommand::kLowestPriority)
 
static ICommandSequenceBeginCommandSequence (const char *trackingData=nullptr)
 
static ErrorCode EndCommandSequence (ICommandSequence *sequence)
 
static IAbortableCmdSeqBeginAbortableCmdSeq (const char *trackingData=nullptr)
 
static ErrorCode EndCommandSequence (IAbortableCmdSeq *sequence)
 
static ErrorCode AbortCommandSequence (IAbortableCmdSeq *sequence)
 
static SequenceMark SetSequenceMark (const IAbortableCmdSeq *sequence)
 
static ErrorCode RollBackCommandSequence (const IAbortableCmdSeq *sequence, SequenceMark upToMark=SequenceMark())
 
static void EnableBusyCursor (bool16 bEnable)
 
static bool16 IsBusyCursorEnabled ()
 
static int32 GetMaxStackHeight ()
 
static ErrorCode ExecuteCommand (ICommand *cmd)
 
static ErrorCode LWProcessCommand (ICommand *cmd)
 
static bool8 IsCommandLWProcessed (ICommand *cmd)
 
static IAutoUndoSequenceBeginAutoUndoSequence (IDataBase *target, const char *trackingData=nullptr)
 
static ErrorCode EndAutoUndoSequence (IAutoUndoSequence *arg)
 

Detailed Description

Utilities for creating and processing commands (see ICommand).

See Also
ICommand
ICommandSequence
IAbortableCmdSeq
ErrorUtils
IDataBase

Member Function Documentation

static ErrorCode CmdUtils::AbortCommandSequence (IAbortableCmdSeqsequence)
static

Abort an abortable command sequence.

Parameters
sequencethe sequence to be aborted.
Returns
kSuccess if the sequence was successfully aborted, other ErrorCode otherwise.
Postcondition
don't access the sequence again after calling this method.
static IAbortableCmdSeq* CmdUtils::BeginAbortableCmdSeq (const char * trackingData = nullptr)
static

Begin an abortable command sequence; see IAbortableCmdSeq for documentation (if you are unsure which type of command sequence you need, use ICommandSequence rather than IAbortableCmdSeq).

Parameters
trackingData: string identifier of the caller. This is to help track if any abortable command sequence was lost without EndCommandSequence or AbortCommandSequence
Returns
pointer to the abortable command sequence or nil on error.
Postcondition
call CmdUtils::EndCommandSequence(IAbortableCmdSeq*) or CmdUtils::AbortCommandSequence(IAbortableCmdSeq*) to terminate sequence.
static IAutoUndoSequence* CmdUtils::BeginAutoUndoSequence (IDataBasetarget,
const char * trackingData = nullptr 
)
static

Begin an auto undo sequence; see IAutoUndoSequence for documentation.

Parameters
targetdatabase to be changed by the sequence.
trackingData: string identifier of the caller. This is to help track if any auto undo sequence was lost without EndAutoUndoSequence
Returns
pointer to the auto undo sequence or nil on error.
Postcondition
call CmdUtils::EndAutoUndoSequence(IAutoUndoSequence*) to terminate the sequence.
See Also
IAutoUndoSequence
CmdUtils::AutoUndoSequencePtr helper class
static ICommandSequence* CmdUtils::BeginCommandSequence (const char * trackingData = nullptr)
static

Begin a regular command sequence; see ICommandSequence for documentation.

Parameters
trackingData: string identifier of the caller. This is to help track if any command sequence was lost without EndCommandSequence
Returns
the command sequence or nil on error
Postcondition
call CmdUtils::EndCommandSequence(ICommandSequence*) to terminate the sequence.
See Also
CmdUtils::SequenceContext and CmdUtils::SequencePtr helper classes
static ICommand* CmdUtils::CreateCommand (ClassID cmdType)
static

Create a command of the given class.

Parameters
cmdTypeidentifies the command to be created.
Returns
command on success, nil otherwise.
static void CmdUtils::EnableBusyCursor (bool16 bEnable)
static

Turn on or off automatic busy cursor support during commands and sequences.

Parameters
bEnablekTrue to turn on (the default) or kFalse to turn off busy cursor.
static ErrorCode CmdUtils::EndAutoUndoSequence (IAutoUndoSequencearg)
static

End auto undo sequence

Parameters
arg
Returns
ErrorCode
static ErrorCode CmdUtils::EndCommandSequence (ICommandSequencesequence)
static

End a regular command sequence;

Parameters
sequenceto be ended
Returns
kSuccess if the sequence ended successfully, other ErrorCode otherwise.
See Also
ErrorUtils::PMGetGlobalErrorCode
static ErrorCode CmdUtils::EndCommandSequence (IAbortableCmdSeqsequence)
static

End an abortable command sequence.

Parameters
sequenceto be ended
Returns
kSuccess if the sequence ended successfully, other ErrorCode otherwise.
Postcondition
don't access the sequence again after calling this method.
static ErrorCode CmdUtils::ExecuteCommand (ICommandcmd)
static

Private; for internal use only: Execute a command

static ErrorCode CmdUtils::ExecuteDynamicCommand (ICommandcmd)
static

DEPRICATED Avoid using this function if possible - this is legacy and is deprecated.

Execute a dynamic command

Parameters
cmdthe command to be processed.
Returns
kSuccess on success, other ErrorCode otherwise.
static ErrorCode CmdUtils::ExecuteDynamicCommand (ICommandcmd,
bool16 isActive 
)
static

DEPRICATED Avoid using this function if possible - this is legacy and is deprecated.

Execute a dynamic command

Parameters
cmdthe command to be processed.
isActive- pass kFalse to get notification only from the command, eg. when a tracker is in wireframe mode
Returns
kSuccess on success, other ErrorCode otherwise.
static int32 CmdUtils::GetMaxStackHeight ()
static

Return the maximum sequence length.

Returns
the maximum sequence length.
static bool16 CmdUtils::IsBusyCursorEnabled ()
static

Is automatic busy cursor support on or off.

Parameters
none
Returns
bool16 kTrue if busy cursor support is turned on (the default), or kFalse if off
static bool8 CmdUtils::IsCommandLWProcessed (ICommandcmd)
static

Private; for internal use only: Returns kTrue if a command was light-weight processed

static ErrorCode CmdUtils::LWProcessCommand (ICommandcmd)
static

Private; for internal use only: Light-weight process a command

static ErrorCode CmdUtils::ProcessCommand (ICommandcmd)
static

Process a command using regular cmd processing, the default method for cmd execution; remember to check the ErrorCode returned by this call, if you continue to process commands while the global error code is set then protective shutdown will occur.

Parameters
cmdthe command to be processed.
Returns
kSuccess on success, other ErrorCode otherwise.
See Also
ErrorUtils::PMGetGlobalErrorCode
static bool16 CmdUtils::ProcessScheduledCmds (ICommand::Priority downToPriority = ICommand::kLowestPriority)
static

Flush the command queue, processing scheduled commands

Parameters
downToPrioritycontrols the priority level that commands are processed down to. Commands with this priority and higher will be processed.
Returns
kTrue if all scheduled commands in the command queue could be processed down to the priority specified without any errors, or kFalse otherwise
static ErrorCode CmdUtils::RollBackCommandSequence (const IAbortableCmdSeqsequence,
SequenceMark upToMark = SequenceMark() 
)
static

Roll back an abortable command sequence to a particular sequence mark.

Precondition
CmdUtils::SetSequenceMark was used to set the mark.
Parameters
sequenceto be rolled back.
upToMarksequennce mark to roll back to.
static ErrorCode CmdUtils::ScheduleCommand (ICommandcmd,
ICommand::Priority priority = ICommand::kLowPriority 
)
static

Schedule a command to be processed later (depending on their priority)

Parameters
cmdthe command to be processed.
priorityat which the scheduled command should be processed.
Returns
kSuccess if the command is scheduled for processing, other ErrorCode otherwise.
static SequenceMark CmdUtils::SetSequenceMark (const IAbortableCmdSeqsequence)
static

Mark a point in an abortable command sequence to roll back to later on before the sequence is ended or aborted.

Parameters
sequencein which you want to set the mark
Returns
0 on failure, sequence mark value otherwise