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);
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
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);
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);
46 //! Removes document data
47 MODEL_EXPORT void Close();
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();
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();
72 int myTransactionsAfterSave; ///< number of transactions after the last "save" call, used for "IsModified" method
75 // Define handle class
76 DEFINE_STANDARD_HANDLE(Model_Document, TDocStd_Document)