Salome HOME
Has functionality from SalomeApp without dependency from CORBA
[modules/gui.git] / src / LightApp / LightApp_DataModel.cxx
1 // File:      LightApp_DataModel.cxx
2 // Created:   10/25/2004 10:36:06 AM
3 // Author:    Sergey LITONIN
4 // Copyright (C) CEA 2004
5
6 #include "LightApp_DataModel.h"
7 #include "LightApp_Study.h"
8 #include "LightApp_RootObject.h"
9 #include "LightApp_Module.h"
10 #include "LightApp_Application.h"
11
12 #include <CAM_DataObject.h>
13
14 #include <SUIT_Application.h>
15 #include <SUIT_ResourceMgr.h>
16 #include <SUIT_Session.h>
17 #include <SUIT_DataObject.h>
18
19 //=======================================================================
20 // name    : LightApp_DataModel::LightApp_DataModel
21 /*!Purpose : Constructor*/
22 //=======================================================================
23 LightApp_DataModel::LightApp_DataModel( CAM_Module* theModule )
24 : CAM_DataModel( theModule )
25 {
26 }
27
28 //=======================================================================
29 // name    : LightApp_DataModel::~LightApp_DataModel
30 /*! Purpose : Destructor*/
31 //=======================================================================
32 LightApp_DataModel::~LightApp_DataModel()
33 {
34 }
35
36 //================================================================
37 // Function : open
38 /*! Purpose  : Emit opened()*/
39 //================================================================
40 bool LightApp_DataModel::open( const QString&, CAM_Study* study, QStringList )
41 {
42   emit opened(); //TODO: is it really needed? to be removed maybe...
43   return true;
44 }
45
46 //================================================================
47 // Function : save
48 /*! Purpose  : Emit saved()*/
49 //================================================================
50 bool LightApp_DataModel::save( QStringList& )
51 {
52   emit saved();
53   return true;
54 }
55
56 //================================================================
57 // Function : saveAs
58 /*! Purpose  : Emit saved()*/
59 //================================================================
60 bool LightApp_DataModel::saveAs( const QString&, CAM_Study*, QStringList& )
61 {
62   emit saved();
63   return true;
64 }
65
66 //================================================================
67 // Function : close
68 /*! Purpose  : Emit closed()*/
69 //================================================================
70 bool LightApp_DataModel::close()
71 {
72   emit closed();
73   return true;
74 }
75
76 //================================================================
77 // Function : update
78 /*! Purpose  : Update application (empty virtual function).*/
79 //================================================================
80 void LightApp_DataModel::update( LightApp_DataObject*, LightApp_Study* study )
81 {
82 }
83
84 //================================================================
85 // Function : getModule
86 /*! Purpose  : gets module*/
87 //================================================================
88
89 LightApp_Module* LightApp_DataModel::getModule() const
90 {
91   return dynamic_cast<LightApp_Module*>( module() );
92 }
93
94 //================================================================
95 // Function : getStudy
96 /*! Purpose  : gets study */
97 //================================================================
98 LightApp_Study* LightApp_DataModel::getStudy() const
99 {
100   LightApp_RootObject* aRoot = dynamic_cast<LightApp_RootObject*>( root()->root() );
101   if ( !aRoot )
102     return 0;
103   return aRoot->study();
104 }
105
106 //================================================================
107 // Function : isModified
108 /*! Purpose  : default implementation, always returns false so as not to mask study's isModified()*/
109 //================================================================
110 bool LightApp_DataModel::isModified() const
111 {
112   return false;
113 }
114
115 //================================================================
116 // Function : isSaved
117 /*! Purpose  : default implementation, always returns true so as not to mask study's isSaved()*/
118 //================================================================
119 bool LightApp_DataModel::isSaved() const
120 {
121   return true;
122 }