1 // File: Model_Document.hxx
2 // Created: 28 Dec 2011
3 // Author: Mikhail PONIKAROV
6 #ifndef Model_Document_HeaderFile
7 #define Model_Document_HeaderFile
10 #include <ModelAPI_Document.hxx>
11 #include <TDocStd_Document.hxx>
13 class Handle_Model_Document;
15 /**\class Model_Document
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.
24 class Model_Document: public TDocStd_Document, public ModelAPI_Document
28 DEFINE_STANDARD_RTTI(Model_Document)
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
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);
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);
47 //! Removes document data
48 MODEL_EXPORT void Close();
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();
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();
73 int myTransactionsAfterSave; ///< number of transactions after the last "save" call, used for "IsModified" method
76 // Define handle class
77 DEFINE_STANDARD_HANDLE(Model_Document, TDocStd_Document)