]> SALOME platform Git repositories - modules/gui.git/blob - src/CAF/CAF_Study.h
Salome HOME
5fbc614e4046b6ba94b5bbb683e3e4a62f87db6f
[modules/gui.git] / src / CAF / CAF_Study.h
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
2 // 
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either 
6 // version 2.1 of the License.
7 // 
8 // This library is distributed in the hope that it will be useful 
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public  
14 // License along with this library; if not, write to the Free Software 
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/
18 //
19 #ifndef CAF_STUDY_H
20 #define CAF_STUDY_H
21
22 #include "CAF.h"
23
24 #include "SUIT_Study.h"
25
26 #include <qobject.h>
27
28 #include <TDocStd_Document.hxx>
29 #include <TDocStd_Application.hxx>
30
31 class CAF_Application;
32
33 #if defined WNT
34 #pragma warning ( disable: 4251 )
35 #endif
36
37 /*!
38   \class CAF_Study
39   Represents study for using in CAF, contains reference
40   to OCAF std document and allows to use OCAF services.
41   Provides necessary functionality for OCC transactions management.
42 */
43 class CAF_EXPORT CAF_Study : public SUIT_Study
44 {
45   Q_OBJECT
46
47 public:
48         CAF_Study( SUIT_Application* theApp );
49         CAF_Study( SUIT_Application* theApp, Handle(TDocStd_Document)& aStdDoc );
50         virtual ~CAF_Study();
51
52   virtual void                createDocument();
53   virtual void                closeDocument( bool = true );
54   virtual bool                openDocument( const QString& );
55
56   virtual bool                saveDocumentAs( const QString& );
57
58   bool                        isSaved() const;
59         bool                        isModified() const;
60         void                        doModified( bool = true );
61         void                        undoModified();
62         void                        clearModified();
63
64   bool                        undo();
65         bool                        redo();
66         bool                        canUndo() const;
67         bool                        canRedo() const;
68         QStringList                 undoNames() const;
69         QStringList                 redoNames() const;
70
71   Handle(TDocStd_Document)    stdDoc() const;
72
73 protected:
74   Handle(TDocStd_Application) stdApp() const;
75   CAF_Application*            cafApplication() const;
76
77   virtual bool                openTransaction();
78   virtual bool                abortTransaction();
79   virtual bool                hasTransaction() const;
80   virtual bool                commitTransaction( const QString& = QString::null );
81
82   virtual void                setStdDoc( Handle(TDocStd_Document)& );
83
84 private:
85         Handle(TDocStd_Document)    myStdDoc;
86         int                         myModifiedCnt;
87
88   friend class CAF_Operation;
89 };
90
91 #if defined WNT
92 #pragma warning ( default: 4251 )
93 #endif
94
95 #endif