Represents study for using in CAF module. More...
#include <CAF_Study.h>
Public Member Functions | |
CAF_Study (SUIT_Application *theApp) | |
Constructor. More... | |
CAF_Study (SUIT_Application *theApp, Handle(TDocStd_Document)&aStdDoc) | |
Constructor. More... | |
virtual | ~CAF_Study () |
Destructor. More... | |
virtual bool | createDocument (const QString &) |
Customize document initialization. More... | |
virtual void | closeDocument (bool=true) |
Close document. More... | |
virtual bool | openDocument (const QString &) |
Open document. More... | |
virtual bool | saveDocumentAs (const QString &) |
Save document with other name. More... | |
bool | isSaved () const |
Check if the study is saved. More... | |
bool | isModified () const |
Check if the study is modified. More... | |
void | doModified (bool=true) |
Increment modifications count. More... | |
void | undoModified () |
Decrement modifications count. More... | |
void | clearModified () |
Clear modifications count. More... | |
bool | undo () |
Undo the last command. More... | |
bool | redo () |
Redo the last undo. More... | |
bool | canUndo () const |
Check if it is possible to undo last command. More... | |
bool | canRedo () const |
Check if it is possible to redo last undo. More... | |
QStringList | undoNames () const |
Get names of available undo commands. More... | |
QStringList | redoNames () const |
Get names of available redo commands. More... | |
Handle (TDocStd_Document) stdDoc() const | |
Public Member Functions inherited from SUIT_Study | |
SUIT_Study (SUIT_Application *) | |
virtual | ~SUIT_Study () |
virtual int | id () const |
SUIT_DataObject * | root () const |
virtual QString | studyName () const |
SUIT_Application * | application () const |
virtual void | Modified () |
bool | saveDocument () |
virtual void | update () |
virtual void | sendChangesNotification () |
SUIT_Operation * | activeOperation () const |
virtual void | abortAllOperations () |
const QList< SUIT_Operation * > & | operations () const |
Get all started operations. More... | |
virtual SUIT_Operation * | blockingOperation (SUIT_Operation *) const |
Verifies whether operation can be activated above already started ones. More... | |
bool | start (SUIT_Operation *, const bool check=true) |
Starts operation. More... | |
bool | abort (SUIT_Operation *) |
Aborts operation. More... | |
bool | commit (SUIT_Operation *) |
Commits operation. More... | |
bool | suspend (SUIT_Operation *) |
Commits operation. More... | |
bool | resume (SUIT_Operation *) |
Resumes operation. More... | |
virtual void | restoreState (int savePoint) |
Restores the study state. More... | |
Protected Member Functions | |
Handle (TDocStd_Application) stdApp() const | |
CAF_Application * | cafApplication () const |
Get application. More... | |
virtual bool | openTransaction () |
Open OCAF transaction. More... | |
virtual bool | abortTransaction () |
Abort OCAF transaction. More... | |
virtual bool | hasTransaction () const |
Check if there is any transaction opened. More... | |
virtual bool | commitTransaction (const QString &=QString()) |
Commit OCAF transaction. More... | |
virtual void | setStdDoc (Handle(TDocStd_Document)&) |
Protected Member Functions inherited from SUIT_Study | |
virtual void | setIsSaved (const bool) |
virtual void | setIsModified (const bool) |
virtual void | setRoot (SUIT_DataObject *) |
virtual void | setStudyName (const QString &) |
virtual void | operationStarted (SUIT_Operation *) |
Perform some actions when operation starting. More... | |
virtual void | operationAborted (SUIT_Operation *) |
Perform some actions when operation aborted. More... | |
virtual void | operationStopped (SUIT_Operation *) |
Perform some actions when operation stopped. More... | |
virtual void | operationCommited (SUIT_Operation *) |
Perform some actions when operation commited. More... | |
Private Member Functions | |
Handle (TDocStd_Document) myStdDoc | |
Private Attributes | |
int | myModifiedCnt |
Friends | |
class | CAF_Operation |
Additional Inherited Members | |
Signals inherited from SUIT_Study | |
void | studyModified (SUIT_Study *) |
A study contains reference to OCAF std document and allows using OCAF services. Provides necessary functionality for OCC transactions management.
CAF_Study::CAF_Study | ( | SUIT_Application * | theApp | ) |
theApp | application |
CAF_Study::CAF_Study | ( | SUIT_Application * | theApp, |
Handle(TDocStd_Document)& | aStdDoc | ||
) |
theApp | application |
aStdDoc | OCAF document |
|
virtual |
|
protectedvirtual |
true
if transaction is aborted successfully Reimplemented from SUIT_Study.
References SUIT_Study::update().
|
protected |
bool CAF_Study::canRedo | ( | ) | const |
true
if redo is avaiable bool CAF_Study::canUndo | ( | ) | const |
true
if undo is avaiable void CAF_Study::clearModified | ( | ) |
References myModifiedCnt.
|
virtual |
permanently | if true , a document is closed permanently |
Reimplemented from SUIT_Study.
References app, SUIT_Study::closeDocument(), Handle(), and stdApp.
|
protectedvirtual |
true
if transaction is committed successfully Reimplemented from SUIT_Study.
References canUndo(), Handle(), and CAF_Tools::toExtString().
|
virtual |
doc | study name |
true
on success and false
on error Reimplemented from SUIT_Study.
References app, cafApplication(), and SUIT_Study::createDocument().
void CAF_Study::doModified | ( | bool | undoable = true | ) |
If undoable is true
, this modification can be rolled back by undoModified(), otherwise the document will be marked as modified
until it is saved.
undoable | if true the operation is undoable |
References myModifiedCnt.
CAF_Study::Handle | ( | TDocStd_Document | ) | const |
|
protected |
|
private |
|
protectedvirtual |
true
if there is opened OCAF transaction Reimplemented from SUIT_Study.
|
virtual |
true
if the document has been modified Reimplemented from SUIT_Study.
References myModifiedCnt.
|
virtual |
true
if the document has been saved to file Reimplemented from SUIT_Study.
|
virtual |
fname | study file name |
true
on success and false
if document cannot be opened Reimplemented from SUIT_Study.
References app, Handle(), SUIT_Study::openDocument(), stdApp, and CAF_Tools::toExtString().
|
protectedvirtual |
true
if transaction is opened successfully Reimplemented from SUIT_Study.
bool CAF_Study::redo | ( | ) |
true
on success and false
on error References SUIT_Study::application(), SUIT_MessageBox::critical(), and doModified().
QStringList CAF_Study::redoNames | ( | ) | const |
References CAF_Tools::toQString().
|
virtual |
fname | study file name |
Reimplemented from SUIT_Study.
References app, Handle(), myModifiedCnt, SUIT_Study::saveDocumentAs(), stdApp, CAF_Tools::toExtString(), and CAF_Tools::toQString().
|
protectedvirtual |
bool CAF_Study::undo | ( | ) |
true
on success and false
on error References SUIT_Study::application(), SUIT_MessageBox::critical(), and undoModified().
void CAF_Study::undoModified | ( | ) |
References myModifiedCnt.
QStringList CAF_Study::undoNames | ( | ) | const |
References CAF_Tools::toQString().
|
friend |
|
private |