gui::TreeItemPdf Class Reference

Tree item containing PDF document or special parts of it. More...

#include <treeitempdf.h>

Inheritance diagram for gui::TreeItemPdf:
gui::TreeItemAbstract

List of all members.

Public Member Functions

 TreeItemPdf (TreeData *_data, boost::shared_ptr< CPdf > _pdf, Q_ListView *parent, const QString &name=QString::null, Q_ListViewItem *after=NULL)
 TreeItemPdf (TreeData *_data, boost::shared_ptr< CPdf > _pdf, Q_ListViewItem *parent, const QString &name=QString::null, Q_ListViewItem *after=NULL)
 TreeItemPdf (TreeData *_data, TreeItemPdf *parent, const QString &name, Q_ListViewItem *after=NULL)
virtual ~TreeItemPdf ()
boost::shared_ptr< CPdfgetObject ()
virtual bool validChild (const QString &name, Q_ListViewItem *oldChild)
virtual ChildType getChildType (const QString &name)
virtual TreeItemAbstractcreateChild (const QString &name, ChildType typ, Q_ListViewItem *after=NULL)
virtual QStringList getChildNames ()
virtual bool deepReload (const QString &childName, Q_ListViewItem *oldItem)
virtual bool haveChild ()
virtual void reloadSelf ()
virtual QSCObjectgetQSObject ()
virtual void remove ()

Private Member Functions

void observePageDict ()
void removeObserver ()
void init (boost::shared_ptr< CPdf > pdf, const QString &name)
void initSpec (boost::shared_ptr< CPdf > pdf, const QString &name)

Private Attributes

boost::shared_ptr< CPdfobj
QString nType
boost::shared_ptr
< TreeItemObserver
observer
boost::shared_ptr< IPropertypageDictionary
std::vector< OutlineItemoutlines

Detailed Description

Tree item containing PDF document or special parts of it.

Class holding CPDF object (document) in tree
This class can actually be in the tree multiple times, in root of the tree it represents the document, but the document have some special children, which are of this class too (for simplicity they "map" to PDF too)

These are:

List of outlines
List of pages


Constructor & Destructor Documentation

gui::TreeItemPdf::TreeItemPdf ( TreeData _data,
boost::shared_ptr< CPdf _pdf,
Q_ListView *  parent,
const QString &  name = QString::null,
Q_ListViewItem *  after = NULL 
)

constructor of TreeItemPdf - create root item from given object

Parameters:
_data TreeData containing necessary information about tree in which this item will be inserted
parent Q_ListView in which to put item
_pdf CPdf Object contained in this item
name Name of this item - will be shown in treeview
after Item after which this one will be inserted

References gui::dictItem, gui::invalidItem, gui::outlineItem, gui::outlineList, gui::pageItem, and gui::pageList.

gui::TreeItemPdf::TreeItemPdf ( TreeData _data,
boost::shared_ptr< CPdf _pdf,
Q_ListViewItem *  parent,
const QString &  name = QString::null,
Q_ListViewItem *  after = NULL 
)

constructor of TreeItemPdf - create child item from given object

Parameters:
_data TreeData containing necessary information about tree in which this item will be inserted
parent Q_ListViewItem which is parent of this object
_pdf CPdf Object contained in this item
name Name of file - will be shown in treeview
after Item after which this one will be inserted

References init(), observePageDict(), and reloadSelf().

gui::TreeItemPdf::TreeItemPdf ( TreeData _data,
TreeItemPdf parent,
const QString &  name,
Q_ListViewItem *  after = NULL 
)

constructor of TreeItemPdf - create special child item of TreeItemPdf

Parameters:
_data TreeData containing necessary information about tree in which this item will be inserted
parent Q_ListViewItem which is parent of this object
name Name (type) of this item - will be shown in treeview
after Item after which this one will be inserted
gui::TreeItemPdf::~TreeItemPdf (  )  [virtual]

default destructor

References obj, and outlines.


Member Function Documentation

TreeItemAbstract * gui::TreeItemPdf::createChild ( const QString &  name,
ChildType  typ,
Q_ListViewItem *  after = NULL 
) [virtual]

Create one subchild

Parameters:
name Name of child (the same as in list returned from getChildNames)
typ Type of TreeItemAbstract's child. (see ChildType)
after Q_ListViewItem after which will be this item added. If unspecified (or NULL), it is added before any other items
Returns:
Pointer to subchild. If returned NULL, the subchild can not be created
See also:
getChildNames

Implements gui::TreeItemAbstract.

References util::countString(), and obj.

bool gui::TreeItemPdf::deepReload ( const QString &  childName,
Q_ListViewItem *  oldItem 
) [virtual]

