pdfobjects::CPdf::PageTreeRootObserver Class Reference

#include <cpdf.h>

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

List of all members.

Public Member Functions

 PageTreeRootObserver (CPdf *_pdf)
virtual ~PageTreeRootObserver () 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 root synchronization.

This observer is registered on Document catalog and if Pages property is reference (as it should be) also to this reference property. Whenever document catalog is changed and this change is done either in Pages property or directly in reference value, notify method will handle this situation and synchronize pdf internal structures with new state.

See also:
notify

Constructor & Destructor Documentation

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

Initialization constructor.

Parameters:
_pdf CPdf instance.

Sets pdf field according parameter.

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

Empty destructor.


Member Function Documentation

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

Reurns observer priority.

Implements observer::IObserver< IProperty >.

void pdfobjects::CPdf::PageTreeRootObserver::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 root which is represented by Pages property of Document catalog dictionary.
Handling depends on given context type:

  • BasicChangeContext means that Pages reference value has changed. Property itself is kept as it is.
  • ComplexChangeContext means that Document catalog dictionary has changed (dictionary property was added, removed or replaced). Checks valueId from context and if it is not Pages, immediately returns. Otherwise checks oldValue type and if it is reference, unregisters this observer from property. If newValue is reference registers this observer to property.

In any case:

  • tries to get dictionary from oldValue (if it is reference) and unregister observers from whole page tree (uses pdf::unregisterPageTreeObservers method).
  • invalidates pdf-pageCount
  • clears pdf::pageList and invalidates all pages.
  • clears pdf::nodeCountCache
  • tries to get dictionary from newValue (if it is reference) and registers observers to whole new page tree (uses pdf::registerPageTreeObservers method).

References observer::BasicChangeContextType, observer::ComplexChangeContextType, debug::DBG_DBG, debug::DBG_ERR, debug::DBG_WARN, observer::IObserver< IProperty >::isActive(), pdfobjects::isDict(), 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: