#include <doccontroller.h>
Inheritance diagram for DocController:

Public Slots | |
| void | undo () |
| void | redo () |
Public Member Functions | |
| DocController (QObject *parent=0) | |
| DocController (AbstractModel *doc, QObject *parent=0) | |
| Doc * | doc () const |
Protected Member Functions | |
| virtual void | customEvent (QEvent *e) |
| virtual void | dispatchEvent (CEvent *) |
| virtual void | changeModelEvent (CChangeModelEvent *) |
| virtual void | renameEvent (CRenameEvent *) |
| virtual void | fileSaveToEvent (CFileEvent *) |
| virtual void | fileInitFromEvent (CFileEvent *) |
| virtual bool | saveDocToFile (const QString &filename) const |
| virtual bool | initDocFromFile (const QString &filename, bool resetViews=true) |
| QStack< UndoRedoItem * > | undoStack () const |
| QStack< UndoRedoItem * > | redoStack () const |
| bool | undoAvaliable () const |
| bool | redoAvaliable () const |
| virtual void | pushUndoRedoItem (UndoRedoItem *item) |
Note that the doc's pointer is stored internally as a "guarded pointer". Hence, if the doc is deleted, our reference to it will be automatically set back to NULL.
Warning! We always assert that the doc is non-null. Hence, you can't have an instance of a DocController without a Doc. This is fine for Nodal and means that we don't need to constantly check if the doc is null in the release / deployment version (when assertions are stripped).
| DocController::DocController | ( | QObject * | parent = 0 |
) |
Constructs a document controller with the given parent.
| DocController::DocController | ( | AbstractModel * | doc, | |
| QObject * | parent = 0 | |||
| ) |
Constructs a document controller with the given parent and uses doc as its model.
| Doc * DocController::doc | ( | ) | const |
Convenience method.
Returns a cached guarded pointer that has been dynamically cast to Doc* from AbstractModel*.
See also AbstractController::model().
| void DocController::undo | ( | ) | [inline, slot] |
| void DocController::redo | ( | ) | [inline, slot] |
| virtual void DocController::customEvent | ( | QEvent * | e | ) | [inline, protected, virtual] |
| void DocController::dispatchEvent | ( | CEvent * | event | ) | [protected, virtual] |
The doc event dispatcher.
Warning! It is assumed that the events have their correct type set (as it uses static casts).
Asserts that the event is non-null.
Reimplemented from AbstractController.
Reimplemented in AttributeDocController, ElementDocController, and DiagramController.
| void DocController::changeModelEvent | ( | CChangeModelEvent * | event | ) | [protected, virtual] |
Re-implemented, as to also have the pointer returned by doc() updated.
Asserts that the event is non-null.
Reimplemented from AbstractController.
Reimplemented in AttributeDocController, ElementDocController, and DiagramController.
| void DocController::renameEvent | ( | CRenameEvent * | event | ) | [protected, virtual] |
Will post VEvent::Renamed after making the change.
Asserts that the event is non-null.
| void DocController::fileSaveToEvent | ( | CFileEvent * | event | ) | [protected, virtual] |
Note: To save a doc to file using the doc's current filename, pass the value of Doc::filename() to the CFileEvent.
Asserts that the event is non-null and that the filename that the event contains is non-empty.
| void DocController::fileInitFromEvent | ( | CFileEvent * | event | ) | [protected, virtual] |
CURRENT ASSUMPTION: Doc is currently empty!
Asserts that the event is non-null and that the filename that the event contains is non-empty.
| bool DocController::saveDocToFile | ( | const QString & | filename | ) | const [protected, virtual] |
Reimplemented in GuiDiagramController.
| bool DocController::initDocFromFile | ( | const QString & | filename, | |
| bool | resetViews = true | |||
| ) | [protected, virtual] |
Posts VEvent(VEvent::Reset) to the views before returning.
If the views' controllers are set to this class after this is called, then resetViews can be set to false.
Asserts that the doc() is non-null.
| QStack<UndoRedoItem*> DocController::undoStack | ( | ) | const [inline, protected] |
| QStack<UndoRedoItem*> DocController::redoStack | ( | ) | const [inline, protected] |
| bool DocController::undoAvaliable | ( | ) | const [inline, protected] |
| bool DocController::redoAvaliable | ( | ) | const [inline, protected] |
| virtual void DocController::pushUndoRedoItem | ( | UndoRedoItem * | item | ) | [inline, protected, virtual] |
1.5.2