Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/gui.git] / src / SalomeApp / SalomeApp_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/ or email : webmaster.salome@opencascade.com
18 //
19 #ifndef SALOMEAPP_STUDY_H
20 #define SALOMEAPP_STUDY_H
21
22 #include "SalomeApp.h"
23
24 #include <LightApp_Study.h>
25 #include <string>
26
27 #ifdef WIN32
28 #pragma warning( disable:4251 )
29 #endif
30
31 #include "SALOMEDSClient.hxx"
32
33 class SALOMEAPP_EXPORT SalomeApp_Study : public LightApp_Study
34 {
35   Q_OBJECT
36
37 public:
38   SalomeApp_Study( SUIT_Application* );
39   virtual ~SalomeApp_Study();
40
41   virtual int         id() const;
42
43   virtual void        createDocument();
44   virtual bool        openDocument( const QString& );
45   virtual bool        loadDocument( const QString& );
46
47   virtual bool        saveDocument();
48   virtual bool        saveDocumentAs( const QString& );
49
50   virtual void        closeDocument(bool permanently = true);
51
52   virtual bool        isSaved()  const;
53   virtual bool        isModified() const;
54   virtual void        Modified();
55
56   virtual void        addComponent   ( const CAM_DataModel* dm);
57
58   _PTR(Study)         studyDS() const;
59
60   virtual std::string GetTmpDir      ( const char* theURL, const bool  isMultiFile);
61
62   // to delete all references to object, whose have the same component
63   void                deleteReferencesTo( _PTR( SObject ) );
64
65   virtual QString     componentDataType( const QString& ) const;
66   virtual QString     referencedToEntry( const QString& ) const;
67   virtual bool        isComponent( const QString& ) const;
68   virtual void        children( const QString&, QStringList& ) const;
69   virtual void        components( QStringList& ) const;
70
71   std::vector<int>    getSavePoints();
72   void                removeSavePoint(int savePoint);
73   QString             getNameOfSavePoint(int savePoint);
74   void                setNameOfSavePoint(int savePoint, const QString& nameOfSavePoint);
75   virtual std::string getVisualComponentName();
76
77   virtual void        restoreState(int savePoint);
78
79 protected:
80   virtual void        saveModuleData ( QString theModuleName, QStringList theListOfFiles );
81   virtual void        openModuleData ( QString theModuleName, QStringList& theListOfFiles );
82   virtual bool        saveStudyData  (  const QString& theFileName );
83   virtual bool        openStudyData  ( const QString& theFileName );
84
85   virtual std::vector<std::string> GetListOfFiles ( const char* theModuleName ) const;
86   virtual void        SetListOfFiles ( const char* theModuleName,
87                                        const std::vector<std::string> theListOfFiles);
88   virtual void        RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile) const;
89
90 protected:
91   virtual void        dataModelInserted( const CAM_DataModel* );
92   virtual bool        openDataModel( const QString&, CAM_DataModel* );
93   void                setStudyDS(const _PTR(Study)& s );
94
95 protected slots:
96   virtual void        updateModelRoot( const CAM_DataModel* );
97
98 private:
99   QString             newStudyName() const;
100
101 private:
102   _PTR(Study)         myStudyDS;
103 };
104
105 #ifdef WIN32
106 #pragma warning( default:4251 )
107 #endif
108
109 #endif