InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ISession.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Lonnie Millett
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 __ISESSION__
25 #define __ISESSION__
26 
27 #include "IPMUnknown.h"
28 #include "ShuksanID.h"
29 
30 //----------------------------------------------------------------------------------------
31 // Forward Declarations
32 //----------------------------------------------------------------------------------------
33 
34 class IApplication;
35 class IActiveContext;
36 class IChangeManager;
37 class IWorkspace;
38 class ICommandProcessor;
39 class IEventConverter;
40 class IDataBase;
41 class GlobalTime;
42 class IObjectModel;
43 class VersionNumber;
44 class IStartupScreen;
45 class IAutomationManager;
46 class IUserActionPersonalityManager;
47 class IINXManager;
48 class IDocumentList;
71 class ISession : public IPMUnknown
72 {
73 public:
82  virtual IActiveContext* GetActiveContext() = 0;
83 
89  virtual IChangeManager* GetChangeManager() = 0;
90 
96  virtual IEventConverter* GetEventConverter() = 0;
97 
105  virtual IApplication* QueryApplication() = 0;
106 
114  virtual IWorkspace* QueryWorkspace() = 0;
115 
123  virtual IPMUnknown* QueryWorkspace(PMIID faceID) = 0;
124 
131 
136  virtual IAutomationManager* QueryAutomationMangager() = 0;
137 
142  virtual IUserActionPersonalityManager* QueryUserActionPersonalityMangager() = 0;
143 
148  virtual IINXManager * QueryINXManager() = 0;
149 
152  typedef enum SessionStateType
153  { kUnknown, kStartingUp, kRunning, kShuttingDown } SessionStateType;
154 
159  virtual SessionStateType GetState() = 0;
160 
162 
163 
164 
165  // Purge handler is called automatically when memory allocation fails.
166  virtual bool16 PurgeMemory(int32 level) = 0;
167 
168  // Get the startup time
169  virtual const GlobalTime &GetStartupTime() = 0;
170 
171  // Is InDesign running without saved data
172  virtual const bool16 IsStartupWithoutSavedData (void) = 0;
173 
174  // Initialize the session.
175  virtual bool16 Init(IDataBase* workSpaceDB = nil, const GlobalTime* const pStartupTime = nil) = 0;
176 
177  // Shutdown the session.
178  virtual void Cleanup() = 0;
179 
180  // access to the startup screen.
181  virtual IStartupScreen *GetStartupScreen() const = 0;
182 
183  // This call can be used to insert a proxy command processor, or to remove
184  // the proxy and restore the original command processor that will be returned
185  // by QueryCommandProcessor(). This will not change the reference count
186  // of their command processor boss.
187  virtual ICommandProcessor *SetProxyCommandProcessor (ICommandProcessor *proxy) = 0;
188 
189 
192  virtual IDocumentList* QueryDocumentList() const = 0;
193 
194 
196 };
197 
200  ISession* GetExecutionContextSession();
201 
202 
203 template <class FACE>
204 inline FACE* QuerySessionWorkspace()
205 {
206  IPMUnknown* face = GetExecutionContextSession()->QueryWorkspace(FACE::kDefaultIID);
207 
208  return static_cast<FACE*>(face);
209 }
210 
211 
212 #endif // __ISESSION__