1 // File : SALOMEDSImpl_StudyManager.hxx
2 // Author : Sergey RUIN
5 #ifndef __SALOMEDSImpl_STUDYMANAGER_I_H__
6 #define __SALOMEDSImpl_STUDYMANAGER_I_H__
9 #include <Handle_MMgt_TShared.hxx>
10 #include <Standard_DefineHandle.hxx>
11 DEFINE_STANDARD_HANDLE( SALOMEDSImpl_StudyManager, MMgt_TShared )
17 #include "SALOMEDSImpl_OCAFApplication.hxx"
18 #include "SALOMEDSImpl_Study.hxx"
19 #include "SALOMEDSImpl_SObject.hxx"
20 #include "SALOMEDSImpl_Driver.hxx"
21 #include <TCollection_AsciiString.hxx>
22 #include <TDF_Attribute.hxx>
23 #include <TDF_Label.hxx>
24 #include <TDocStd_Document.hxx>
25 #include <TColStd_HSequenceOfTransient.hxx>
29 class SALOMEDSImpl_StudyManager : public MMgt_TShared
34 Handle (SALOMEDSImpl_OCAFApplication) _OCAFApp;
36 Handle(TDocStd_Document) _clipboard;
37 TCollection_AsciiString _errorCode;
41 //! standard constructor
42 Standard_EXPORT SALOMEDSImpl_StudyManager();
44 //! standard destructor
45 Standard_EXPORT virtual ~SALOMEDSImpl_StudyManager();
47 //! method to Create a New Study of name study_name
48 Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) NewStudy(const TCollection_AsciiString& study_name);
50 //! method to Open a Study from it's persistent reference
51 Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) Open(const TCollection_AsciiString& aStudyUrl);
53 //! method to close a Study
54 Standard_EXPORT virtual void Close(const Handle(SALOMEDSImpl_Study)& aStudy);
56 //! method to save a Study
57 Standard_EXPORT virtual bool Save(const Handle(SALOMEDSImpl_Study)& aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile);
59 Standard_EXPORT virtual bool SaveASCII(const Handle(SALOMEDSImpl_Study)& aStudy,
60 SALOMEDSImpl_DriverFactory* aFactory,
63 //! method to save a Study to the persistent reference aUrl
64 Standard_EXPORT virtual bool SaveAs(const TCollection_AsciiString& aUrl,
65 const Handle(SALOMEDSImpl_Study)& aStudy,
66 SALOMEDSImpl_DriverFactory* aFactory,
69 Standard_EXPORT virtual bool SaveAsASCII(const TCollection_AsciiString& aUrl,
70 const Handle(SALOMEDSImpl_Study)& aStudy,
71 SALOMEDSImpl_DriverFactory* aFactory,
74 //! method to Get name list of open studies in the session
75 Standard_EXPORT virtual Handle(TColStd_HSequenceOfTransient) GetOpenStudies();
77 //! method to get a Study from it's name
78 Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) GetStudyByName(const TCollection_AsciiString& aStudyName) ;
80 //! method to get a Study from it's ID
81 Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) GetStudyByID(int aStudyID) ;
84 Standard_EXPORT Handle(TDocStd_Document) GetDocumentOfStudy(const Handle(SALOMEDSImpl_Study)& theStudy);
86 Standard_EXPORT Handle(TDocStd_Document) GetClipboard() { return _clipboard; }
88 Standard_EXPORT bool CopyLabel(const Handle(SALOMEDSImpl_Study)& theSourceStudy,
89 SALOMEDSImpl_Driver* theEngine,
90 const int theSourceStartDepth,
91 const TDF_Label& theSource,
92 const TDF_Label& theDestinationMain);
94 Standard_EXPORT TDF_Label PasteLabel(const Handle(SALOMEDSImpl_Study)& theDestinationStudy,
95 SALOMEDSImpl_Driver* theEngine,
96 const TDF_Label& theSource,
97 const TDF_Label& theDestinationStart,
98 const int theCopiedStudyID,
99 const bool isFirstElement);
101 Standard_EXPORT virtual bool CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine);
102 Standard_EXPORT virtual bool Copy(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine);
103 Standard_EXPORT virtual bool CanPaste(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine);
104 Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) Paste(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine);
106 // _SaveAs private function called by Save and SaveAs
107 Standard_EXPORT virtual bool Impl_SaveAs(const TCollection_AsciiString& aUrl,
108 const Handle(SALOMEDSImpl_Study)& aStudy,
109 SALOMEDSImpl_DriverFactory* aFactory,
113 // _SaveObject private function called by _SaveAs
114 Standard_EXPORT virtual bool Impl_SaveObject(const Handle(SALOMEDSImpl_SObject)& SC, HDFgroup *hdf_group_datatype);
116 // _SubstituteSlash function called by Open and GetStudyByName
117 Standard_EXPORT virtual TCollection_AsciiString Impl_SubstituteSlash(const TCollection_AsciiString& aUrl);
119 Standard_EXPORT virtual bool Impl_SaveProperties(const Handle(SALOMEDSImpl_Study)& aStudy, HDFgroup *hdf_group);
121 Standard_EXPORT TCollection_AsciiString GetErrorCode() { return _errorCode; }
122 Standard_EXPORT virtual bool IsError() { return _errorCode != ""; }
125 DEFINE_STANDARD_RTTI( SALOMEDSImpl_StudyManager )