Salome HOME
Update from BR_V5_DEV 13Feb2009
[modules/gui.git] / src / SalomeApp / SalomeApp_Study.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 #ifndef SALOMEAPP_STUDY_H
23 #define SALOMEAPP_STUDY_H
24
25 #include "SalomeApp.h"
26
27 #include <LightApp_Study.h>
28
29 #ifdef WIN32
30 #pragma warning( disable:4251 )
31 #endif
32
33 #include "SALOMEDSClient.hxx"
34
35 class SALOMEAPP_EXPORT SalomeApp_Study : public LightApp_Study
36 {
37   Q_OBJECT
38
39 public:
40   SalomeApp_Study( SUIT_Application* );
41   virtual ~SalomeApp_Study();
42
43   virtual int         id() const;
44
45   virtual bool        createDocument( const QString& );
46   virtual bool        openDocument( const QString& );
47   virtual bool        loadDocument( const QString& );
48
49   virtual bool        saveDocument();
50   virtual bool        saveDocumentAs( const QString& );
51
52   virtual void        closeDocument(bool permanently = true);
53
54   virtual bool        isSaved()  const;
55   virtual bool        isModified() const;
56   virtual void        Modified();
57
58   virtual void        addComponent   ( const CAM_DataModel* dm);
59
60   _PTR(Study)         studyDS() const;
61
62   virtual std::string GetTmpDir      ( const char* theURL, const bool  isMultiFile);
63
64   // to delete all references to object, whose have the same component
65   void                deleteReferencesTo( _PTR( SObject ) );
66
67   virtual QString     componentDataType( const QString& ) const;
68   virtual QString     referencedToEntry( const QString& ) const;
69   virtual bool        isComponent( const QString& ) const;
70   virtual void        children( const QString&, QStringList& ) const;
71   virtual void        components( QStringList& ) const;
72
73   std::vector<int>    getSavePoints();
74   void                removeSavePoint(int savePoint);
75   QString             getNameOfSavePoint(int savePoint);
76   void                setNameOfSavePoint(int savePoint, const QString& nameOfSavePoint);
77   virtual std::string getVisualComponentName();
78
79   virtual void        restoreState(int savePoint);
80   void                markAsSavedIn(QString theFileName);
81
82 protected:
83   virtual void        saveModuleData ( QString theModuleName, QStringList theListOfFiles );
84   virtual void        openModuleData ( QString theModuleName, QStringList& theListOfFiles );
85   virtual bool        saveStudyData  (  const QString& theFileName );
86   virtual bool        openStudyData  ( const QString& theFileName );
87
88   virtual std::vector<std::string> GetListOfFiles ( const char* theModuleName ) const;
89   virtual void        SetListOfFiles ( const char* theModuleName,
90                                        const std::vector<std::string> theListOfFiles);
91   virtual void        RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile) const;
92
93 protected:
94   virtual void        dataModelInserted( const CAM_DataModel* );
95   virtual bool        openDataModel( const QString&, CAM_DataModel* );
96   void                setStudyDS(const _PTR(Study)& s );
97
98 protected slots:
99   virtual void        updateModelRoot( const CAM_DataModel* );
100
101 private:
102   QString             newStudyName() const;
103
104 private:
105   _PTR(Study)         myStudyDS;
106 };
107
108 #ifdef WIN32
109 #pragma warning( default:4251 )
110 #endif
111
112 #endif