InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ActiveSelectionObserver Class Reference

#include <SelectionObserver.h>

Inheritance diagram for ActiveSelectionObserver:
CObserverIObserverIPMUnknownBPISelectionObserverCdlChtUISelectionObserverCustSEObserverGraphicStateDefnObserverHidTxtEdSelectionObserverIDHAObserverPstLstUISelectionObserverSnipRunGoSelectionObserverStrMutSelectionObserverTblAttSelectionObserver

Public Member Functions

 ActiveSelectionObserver (IPMUnknown *boss, PMIID observerIID=IID_IOBSERVER)
 
virtual void AutoAttach ()
 
virtual void AutoDetach ()
 
virtual void Update (const ClassID &c, ISubject *, const PMIID &p, void *v)
 
- Public Member Functions inherited from CObserver
 CObserver (IPMUnknown *boss, PMIID interfaceID=IID_IOBSERVER)
 
IChangeManagerGetChangeManager () const
 
virtual void SetAttachIID (PMIID iid)
 
virtual PMIID GetAttachIID () const
 
virtual void SetEnabled (bool16 state)
 
virtual bool16 IsEnabled () const
 
virtual void LazyUpdate (ISubject *theSubject, const PMIID &protocol, const LazyNotificationData *data)
 

Protected Member Functions

virtual void HandleSelectionChanged (const ISelectionMessage *)
 
virtual void HandleFrequentSelectionChanged ()
 
virtual void HandleSelectionAttributeChanged (const ISelectionMessage *)
 
virtual void AttachToSelectionSubject (ISubject *selectionSubject)
 
virtual void DetachFromSelectionSubject (ISubject *selectionSubject)
 
virtual void HandleActiveSelectionChanged ()
 
virtual void HandleSelectionUpdate (const ClassID &c, ISubject *s, const PMIID &p, void *v)
 
virtual IPMUnknownQueryAbstractSelection (const PMIID &p)
 
virtual void AttachToActiveSelection ()
 
virtual void DetachFromActiveSelection ()
 

Protected Attributes

PMIID fObserverIID
 
ISelectionManagerfCurrentSelection
 
- Protected Attributes inherited from CObserver
bool16 fDetachSubjectsOnDelete
 
PMIID fAttachIID
 
const UIDRef fThisRef
 
bool16 fEnabled
 

Additional Inherited Members

- Public Types inherited from IObserver
enum  { kDefaultIID = IID_IOBSERVER }
 

Detailed Description

Active Selection Observer observes the active context so that it is always observing the active selection (ASB) via the IID_SELECTION_MESSAGE protocol.

Member Function Documentation

virtual void ActiveSelectionObserver::AttachToActiveSelection ()
protectedvirtual

DESCR: Attach this observer to the active selection. Obtains the ISubject of the active selection and passes it to AttachToSelectionSubject() which is overridden by subclasses.

virtual void ActiveSelectionObserver::AttachToSelectionSubject (ISubjectselectionSubject)
protectedvirtual

DESCR: Attach this observer to the active selection using protocol IID_SELECTION_MESSAGE.

Parameters
selectionSubjectthe Subject
virtual void ActiveSelectionObserver::AutoAttach ()
virtual

Called when this observer should attach to the subject(s) that it observes (Active Context and Active Abstract Selection).

NOTE: Subclasses should override AttachToSelectionSubject() to attach to the the active selection using their own protocol(s). Subclasses which override this method should call the inherited method prior to attaching to their own specific protocols.

Reimplemented from CObserver.

Reimplemented in StrMutSelectionObserver, IDHAObserver, CustSEObserver, and GraphicStateDefnObserver.

virtual void ActiveSelectionObserver::AutoDetach ()
virtual

DESCR: Called when this observer should automatically detach from the subject(s) that it observes.

NOTE: Subclasses should override DetachFromSelectionSubject() to detach from the the active selection using their own protocol(s). Subclasses which override this method should call the inherited method after detaching from their own specific protocols.

