InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IK2ServiceRegistry.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Zak_Williamson
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 // Purpose:
24 // The IK2ServiceRegistry interface lives on the session boss. The
25 // service registry provides a globally accessible container where
26 // non-persistent bosses can be registered as providing a "service".
27 // A ServiceID (a long integer in K2's ID space) is used to categorize
28 // a set of non-persistent boss objects that support the same set of
29 // interfaces.
30 //
31 // To provide a service, a boss object only needs to aggregate an
32 // IK2ServiceProvider interface. The remainder of the interfaces of the
33 // boss can be whatever the developer needs to a specific task. The
34 // service registry will automatically find and register the boss as a
35 // service during startup.
36 //
37 // Examples of services include: import filters, export filters, open
38 // converters, text composers, dialog panels, actions to run when creating
39 // a new document, actions to run at application startup/shutdown, image data
40 // manipulators, hyphenation systems, spelling systems, measurement systems, etc.
41 //
42 //========================================================================================
43 
44 #ifndef __IK2ServiceRegistry__
45 #define __IK2ServiceRegistry__
46 
47 #include "IPMUnknown.h"
48 #include "ShuksanID.h"
49 
50 class IK2ServiceProvider;
51 
61 {
62 public:
63  enum { kDefaultIID = IID_IK2SERVICEREGISTRY };
64 
72  virtual IK2ServiceProvider * QueryServiceProviderByClassID(ServiceID serviceID, ClassID providerClassID) const= 0;
73 
79  virtual IK2ServiceProvider * QueryDefaultServiceProvider(ServiceID serviceID) const= 0;
80 
87  virtual ClassID GetDefaultServiceProviderID(ServiceID serviceID) const = 0;
88 
93  virtual void SetDefaultServiceProviderID(ServiceID serviceID, ClassID classID) = 0;
94 
95 
97 
98 
99 
104  virtual int32 GetServiceProviderCount(ServiceID serviceID) const= 0;
105 
111  virtual IK2ServiceProvider * QueryNthServiceProvider(ServiceID serviceID, int32 n) const= 0;
112 
118  virtual ClassID GetNthServiceProviderID(ServiceID serviceID, int32 n) const= 0;
119 
125  virtual int32 GetServiceProviderIndex(ServiceID serviceID, ClassID serviceProviderID) const= 0;
126 
131  virtual int32 GetServiceProviderIndex(const IK2ServiceProvider * serviceProvider) const= 0;
132 
134 
135 
137 
138 
139 
144  virtual void Startup() = 0;
145 
150  virtual void Shutdown() = 0;
151 
155  virtual void ReleaseCachedServiceProviders() = 0;
156 
162  virtual void RegisterServiceProvider(ClassID classID) = 0;
163 
167  virtual void PerformStartupServices() = 0;
168 
171  virtual void GetRegisteredServiceIDs(K2Vector<ServiceID>& services) const= 0;
172 
174 
175 };
176 
177 #endif