Salome HOME
fe47c5b0b9909b4c5538e955433c2ea9d707d38a
[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 class CAF_EXPORT CAF_Study : public SUIT_Study
38 {
39   Q_OBJECT
40
41 public:
42         CAF_Study( SUIT_Application* theApp );
43         CAF_Study( SUIT_Application* theApp, Handle(TDocStd_Document)& aStdDoc );
44         virtual ~CAF_Study();
45
46   virtual void                createDocument();
47   virtual void                closeDocument( bool = true );
48   virtual bool                openDocument( const QString& );
49
50   virtual bool                saveDocumentAs( const QString& );
51
52   bool                        isSaved() const;
53         bool                        isModified() const;
54         void                        doModified( bool = true );
55         void                        undoModified();
56         void                        clearModified();
57
58   bool                        undo();
59         bool                        redo();
60         bool                        canUndo() const;
61         bool                        canRedo() const;
62         QStringList                 undoNames() const;
63         QStringList                 redoNames() const;
64
65   Handle(TDocStd_Document)    stdDoc() const;
66
67 protected:
68   Handle(TDocStd_Application) stdApp() const;
69   CAF_Application*            cafApplication() const;
70
71   virtual bool                openTransaction();
72   virtual bool                abortTransaction();
73   virtual bool                hasTransaction() const;
74   virtual bool                commitTransaction( const QString& = QString::null );
75
76   virtual void                setStdDoc( Handle(TDocStd_Document)& );
77
78 private:
79         Handle(TDocStd_Document)    myStdDoc;
80         int                         myModifiedCnt;
81
82   friend class CAF_Operation;
83 };
84
85 #if defined WNT
86 #pragma warning ( default: 4251 )
87 #endif
88
89 #endif