1 // File : SALOMEDSImpl_StudyBuilder.hxx
2 // Author : Sergey RUIN
5 #ifndef __SALOMEDSImpl_STUDYBUILDER_H__
6 #define __SALOMEDSImpl_STUDYBUILDER_H__
9 #include <Handle_MMgt_TShared.hxx>
10 #include <Standard_DefineHandle.hxx>
11 DEFINE_STANDARD_HANDLE( SALOMEDSImpl_StudyBuilder, MMgt_TShared )
17 #include <TCollection_AsciiString.hxx>
18 #include <TDocStd_Document.hxx>
20 #include "SALOMEDSImpl_Callback.hxx"
21 #include "SALOMEDSImpl_Driver.hxx"
23 class SALOMEDSImpl_StudyBuilder : public MMgt_TShared
26 Handle(TDocStd_Document) _doc;
27 Handle(Standard_Transient) _study;
28 Handle(SALOMEDSImpl_Callback) _callbackOnAdd;
29 Handle(SALOMEDSImpl_Callback) _callbackOnRemove;
30 TCollection_AsciiString _errorCode;
34 Standard_EXPORT SALOMEDSImpl_StudyBuilder(const Handle(Standard_Transient)& theOwner);
36 Standard_EXPORT ~SALOMEDSImpl_StudyBuilder();
38 Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) NewComponent(const TCollection_AsciiString& ComponentDataType);
40 Standard_EXPORT virtual bool DefineComponentInstance (const Handle(SALOMEDSImpl_SComponent)&, const TCollection_AsciiString& ComponentIOR);
42 Standard_EXPORT virtual bool RemoveComponent(const Handle(SALOMEDSImpl_SComponent)& aComponent);
44 Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) NewObject(const Handle(SALOMEDSImpl_SObject)& theFatherObject);
46 Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) NewObjectToTag(const Handle(SALOMEDSImpl_SObject)& theFatherObject,
49 //! The methods adds a new subdirectory, the path can be absolute or relative (then the current context is used)
50 Standard_EXPORT virtual bool AddDirectory(const TCollection_AsciiString& thePath);
52 Standard_EXPORT virtual bool LoadWith(const Handle(SALOMEDSImpl_SComponent)& sco, SALOMEDSImpl_Driver* Engine);
53 Standard_EXPORT virtual bool Load(const Handle(SALOMEDSImpl_SObject)& sco);
55 Standard_EXPORT virtual bool RemoveObject(const Handle(SALOMEDSImpl_SObject)& anObject);
56 Standard_EXPORT virtual bool RemoveObjectWithChildren(const Handle(SALOMEDSImpl_SObject)& anObject);
58 Standard_EXPORT virtual Handle(TDF_Attribute) FindOrCreateAttribute(const Handle(SALOMEDSImpl_SObject)& anObject,
59 const TCollection_AsciiString& aTypeOfAttribute);
60 Standard_EXPORT virtual bool FindAttribute(const Handle(SALOMEDSImpl_SObject)& anObject,
61 Handle(TDF_Attribute)& anAttribute,
62 const TCollection_AsciiString& aTypeOfAttribute);
64 Standard_EXPORT virtual bool RemoveAttribute(const Handle(SALOMEDSImpl_SObject)& anObject, const TCollection_AsciiString& aTypeOfAttribute);
66 Standard_EXPORT virtual bool Addreference(const Handle(SALOMEDSImpl_SObject)& me,
67 const Handle(SALOMEDSImpl_SObject)& thereferencedObject);
69 Standard_EXPORT virtual bool RemoveReference(const Handle(SALOMEDSImpl_SObject)& me);
71 Standard_EXPORT virtual bool SetGUID(const Handle(SALOMEDSImpl_SObject)& anObject, const TCollection_AsciiString& theGUID);
72 Standard_EXPORT virtual bool IsGUID(const Handle(SALOMEDSImpl_SObject)& anObject, const TCollection_AsciiString& theGUID);
74 Standard_EXPORT virtual void NewCommand();
75 Standard_EXPORT virtual void CommitCommand();
76 Standard_EXPORT virtual bool HasOpenCommand();
77 Standard_EXPORT virtual void AbortCommand();
78 Standard_EXPORT virtual void Undo();
79 Standard_EXPORT virtual void Redo();
80 Standard_EXPORT bool GetAvailableUndos();
81 Standard_EXPORT bool GetAvailableRedos();
82 Standard_EXPORT bool IsSaved();
83 Standard_EXPORT bool IsModified();
84 Standard_EXPORT virtual int UndoLimit();
85 Standard_EXPORT virtual void UndoLimit(const int);
87 Standard_EXPORT void CheckLocked();
89 Standard_EXPORT virtual Handle(SALOMEDSImpl_Callback) SetOnAddSObject(const Handle(SALOMEDSImpl_Callback)& theCallback);
90 Standard_EXPORT virtual Handle(SALOMEDSImpl_Callback) SetOnRemoveSObject(const Handle(SALOMEDSImpl_Callback)& theCallback);
92 Standard_EXPORT virtual bool SetName(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue);
94 Standard_EXPORT virtual bool SetComment(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue);
96 Standard_EXPORT virtual bool SetIOR(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue);
98 Standard_EXPORT virtual TCollection_AsciiString GetErrorCode() { return _errorCode; }
99 Standard_EXPORT virtual bool IsError() { return _errorCode != ""; }
101 Standard_EXPORT virtual Handle(Standard_Transient) GetOwner() { return _study; }
104 DEFINE_STANDARD_RTTI( SALOMEDSImpl_StudyBuilder )