InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IChangeManager Class Referenceabstract

#include <IChangeManager.h>

Inheritance diagram for IChangeManager:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_ICHANGEMANAGER }
 

Public Member Functions

virtual void AddDependency (ISubject *subject, IObserver *observer, const PMIID &observerIID, const PMIID &interestedIn, bool lazy)=0
 
virtual void RemoveDependency (ISubject *subject, IObserver *observer, const PMIID &observerIID, const PMIID &interestedIn, bool lazy)=0
 
virtual bool16 HasDependency (ISubject *subject, IObserver *observer, const PMIID &observerIID, const PMIID &interestedIn, bool lazy)=0
 
virtual void RemoveSubject (ISubject *theSubject)=0
 
virtual void RemoveObserver (IObserver *theObserver, const PMIID &observerIID)=0
 
virtual void RemoveSubject (const UIDRef &theSubject)=0
 
virtual void RemoveObserver (const UIDRef &theObserver, const PMIID &observerIID)=0
 
virtual void SubjectChanged (ISubject *subject, ClassID theChange, const PMIID &interestedIn, void *changedBy)=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

For Internal Use Only

virtual void SubjectChanged (ISubject *originalSubject, ISubject *subject, ClassID theChange, const PMIID &interestedIn, void *changedBy)=0
 
virtual void SubjectModelChanged (ISubject *subject, IDataBase *model, ClassID theChange, const PMIID &interestedIn, void *changedBy, LazyNotificationData *data)=0
 
virtual void SubjectModelChanged (ISubject *originalSubject, ISubject *subject, IDataBase *model, ClassID theChange, const PMIID &interestedIn, void *changedBy, LazyNotificationData *data)=0
 
virtual void LazySubjectChanged (ISubject *subject, const PMIID &interestedIn, const LazyNotificationData *data)=0
 
virtual bool16 CanSendMessage () const =0
 
 IChangeManager ()
 

Detailed Description

This is an interface to the change manager, which manages subject/observer relationships, and subject/observer notifications. You should not need to access this class directly unless you are implementing a new subject type (which is quite unusual). Normally, all interaction with the messaging system is either through ISubject or IObserver.

See Also
ISubject
IObserver

Member Function Documentation

virtual void IChangeManager::AddDependency (ISubjectsubject,
IObserverobserver,
const PMIIDobserverIID,
const PMIIDinterestedIn,
bool lazy 
)
pure virtual

Register an observer as a dependent of the subject. Normally this is called for you from ISubject::AttachObserver.

Parameters
subjectthe subject to attach the observer to
observerthe observer to attach
observerIIDthe IID the change manager should use to access the observer
interestedInthe type of change this observer wants to be notifed about
virtual bool16 IChangeManager::CanSendMessage () const
pure virtual

Returns true if it's OK to send a message. Check this before doing anything that might cause a SubjectChanged() during a purge operation. If the purge originated from the change manager, it will cause a fatal error to send the message. In that case, you can prevent it by calling CanSendMessage, which will return false if the change manager is in the middle of handling an add or remove and cannot send a message.

Returns
bool16 true if it's ok to use the ChangeManager, false otherwise
virtual bool16 IChangeManager::HasDependency (ISubjectsubject,
IObserverobserver,
const PMIIDobserverIID,
const PMIIDinterestedIn,
bool lazy 
)
pure virtual

Determine if a dependency already exists

Parameters
subjectthe subject we're asking about
observerthe observer we're asking about
observerIIDwhich observer(in case the boss has multiple) to check for
interestedInthe type of change this observer originally registered for
Returns
kTrue if the observer is attach to the subject
virtual void IChangeManager::RemoveDependency (ISubjectsubject,
IObserverobserver,
const PMIIDobserverIID,
const PMIIDinterestedIn,
bool lazy 
)
pure virtual

Remove an observer as a dependent of the subject. Normally this is called for you from ISubject::DetachObserver. If an observer is attached in multiple ways to the same subject (e.g. for multiple protocols) this detaches only one attachment relationship and leaves the others unchanged.

Parameters
subjectthe subject to detach the observer from
observerthe observer to attach
observerIIDwhich observer(in case the boss has multiple) to detach
interestedInthe type of change this observer originally registered for
virtual void IChangeManager::RemoveObserver (IObservertheObserver,
const PMIIDobserverIID 
)
pure virtual

Remove all dependencies that reference this observer

Parameters
observerthe observer we're asking about
observerIIDwhich observer(in case the boss has multiple) to remove
virtual void IChangeManager::RemoveObserver (const UIDReftheObserver,
const PMIIDobserverIID 
)
pure virtual

Remove all dependencies that reference this observer

Parameters
theObserverthe observer we're asking about
observerIIDwhich observer(in case the boss has multiple) to remove
virtual void IChangeManager::RemoveSubject (ISubjecttheSubject)
pure virtual

Remove all dependencies that reference this subject

virtual void IChangeManager::RemoveSubject (const UIDReftheSubject)
pure virtual

Remove all dependencies that reference the subject.

virtual void IChangeManager::SubjectChanged (ISubjectsubject,
ClassID theChange,
const PMIIDinterestedIn,
void * changedBy 
)
pure virtual

Notifies dependents of "notifier" that it has changed. This is normally called by ISubject::Change, and will iterate over the observers that are attached to the subject (if there are any) and call their Update functions.

Parameters
subjectthat changed (specifies which observers to call)
theChangetype of the change, often a ClassID of a command
interestedInspecifies the interface the change affected
changedBythe change agent (may be nil; but often this is the command that initiated the broadcast)