Salome HOME
Changing ".hxx" to ".h" headers files extensions
[modules/shaper.git] / src / Model / Model_Document.h
1 // File:        Model_Document.hxx
2 // Created:     28 Dec 2011
3 // Author:      Mikhail PONIKAROV
4 // Copyright:   CEA 2011
5
6 #ifndef Model_Document_HeaderFile
7 #define Model_Document_HeaderFile
8
9 #include <Model.h>
10 #include <ModelAPI_Document.h>
11 #include <TDocStd_Document.hxx>
12
13 class Handle_Model_Document;
14
15 /**\class Model_Document
16  * \ingroup DataModel
17  * \brief Document for internal data structure of any object storage. Corresponds to the SALOME study.
18  * Document contains all data of te SALOME Study specific to this module
19  * that must be written into the HDF file.
20  * Also it provides acces to this data: open/save, transactions management etc.
21  * to provide access to all stored data.
22  */
23
24 class Model_Document: public TDocStd_Document, public ModelAPI_Document
25 {
26 public:
27
28   DEFINE_STANDARD_RTTI(Model_Document)
29   ;
30
31   //! Creates new document by the format string of a storage
32   Model_Document(const TCollection_ExtendedString& theStorageFormat);
33   //! Deletes all high-level data, managed this document
34   ~Model_Document();
35
36   //! Loads the OCAF document from the file.
37   //! \param theFileName full name of the file to load
38   //! \param theStudyID identifier of the SALOME study to associate with loaded file
39   //! \returns true if file was loaded successfully
40   MODEL_EXPORT bool Load(const char* theFileName);
41
42   //! Saves the OCAF document to the file.
43   //! \param theFileName full name of the file to store
44   //! \returns true if file was stored successfully
45   MODEL_EXPORT bool Save(const char* theFileName);
46
47   //! Removes document data
48   MODEL_EXPORT void Close();
49
50   //! Starts a new operation (opens a tansaction)
51   MODEL_EXPORT void StartOperation();
52   //! Finishes the previously started operation (closes the transaction)
53   MODEL_EXPORT void FinishOperation();
54   //! Aborts the operation 
55   MODEL_EXPORT void AbortOperation();
56   //! Returns true if operation has been started, but not yet finished or aborted
57   MODEL_EXPORT bool IsOperation();
58   //! Returns true if document was modified (since creation/opening)
59   MODEL_EXPORT bool IsModified();
60
61   //! Returns True if there are available Undos
62   MODEL_EXPORT bool CanUndo();
63   //! Undoes last operation
64   MODEL_EXPORT void Undo();
65   //! Returns True if there are available Redos
66   MODEL_EXPORT bool CanRedo();
67   //! Redoes last operation
68   MODEL_EXPORT void Redo();
69
70 protected:
71
72 private:
73   int myTransactionsAfterSave; ///< number of transactions after the last "save" call, used for "IsModified" method
74 };
75
76 // Define handle class 
77 DEFINE_STANDARD_HANDLE(Model_Document, TDocStd_Document)
78
79 #endif