Salome HOME
58119e0e63f4c66f45bfc04893252677fd09f7fc
[modules/gui.git] / src / CAF / CAF_Study.h
1 #ifndef CAF_STUDY_H
2 #define CAF_STUDY_H
3
4 #include "CAF.h"
5
6 #include "SUIT_Study.h"
7
8 #include <qobject.h>
9
10 #include <TDocStd_Document.hxx>
11 #include <TDocStd_Application.hxx>
12
13 class CAF_Application;
14
15 #if defined WNT
16 #pragma warning ( disable: 4251 )
17 #endif
18
19 class CAF_EXPORT CAF_Study : public SUIT_Study
20 {
21   Q_OBJECT
22
23 public:
24         CAF_Study( SUIT_Application* theApp );
25         CAF_Study( SUIT_Application* theApp, Handle(TDocStd_Document)& aStdDoc );
26         virtual ~CAF_Study();
27
28   virtual void                createDocument();
29   virtual void                closeDocument( bool = true );
30   virtual bool                openDocument( const QString& );
31
32   virtual bool                saveDocumentAs( const QString& );
33
34   bool                        isSaved() const;
35         bool                        isModified() const;
36         void                        doModified( bool = true );
37         void                        undoModified();
38         void                        clearModified();
39
40   bool                        undo();
41         bool                        redo();
42         bool                        canUndo() const;
43         bool                        canRedo() const;
44         QStringList                 undoNames() const;
45         QStringList                 redoNames() const;
46
47   Handle(TDocStd_Document)    stdDoc() const;
48
49 protected:
50   Handle(TDocStd_Application) stdApp() const;
51   CAF_Application*            cafApplication() const;
52
53   virtual bool                openTransaction();
54   virtual bool                abortTransaction();
55   virtual bool                hasTransaction() const;
56   virtual bool                commitTransaction( const QString& = QString::null );
57
58   virtual void                setStdDoc( Handle(TDocStd_Document)& );
59
60 private:
61         Handle(TDocStd_Document)    myStdDoc;
62         int                         myModifiedCnt;
63
64   friend class CAF_Operation;
65 };
66
67 #if defined WNT
68 #pragma warning ( default: 4251 )
69 #endif
70
71 #endif