pdfobjects::CPdf::PageTreeNodeObserver Class Reference

#include <cpdf.h>

Inheritance diagram for pdfobjects::CPdf::PageTreeNodeObserver:
observer::IObserver< IProperty >

List of all members.

Public Member Functions

 PageTreeNodeObserver (CPdf *_pdf)
virtual ~PageTreeNodeObserver () throw ()
virtual void notify (boost::shared_ptr< IProperty > newValue, boost::shared_ptr< const observer::IChangeContext< IProperty > > context) const throw ()
virtual observer::IObserver
< IProperty >::priority_t 
getPriority () const throw ()

Private Attributes

CPdfpdf

Detailed Description

Observer for page tree node synchronization.

This observer is responsible for intermediate page tree node change handling. From all changes in node's dictionary just Kids array property is monitored. If this property is replaced, added or removed or if it is reference property and reference its value is changed, notify method will handle change.
Note that this observer handles whole Kids property change. Kids array content is not handled here (this is done in PageTreeKidsObserver).

See also:
notify

Constructor & Destructor Documentation

pdfobjects::CPdf::PageTreeNodeObserver::PageTreeNodeObserver ( CPdf _pdf  )  [inline]

Initialization constructor.

Parameters:
_pdf CPdf instance.

Sets pdf field according parameter.

virtual pdfobjects::CPdf::PageTreeNodeObserver::~PageTreeNodeObserver (  )  throw () [inline, virtual]

Empty destructor.


Member Function Documentation

virtual observer::IObserver<IProperty>::priority_t pdfobjects::CPdf::PageTreeNodeObserver::getPriority (  )  const throw () [inline, virtual]

Reurns observer priority.

Implements observer::IObserver< IProperty >.

void pdfobjects::CPdf::PageTreeNodeObserver::notify ( boost::shared_ptr< IProperty newValue,
boost::shared_ptr< const observer::IChangeContext< IProperty > >  context 
) const throw () [virtual]

Observer handler.

Parameters:
newValue New value of changed property.
context Context of the change.

This observer handles change in page tree node.
Handling depends on given context type:

  • BasicChangeContext means that intermediate node has Kids property with reference type and its value has changed. Property itself is same.
  • ComplexChangeContext means that node's dictionary has changed, so valueId from context is checked. If it is not Kids (some other element is changed) immediately returns. Otherwise checks oldValue type and if it is reference, unregister this observer from property. If newValue is reference, register this observer to the property.

In any case:

  • tries to get array from oldValue (if it is reference, dereferences target object), unregisters pdf->pageTreeKidsObserver from array property and collects all reference elements from array.
  • similary does with newValue except that register pageTreeKidsObserver to the array property.
  • consolidates parent of parent node (either newValue or oldValue - depends on which is defined, because one of them may be CNull)
  • unregisters observers for all collected properties from oldValue array (uses pdf::unregisterPageTreeObservers) and consolidates pageList for each element (equivalent to removig this node)
  • similary to collected referencies from newValue array property, except that observers are registered and pageList is consolidated as if elemented has been inserted

References observer::BasicChangeContextType, observer::ComplexChangeContextType, debug::DBG_CRIT, debug::DBG_DBG, debug::DBG_ERR, debug::DBG_WARN, pdfobjects::CNullFactory::getInstance(), observer::IObserver< IProperty >::isActive(), pdfobjects::isArray(), pdfobjects::isDict(), pdfobjects::isNull(), pdfobjects::isRef(), kernelPrintDbg, REGISTER_SHAREDPTR_OBSERVER, and UNREGISTER_SHAREDPTR_OBSERVER.


Member Data Documentation

Pdf instance. This instance is used as page tree holder, so watch dog uses it to handle changes.


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