Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/gui.git] / src / LightApp / LightApp_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 LIGHTAPP_STUDY_H
20 #define LIGHTAPP_STUDY_H
21
22 #include <LightApp.h>
23 #include <LightApp_Driver.h>
24
25 #include <CAM_Study.h>
26 #include <CAM_DataModel.h>
27 #include <SUIT_Study.h>
28
29 #include "string"
30 #include "vector"
31
32 class SUIT_Application;
33 class CAM_DataModel;
34
35 /*!
36   Custom study, using for open/close of documents HDF format.
37   Data of each module can be saved to different files, those 
38   after that are combined into one HDF file
39 */
40 class LIGHTAPP_EXPORT LightApp_Study : public CAM_Study
41 {
42   Q_OBJECT
43
44 public:
45   LightApp_Study( SUIT_Application* );
46   virtual ~LightApp_Study();
47
48   virtual void        createDocument();
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        isSaved()  const;
58   virtual bool        isModified() const;
59
60   virtual void        addComponent   ( const CAM_DataModel* dm);
61
62   virtual std::string GetTmpDir      ( const char* theURL, const bool  isMultiFile );
63
64   virtual QString     componentDataType( const QString& ) const;
65   virtual QString     referencedToEntry( const QString& ) const;
66   virtual bool        isComponent( const QString& ) const;
67   virtual void        children( const QString&, QStringList& ) const;
68   virtual void        components( QStringList& ) const;
69
70 protected:
71   virtual void        saveModuleData ( QString theModuleName, QStringList theListOfFiles );
72   virtual void        openModuleData ( QString theModuleName, QStringList& theListOfFiles );
73   virtual bool        saveStudyData  ( const QString& theFileName );
74   virtual bool        openStudyData  ( const QString& theFileName );
75
76   virtual std::vector<std::string> GetListOfFiles ( const char* theModuleName ) const;
77   virtual void        SetListOfFiles ( const char* theModuleName,
78                                        const std::vector<std::string> theListOfFiles );
79
80   virtual void        RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile ) const;
81
82 protected:
83   virtual bool        openDataModel  ( const QString&, CAM_DataModel* );
84
85 signals:
86   void                saved  ( SUIT_Study* );
87   void                opened ( SUIT_Study* );
88   void                closed ( SUIT_Study* );
89   void                created( SUIT_Study* );
90
91
92 private:
93   LightApp_Driver*    myDriver;
94
95   friend class LightApp_Application;
96 };
97
98 #endif