VCF::DocumentManager Class Reference
The DocumentManager manages the interaction between the application (and any other UI classes) and a collection of one or more documents. More...
#include <vcf/ApplicationKit/DocumentManager.h>
Inheritance diagram for VCF::DocumentManager:

Public Types | |
| enum | { dmSaveDocument = 1000, dmOpenDocument, dmNewDocument, dmCloseDocument, dmDocumentInitialized, dmCurrentDocumentChanged } |
| events types. More... | |
| enum | ActionTag { atFileNew = 1, atFileOpen, atFileClose, atFileSave, atFileSaveAs, atEditUndo = 100, atEditRedo, atEditCut, atEditCopy, atEditPaste, atEditPreferences, atLast } |
Public Member Functions | |
| DocumentManager () | |
| virtual | ~DocumentManager () |
| virtual void | init () |
| inizialization function for document based applications. | |
| virtual void | terminate () |
| termination function for document based applications. | |
| virtual Document * | getCurrentDocument () |
| gets the current document. | |
| virtual void | setCurrentDocument (Document *newCurrentDocument) |
| sets the new current document. | |
| bool | saveDocument (Document *doc) |
| saves the specified document. | |
| virtual bool | saveFile (Document *document) |
| save a document into a file. | |
| virtual bool | saveFileAs (Document *document, const String &newFileName=L"") |
| save a document into a file. | |
| virtual Document * | openFromFileName (const String &fileName) |
| opens a document instance from a file. | |
| virtual void | openFile () |
| opens a file. | |
| virtual void | closeCurrentDocument () |
| close the current ( active ) document. | |
| virtual void | reloadDocument (Document *document, const bool &keepPosition=true) |
| reloads from the hard drive the file for an existing document. | |
| void | currentDocumentChanged () |
| this method is called to notify the application has changed its active document, child or not. | |
| virtual void | newDocument () |
| creates a new document. | |
| virtual Document * | newDefaultDocument (const String &fileName, const MIMEType &mimetype) |
| creates a new default document. | |
| virtual Document * | createDocumentFromType (const DocumentInfo &info) |
| creates a new document with specified Document infos. | |
| virtual Model * | createModelFromType (const DocumentInfo &info) |
| virtual Window * | getWindowForNewDocument (Document *document, const DocumentInfo &info) |
| gets the appropriate window to be associated to a new document. | |
| void | addDocumentInfo (const MIMEType &mimeType, const DocumentInfo &info) |
| there is an internal association map between a mimeType and the DocumentInfo this function adds an item to this map. | |
| Enumerator< DocumentInfo > * | getRegisteredDocumentInfo () |
| gets a pointer to the enumerator of all the registered DocumentInfo(s). | |
| DocumentInfo | getDocumentInfo (const MIMEType &mimeType) |
| gets the DocumentInfo of a document from its mime type only. | |
| MIMEType | getMimeTypeFromFileExtension (const String &fileName) |
| gets the mime type of a document from the extension of its associated file. | |
| virtual void | setNewView (const DocumentInfo &info, View *view, Window *window, Document *newDocument) |
| sets a specified view for a specified new document. | |
| virtual void | editPreferences () |
| preferences support. | |
| bool | getShouldCreateUI () |
| tells if our Document manager is expected to have (create) a User Interface. | |
| void | setShouldCreateUI (bool val) |
| states if our Document manager should create a User Interface. | |
| virtual void | attachUIToDocument (const String &mimeType, Document *document) |
| attaches a document specific User Interface to a document. | |
| Enumerator< Document * > * | getOpenedDocuments () |
| gets a pointer to an enumerator of all the opened documents in the application. | |
| virtual void | createMenus () |
| creates the menus associated to our document based application. | |
| virtual void | initializeWindowMenus (Window *window, Document *document, const DocumentInfo &info) |
| initializes the menu for the window associated to a document. | |
| Action * | getAction (uint32 tag) |
| gets the action associated to an action tag, as specified by this document manager. | |
| virtual void | cutFromDocument (Document *doc) |
| performs a cut operation on the document, if the document allows for it. | |
| virtual void | copyFromDocument (Document *doc) |
| performs a copy operation on the document, if the document allows for it. | |
| virtual void | pasteToDocument (Document *doc) |
| performs a paste operation on the document, if the document allows for it. | |
| virtual void | undoForDocument (Document *doc) |
| performs an undo operation on the document. | |
| virtual void | redoForDocument (Document *doc) |
| performs a redo operation on the document. | |
| void | undo () |
| performs an undo operation using the shared undo-redo stack | |
| void | redo () |
| performs a redo operation using the shared undo-redo stack | |
| UndoRedoStack & | getUndoRedoStack (Document *doc) |
| gets the undo-redo stack associated with a document. | |
| UndoRedoStack & | getUndoRedoStack (Model *model) |
| UndoRedoStack & | getSharedUndoRedoStack () |
| Returns the shared undo-redo stack for the document manager. | |
| void | linkDocumentToModel (Document *document, Model *model) |
| void | unlinkDocumentToModel (Document *document) |
| Document * | getDocument (Model *model) |
| Model * | getModel (Document *document) |
| void | addDropTarget (DropTarget *dropTarget) |
| void | cleanupDropTarget (Document *doc) |
| void | addDocument (Document *document) |
| called to add a document to the document based application | |
| void | removeDocument (Document *document) |
| called to remove a document from the document based application | |
| void | openFromCommandLine (const CommandLine &comdLine) |
Static Public Member Functions | |
| static DocumentManager * | getDocumentManager () |
| gives the current document manager instance. | |
Public Attributes | |
| VCF::Delegate | DocManagerDelegate |
| SaveFile | |
| OpenFile | |
| DocumentInitialized VCF::Delegate | DocManagerDelegate |
| DocumentClosed VCF::Delegate | DocManagerDelegate |
Protected Types | |
| typedef std::map< String, DocumentInfo > | DocumentInfoMap |
| typedef std::map< Document *, UndoRedoStack * > | DocumentUndoRedoMap |
| typedef std::map< uint32, Action * > | ActionMap |
| typedef std::map< Document *, Model * > | DocumentModelMap |
Protected Member Functions | |
| DocumentInfo * | getDocumentInfo (Document *doc) |
| gives the document info associated to the document this implementation uses the VCF RTTI for this document. | |
| virtual void | prepareOpenDialog (CommonFileOpenDialog *openDialog) |
| called to prepare a file open dialog | |
| virtual void | openDialogFinished (CommonFileOpenDialog *openDialog) |
| called after the file open dialog has been closed by the user and confirmed Ok | |
| virtual void | prepareSaveDialog (CommonFileSaveDialog *saveDialog, Document *doc) |
| called to prepare a file save dialog | |
| virtual void | saveDialogFinished (CommonFileSaveDialog *saveDialog) |
| called after the file save dialog has been closed by the user and confirmed Ok | |
| virtual void | updateSave (ActionEvent *event, Document *doc) |
| called when this target gets notified for update events of the UI of a save operation | |
| virtual void | updateSaveAs (ActionEvent *event, Document *doc) |
| called when this target gets notified for update events of the UI of a saveAs operation | |
| virtual void | updateClose (ActionEvent *event, Document *doc) |
| called when this target gets notified for update events of the UI of a close operation | |
| virtual void | updateCut (ActionEvent *event, Document *doc) |
| called when this target gets notified for update events of the UI of a cut operation | |
| virtual void | updateCopy (ActionEvent *event, Document *doc) |
| called when this target gets notified for update events of the UI of a copy operation | |
| virtual void | updatePaste (ActionEvent *event, Document *doc) |
| called when this target gets notified for update events of the UI of a paste operation | |
| virtual void | updateUndo (ActionEvent *event, Document *doc) |
| called when this target gets notified for update events of the UI of a undo operation | |
| virtual void | updateRedo (ActionEvent *event, Document *doc) |
| called when this target gets notified for update events of the UI of a redo operation | |
| void | removeUndoRedoStackForDocument (Document *doc) |
| removes the undo redo stack from the specified document | |
| virtual UIToolkit::ModalReturnType | saveChanges (Document *document) |
| called to save the changes done on a specified document | |
| void | addAction (uint32 tag, Action *action) |
| add an action to the internal action map | |
| void | onDocWndEntered (DropTargetEvent *e) |
| void | onDocWndDragging (DropTargetEvent *e) |
| void | onDocWndDropped (DropTargetEvent *e) |
Protected Attributes | |
| DocumentInfoMap | docInfo_ |
| The map of all registered DocumentInfo(s). | |
| EnumeratorMapContainer< DocumentInfoMap, DocumentInfo > | docInfoContainer_ |
| Array< Document * > | openDocuments_ |
| The list of all the opened document at this moment. | |
| bool | shouldCreateUI_ |
| this DocumentManager has a User Interface | |
| ActionMap | actionsMap_ |
| the map of all actions and their associated tags according to our document manager | |
| DocumentUndoRedoMap | undoRedoStack_ |
| the map of all undo redo stack associated to each document | |
| DocumentModelMap | docModelMap_ |
| std::vector< DropTarget * > | dropTargets_ |
| Document * | currentDragDocument_ |
Static Protected Attributes | |
| static DocumentManager * | docManagerInstance |
| the only document manager instance for the application | |
Detailed Description
The DocumentManager manages the interaction between the application (and any other UI classes) and a collection of one or more documents.A DocumentBasedApplication inherits from this class and from a DocInterfacePolicy The DocInterfacePolicy is the template argument class that specifies how the DocumentManager is supposed to manage the collection (of one or more) documents. The member functions of this DocumentManager class are very general and common to any kind document manager interface, and so it contributes to define the Document Interface pattern itself. The DocumentManager allows only for a single instance, which you can get at by calling the static method DocumentManager::getDocumentManager().
- Event Delegates for this class:
- DocumentManager::SaveFile
- DocumentManager::OpenFile
- DocumentManager::DocumentInitialized
- DocumentManager::DocumentClosed
- DocumentManager::CurrentDocumentChanged
Member Typedef Documentation
|
|
|
|
|
|
|
|
|
|
|
|
Member Enumeration Documentation
|
|
events types. See the DELEGATEs of this class. |
|
|
|
Constructor & Destructor Documentation
|
|
|
|
|
|
Member Function Documentation
|
||||||||||||
|
add an action to the internal action map
|
|
|
called to add a document to the document based application
|
|
||||||||||||
|
there is an internal association map between a mimeType and the DocumentInfo this function adds an item to this map.
|
|
|
|
|
||||||||||||
|
attaches a document specific User Interface to a document. using the appropriate DocumentInfo extracted from the mimeType. The basic functionality is empty. The real implementation is dependent on the policy. Reimplemented in VCF::DocumentManagerImpl< AppClass, DocInterfacePolicy >, and VCF::DocumentManagerImpl< DocumentBasedApplication< DocInterfacePolicy >, DocInterfacePolicy >. |
|
|
|
|
|
close the current ( active ) document. The basic functionality is empty. The real implementation is dependent on the policy. Reimplemented in VCF::DocumentManagerImpl< AppClass, DocInterfacePolicy >, and VCF::DocumentManagerImpl< DocumentBasedApplication< DocInterfacePolicy >, DocInterfacePolicy >. |
|
|
performs a copy operation on the document, if the document allows for it.
|
|
|
creates a new document with specified Document infos. The basic functionality is empty. The real implementation is dependent on the policy.
Reimplemented in VCF::DocumentManagerImpl< AppClass, DocInterfacePolicy >, and VCF::DocumentManagerImpl< DocumentBasedApplication< DocInterfacePolicy >, DocInterfacePolicy >. |
|
|
creates the menus associated to our document based application. The basic functionality is empty. The real implementation is dependent on the policy. Reimplemented in VCF::DocumentManagerImpl< AppClass, DocInterfacePolicy >, and VCF::DocumentManagerImpl< DocumentBasedApplication< DocInterfacePolicy >, DocInterfacePolicy >. |
|
|
Reimplemented in VCF::DocumentManagerImpl< AppClass, DocInterfacePolicy >, and VCF::DocumentManagerImpl< DocumentBasedApplication< DocInterfacePolicy >, DocInterfacePolicy >. |
|
|
this method is called to notify the application has changed its active document, child or not.
|
|
|
performs a cut operation on the document, if the document allows for it.
|
|
|
preferences support. performs any editing operation on the application's preferences. The basic functionality is empty. Override this to implement one. |
|
|
gets the action associated to an action tag, as specified by this document manager.
|
|
|
gets the current document. The current document is the document having the focus, so to speak. It is also called the active document, as the default operations are performed on this one. The basic functionality is empty. The real implementation is dependent on the policy.
Reimplemented in VCF::DocumentManagerImpl< AppClass, DocInterfacePolicy >, and VCF::DocumentManagerImpl< DocumentBasedApplication< DocInterfacePolicy >, DocInterfacePolicy >. |
|
|
|
|
|
gives the document info associated to the document this implementation uses the VCF RTTI for this document.
|
|
|
gets the DocumentInfo of a document from its mime type only.
|
|
|
gives the current document manager instance. This is a singleton, so this function is static.
|
|
|
gets the mime type of a document from the extension of its associated file.
|
|
|
|
|
|
gets a pointer to an enumerator of all the opened documents in the application.
|
|
|
gets a pointer to the enumerator of all the registered DocumentInfo(s).
|
|
|
Returns the shared undo-redo stack for the document manager.
|
|
|
tells if our Document manager is expected to have (create) a User Interface.
|
|
|
|
|
|
gets the undo-redo stack associated with a document.
|
|
||||||||||||
|
gets the appropriate window to be associated to a new document. The standard implementation of a Document Interface is a one to one relationship between documents and windows. The basic functionality is empty. The real implementation is dependent on the policy, as this is depending on the type of Document Interface.
Reimplemented in VCF::DocumentManagerImpl< AppClass, DocInterfacePolicy >, and VCF::DocumentManagerImpl< DocumentBasedApplication< DocInterfacePolicy >, DocInterfacePolicy >. |
|
|
inizialization function for document based applications. This is called just after Application::initRunningApplication(). Reimplemented in VCF::DocumentManagerImpl< AppClass, DocInterfacePolicy >, and VCF::DocumentManagerImpl< DocumentBasedApplication< DocInterfacePolicy >, DocInterfacePolicy >. |
|
||||||||||||||||
|
initializes the menu for the window associated to a document. The DocumentInfo is also specified. The basic functionality is empty. The real implementation is dependent on the policy.
Reimplemented in VCF::DocumentManagerImpl< AppClass, DocInterfacePolicy >, and VCF::DocumentManagerImpl< DocumentBasedApplication< DocInterfacePolicy >, DocInterfacePolicy >. |
|
||||||||||||
|
|
|
||||||||||||
|
creates a new default document. The mimetype of the document to be opened can be optionally specified. The basic functionality is empty. The real implementation is dependent on the policy.
Reimplemented in VCF::DocumentManagerImpl< AppClass, DocInterfacePolicy >, and VCF::DocumentManagerImpl< DocumentBasedApplication< DocInterfacePolicy >, DocInterfacePolicy >. |
|
|
creates a new document. The default implementation is to create a default document as this is what happens in a SDI policy ( where only one DocumentInfo has been registered into this DocumentManager). By overriding this function the user could change this default implementation and open an appropriate New File dialog. |
|
|
|
|
|
|
|
|
|
|
|
called after the file open dialog has been closed by the user and confirmed Ok
|
|
|
opens a file. The basic functionality is empty. The real implementation is dependent on the policy. Reimplemented in VCF::DocumentManagerImpl< AppClass, DocInterfacePolicy >, and VCF::DocumentManagerImpl< DocumentBasedApplication< DocInterfacePolicy >, DocInterfacePolicy >. |
|
|
|
|
|
opens a document instance from a file. the mime type identifying the document is extracted from the file extension stored with all the DocumentInfo(s) registered to the manager. Afterward creating/opening the document, the file is actually loaded too.
|
|
|
performs a paste operation on the document, if the document allows for it.
|
|
|
called to prepare a file open dialog
|
|
||||||||||||
|
called to prepare a file save dialog
|
|
|
performs a redo operation using the shared undo-redo stack
|
|
|
performs a redo operation on the document.
|
|
||||||||||||
|
reloads from the hard drive the file for an existing document. The basic functionality is empty. The real implementation is dependent on the policy.
Reimplemented in VCF::DocumentManagerImpl< AppClass, DocInterfacePolicy >, and VCF::DocumentManagerImpl< DocumentBasedApplication< DocInterfacePolicy >, DocInterfacePolicy >. |
|
|
called to remove a document from the document based application
|
|
|
removes the undo redo stack from the specified document
|
|
|
called to save the changes done on a specified document
|
|
|
called after the file save dialog has been closed by the user and confirmed Ok
|
|
|
saves the specified document.
|
|
|
save a document into a file. The basic functionality is empty. The real implementation is dependent on the policy.
Reimplemented in VCF::DocumentManagerImpl< AppClass, DocInterfacePolicy >, and VCF::DocumentManagerImpl< DocumentBasedApplication< DocInterfacePolicy >, DocInterfacePolicy >. |
|
||||||||||||
|
save a document into a file. The basic functionality is empty. The real implementation is dependent on the policy.
Reimplemented in VCF::DocumentManagerImpl< AppClass, DocInterfacePolicy >, and VCF::DocumentManagerImpl< DocumentBasedApplication< DocInterfacePolicy >, DocInterfacePolicy >. |
|
|
sets the new current document. The basic functionality is empty. The real implementation is dependent on the policy.
Reimplemented in VCF::DocumentManagerImpl< AppClass, DocInterfacePolicy >, and VCF::DocumentManagerImpl< DocumentBasedApplication< DocInterfacePolicy >, DocInterfacePolicy >. |
|
||||||||||||||||||||
|
sets a specified view for a specified new document. In this default implementation the window, previously 'assigned' to the document, becomes the view itself. The DocumentInfo is also specified because in alternative implementations we may need to decide to select which view will be associated to the document: the window could be the view itself or the control hosting the view instead.
|
|
|
states if our Document manager should create a User Interface.
|
|
|
termination function for document based applications. This is called just before Application::terminateRunningApplication(). |
|
|
performs an undo operation using the shared undo-redo stack
|
|
|
performs an undo operation on the document.
|
|
|
|
|
||||||||||||
|
called when this target gets notified for update events of the UI of a close operation
|
|
||||||||||||
|
called when this target gets notified for update events of the UI of a copy operation
|
|
||||||||||||
|
called when this target gets notified for update events of the UI of a cut operation
|
|
||||||||||||
|
called when this target gets notified for update events of the UI of a paste operation
|
|
||||||||||||
|
called when this target gets notified for update events of the UI of a redo operation
|
|
||||||||||||
|
called when this target gets notified for update events of the UI of a save operation
|
|
||||||||||||
|
called when this target gets notified for update events of the UI of a saveAs operation
|
|
||||||||||||
|
called when this target gets notified for update events of the UI of a undo operation
|
Member Data Documentation
|
|
the map of all actions and their associated tags according to our document manager
|
|
|
|
|
|
The map of all registered DocumentInfo(s).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
the only document manager instance for the application
|
|
|
|
|
|
|
|
|
The list of all the opened document at this moment.
|
|
|
|
|
|
|
|
|
this DocumentManager has a User Interface
|
|
|
the map of all undo redo stack associated to each document
|
The documentation for this class was generated from the following file:
- vcf/ApplicationKit/DocumentManager.h
