Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CAF_Study Class Reference

Represents study for using in CAF module. More...

#include <CAF_Study.h>

Inheritance diagram for CAF_Study:
Inheritance graph

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_DataObjectroot () const
 
virtual QString studyName () const
 
SUIT_Applicationapplication () const
 
virtual void Modified ()
 
bool saveDocument ()
 
virtual void update ()
 
virtual void sendChangesNotification ()
 
SUIT_OperationactiveOperation () const
 
virtual void abortAllOperations ()
 
const QList< SUIT_Operation * > & operations () const
 Get all started operations. More...
 
virtual SUIT_OperationblockingOperation (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_ApplicationcafApplication () 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 *)
 

Detailed Description

A study contains reference to OCAF std document and allows using OCAF services. Provides necessary functionality for OCC transactions management.

Constructor & Destructor Documentation

CAF_Study::CAF_Study ( SUIT_Application theApp)
Parameters
theAppapplication
CAF_Study::CAF_Study ( SUIT_Application theApp,
Handle(TDocStd_Document)&  aStdDoc 
)
Parameters
theAppapplication
aStdDocOCAF document
CAF_Study::~CAF_Study ( )
virtual

Member Function Documentation

bool CAF_Study::abortTransaction ( )
protectedvirtual
Returns
true if transaction is aborted successfully

Reimplemented from SUIT_Study.

References SUIT_Study::update().

CAF_Application * CAF_Study::cafApplication ( ) const
protected
Returns
application object (CAF_Application)
bool CAF_Study::canRedo ( ) const
Returns
true if redo is avaiable
bool CAF_Study::canUndo ( ) const
Returns
true if undo is avaiable
void CAF_Study::clearModified ( )
void CAF_Study::closeDocument ( bool  permanently = true)
virtual
Parameters
permanentlyif true, a document is closed permanently

Reimplemented from SUIT_Study.

References app, SUIT_Study::closeDocument(), Handle(), and stdApp.

bool CAF_Study::commitTransaction ( const QString &  name = QString())
protectedvirtual
Returns
true if transaction is committed successfully

Reimplemented from SUIT_Study.

References canUndo(), Handle(), and CAF_Tools::toExtString().

bool CAF_Study::createDocument ( const QString &  doc)
virtual
Parameters
docstudy name
Returns
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.

Parameters
undoableif true the operation is undoable
See Also
undoModified(), clearModified()

References myModifiedCnt.

CAF_Study::Handle ( TDocStd_Document  ) const
CAF_Study::Handle ( TDocStd_Application  ) const
protected
CAF_Study::Handle ( TDocStd_Document  )
private
bool CAF_Study::hasTransaction ( ) const
protectedvirtual
Returns
true if there is opened OCAF transaction

Reimplemented from SUIT_Study.

bool CAF_Study::isModified ( ) const
virtual
Returns
true if the document has been modified

Reimplemented from SUIT_Study.

References myModifiedCnt.

bool CAF_Study::isSaved ( ) const
virtual
Returns
true if the document has been saved to file

Reimplemented from SUIT_Study.

bool CAF_Study::openDocument ( const QString &  fname)
virtual
Parameters
fnamestudy file name
Returns
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().

bool CAF_Study::openTransaction ( )
protectedvirtual
Returns
true if transaction is opened successfully

Reimplemented from SUIT_Study.

bool CAF_Study::redo ( )
Returns
true on success and false on error

References SUIT_Study::application(), SUIT_MessageBox::critical(), and doModified().

QStringList CAF_Study::redoNames ( ) const
Returns
list of commands names

References CAF_Tools::toQString().

bool CAF_Study::saveDocumentAs ( const QString &  fname)
virtual
Parameters
fnamestudy file name

Reimplemented from SUIT_Study.

References app, Handle(), myModifiedCnt, SUIT_Study::saveDocumentAs(), stdApp, CAF_Tools::toExtString(), and CAF_Tools::toQString().

virtual void CAF_Study::setStdDoc ( Handle(TDocStd_Document)&  )
protectedvirtual
bool CAF_Study::undo ( )
Returns
true on success and false on error

References SUIT_Study::application(), SUIT_MessageBox::critical(), and undoModified().

void CAF_Study::undoModified ( )
QStringList CAF_Study::undoNames ( ) const
Returns
list of commands names

References CAF_Tools::toQString().

Friends And Related Function Documentation

friend class CAF_Operation
friend

Member Data Documentation

int CAF_Study::myModifiedCnt
private

The documentation for this class was generated from the following files: