VCF::DocumentManagerImpl< AppClass, DocInterfacePolicy > Class Template Reference
class DocumentManagerImpl implementation of the DocumentManager for which also the DocInterfacePolicy is specified. More...
#include <vcf/ApplicationKit/DocumentManager.h>
Inheritance diagram for VCF::DocumentManagerImpl< AppClass, DocInterfacePolicy >:

Public Member Functions | |
| DocumentManagerImpl () | |
| virtual void | init () |
| inizialization function for document based applications. | |
| virtual Document * | getCurrentDocument () |
| gets a pointer to the active document. | |
| virtual void | setCurrentDocument (Document *newCurrentDocument) |
| sets the given document as the active one. | |
| virtual bool | saveFile (Document *document) |
| save a document into a file. | |
| virtual bool | saveFileAs (Document *document, const String &newFileName=String(L"")) |
| save a document into a file. | |
| virtual void | openFile () |
| opens a file. | |
| virtual void | closeCurrentDocument () |
| closes the current document, and all its children if they exist according to the policy. | |
| virtual void | reloadDocument (Document *document, const bool &keepPosition=true) |
| reloads a file for an existing document. | |
| virtual Document * | createDocumentFromType (const DocumentInfo &info) |
| just creates the object from its type using the VCF RTTI The info.classID is used first if available, otherwise the info.className. | |
| virtual Window * | getWindowForNewDocument (Document *document, const DocumentInfo &info) |
| gets a window to be associated to the document just created. | |
| virtual Document * | newDefaultDocument (const String &fileName, const String &mimetype=L"") |
| default procedures when creating a new document | |
| virtual void | attachUIToDocument (const String &mimeType, Document *document) |
| attaches a document specific User Interface to a document using the appropriate DocumentInfo extracted from the mimeType. | |
| virtual void | createMenus () |
| creates the standard menu for a document based application and adds them as target to the appropriate action instances. | |
| virtual void | initializeWindowMenus (Window *window, Document *document, const DocumentInfo &info) |
| initializes the menu for the window associated to a document. | |
Protected Member Functions | |
| void | attachUI (const DocumentInfo &info, Document *document) |
| attaches a UI to the specified document param const DocumentInfo& info, the infos about this document's class. | |
| void | initActions () |
| initializes the actions for the application. | |
| virtual void | onSave (Event *e) |
| saves the current document, if it has been modified. | |
| virtual void | onUpdateSave (ActionEvent *e) |
| called when this target gets notified for update events | |
| virtual void | onSaveAs (Event *e) |
| saves the current document, but let the user to specify an alternative filename and type through a dialog box. | |
| virtual void | onUpdateSaveAs (ActionEvent *e) |
| called when this target gets notified for update events | |
| virtual void | onOpen (Event *e) |
| opens a document. | |
| virtual void | onClose (Event *e) |
| closes a document. | |
| virtual void | onUpdateClose (ActionEvent *e) |
| called when this target gets notified for update events | |
| virtual void | onNew (Event *e) |
| creates a new document. | |
| virtual void | onPreferences (Event *e) |
| let the user to change preferences. | |
| virtual void | onUpdatePreferences (ActionEvent *e) |
| handles notification that the user preferences has been changed | |
| void | onDocWindowClosing (FrameEvent *e) |
| closes the document's window | |
| void | onDocWindowActive (WindowEvent *e) |
| activates a window and its document | |
| void | onDocWindowCreated (Event *e) |
| Happens the first time after the window is created. | |
| void | onDocModified (ModelEvent *e) |
| handles notification that a document ( specified by the event ) has been changed. | |
| virtual void | onCut (Event *e) |
| starts cut operation | |
| virtual void | onUpdateCut (ActionEvent *e) |
| called when this target gets notified for update events | |
| virtual void | onCopy (Event *e) |
| starts copy operation | |
| virtual void | onUpdateCopy (ActionEvent *e) |
| called when this target gets notified for update events | |
| virtual void | onPaste (Event *e) |
| starts paste operation | |
| virtual void | onUpdatePaste (ActionEvent *e) |
| called when this target gets notified for update events | |
| virtual void | onUndo (Event *e) |
| starts undo operation | |
| virtual void | onUpdateUndo (ActionEvent *e) |
| called when this target gets notified for update events | |
| virtual void | onRedo (Event *e) |
| starts redo operation | |
| virtual void | onUpdateRedo (ActionEvent *e) |
| called when this target gets notified for update events | |
Protected Attributes | |
| AppClass * | app_ |
| pointer to the application | |
| bool | closingDocument_ |
| bool | documentClosedOK_ |
Detailed Description
template<typename AppClass, typename DocInterfacePolicy>
class VCF::DocumentManagerImpl< AppClass, DocInterfacePolicy >
class DocumentManagerImpl implementation of the DocumentManager for which also the DocInterfacePolicy is specified.
The DocInterfacePolicy is the template argument class that specifies how the DocumentManager is supposed to manage the collection (of one or more) documents. We can say than DocumentManagerImpl is the part of the DocumentManager whose member functions are depending on the DocInterfacePolicy chosen by the user.
Constructor & Destructor Documentation
|
|||||||||
|
|
Member Function Documentation
|
||||||||||||||||
|
attaches a UI to the specified document param const DocumentInfo& info, the infos about this document's class.
param Document* document, the document to attach the UI to. |
|
||||||||||||||||
|
attaches a document specific User Interface to a document using the appropriate DocumentInfo extracted from the mimeType.
In this standard implementation: first it saves the current document if the policy requests this then it does the work of attaching the UI ( by calling attachUI ), finally it notifies the document has been changed. The implementation is very similar to newDefaultDocument() with the difference that a document instance is already given. Reimplemented from VCF::DocumentManager. |
|
|||||||||
|
closes the current document, and all its children if they exist according to the policy.
Reimplemented from VCF::DocumentManager. |
|
||||||||||
|
just creates the object from its type using the VCF RTTI The info.classID is used first if available, otherwise the info.className.
Reimplemented from VCF::DocumentManager. |
|
|||||||||
|
creates the standard menu for a document based application and adds them as target to the appropriate action instances. The menu follows a standard for all the OS. Reimplemented from VCF::DocumentManager. |
|
|||||||||
|
gets a pointer to the active document.
Reimplemented from VCF::DocumentManager. |
|
||||||||||||||||
|
gets a window to be associated to the document just created. This implementation just creates the associated window from its type using the VCF RTTI. In a SDI policy the new window for the document is the main window. In a MDI policy the new window for the document is simply a new window. In an AdvancedMDIPolicy this implementation needs to be overriden. Reimplemented from VCF::DocumentManager. |
|
|||||||||
|
inizialization function for document based applications. This is called just after Application::initRunningApplication(). Reimplemented from VCF::DocumentManager. |
|
|||||||||
|
initializes the actions for the application. These are tipical for any document based application. |
|
||||||||||||||||||||
|
initializes the menu for the window associated to a document. The DocumentInfo is also specified. Initializes the appropriate menu for the document's window, by merging it with the application menu.
Reimplemented from VCF::DocumentManager. |
|
||||||||||||||||
|
default procedures when creating a new document
this is normally called before actually opening the file for the document.
In a SDI policy saveBeforeNewDocument() returns true so, if we create a new document while the current document has been modified the user is asked what to do, and the operation is aborted if the he decides to.
Reimplemented from VCF::DocumentManager. |
|
||||||||||
|
closes a document.
|
|
||||||||||
|
starts copy operation
|
|
||||||||||
|
starts cut operation
|
|
||||||||||
|
handles notification that a document ( specified by the event ) has been changed. The UI will set the caption to the caption of modified document's window. |
|
||||||||||
|
activates a window and its document
|
|
||||||||||
|
closes the document's window
|
|
||||||||||
|
Happens the first time after the window is created. This will activate the window and its document |
|
||||||||||
|
creates a new document.
|
|
||||||||||
|
opens a document.
|
|
||||||||||
|
starts paste operation
|
|
||||||||||
|
let the user to change preferences.
|
|
||||||||||
|
starts redo operation
|
|
||||||||||
|
saves the current document, if it has been modified.
|
|
||||||||||
|
saves the current document, but let the user to specify an alternative filename and type through a dialog box.
|
|
||||||||||
|
starts undo operation
|
|
||||||||||
|
called when this target gets notified for update events
|
|
||||||||||
|
called when this target gets notified for update events
|
|
||||||||||
|
called when this target gets notified for update events
|
|
||||||||||
|
called when this target gets notified for update events
|
|
||||||||||
|
handles notification that the user preferences has been changed
|
|
||||||||||
|
called when this target gets notified for update events
|
|
||||||||||
|
called when this target gets notified for update events
|
|
||||||||||
|
called when this target gets notified for update events
|
|
||||||||||
|
called when this target gets notified for update events
|
|
|||||||||
|
opens a file.
the standard behaviour is to show a dialog asking the user which file to open. If we don't want this base behaviour, an event handler must be implemented and added to the SaveFile delegate. Reimplemented from VCF::DocumentManager. |
|
||||||||||||||||
|
reloads a file for an existing document. If the file is modified, the user is prompted to save it or not. It the operation fails, the user is warned with a message, but the document is not closed.
Reimplemented from VCF::DocumentManager. |
|
||||||||||
|
save a document into a file. the standard behaviour is simply save the file if it has been modified, and to create a backup copy first if the document specifies to keep one. If there is a problem with the destination directory, the user is prompted with a dialog in order to specify an alternative location. If we don't want this base behaviour, an event handler must be implemented and added to the SaveFile delegate.
Reimplemented from VCF::DocumentManager. |
|
||||||||||||||||
|
save a document into a file. the standard behaviour is to show a dialog asking the user which file to open. The user is prompted with a dialog if the destination filename is not specified or if its directory does not exists. If the document is saved, then a ModelChanged event with type Document::deSaved is fired. If we don't want this base behaviour, an event handler must be implemented and added to the SaveFile delegate.
Reimplemented from VCF::DocumentManager. |
|
||||||||||
|
sets the given document as the active one. Applies the policy's implemenation and send a change notification. Reimplemented from VCF::DocumentManager. |
Member Data Documentation
|
|||||
|
pointer to the application
|
|
|||||
|
|
|
|||||
|
|
The documentation for this class was generated from the following file:
- vcf/ApplicationKit/DocumentManager.h
