Views
Application Framework Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions | Protected Member Functions | Friends
IlvDvProjectDocument Class Reference

Application Framework document project class. More...

#include <ilviews/appframe/project/prjdoc.h>

Inheritance diagram for IlvDvProjectDocument:
IlvDvDocument IlvDvSerializable IlvDvInterface

Public Member Functions

virtual IlBoolean activateItem (IlvDvProjectItem *item)
 Activates the project item item. More...
 
IlBoolean activateItems (IlvDvProjectItem *const *items, IlUInt count)
 Activates the project items items by calling the activateItem method for each item. This method can be called by a project view if the multiple selection of tree gadget items has been activated. More...
 
virtual void clean ()
 Cleans the document data by deleting the project root item and all file information owned by the project document.
 
IlvDvFileInfogetFileInfo (IlUInt index) const
 Returns the file information object located at index index. More...
 
IlUInt getFileInfosCount () const
 Returns the number of files that are owned by the project document. More...
 
IlUInt getIndexOfFileInfo (const IlvDvFileInfo *fInfo) const
 Returns the index of the file information object fInfo from the list of file information stored by the document. More...
 
IlvDvDocumentProjectItemgetProjectRootItem () const
 Returns the project root item of the document. More...
 
virtual IlBoolean initializeDocument (IlAny data=0)
 Initializes a new project document. More...
 
IlBoolean insertFile (IlvDvProjectItem *parent, const IlPathName &filename)
 Inserts a file in the project. More...
 
IlBoolean insertFolder (IlvDvProjectItem *parent, const char *name, const char *extensions=0)
 Inserts a project folder item with the name name as a child of the project item parent.
More...
 
IlBoolean insertItem (IlvDvProjectItem *item, IlvDvProjectItem *parent=0, IlUShort index=(IlUShort) -1)
 Inserts a project item as a child of the project item parent.
More...
 
void removeTreeItems (IlvDvProjectItem *const *items, IlUInt count)
 Removes a list of project items. More...
 
virtual void serialize (IlvDvStream &stream)
 Serializes the document. More...
 
virtual void setTitle (const char *title, IlBoolean update=IlTrue)
 Sets the title title for the document.
More...
 
- Public Member Functions inherited from IlvDvDocument
 IlvDvDocument ()
 Constructor. More...
 
virtual ~IlvDvDocument ()
 Destructor. More...
 
virtual void activated (IlBoolean active=IlTrue)
 Notification of the document activation. More...
 
void addDoneCommand (IlvDvCommand *command, IlBoolean updateUI=IlTrue, IlBoolean modified=IlTrue)
 Adds an executed command. More...
 
void addView (IlvDvDocViewInterface *, IlBoolean update=IlTrue)
 Adds the document view view to the list of owned document views. More...
 
virtual IlBoolean canCloseViewContainer (IlvDvViewContainerInterface *v)
 Returns IlTrue if the given view container can be closed. More...
 
virtual IlBoolean canRedo () const
 Returns IlTrue if the last undone command can be executed. More...
 
virtual IlBoolean canRepeat () const
 Returns IlTrue if the last command to be executed can be repeated. More...
 
virtual IlBoolean canUndo () const
 Returns IlTrue if the last executed command can be undone. More...
 
virtual void doCommand (IlvDvCommand *command, IlBoolean updateUI=IlTrue, IlBoolean modified=IlTrue)
 Executes the command command. More...
 
IlvDisplaygetDisplay () const
 Returns the display of the application. More...
 
IlvDvDocTemplategetDocTemplate () const
 Returns the document template associated with the document. More...
 
IlvDvDocViewInterfacegetDocView (IlUInt index) const
 Returns a document view. More...
 
IlvDvDocViewInterface ** getDocViews (IlUInt &count, IlBoolean create=IlTrue) const
 Returns document views. More...
 
IlvDvApplicationgetDvApplication () const
 Returns the application object. More...
 
IlUInt getNumberOfViews () const
 Counts owned document views. More...
 
const IlvPathName & getPathName () const
 Returns the path of the document. It can be empty if the document is a new empty document. More...
 
const IlStringgetTitle () const
 Returns the title of the document. More...
 
IlUInt getViewContainersCount (IlBoolean vis=IlTrue) const
 Returns the number of containers associated with the document view. More...
 
IlBoolean isAutoDelete () const
 Returns the auto deletion mode. More...
 
IlBoolean isModified () const
 Returns the modification state of the document. More...
 
virtual IlBoolean open (const IlvPathName &pathname)
 Loads data from the file that has the path pathname. It cleans the document if the associated document template specifies a Single Document Interface mode. It manages the modified state to IlFalse, and updates internal data, before calling the real reading method readDocument. Therefore, it is recommended not to override this method. It may be more sensible to override method readDocument. More...
 
virtual IlBoolean readDocument (const IlvPathName &pathname)
 Initializes document data from a file. More...
 
virtual void redo (IlBoolean updateUI=IlTrue)
 To redo the last undone command. More...
 
IlBoolean removeView (IlvDvDocViewInterface *view, IlBoolean destroyIt=IlTrue, IlBoolean update=IlTrue)
 Removes a document view. More...
 
void removeViews (IlBoolean destroyThem=IlFalse)
 Removes document views. More...
 
virtual void repeat (IlBoolean updateUI=IlTrue)
 Repeats the last executed command. More...
 
IlBoolean revert ()
 Reloads the document data from the document file. More...
 
IlBoolean save ()
 Saves the document data in the current document file. More...
 
IlBoolean save (IlvPathName &pathName, IlBoolean replace=IlTrue)
 Saves the document in a file. More...
 
IlBoolean saveAs ()
 Saves the document in a new file. More...
 
virtual IlBoolean saveDocument (const IlvPathName &pathName)
 Saves the document data in the file with the path pathname. More...
 
virtual IlBoolean saveModifications ()
 Saves the document only if it has been modified. More...
 
void setAutoDelete (IlBoolean autoDelete)
 Sets the auto deletion mode of the document to the parameter autoDelete.
 
void setDocTemplate (IlvDvDocTemplate *docTemplate)
 Associates the document template docTemplate with the document. More...
 
virtual void setModified (IlBoolean modified, IlBoolean notify=IlTrue)
 Forces the modification state of the document. More...
 
virtual void setPathName (const IlvPathName &pathName, IlBoolean addToMRU=IlTrue)
 Sets the path of the document to the parameter pathName. More...
 
virtual void undo (IlBoolean updateUI=IlTrue)
 To undo the last executed command. More...
 
void updateViewContainerTitles ()
 Updates the view container titles. More...
 
- Public Member Functions inherited from IlvDvInterface
IlBoolean callMethod (const IlSymbol *methodName, IlvDvValue *returnedValue,...)
 Generic method for calling a method that is exported in a class interface. More...
 
IlvDvValuegetFieldValue (const IlSymbol *fieldName, IlvDvValue &value) const
 Gets a field value. More...
 
virtual IlBoolean isProcessingAction (const IlSymbol *methodName) const
 Returns IlTrue if the given action can be processed by the class. More...
 
virtual IlBoolean processAction (const IlSymbol *actionName)
 Processes an action. More...
 
virtual IlBoolean refreshAction (const IlSymbol *actionName, IlvDvActionDescriptor *desc) const
 Refresh all the menu items that reference the action given by the parameter actionName. More...
 
void setFieldValue (const IlSymbol *fieldName, const IlvDvValue &value)
 Sets a field value. More...
 

Protected Member Functions

virtual IlvDvDocumentProjectItemcreateDocumentProjectItem ()
 Creates a document project item. More...
 
virtual IlvDvProjectItemcreateProjectFileItem (IlvDvFileInfo *fileInfo)
 Creates a project file item that corresponds to the parameter fileInfo. By default, it creates an IlvDvFileItem object. More...
 
