pdfobjects::CPdf::PageTreeKidsObserver Class Reference

#include <cpdf.h>

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

List of all members.

Public Member Functions

 PageTreeKidsObserver (CPdf *_pdf)
virtual ~PageTreeKidsObserver () 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 kids array synchronization.

This observer is registered on Kids array and all referecence elementes from this array. Change notified to this observer is allways page tree node insertion, delete or replacement.
Note that this observer is used for Kids array content or member value change, not for whole Kids array property change (like

See also:
PageTreeNodeObserver).
notify

Constructor & Destructor Documentation

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

Initialization constructor.

Parameters:
_pdf CPdf instance.

Sets pdf field according parameter.

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

Empty destructor.


Member Function Documentation

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

Reurns observer priority.

Implements observer::IObserver< IProperty >.

void pdfobjects::CPdf::PageTreeKidsObserver::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.

Checks given context type and if it is ComplexChangeContextType then Kids array has changed. If oldValue is reference property, unregisters this observer from property and if newValue is reference registers this observer property.
If given context is BasicChangeContext, Kids array reference element has changed its value.
In any case:

  • If both newValue and oldValue are not referencies, there is nothing to do here, because both values are just mess in array and so immediatelly returns.
  • If oldValue is reference, than observers from whole subtree have to be unregistered because it is no more accessible from the tree. Uses pdf::unregisterPageTreeObservers method.
  • consolidates page tree for intermediate node, where change has occured. Uses getIndiRef from oldValue or newValue (depends on which is defined, because one can be CNull) and checks CPdf::pageTreeKidsParentCache. If cache entry exists, uses it. This is kind of work around to handle situation when Kids array is indirect property (cache entries are done just for such Kids arrays). Uses CPdf::consolidatePageTree method. If this method returns with false, discards CPdf::pageCount field (sets it to 0). Consolidation will change node's Count property and checks all direct childs whether they contain correct reference to parent (consolidated node).
  • consolidate CPdf::pageList with Cpdf::consolidatePageList method. Consolidation will remove and invalidate all pages from oldValue subtree and moves all which position has changed because of this removing.
  • If oldValue is reference, discards Cpdf::nodeCountCache for it and all nodes in its subtree.
  • If newValue is reference, registers obserers to new subtree. Uses CPdf::registerPageTreeObservers method.

References observer::BasicChangeContextType, observer::ComplexChangeContextType, debug::DBG_CRIT, debug::DBG_DBG, debug::DBG_ERR, debug::DBG_WARN, observer::IObserver< IProperty >::isActive(), pdfobjects::isRef(), kernelPrintDbg, pdfobjects::pDict, pdfobjects::pNull, pdfobjects::pRef, 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: