1 // File: ModelAPI_Document.cxx
2 // Created: 28 Feb 2014
3 // Author: Mikhail PONIKAROV
5 #ifndef ModelAPI_Document_HeaderFile
6 #define ModelAPI_Document_HeaderFile
9 #include <boost/shared_ptr.hpp>
11 class ModelAPI_Feature;
13 /**\class Model_Document
15 * \brief Document for internal data structure of any object storage. Corresponds to the SALOME study.
16 * Document contains all data of te SALOME Study specific to this module
17 * that must be written into the HDF file.
18 * Also it provides acces to this data: open/save, transactions management etc.
19 * to provide access to all stored data.
22 class ModelAPI_Document
26 //! Loads the OCAF document from the file.
27 //! \param theFileName full name of the file to load
28 //! \param theStudyID identifier of the SALOME study to associate with loaded file
29 //! \returns true if file was loaded successfully
30 MODELAPI_EXPORT virtual bool Load(const char* theFileName) = 0;
32 //! Saves the OCAF document to the file.
33 //! \param theFileName full name of the file to store
34 //! \returns true if file was stored successfully
35 MODELAPI_EXPORT virtual bool Save(const char* theFileName) = 0;
37 //! Removes document data
38 MODELAPI_EXPORT virtual void Close() = 0;
40 //! Starts a new operation (opens a tansaction)
41 MODELAPI_EXPORT virtual void StartOperation() = 0;
42 //! Finishes the previously started operation (closes the transaction)
43 MODELAPI_EXPORT virtual void FinishOperation() = 0;
44 //! Aborts the operation
45 MODELAPI_EXPORT virtual void AbortOperation() = 0;
46 //! Returns true if operation has been started, but not yet finished or aborted
47 MODELAPI_EXPORT virtual bool IsOperation() = 0;
48 //! Returns true if document was modified (since creation/opening)
49 MODELAPI_EXPORT virtual bool IsModified() = 0;
51 //! Returns True if there are available Undos
52 MODELAPI_EXPORT virtual bool CanUndo() = 0;
53 //! Undoes last operation
54 MODELAPI_EXPORT virtual void Undo() = 0;
55 //! Returns True if there are available Redos
56 MODELAPI_EXPORT virtual bool CanRedo() = 0;
57 //! Redoes last operation
58 MODELAPI_EXPORT virtual void Redo() = 0;
60 //! Adds to the document the new object of the given group id
61 //! \param theFeature a feature object that will be connected to the document in this method
62 //! \param theGroupID identifier of the groups of objects (must be greater than zero)
63 MODELAPI_EXPORT virtual void AddObject(boost::shared_ptr<ModelAPI_Feature> theFeature,
64 const int theGroupID) = 0;
67 /// Only for SWIG wrapping it is here
68 MODELAPI_EXPORT ModelAPI_Document()