virtual IlvDvProjectItemcreateProjectFolderItem (const char *name, const char *extensions=0)
 Creates a project folder item using the parameters name and extensions. By default, it creates an IlvDvFolderItem object. More...
 
virtual void removeTreeItemData (IlvDvProjectItem *item)
 It removes the data associated with the project item item. More...
 
- Protected Member Functions inherited from IlvDvDocument
IlvDvDocViewInterfacegetCurrentCallerView () const
 Returns the document view that is sending a message to the document. More...
 
void notifyViews (const IlSymbol *name, IlvDvDocViewInterface *except,...)
 Notifies the associated document views of an event. More...
 

Friends

class IlvDvFileInfo
 

Detailed Description

Application Framework document project class.

Library: ilvappframe

IlvDvProjectDocument is a subclass of IlvDvDocument The document data is a hierarchical tree of items whose class must inherit from IlvDvProjectItem class.

Project items
By default, two types of items are provided. Some items store a group of other items (IlvDvFolderItem class) represented in the project view as a folder. The other items reference a file (IlvDvFileItem class) represented in the project view as a file tree item that opens the corresponding document when it is activated.

IlvDvFileInfo objects
References to a file are objects of the class IlvDvFileInfo that contain information on the file, such as its full path. IlvDvFileInfo objects are stored by the IlvDvProjectDocument document and must be locked and unlocked when they are used or stored outside the project document, the same way project file items do. Two project file items that reference the same file point to the same IlvDvFileInfo object.

Member Function Documentation

◆ activateItem()

virtual IlBoolean IlvDvProjectDocument::activateItem ( IlvDvProjectItem item)
virtual

Activates the project item item.

By default, if the item is a file item, a document corresponding to the file path is created, or activated if it was already open.
This method can be overridden to activate its own project item types.

Returns
IlFalse if a project item could not be activated.

◆ activateItems()

IlBoolean IlvDvProjectDocument::activateItems ( IlvDvProjectItem *const *  items,
IlUInt  count 
)

Activates the project items items by calling the activateItem method for each item. This method can be called by a project view if the multiple selection of tree gadget items has been activated.

Returns
IlFalse if a project item could not be activated.

◆ createDocumentProjectItem()

virtual IlvDvDocumentProjectItem* IlvDvProjectDocument::createDocumentProjectItem ( )
protectedvirtual

Creates a document project item.

Creates a project item of a subclass of IlvDvDocumentProjectItem. This project item will be the root of the project items.
By default, it creates an IlvDvDocumentProjectItem object.

Returns
The new document project item.

◆ createProjectFileItem()

virtual IlvDvProjectItem* IlvDvProjectDocument::createProjectFileItem ( IlvDvFileInfo fileInfo)
protectedvirtual

Creates a project file item that corresponds to the parameter fileInfo. By default, it creates an IlvDvFileItem object.

Returns
The new project file item.

◆ createProjectFolderItem()

virtual IlvDvProjectItem* IlvDvProjectDocument::createProjectFolderItem ( const char *  name,
const char *  extensions = 0 
)
protectedvirtual

Creates a project folder item using the parameters name and extensions. By default, it creates an IlvDvFolderItem object.

Returns
The new project folder item.

◆ getFileInfo()

IlvDvFileInfo* IlvDvProjectDocument::getFileInfo ( IlUInt  index) const

Returns the file information object located at index index.

These files are referenced by an IlvDvFileInfo object that is used by at least one project file item.

Returns
The file information located object at index index.

◆ getFileInfosCount()

IlUInt IlvDvProjectDocument::getFileInfosCount ( ) const

Returns the number of files that are owned by the project document.

These files are referenced by an IlvDvFileInfo object that is used by at least one project file item.

Returns
The number of files that are owned by the project document.

◆ getIndexOfFileInfo()

IlUInt IlvDvProjectDocument::getIndexOfFileInfo ( const IlvDvFileInfo fInfo) const

Returns the index of the file information object fInfo from the list of file information stored by the document.

