Salome HOME
2284df8dbff6f083a71a9584c6c6bb737d19ff50
[modules/gui.git] / src / SalomeApp / SalomeApp_Study.h
1 // Copyright (C) 2007-2016  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, or (at your option) any later version.
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
23 #ifndef SALOMEAPP_STUDY_H
24 #define SALOMEAPP_STUDY_H
25
26 #include "SalomeApp.h"
27
28 #include <LightApp_Study.h>
29
30 #ifdef WIN32
31 #pragma warning( disable:4251 )
32 #endif
33
34 #include "SALOMEDSClient.hxx"
35
36 class SALOMEAPP_EXPORT SalomeApp_Study : public LightApp_Study
37 {
38   Q_OBJECT
39
40   class Observer_i;
41
42 public:
43   SalomeApp_Study( SUIT_Application* );
44   virtual ~SalomeApp_Study();
45
46   virtual QString     studyName() const;
47
48   virtual bool        createDocument( const QString& );
49   virtual bool        openDocument( const QString& );
50   virtual bool        loadDocument( const QString& );
51
52   virtual bool        saveDocument();
53   virtual bool        saveDocumentAs( const QString& );
54
55   virtual void        closeDocument(bool permanently = true);
56
57   virtual bool        dump( const QString&, bool, bool, bool );
58
59   virtual bool        isSaved()  const;
60   virtual bool        isModified() const;
61   virtual void        Modified();
62
63   virtual void        addComponent   ( const CAM_DataModel* dm);
64
65   _PTR(Study)         studyDS() const;
66
67   virtual std::string GetTmpDir      ( const char* theURL, const bool  isMultiFile);
68
69   // to delete all references to object, whose have the same component
70   void                deleteReferencesTo( _PTR( SObject ) );
71
72   virtual QString     componentDataType( const QString& ) const;
73   virtual QString     referencedToEntry( const QString& ) const;
74   virtual bool        isComponent( const QString& ) const;
75   virtual void        children( const QString&, QStringList& ) const;
76   virtual void        components( QStringList& ) const;
77   virtual QString     centry( const QString& ) const;
78
79   std::vector<int>    getSavePoints();
80   void                removeSavePoint(int savePoint);
81   QString             getNameOfSavePoint(int savePoint);
82   void                setNameOfSavePoint(int savePoint, const QString& nameOfSavePoint);
83
84   virtual void        restoreState(int savePoint);
85 #ifndef DISABLE_PYCONSOLE
86   void                updateFromNotebook(const QString&, bool);
87 #endif
88
89   virtual LightApp_DataObject* findObjectByEntry( const QString& theEntry );
90
91 protected:
92   virtual void        saveModuleData ( QString theModuleName, QStringList theListOfFiles );
93   virtual void        openModuleData ( QString theModuleName, QStringList& theListOfFiles );
94   virtual bool        saveStudyData  (  const QString& theFileName );
95   virtual bool        openStudyData  ( const QString& theFileName );
96
97   virtual std::vector<std::string> GetListOfFiles ( const char* theModuleName ) const;
98   virtual void        SetListOfFiles ( const char* theModuleName,
99                                        const std::vector<std::string> theListOfFiles);
100   virtual void        RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile) const;
101
102 protected:
103   virtual void        dataModelInserted( const CAM_DataModel* );
104   virtual bool        openDataModel( const QString&, CAM_DataModel* );
105
106   virtual CAM_ModuleObject* createModuleObject( LightApp_DataModel* theDataModel, 
107                                                 SUIT_DataObject* theParent ) const;
108 protected slots:
109   virtual void        updateModelRoot( const CAM_DataModel* );
110 #ifndef DISABLE_PYCONSOLE
111   void                onNoteBookVarUpdate( QString theVarName );
112 #endif
113
114 private:
115   _PTR(Study)         myStudyDS;
116   Observer_i*         myObserver;
117
118 #ifndef DISABLE_PYCONSOLE
119  signals:
120   void                notebookVarUpdated( QString theVarName );
121 #endif
122 };
123
124 #ifdef WIN32
125 #pragma warning( default:4251 )
126 #endif
127
128 #endif