InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TreeLazyNotificationData< ItemType > Class Template Referenceabstract

#include <TreeLazyNotificationData.h>

Inheritance diagram for TreeLazyNotificationData< ItemType >:
LazyNotificationData

Classes

struct  IgnoreItem
 

Public Member Functions

 TreeLazyNotificationData ()
 
virtual ~TreeLazyNotificationData ()
 
virtual void Add (const LazyNotificationData *other)
 
virtual LazyNotificationDataClone (bool16 undoData) const
 
virtual void Validate (IDataBase *)
 
virtual void MarkShouldRebuildAll ()
 
virtual bool ShouldRebuildAll () const
 
void ItemAdded (const ItemType &item)
 
void ItemDeleted (const ItemType &item)
 
void ItemChanged (const ItemType &item)
 
void ItemRebuilt (const ItemType &item)
 
template<typename TAdded , typename TDeleted , typename TChanged , typename TBuild >
void ProcessChanges (TAdded Added, TDeleted Deleted, TChanged Changed, TBuild Rebuilt)
 
- Public Member Functions inherited from LazyNotificationData
virtual ~LazyNotificationData ()
 

Protected Member Functions

virtual TreeLazyNotificationDataCreateNewCookie () const =0
 
virtual bool16 GetParent (const ItemType &item, ItemType &parent) const =0
 

Detailed Description

template<class ItemType>
class TreeLazyNotificationData< ItemType >

This class is used to identify changes that happened to objects which are tree based. For list based objects please use

See Also
ListLazyNotificationData

Constructor & Destructor Documentation

template<class ItemType>
TreeLazyNotificationData< ItemType >::TreeLazyNotificationData()
inline

Default constructor

template<class ItemType>
virtual TreeLazyNotificationData< ItemType >::~TreeLazyNotificationData()
inlinevirtual

Default destructor

Member Function Documentation

template<class ItemType>
virtual void TreeLazyNotificationData< ItemType >::Add (const LazyNotificationDataother)
virtual

Use this to add another cookie into this one This method will ensure that items added that already exist in this tree will get set to a "combined" state.

Parameters
other- The tree to add

Implements LazyNotificationData.

template<class ItemType>
virtual LazyNotificationData* TreeLazyNotificationData< ItemType >::Clone (bool16 undoData) const
virtual

Use this to copy this tree and its state. You can ask the copy to be an exact copy or to have the proper state for undo (Adds and Deletes are swapped)

Parameters
undoData- Whether to swap adds and deletes
Returns
- A copy of this class

Implements LazyNotificationData.

template<class ItemType>
virtual TreeLazyNotificationData* TreeLazyNotificationData< ItemType >::CreateNewCookie () const
protectedpure virtual

This method must be overridden by derived classes so that this class can clone itself without having to have knowledge about the actual class in question

Returns
- A new object that is derived from this
template<class ItemType>
virtual bool16 TreeLazyNotificationData< ItemType >::GetParent (const ItemType & item,
ItemType & parent 
) const
protectedpure virtual

Get the parent of a given item. This method should be overridden by classes that derive from this class and the implementation should look at the model to determine what the appropriate parent is.

Parameters
item- The item for which we want the parent
parent- Will be filled in with a parent (unless there is none)
Returns
- kFalse if no valid parent was found - kTrue if a parent was found
template<class ItemType>
void TreeLazyNotificationData< ItemType >::ItemAdded (const ItemType & item)

Notify the tree that an item was added in the model

Parameters
item- The item that was added.
template<class ItemType>
void TreeLazyNotificationData< ItemType >::ItemChanged (const ItemType & item)

Notify the tree that an item was changed in the model

Parameters
item- The item that was changed.
template<class ItemType>
void TreeLazyNotificationData< ItemType >::ItemDeleted (const ItemType & item)

Notify the tree that an item was deleted in the model

Parameters
item- The item that was deleted.
template<class ItemType>
void TreeLazyNotificationData< ItemType >::ItemRebuilt (const ItemType & item)

Notify the tree that an item was rebuilt in the model When you mark an item as rebuilt it means that it and each of its descendants will be reconstructed

Parameters
item- The item that needs rebuilt.
template<class ItemType>
virtual void TreeLazyNotificationData< ItemType >::MarkShouldRebuildAll ()
virtual

Compress the tree to one root node that has kRebuild

Implements LazyNotificationData.

template<class ItemType>
template<typename TAdded , typename TDeleted , typename TChanged , typename TBuild >
void TreeLazyNotificationData< ItemType >::ProcessChanges (TAdded Added,
TDeleted Deleted,
TChanged Changed,
TBuild Rebuilt 
)

This method allows the client to handel adds, deletes, changes, and rebuilds of given nodes. These operations are handled via callbacks. To use this simply create your required function objects. Objects must take an item of ItemType.

See Also
IgnoreItem
Parameters
Added- The method to be called when an item is added
Deleted- The method to call when an item is deleted
Changed- The method to call when an item is changed
Rebuilt- The method to call when an item and its children need rebuilt
template<class ItemType>
virtual bool TreeLazyNotificationData< ItemType >::ShouldRebuildAll () const
virtual
template<class ItemType>
virtual void TreeLazyNotificationData< ItemType >::Validate (IDataBase)
inlinevirtual

Validate the cookie against the model. This is only really used for UIDs. There are some problems with deleting objects twice which will cause the cookie to think that an item which never existed actually existed and was deleted. This call will verify that items which are currently marked for add (undo of a delete) exist in the database. NOTE: This call will not do anything in the release build

Parameters
db- The database that is associated with this cookie

Implements LazyNotificationData.