Reimplemented from CObserver.

Reimplemented in StrMutSelectionObserver, IDHAObserver, CustSEObserver, and GraphicStateDefnObserver.

virtual void ActiveSelectionObserver::DetachFromActiveSelection ()
protectedvirtual

DESCR: Detach this observer from the current selection. Obtains the ISubject of the active selection and passes it to DetachFromSelectionSubject() which is overridden by subclasses.

virtual void ActiveSelectionObserver::DetachFromSelectionSubject (ISubjectselectionSubject)
protectedvirtual

DESCR: Detach this observer from the active selection using protocol IID_SELECTION_MESSAGE.

Parameters
selectionSubjectthe Subject
virtual void ActiveSelectionObserver::HandleActiveSelectionChanged ()
protectedvirtual

DESCR: The active selection has changed. Calls HandleSelectionChanged() which is overridden by subclasses.

virtual void ActiveSelectionObserver::HandleFrequentSelectionChanged ()
inlineprotectedvirtual

DESCR: This is a frequent update of the selection. Currently only used by text to catch every cursor move.

virtual void ActiveSelectionObserver::HandleSelectionAttributeChanged (const ISelectionMessage)
inlineprotectedvirtual

DESCR: Some aspect of one or more items in the selection has changed. Only those clients whose observed suiteIID was affected by the selection message should update. The suite may have also sent some suite specific broadcast data.

Parameters
mthe selection message

Reimplemented in StrMutSelectionObserver, PstLstUISelectionObserver, BPISelectionObserver, HidTxtEdSelectionObserver, GraphicStateDefnObserver, and TblAttSelectionObserver.

virtual void ActiveSelectionObserver::HandleSelectionChanged (const ISelectionMessage)
inlineprotectedvirtual

DESCR: Everything relating to the selection should update.

Either (a) there is a new active selection or (b) the items in the selection has changed

If ISelectionMessage* is nil, everything should update.

Parameters
mthe selection message

Reimplemented in StrMutSelectionObserver, PstLstUISelectionObserver, BPISelectionObserver, SnipRunGoSelectionObserver, CdlChtUISelectionObserver, HidTxtEdSelectionObserver, GraphicStateDefnObserver, and TblAttSelectionObserver.

virtual void ActiveSelectionObserver::HandleSelectionUpdate (const ClassIDc,
ISubjects,
const PMIIDp,
void * v 
)
protectedvirtual

DESCR: Called when the observer receives a broadcast other than those from the active context. i.e. a message from the active selection boss itself, which a subclass attached to using a protocol of its choice. All of the broadcast information is passed through.

        Processes IID_SELECTION_MESSAGE messages, calling HandleSelectionChanged(),

HandleFrequentSelectionChanged() or HandleSelectionAttributeChanged() as appropriate.

NOTE: Subclasses should override this member function only if they attach to additional protocols. If overridden, the subclass should call the inherited method prior to handling the message. Do NOT override Update w/o a very good reason.

Parameters
cthe Class
sthe Subject
pPMIID
vvoid star

Reimplemented in StrMutSelectionObserver, IDHAObserver, and CustSEObserver.

virtual IPMUnknown* ActiveSelectionObserver::QueryAbstractSelection (const PMIIDp)
protectedvirtual

DESCR: Query the abstract selection that this observer is attached to for an interface (or suite).

NOTE: The caller is responsible for calling Release() on the returned interface.

Parameters
pPMIID
Returns
IPMUnknown
virtual void ActiveSelectionObserver::Update (const ClassIDc,
ISubject,
const PMIIDp,
void * v 
)
virtual

DESCR: Handle updates to the observer. When the active abstract selection boss changes, detach from the old and attach to the new. Other broadcasts (i.e. those from the selection boss) are passed to HandleSelectionUpdate().

NOTE: Subclasses should override HandleSelectionUpdate() rather than this method.

Parameters
cClassID
pPMIID
vvoid star

Implements IObserver.

Reimplemented in IDHAObserver, and CustSEObserver.