InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
SelectionObserver.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Michael Martz
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 __SELECTION_OBSERVER__
25 #define __SELECTION_OBSERVER__
26 
27 #include "CObserver.h"
28 
29 class ISelectionManager;
30 class ISelectionMessage;
31 class IControlView;
32 
37 {
38 public:
39  ActiveSelectionObserver(IPMUnknown *boss, PMIID observerIID = IID_IOBSERVER);
40  virtual ~ActiveSelectionObserver();
41 
51  virtual void AutoAttach();
52 
62  virtual void AutoDetach();
63 
75  virtual void Update(const ClassID& c, ISubject*, const PMIID& p, void* v);
76 
77 protected:
78  //........................................................................................
79  // Methods to be overridden by most subclasses
80  //........................................................................................
90  virtual void HandleSelectionChanged(const ISelectionMessage* /*m*/) {}
91 
97 
106 
107 protected:
108  //........................................................................................
109  // Methods to be overridden by some subclasses
110  //........................................................................................
116  virtual void AttachToSelectionSubject(ISubject* selectionSubject);
117 
123  virtual void DetachFromSelectionSubject(ISubject* selectionSubject);
124 
129  virtual void HandleActiveSelectionChanged();
130 
149  virtual void HandleSelectionUpdate(const ClassID& c, ISubject* s, const PMIID& p, void* v);
150 
159  virtual IPMUnknown* QueryAbstractSelection(const PMIID& p);
160 
166  virtual void AttachToActiveSelection();
167 
173  virtual void DetachFromActiveSelection();
174 
175 protected:
176  PMIID fObserverIID;
177  ISelectionManager* fCurrentSelection;
178 };
179 
185 {
186 public:
187  SelectionHighlightObserver(IPMUnknown *boss, PMIID observerIID = IID_IOBSERVER);
188 
198  virtual void AutoAttach();
199 
209  virtual void AutoDetach();
210 
224  virtual void Update(const ClassID& c, ISubject* s, const PMIID& p, void* v);
225 
226 protected:
232  virtual void AttachToSelectionSubject(ISubject* selectionSubject);
233 
239  virtual void DetachFromSelectionSubject(ISubject* selectionSubject);
240 
250 
251  virtual IControlView* QueryControlView() = 0;
252 
253 protected:
254  PMIID fObserverIID;
255  ISelectionManager* fCurrentSelection;
256 };
257 
258 #endif // __SELECTION_OBSERVER__