InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CObserver.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 __COBSERVER__
25 #define __COBSERVER__
26 
27 #include "IObserver.h"
28 #include "HelperInterface.h"
29 #include "ShuksanID.h"
30 
31 //----------------------------------------------------------------------------------------
32 // Forward Declarations
33 //----------------------------------------------------------------------------------------
34 class IChangeManager;
35 
36 //----------------------------------------------------------------------------------------
37 // Class Info
38 //----------------------------------------------------------------------------------------
39 
40 
50 class CObserver : public IObserver
51 {
52  public:
53  CObserver(IPMUnknown *boss, PMIID interfaceID = IID_IOBSERVER);
54  virtual ~CObserver();
55 
56  IChangeManager* GetChangeManager() const;
57 
58  virtual void AutoAttach();
59  // If the observer knows who to attach itself to, it'll do so with this call
60 
61  virtual void AutoDetach();
62  // If the observer knows who to detach itself from, it'll do so with this call
63 
64  virtual void SetAttachIID(PMIID iid);
65 
66  virtual PMIID GetAttachIID() const;
67  // Get and set the IID of the interface this observer is attached as.
68 
69  virtual void SetEnabled(bool16 state);
70  // Enable or disable the observer. A disabled observer will not receive an update for a change.
71 
72  virtual bool16 IsEnabled() const;
73  // Accessor for enabled state
74 
75  virtual void LazyUpdate(ISubject* theSubject, const PMIID &protocol, const LazyNotificationData* data);
76 
77  protected:
78  bool16 fDetachSubjectsOnDelete;
79  PMIID fAttachIID;
80  const UIDRef fThisRef;
81  bool16 fEnabled;
82 
83 
84 };
85 
86 
87 #endif