Attempt to "deep reload", i.e. exchange the item inside the tree for an actual (different) one, without destroying the object (destroying have unfortunate effect of losing information about which child were opened ...) oldChild should be modified to refrlect the new object If deep reload is supported and was sucessful, return true, otherwise false.

Note: oldItem should not check or reload its children in this method (at it might lead to multiple reloading of same part of tree) Also, it is guaranteed that reloadSelf will be called on that item, so explicitly reloading the item might be unnecessary too

Parameters:
childName name of (old and new) treeitem
oldItem reference to old child tree item
Returns:
true if successful, false otherwise

Reimplemented from gui::TreeItemAbstract.

QStringList gui::TreeItemPdf::getChildNames (  )  [virtual]

Get list of all item's childs names

Returns:
list of child names. Names in the list must be unique and the list may be empty.

Implements gui::TreeItemAbstract.

References gui::dictItem, gui::invalidItem, gui::outlineList, and gui::pageList.

ChildType gui::TreeItemPdf::getChildType ( const QString &  name  )  [virtual]

Get type of this items child, given its name.

Parameters:
name Name of child item
Returns:
type of specified child

Implements gui::TreeItemAbstract.

References obj.

boost::shared_ptr< CPdf > gui::TreeItemPdf::getObject (  ) 

return CPdf stored inside this item

Returns:
stored object (CPdf)
QSCObject * gui::TreeItemPdf::getQSObject (  )  [virtual]

Create and return object for scripting representing this tree item

Returns:
object for scripting

Implements gui::TreeItemAbstract.

bool gui::TreeItemPdf::haveChild (  )  [virtual]

Return true, if the item have at least one child

Returns:
Presence of at least one child

Implements gui::TreeItemAbstract.

References util::countList(), debug::DBG_WARN, guiPrintDbg, and outlines.

void gui::TreeItemPdf::init ( boost::shared_ptr< CPdf pdf,
const QString &  name 
) [private]

Initialize item from given CPdf object

Parameters:
pdf CPdf used to initialize this item
name Name of this item - will be shown in treeview (usually name of PDF file)

Referenced by TreeItemPdf().

void gui::TreeItemPdf::initSpec ( boost::shared_ptr< CPdf pdf,
const QString &  name 
) [private]

Initialize special PDF subitem from given CPdf object and its name (which defines also type of this item)

Parameters:
pdf CPdf used to initialize this item
name Name of this item - will be shown in treeview
void gui::TreeItemPdf::observePageDict (  )  [private]

Try to install observer on page dictionary - so we will know about any change

Referenced by TreeItemPdf().

void gui::TreeItemPdf::reloadSelf (  )  [virtual]

Reload contents of itself and only itself (excluding any children)

Not special type

Implements gui::TreeItemAbstract.

Referenced by TreeItemPdf().

void gui::TreeItemPdf::remove (  )  [virtual]

Remove itself from document (including any children) Do not remove the treeitem itself in this method -> this may lead to crash! If desired, you may call reload() on parent to get rid of the item correctly

Implements gui::TreeItemAbstract.

void gui::TreeItemPdf::removeObserver (  )  [private]

Uninstall obbserver from page dictionary - if it is installed

bool gui::TreeItemPdf::validChild ( const QString &  name,
Q_ListViewItem *  oldChild 
) [virtual]

Validate child, given its name and reference to old child Usually it is valid, since item with same name refer to same subitem (key-based items), but for value-based items (array) same keys can correspond to different values after reloading. In such cases, false should be returned. Also, similar problems can happen when switching revisions (with almost all types)

Note: false negative it not a problem (only unnecessary reloading), while false positive mean the tree is invalid/outdated

Parameters:
name name of (old and new) treeitem
oldChild reference to old child tree item
Returns:
True, if the old child is pointing to same item as item "name", false, if the child item "name" no longer point to same item as oldChild.

Implements gui::TreeItemAbstract.


Member Data Documentation

QString gui::TreeItemPdf::nType [private]

Node type (Null, Pages,Outlines)

boost::shared_ptr<CPdf> gui::TreeItemPdf::obj [private]

CPdf stored in this TreeItem

Referenced by createChild(), getChildType(), and ~TreeItemPdf().

boost::shared_ptr<TreeItemObserver> gui::TreeItemPdf::observer [private]

Observer registered for this item

std::vector<OutlineItem> gui::TreeItemPdf::outlines [private]

Outline list

Referenced by haveChild(), and ~TreeItemPdf().

boost::shared_ptr<IProperty> gui::TreeItemPdf::pageDictionary [private]

Reference to page dictionary


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