InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Command.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: EricM
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //========================================================================================
23 
24 #ifndef __COMMAND__
25 #define __COMMAND__
26 
27 #include "ICommand.h"
28 #include "HelperInterface.h"
29 
30 #include "UIDList.h"
31 class IResourceAccess;
32 
89 class Command : public ICommand {
90 public:
91  enum CommandDummyArg { kItemList = 1 };
92 
93  Command(IPMUnknown *boss);
94  virtual ~Command();
95 
96  virtual void GetName(PMString *name) const;
97  virtual void SetName(const PMString& newName);
98  virtual bool16 IsNameRequired() const;
99 
100  virtual const UIDList* GetItemList() const;
101  virtual const UIDList &GetItemListReference() const;
102  virtual void SetItemList(const UIDList &newItemList);
103 
104  virtual void DoImmediate(bool16 isDynamic = kFalse);
105  virtual void LWDoImmediate();
106 
107 
111  virtual void DoDynamic();
112 
113  virtual CommandState GetCommandState() const;
114  virtual bool16 IsDone() const;
115  virtual bool16 CanJoin( const ICommand *pNewCmd )const;
116 
117  virtual void SetCreatorID(int32 creatorID);
118  virtual int32 GetCreatorID() const;
119 
120  virtual bool16 LowMemIsOK() const;
121 
122  virtual const Target &GetTarget() const;
123 
124  virtual Undoability GetUndoability() const;
125  virtual void SetUndoability(Undoability newUndoability);
126 
127  virtual void SetActive(bool16 isActive);
128  virtual bool16 IsActive() const;
129 
130  virtual bool8 IsLWProcessed() const;
131 
132 protected:
133  // If you are considering making any of these methods public
134  // instead of protected... please let me know. - Zak
135 
141  virtual void Do() = 0;
142  // Executes the command, causing changes to the model.
143  //
144  // This must be overridden by each command. This method
145  // is only called by ExecuteImmediate(), which also sets
146  // the command state and calls DoNotify().
147 
153  virtual void DoNotify();
154 
158  virtual void SetCommandState(CommandState state);
159 
163  virtual PMString *CreateName();
164 
172  virtual void SetUpTarget();
173 
183  virtual void PreVerify(CommandState state);
184 
188  virtual void PostVerify(CommandState state);
189 
193  typedef enum
194  {
199  } PredefinedTarget;
200 
204  void SetTarget(const Target &newTarget);
205 
209  void SetTarget(PredefinedTarget newTarget);
210 
216  void SetTarget(IDataBase *db);
217 
221 
222 #ifdef ID_ENABLE_DEBUGGING
223  enum Action { kDoAbsolutelyNothing, kDo} ;
224  void LogCommand( Action act ) ;
225 #endif
226 
227 private:
228  mutable PMString *fName;
229 
230  CommandState fCommandState;
231  int32 fCreatorID;
232 
233  Undoability fUndoability;
234  bool16 fIsActive;
235  UIDRef fTarget;
236  // will go away
237  bool8 fIsLWProcessed;
238 
239 };
240 
241 
242 #endif // __COMMAND__
243