Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[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.salome-platform.org/ or email : webmaster.salome@opencascade.com
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 <LightApp_DataModel.h>
34
35 class CAM_Module;
36 class LightApp_Study;
37 class LightApp_DataObject;
38 class LIGHTGUI_DataObject;
39
40 class LIGHTGUI_DataModel : public LightApp_DataModel
41 {
42   Q_OBJECT
43
44 public:
45   LIGHTGUI_DataModel ( CAM_Module* theModule );
46   virtual ~LIGHTGUI_DataModel();
47
48   virtual bool         open   ( const QString&, CAM_Study*, QStringList );
49   virtual bool         save   ( QStringList& );
50   virtual bool         saveAs ( const QString&, CAM_Study*, QStringList& );
51   virtual bool         close  ();
52   virtual bool         create ( CAM_Study* );
53
54   virtual bool         isModified () const;
55   virtual bool         isSaved    () const;
56
57   virtual void         update ( LightApp_DataObject* = 0, LightApp_Study* = 0 );
58
59   bool                 loadFile ( const QString&, CAM_Study* study = 0 );
60   bool                 dumpFile ( const QString& = QString::null );
61   QString              fileName () const;
62
63   QString              getLineText      ( const int thePosition ) const;
64   bool                 setLineText      ( const int thePosition, const QString& theText );
65   bool                 insertLineBefore ( const int thePosition, const QString& theText );
66   bool                 deleteTextLine   ( const int thePosition );
67
68   void                 clearAll ();
69
70 private:
71   void                 buildTree  ( SUIT_DataObject*, const QStringList& );
72   LIGHTGUI_DataObject* findObject ( const int ) const;
73
74 private:
75   QString              myFileName;
76   QString              myStudyURL;
77 };
78
79 #endif // LIGHTGUI_DATAMODEL_H