pdfobjects::CPageAnnots::PropWatchDog Class Reference

Inheritance diagram for pdfobjects::CPageAnnots::PropWatchDog:
observer::IObserver< IProperty >

List of all members.

Public Member Functions

 PropWatchDog (CPageAnnots *annots)
virtual ~PropWatchDog () throw ()
virtual void notify (boost::shared_ptr< IProperty > newValue, boost::shared_ptr< const IProperty::ObserverContext > context) const throw ()
virtual priority_t getPriority () const throw ()

Private Attributes

CPageAnnots_annots

Detailed Description

Observer for Annots property. This observer is registered on page dictionary and if Annots property is a reference also to this property. Any change which leads to change of Annots array (either add, remove or change) is handled here. Note that it doesn't handle array content change.


Constructor & Destructor Documentation

pdfobjects::CPageAnnots::PropWatchDog::PropWatchDog ( CPageAnnots annots  )  [inline]

Initialization constructor. Sets annots field according parameter.

Parameters:
annots CPageAnnots instance.

References _annots.

virtual pdfobjects::CPageAnnots::PropWatchDog::~PropWatchDog (  )  throw () [inline, virtual]

Empty destructor.


Member Function Documentation

virtual priority_t pdfobjects::CPageAnnots::PropWatchDog::getPriority (  )  const throw () [inline, virtual]

Returns observer priority.

TODO some constant

Implements observer::IObserver< IProperty >.

void pdfobjects::CPageAnnots::PropWatchDog::notify ( boost::shared_ptr< IProperty newValue,
boost::shared_ptr< const IProperty::ObserverContext context 
) const throw () [virtual]

Observer handler.

Checks given context type:

  • BasicChangeContext means that Annots property in page dictionary is reference and its value has changed.
  • ComplexChangeContext means that page dictionary has changed. So checks property id and if it not Annots, immediatelly returns, because this change doesn't affect annotations. Otherwise checks original value type. If it is reference, unregisters this observer from it. If newValue is reference, registers observer to it.

In any case:

  • Tries to get array from oldValue and unregister observers from it (uses page->unregisterAnnotsObservers).
  • Invalidates and removes all annotations from page->annotStorage.
  • collects all current annotations (uses collectAnnotations).
  • Tries to get current Annots array and registers observers to it (uses page->registerAnnotsObservers)
Parameters:
newValue New value of changed property.
context Context of the change.

References observer::BasicChangeContextType, observer::ComplexChangeContextType, debug::DBG_DBG, debug::DBG_INFO, debug::DBG_WARN, pdfobjects::isArray(), pdfobjects::isRef(), kernelPrintDbg, REGISTER_SHAREDPTR_OBSERVER, and UNREGISTER_SHAREDPTR_OBSERVER.


Member Data Documentation

Referenced by PropWatchDog().


The documentation for this class was generated from the following files: