]> SALOME platform Git repositories - modules/shaper.git/blob - src/Model/Model_Document.hxx
Salome HOME
9fdab8ad3e18dc25d209084f98718fdec8b6cdd6
[modules/shaper.git] / src / Model / Model_Document.hxx
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.hxx>
10 #include <ModelAPI_Document.hxx>
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   //! Creates new document by the format string of a storage
31   Model_Document(const TCollection_ExtendedString& theStorageFormat);
32   //! Deletes all high-level data, managed this document
33   ~Model_Document();
34
35   //! Loads the OCAF document from the file.
36   //! \param theFileName full name of the file to load
37   //! \param theStudyID identifier of the SALOME study to associate with loaded file
38   //! \returns true if file was loaded successfully
39   MODEL_EXPORT bool Load(const char* theFileName);
40
41   //! Saves the OCAF document to the file.
42   //! \param theFileName full name of the file to store
43   //! \returns true if file was stored successfully
44   MODEL_EXPORT bool Save(const char* theFileName);
45
46   //! Removes document data
47   MODEL_EXPORT void Close();
48
49   //! Starts a new operation (opens a tansaction)
50   MODEL_EXPORT void StartOperation();
51   //! Finishes the previously started operation (closes the transaction)
52   MODEL_EXPORT void FinishOperation();
53   //! Aborts the operation 
54   MODEL_EXPORT void AbortOperation();
55   //! Returns true if operation has been started, but not yet finished or aborted
56   MODEL_EXPORT bool IsOperation();
57   //! Returns true if document was modified (since creation/opening)
58   MODEL_EXPORT bool IsModified();
59
60   //! Returns True if there are available Undos
61   MODEL_EXPORT bool CanUndo();
62   //! Undoes last operation
63   MODEL_EXPORT void Undo();
64   //! Returns True if there are available Redos
65   MODEL_EXPORT bool CanRedo();
66   //! Redoes last operation
67   MODEL_EXPORT void Redo();
68
69 protected:
70
71 private:
72   int myTransactionsAfterSave; ///< number of transactions after the last "save" call, used for "IsModified" method
73 };
74
75 // Define handle class 
76 DEFINE_STANDARD_HANDLE(Model_Document, TDocStd_Document)
77
78 #endif