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

#include <IDatabaseObserver.h>

Inheritance diagram for IDatabaseObserver:
IPMUnknownCDatabaseObserver

Public Types

enum  Observable {
  kWatchDirties = 1, kWatchUIDCreationDestruction = 2, kWatchTransactions = 4, kWatchModified = 8,
  kWatchAll = 0xffffffff
}
 

Public Member Functions

virtual void SetDirty (IDataBase *db, UID id, ClassID clsID, ImplementationID tag, const bool16 dbModified)=0
 
virtual void NewUID (IDataBase *db, UID id, ClassID clsID)=0
 
virtual void DeleteUID (IDataBase *db, UID id, ClassID clsID)=0
 
virtual void UndeleteUID (IDataBase *db, UID id, ClassID clsID)=0
 
virtual void DestroyDeletedUID (IDataBase *db, UID id)=0
 
virtual void BeginTransaction (IDataBase *db)=0
 
virtual void EndTransaction (IDataBase *db)=0
 
virtual void SetModified (IDataBase *db, bool16 modified)=0
 
virtual void AttachedTo (IDataBase *db)=0
 
virtual uint32 GetEventClassesToObserve ()=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

To find out when certain database actions happen, implement a DatabaseObserver and attach it to the database. The DatabaseObserver will get called by the database on interesting database events. This does not follow the normal subject/observer pattern. Each database maintains its own list of observers, so attach to the database you are interested in. Note that for ease of maintanence we strongly recommend you NOT inherit directly from IDatabaseObserver but rather from CDatabaseObserver instead.

To use this interface...

  • Derive an implementation from CDatabaseObserver, and attach it to a new or existing boss in the .fr file.
  • Override methods from CDataBaseObserver for desired actions called by database.
  • Override GetEventClassesToObserve and return a combination of IDatabaseObserver::Observable constants corresponding to methods you overrode
  • Attach to the database desired with AttachDataObserver
See Also
IDataBase

Member Enumeration Documentation

This enumeration describes the classes of events that a database observer is interested in seeing. In InDesign/InCopy CS and earlier, database observers would be called for everything, which could hurt performance. Now your GetEventClassesToObserver() will get called during attachment and must specify what classes of things it is interested in observing by combining together these Observable constants.
Enumerator
kWatchUIDCreationDestruction 

Watch every DirtyObject call - expensive!

kWatchTransactions 

Watch NewUID(), DLeteUID(), UndeleteUID(), DestoryDeletedUID()

kWatchModified 

Watch BeginTransaction() and EndTransaction()

kWatchAll 

Watch modification state of database

Member Function Documentation

virtual void IDatabaseObserver::AttachedTo (IDataBasedb)
pure virtual

Called by the database when the observer is attached.

Parameters
dbthe database we're observing

Implemented in CDatabaseObserver.

virtual void IDatabaseObserver::BeginTransaction (IDataBasedb)
pure virtual

Called by the database when it gets an BeginTransaction.

Parameters
dbthe database we're observing

Implemented in CDatabaseObserver.

virtual void IDatabaseObserver::DeleteUID (IDataBasedb,
UID id,
ClassID clsID 
)
pure virtual

Called by the database when it gets a DeleteUID.

Parameters
dbthe database we're observing
idthe UID that was deleted
clsIDthe class of the deleted UID

Implemented in CDatabaseObserver.

virtual void IDatabaseObserver::DestroyDeletedUID (IDataBasedb,
UID id 
)
pure virtual

Called by the database when it gets an DestroyDeletedUID.

Parameters
dbthe database we're observing
idthe UID that was destroyed

Implemented in CDatabaseObserver.

virtual void IDatabaseObserver::EndTransaction (IDataBasedb)
pure virtual

Called by the database when it gets an EndTransaction.

Parameters
dbthe database we're observing

Implemented in CDatabaseObserver.

virtual uint32 IDatabaseObserver::GetEventClassesToObserve ()
pure virtual

Called to discover which methods you are overriding and are interested in having called. a logically-ORed combination of IDatabaseObserver::Observable constants specifying what events this observer should be called for

virtual void IDatabaseObserver::NewUID (IDataBasedb,
UID id,
ClassID clsID 
)
pure virtual

Called by the database when it gets a NewUID.

Parameters
dbthe database we're observing
idthe UID that was created
clsIDthe class of the new UID

Implemented in CDatabaseObserver.

virtual void IDatabaseObserver::SetDirty (IDataBasedb,
UID id,
ClassID clsID,
ImplementationID tag,
const bool16 dbModified 
)
pure virtual

Called by the database when it gets a DirtyObject.

Parameters
dbthe database we're observing
idthe UID that was dirtied
tagthe ImplementationID that was dirtied
dbModifiedkTrue if this dirty could have caused the database to be marked as modified

Implemented in CDatabaseObserver.

virtual void IDatabaseObserver::SetModified (IDataBasedb,
bool16 modified 
)
pure virtual

Called by the database when the logical modified state of the database changes.

Parameters
dbthe database we're observing
modifiedis whether the database mofified state is set (e.g. file is dirty from the user's standpoint)

Implemented in CDatabaseObserver.

virtual void IDatabaseObserver::UndeleteUID (IDataBasedb,
UID id,
ClassID clsID 
)
pure virtual

Called by the database when it gets an UndeleteUID.

Parameters
dbthe database we're observing
idthe UID that was restored
clsIDthe class of that the UID was restored to

Implemented in CDatabaseObserver.