InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IActiveContext.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner:
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 __IActiveContext__
25 #define __IActiveContext__
26 
27 #include "IPMUnknown.h"
28 
29 #include "K2Vector.h"
30 #include "KeyValuePair.h"
31 
32 #include "DocumentID.h"
33 #include "ShuksanID.h"
34 #include "widgetid.h"
35 #include "WorkspaceID.h"
36 
37 class IDocument;
38 class ISelectionManager;
39 class IControlView;
40 class IWorkspace;
41 class ISubject;
42 
46 class IActiveContext : public IPMUnknown
47 {
48 public:
49  enum { kDefaultIID = IID_IACTIVECONTEXT };
50 
54  IDocument* GetContextDocument() const { return (IDocument*)GetContextInterface(IID_IDOCUMENT); } ;
55  ISelectionManager* GetContextSelection() const { return (ISelectionManager*)GetContextInterface(IID_ISELECTIONMANAGER); } ;
56  IControlView* GetContextView() const { return (IControlView*)GetContextInterface(IID_ICONTROLVIEW); } ;
57  IWorkspace* GetContextWorkspace() const { return (IWorkspace*)GetContextInterface(IID_IWORKSPACE); } ;
58 
64  virtual IPMUnknown* GetContextInterface( const PMIID& id ) const = 0 ;
65 
66  // When the context is changed, observers are notified and the "changedBy" parameter
67  // passed to the Observer's Update method is a pointer to a ContextInfo.
68  // The PMIID field holds the PMIID of the protocol that was changed.
69  // The IPMUnknown* field holds the previous value of the active context for the PMIID.
70  // NOTE: Old code casts the "changedBy" parameter to be a pointer to a PMIID and
71  // uses the PMIID, so it's important that the first field in this class is the PMIID.
72  // All code should be migrated to expecting a pointer to a ContextInfo class,
73  // rather than the old (const PMIID*), but both will work for now.
74  typedef KeyValuePair<PMIID, IPMUnknown*> ContextInfo;
75  typedef K2Vector<ContextInfo> ContextTable;
76 
80  virtual void GetContextInterfaces( ContextTable& table ) const = 0;
89  virtual void SetContextInterfaces( const ContextTable& table ) = 0;
95  virtual void ChangeContextInterfaces( const ContextTable& table ) = 0;
96 
116  virtual void SetContextDelegate( IActiveContext* newDelegate ) = 0;
120  virtual bool16 IsContextDelegate( IActiveContext* am_I_your_delegate ) const = 0;
121 };
122 
123 #endif