Salome HOME
Base implementation of Notebook
[modules/kernel.git] / src / DF / DF_Document.hxx
1 //  Copyright (C) 2007-2008  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.
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 #ifndef DFDOCUMENT_HXX
23 #define DFDOCUMENT_HXX
24
25 #include "DF_definitions.hxx"
26 #include "DF_Label.hxx"
27
28 #include <string>
29
30 class DF_Application;
31
32 //Class DF_Document is container for user's data stored as a tree of Labels
33 //with assigned Attributes
34 class DF_Document {
35 public:
36   //Constructor
37   Standard_EXPORT DF_Document(const std::string& theDocumentType);
38
39   Standard_EXPORT ~DF_Document();
40
41   Standard_EXPORT DF_Application* GetApplication();    
42
43   //Returns a Label of this Document with entry "0:1"
44   Standard_EXPORT DF_Label Main();
45
46   //Returns a root Label with entry "0:"
47   Standard_EXPORT DF_Label Root();
48
49   //Returns an ID of this 
50   Standard_EXPORT int GetDocumentID() const;
51
52   //Returns a type of the Document
53   Standard_EXPORT std::string GetDocumentType();
54
55   //Clears the content of this Document
56   Standard_EXPORT void Clear();
57
58   //Returns true if this document is empty
59   Standard_EXPORT bool IsEmpty();
60
61   //Returns true if this document is modified
62   Standard_EXPORT bool IsModified();
63
64   //Returns true if this document is modified
65   Standard_EXPORT void SetModified(bool isModified); 
66
67   //########### Load/Save virtual methods ##
68
69   //Restores a content of the Document from the std::string theData
70   Standard_EXPORT virtual void Load(const std::string& theData);
71
72   //Converts a content of the Document into the std::string
73   Standard_EXPORT virtual std::string Save();
74
75   friend class DF_Application;
76
77 private:
78   DF_Label    _main;
79   DF_Label    _root;
80   std::string _type;
81   int         _id;
82   bool        _modified;
83   DF_Application* _appli;
84 };
85
86 #endif