2 // File : QAD_Operation.cxx
3 // Created : UI team, 22.09.00
4 // Descrip : Base class for operations in QAD-based application
8 // Copyright : Open CASCADE 2001
12 \class QAD_Operation QAD_Operation.h
13 \brief Base class for OCAF operations in QAD-based application.
17 #include "QAD_Operation.h"
18 #include "QAD_Study.h"
19 #include "QAD_Application.h"
22 #include <qapplication.h>
27 QAD_Operation::QAD_Operation (QAD_Study* doc) :
30 /* this class is useless without valid doc */
31 QAD_ASSERT_DEBUG_ONLY( myDoc );
37 QAD_Operation::~QAD_Operation ()
42 Returns reference to the document
44 QAD_Study* QAD_Operation::getDoc() const
50 Returns reference to the application
52 QAD_Application* QAD_Operation::getApp() const
54 return myDoc->getApp();
58 Checks compatibility with the other launched operations.
59 Returns \true if appointed operation can be performed.
60 By default returns \false for all operations.
62 bool QAD_Operation::compatibleWith( QAD_Operation* op ) const
68 Returns true if operation can be aborted by pressing "Escape" key
71 bool QAD_Operation::supportCancelByEscape() const
77 Returns true if operation changes document data. In this case it won't be
78 launched if document is opened as "read only". Value by default is true.
80 bool QAD_Operation::changesData() const
86 Starts this operation.
88 bool QAD_Operation::start()
90 /* open transaction */
91 if ( !myDoc->onOperationStarted( this ) )
100 Called after operation started. Does nothing by default.
101 Override to set a desired behaviour.
103 void QAD_Operation::onStartOperation()
110 void QAD_Operation::finish()
112 QApplication::setOverrideCursor( Qt::waitCursor );
114 onFinishOperation(); /* customization */
115 myDoc->onOperationFinished( this ); /* close transaction */
117 QApplication::restoreOverrideCursor();
121 Called after operation finished. Does nothing by default.
122 Override to set a desired behaviour.
124 void QAD_Operation::onFinishOperation()
129 Suspends operation process when the document is deactivated.
131 void QAD_Operation::suspend()
133 onSuspendOperation(); /* customization */
134 myDoc->onOperationSuspended( this ); /* notification */
138 Called after operation suspended. Does nothing by default.
139 Override to set a desired behaviour.
141 void QAD_Operation::onSuspendOperation()
146 Resumes operation performing process when the document became active
147 (if the operation wasn't aborted earlier).
149 void QAD_Operation::resume()
151 onResumeOperation(); /* customization */
152 myDoc->onOperationResumed( this ); /* notification */
156 Called after operation resumed. Does nothing by default.
157 Override to set a desired behaviour.
159 void QAD_Operation::onResumeOperation()
164 Cancels operation performing process without ending.
166 void QAD_Operation::abort()
168 QApplication::setOverrideCursor( Qt::waitCursor );
170 onAbortOperation(); /* customization */
171 myDoc->onOperationAborted( this ); /* abort transaction */
173 QApplication::restoreOverrideCursor();
177 Called after operation aborted. Does nothing by default.
178 Override to set a desired behaviour.
180 void QAD_Operation::onAbortOperation()