![]() | InDesign SDK 20.5 |
#include <CSubject.h>

Public Member Functions | |
| CSubject (IPMUnknown *boss) | |
| virtual IChangeManager * | GetChangeManager () const |
| virtual bool16 | IsAttached (IObserver *observer, const PMIID &interestedIn, const PMIID &asObserver=IID_IOBSERVER) |
| virtual void | AttachObserver (IObserver *observer, const PMIID &interestedIn, const PMIID &asObserver=IID_IOBSERVER) |
| virtual void | DetachObserver (IObserver *observer, const PMIID &interestedIn, const PMIID &asObserver=IID_IOBSERVER) |
| virtual void | Change (ClassID theChange, const PMIID &interestedIn=IID_IUNKNOWN, void *changedBy=nil) |
| virtual void | Change (ISubject *originalSubject, ClassID theChange, const PMIID &interestedIn=IID_IUNKNOWN, void *changedBy=nil) |
| virtual void | Mute (bool16 muteOn) |
| virtual bool16 | IsMuted () const |
| virtual void | AttachObserver (AttachmentType attachType, IObserver *observer, const PMIID &interestedIn, const PMIID &asObserver) |
| virtual void | DetachObserver (AttachmentType attachType, IObserver *observer, const PMIID &interestedIn, const PMIID &asObserver) |
| virtual bool16 | IsAttached (AttachmentType attachType, IObserver *observer, const PMIID &interestedIn, const PMIID &asObserver) |
| virtual void | ModelChange (ClassID theChange, const PMIID &interestedIn, void *changedBy, LazyNotificationData *data) |
| virtual void | ModelChange (ISubject *originalSubject, ClassID theChange, const PMIID &interestedIn, void *changedBy, LazyNotificationData *data) |
| virtual void | ModelChange (IDataBase *model, ClassID theChange, const PMIID &interestedIn, void *changedBy, LazyNotificationData *data) |
Protected Attributes | |
| bool16 | fDetachObserversOnDelete |
| bool16 | fMuted |
| const UIDRef | fThisRef |
Additional Inherited Members | |
Public Types inherited from ISubject | |
| enum | { kDefaultIID = IID_ISUBJECT } |
| enum | AttachmentType { kRegularAttachment = 0, kLazyAttachment, kBothAttachments } |
Base class for implementing ISubject. Usually you can reuse existing implementations of ISubject; either
| virtual |
Attach an observer that uses regular attachment to this subject.
Note: this method is equivalent to calling ISubject::AttachObserver(AttachmentType, IObserver*, const PMIID& interestedIn, const PMIID& asObserver) specifying an attachment type of kRegularAttachment.
| observer | the observer to be attached |
| interestedIn | may be used to narrow the scope of interested changes |
| asObserver | must be used if the observer has an interface id that is different than IID_IOBSERVER |
Implements ISubject.
| virtual |
Attach the observer using the given attachment type (regular, lazy or both) to this subject.
| attachType | specifies the type of attachment the observer uses and controls the type of notification it receives, for example regular notification or lazy notification. |
| observer | is the observer to be attached |
| interestedIn | specifies the scope of interested changes; for example if you are interested in a specific interface on this subject pass the interface id here. |
| asObserver | the interface id of the observer |
Implements ISubject.
| virtual |
Notify observers that are attached to this subject via regular attachment that the object this subject is part of has been changed.
This method iterates over the observers that are attached to this subject using regular attachment and calls their IObserver::Update method (regular notification).
| theChange | is the actual change, often the ClassID of a command |
| interestedIn | specifies the interface of the object that was modified |
| changedBy | is generic pointer to the object that caused the change, usually a pointer to a command object |
Implements ISubject.
| virtual |
Notify observers that are attached to this subject via regular attachment that the object this subject is part of has been changed.
This method iterates over the observers that are attached to this subject using regular attachment and calls their IObserver::Update method (regular notification).
The difference between this method and the other Change method is that the object given by the originalSubject parameter is passed into IObserver::Update as the subject that was changed, rather than this subject.
| originalSubject | is the original subject of the object that was changed |
| theChange | is the actual change, often the ClassID of a command |
| interestedIn | identifies the interface of the object that was modified |
| changedBy | is generic pointer to the object that caused the change, usually a pointer to a command object |
Implements ISubject.
| virtual |
Detach an observer that uses regular attachment from this subject.
Note: this method is equivalent to calling ISubject::DetachObserver(AttachmentType, IObserver*, const PMIID& interestedIn, const PMIID& asObserver) specifying an attachment type of kRegularAttachment.
| observer | the observer to be detached |
| interestedIn | identifies the interface in this subject that the observer is attached to |
| asObserver | is the interface id of the observer |
Implements ISubject.
| virtual |
Detach the observer using the given attachment type (regular, lazy or both) from this subject.
| attachType | specifies the type of attachment |
| observer | is the observer to be detached |
| interestedIn | identifies the interface in this subject that the observer is attached to |
| asObserver | the interface id of the observer |
Implements ISubject.
| virtual |
Access the internal implementation of the notification mechanism.
Implements ISubject.
| virtual |
Check whether an observer that uses regular attachment is attached to this subject.
Note: this method is equivalent to calling ISubject::IsAttached(AttachmentType, IObserver*, const PMIID& interestedIn, const PMIID& asObserver) specifying and attachment type of kRegularAttachment.
| observer | the observer to be checked |
| interestedIn | identifies the interface in this subject that the observer is attached to |
| asObserver | the interface id of the observer |
Implements ISubject.
| virtual |
Check whether the observer is attached to this subject.
| attachType | specifies the type of attachment |
| observer | is the observer to be checked |
| interestedIn | identifies the interface in this subject that the observer is attached to |
| asObserver | the interface id of the observer |
Implements ISubject.
| virtual |
Returns kTrue if this subject is muted.
Implements ISubject.
| virtual |
Notify observers that are attached to this subject via regular or lazy attachment that the object this subject is part of has been changed; this is the ModelChange method you probably want to call.
This method iterates over the observers that are attached to this subject using regular attachment and calls their IObserver::Update method (regular notification). Additionally, this method queues a message so that observers that are attached to the subject using lazy attachment get called later on when the application is idle via their IObserver::LazyUpdate method (lazy notification).
| theChange | is the actual change, often the ClassID of a command |
| interestedIn | identifies the interface of the object that was modified |
| changedBy | pointer to the object that caused the change, usually a pointer to a command object |
| data | contains additional information about the change, nil otherwise; see LazyNotificationData for documentation. |
Implements ISubject.
| virtual |
Notify observers that are attached to this subject via regular or lazy attachment that the object this subject is part of has been changed. Only use this method if you are sure you cannot use ISubject::ModelChange(ClassID, const PMIID&, void*, LazyNotificationData*).
This method passes the object given by the originalSubject parameter to IObserver::Update as the subject that was changed, rather than this subject. However, the originalSubject is not available when IObserver::LazyUpdate is called. When the lazy notification occurs, this subject is passed to IObserver::LazyUpdate. If you need access to originalSubject, do so in the IObserver::Update method.
| originalSubject | is the original subject of the object that was changed |
| theChange | is the actual change, often the ClassID of a command |
| interestedIn | identifies the interface of the object that was modified |
| changedBy | is generic pointer to the object that caused the change, usually a pointer to a command object |
| data | contains additional information about the change, nil otherwise; see LazyNotificationData for documentation. |
Implements ISubject.
| virtual |
Use of this method is very rare. Call one of the other ModelChange methods unless you are sure this one is the right one for your use case. It is used to notify that a "snapshot view interface" has changed. For example, the layout widget uses this method to notify that ILayoutControlData has changed. ILayoutControlData is implemented as a "snapshot view interface" and change to this interface must get undone and redone as changes to the document being viewed get undone and redone.
| model | pointer to an InDesign database that supports undo |
| theChange | is the actual change, often the ClassID of a command |
| interestedIn | identifies the interface of the object that was modified |
| changedBy | is generic pointer to the object that caused the change, usually a pointer to a command object |
| data | contains additional information about the change, nil otherwise; see LazyNotificationData for documentation. |
Implements ISubject.
| virtual |
Mutes all messages from this object. Muting a subject allows you to make changes to the object without notifying its observers.
| muteOn | if kTrue, turns mute on; if kFalse, turns mute off |
Implements ISubject.