Salome HOME
Preparation of 3.1.0a2 - come back old implementation
[samples/light.git] / src / LIGHTGUI / LIGHTGUI_DataModel.h
1 //  LIGHT : sample (no-corba-engine) SALOME module
2 //
3 //  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
21 //
22 //  Author : Julia DOROVSKIKH
23 //  Date   : 01/01/2005
24 //  $Header$
25
26 #ifndef LIGHTGUI_DATAMODEL_H
27 #define LIGHTGUI_DATAMODEL_H
28
29 #if _MSC_VER > 1000
30 #pragma once
31 #endif // _MSC_VER > 1000
32
33 #include <SalomeApp_DataModel.h>
34
35 class CAM_Module;
36 class SalomeApp_Study;
37 class LIGHTGUI_DataObject;
38
39 class LIGHTGUI_DataModel : public SalomeApp_DataModel
40 {
41   Q_OBJECT
42
43 public:
44   LIGHTGUI_DataModel ( CAM_Module* theModule );
45   virtual ~LIGHTGUI_DataModel();
46
47   virtual bool         open   ( const QString&, CAM_Study* );
48   virtual bool         save   ();
49   virtual bool         saveAs ( const QString&, CAM_Study* );
50   virtual bool         close  ();
51   virtual bool         create ( CAM_Study* );
52
53   virtual bool         isModified () const;
54   virtual bool         isSaved    () const;
55
56   virtual void         update ( SalomeApp_DataObject* = 0, SalomeApp_Study* = 0 );
57
58   bool                 loadFile ( const QString&, CAM_Study* study = 0 );
59   bool                 dumpFile ( const QString& = QString::null );
60   QString              fileName () const;
61
62   QString              getLineText      ( const int thePosition ) const;
63   bool                 setLineText      ( const int thePosition, const QString& theText );
64   bool                 insertLineBefore ( const int thePosition, const QString& theText );
65   bool                 deleteTextLine   ( const int thePosition );
66
67   void                 clearAll ();
68
69 private:
70   void                 buildTree  ( SUIT_DataObject*, const QStringList& );
71   LIGHTGUI_DataObject* findObject ( const int ) const;
72
73 private:
74   QString              myFileName;
75   QString              myStudyURL;
76 };
77
78 #endif // LIGHTGUI_DATAMODEL_H