Returns
The index of the file information object.

◆ getProjectRootItem()

IlvDvDocumentProjectItem* IlvDvProjectDocument::getProjectRootItem ( ) const

Returns the project root item of the document.

Returns
The project root item of the document.

◆ initializeDocument()

virtual IlBoolean IlvDvProjectDocument::initializeDocument ( IlAny  data = 0)
virtual

Initializes a new project document.

This method creates a root project item by calling the method createDocumentProjectItem. The item represents the project document itself.

Returns
IlTrue if initialization of document succeeded.

Reimplemented from IlvDvDocument.

◆ insertFile()

IlBoolean IlvDvProjectDocument::insertFile ( IlvDvProjectItem parent,
const IlPathName filename 
)

Inserts a file in the project.

Inserts a project file item as a child of the project item parent. The project file item is built by calling the method createProjectFileItem, which can be redefined.
Associated document views are notified when they receive the message "AddProjectItem" with the new project item as the parameter.
By default, the project views add a tree gadget item corresponding to the new project item.

Parameters
parentProject item that will be the parent of the new project file item.
filenameFull path of the added file item.
Returns
IlTrue if the project file item is created and inserted.

◆ insertFolder()

IlBoolean IlvDvProjectDocument::insertFolder ( IlvDvProjectItem parent,
const char *  name,
const char *  extensions = 0 
)

Inserts a project folder item with the name name as a child of the project item parent.

The project folder item is built by calling method createProjectFolderItem, which can be redefined.
Associated document views are notified when they receive the message "AddProjectItem" with the new project item as the parameter.
By default, the project views add a tree gadget item corresponding to the added project item.

Parameters
parentProject item that will be the parent of the project folder item.
nameName of the folder.
extensionsSpecifies the file extensions that filter which file items can be added to the folder items. This parameter is null by default. If it is null, all file items can be added to the folder items.
Returns
IlTrue if the project folder item is inserted.

◆ insertItem()

IlBoolean IlvDvProjectDocument::insertItem ( IlvDvProjectItem item,
IlvDvProjectItem parent = 0,
IlUShort  index = (IlUShort) -1 
)

Inserts a project item as a child of the project item parent.

Associated document views are notified when they receive the message "AddProjectItem" with the project item item given as the parameter.
By default, the project views add a tree gadget item corresponding to the added project item.

Parameters
itemProject item that must be added to the document.
parentProject item that will be the parent of the project file item item.
indexThe position where the project item item will be inserted among the children of the project item parent.
Returns
IlTrue if the project file item is inserted.

◆ removeTreeItemData()

virtual void IlvDvProjectDocument::removeTreeItemData ( IlvDvProjectItem item)
protectedvirtual

It removes the data associated with the project item item.

Called before a project item is deleted.

◆ removeTreeItems()

void IlvDvProjectDocument::removeTreeItems ( IlvDvProjectItem *const *  items,
IlUInt  count 
)

Removes a list of project items.

The items items are destroyed. For each project item destroyed, associated document views are notified. They receive messages of the name "RemoveProjectItem" with the corresponding deleted project item as the parameter. By default, the project views (IlvDvProjectView class) remove the corresponding tree item from the tree.

Parameters
itemsArray of project items to be deleted.
countNumber of project items to be deleted.

◆ serialize()

virtual void IlvDvProjectDocument::serialize ( IlvDvStream stream)
virtual

Serializes the document.

All project items are serialized, as well as the file information data used by the project file items.

Parameters
streamStream used to serialize the document.

Reimplemented from IlvDvDocument.

◆ setTitle()

virtual void IlvDvProjectDocument::setTitle ( const char *  title,
IlBoolean  update = IlTrue 
)
virtual

Sets the title title for the document.

If the label of the project root item has not been explicitly changed, the label is set to the title.

Parameters
titleNew title of the document.
updateIf update is IlTrue, all associated view containers have their title updated to the document title.

Reimplemented from IlvDvDocument.