1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : SALOMEDSImpl_StudyBuilder.hxx
21 // Author : Sergey RUIN
24 #ifndef __SALOMEDSImpl_STUDYBUILDER_H__
25 #define __SALOMEDSImpl_STUDYBUILDER_H__
28 #include <Handle_MMgt_TShared.hxx>
29 #include <Standard_DefineHandle.hxx>
30 DEFINE_STANDARD_HANDLE( SALOMEDSImpl_StudyBuilder, MMgt_TShared )
36 #include <TCollection_AsciiString.hxx>
37 #include <TDocStd_Document.hxx>
39 #include "SALOMEDSImpl_Callback.hxx"
40 #include "SALOMEDSImpl_Driver.hxx"
42 class SALOMEDSImpl_StudyBuilder : public MMgt_TShared
45 Handle(TDocStd_Document) _doc;
46 Handle(Standard_Transient) _study;
47 Handle(SALOMEDSImpl_Callback) _callbackOnAdd;
48 Handle(SALOMEDSImpl_Callback) _callbackOnRemove;
49 TCollection_AsciiString _errorCode;
53 Standard_EXPORT SALOMEDSImpl_StudyBuilder(const Handle(Standard_Transient)& theOwner);
55 Standard_EXPORT ~SALOMEDSImpl_StudyBuilder();
57 Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) NewComponent(const TCollection_AsciiString& ComponentDataType);
59 Standard_EXPORT virtual bool DefineComponentInstance (const Handle(SALOMEDSImpl_SComponent)&, const TCollection_AsciiString& ComponentIOR);
61 Standard_EXPORT virtual bool RemoveComponent(const Handle(SALOMEDSImpl_SComponent)& aComponent);
63 Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) NewObject(const Handle(SALOMEDSImpl_SObject)& theFatherObject);
65 Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) NewObjectToTag(const Handle(SALOMEDSImpl_SObject)& theFatherObject,
68 //! The methods adds a new subdirectory, the path can be absolute or relative (then the current context is used)
69 Standard_EXPORT virtual bool AddDirectory(const TCollection_AsciiString& thePath);
71 Standard_EXPORT virtual bool LoadWith(const Handle(SALOMEDSImpl_SComponent)& sco, SALOMEDSImpl_Driver* Engine);
72 Standard_EXPORT virtual bool Load(const Handle(SALOMEDSImpl_SObject)& sco);
74 Standard_EXPORT virtual bool RemoveObject(const Handle(SALOMEDSImpl_SObject)& anObject);
75 Standard_EXPORT virtual bool RemoveObjectWithChildren(const Handle(SALOMEDSImpl_SObject)& anObject);
77 Standard_EXPORT virtual Handle(TDF_Attribute) FindOrCreateAttribute(const Handle(SALOMEDSImpl_SObject)& anObject,
78 const TCollection_AsciiString& aTypeOfAttribute);
79 Standard_EXPORT virtual bool FindAttribute(const Handle(SALOMEDSImpl_SObject)& anObject,
80 Handle(TDF_Attribute)& anAttribute,
81 const TCollection_AsciiString& aTypeOfAttribute);
83 Standard_EXPORT virtual bool RemoveAttribute(const Handle(SALOMEDSImpl_SObject)& anObject, const TCollection_AsciiString& aTypeOfAttribute);
85 Standard_EXPORT virtual bool Addreference(const Handle(SALOMEDSImpl_SObject)& me,
86 const Handle(SALOMEDSImpl_SObject)& thereferencedObject);
88 Standard_EXPORT virtual bool RemoveReference(const Handle(SALOMEDSImpl_SObject)& me);
90 Standard_EXPORT virtual bool SetGUID(const Handle(SALOMEDSImpl_SObject)& anObject, const TCollection_AsciiString& theGUID);
91 Standard_EXPORT virtual bool IsGUID(const Handle(SALOMEDSImpl_SObject)& anObject, const TCollection_AsciiString& theGUID);
93 Standard_EXPORT virtual void NewCommand();
94 Standard_EXPORT virtual void CommitCommand();
95 Standard_EXPORT virtual bool HasOpenCommand();
96 Standard_EXPORT virtual void AbortCommand();
97 Standard_EXPORT virtual void Undo();
98 Standard_EXPORT virtual void Redo();
99 Standard_EXPORT bool GetAvailableUndos();
100 Standard_EXPORT bool GetAvailableRedos();
101 Standard_EXPORT bool IsSaved();
102 Standard_EXPORT bool IsModified();
103 Standard_EXPORT virtual int UndoLimit();
104 Standard_EXPORT virtual void UndoLimit(const int);
106 Standard_EXPORT void CheckLocked();
108 Standard_EXPORT virtual Handle(SALOMEDSImpl_Callback) SetOnAddSObject(const Handle(SALOMEDSImpl_Callback)& theCallback);
109 Standard_EXPORT virtual Handle(SALOMEDSImpl_Callback) SetOnRemoveSObject(const Handle(SALOMEDSImpl_Callback)& theCallback);
111 Standard_EXPORT virtual bool SetName(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue);
113 Standard_EXPORT virtual bool SetComment(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue);
115 Standard_EXPORT virtual bool SetIOR(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue);
117 Standard_EXPORT virtual TCollection_AsciiString GetErrorCode() { return _errorCode; }
118 Standard_EXPORT virtual bool IsError() { return _errorCode != ""; }
120 Standard_EXPORT virtual Handle(Standard_Transient) GetOwner() { return _study; }
123 DEFINE_STANDARD_RTTI( SALOMEDSImpl_StudyBuilder )