1 // Created on: 1998-05-12
2 // Created by: Isabelle GRIGNON
3 // Copyright (c) 1998-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _TDocStd_XLinkTool_HeaderFile
18 #define _TDocStd_XLinkTool_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Boolean.hxx>
26 class TDF_RelocationTable;
30 //! This tool class is used to copy the content of
31 //! source label under target label. Only child
32 //! labels and attributes of source are copied.
33 //! attributes located out of source scope are not
34 //! copied by this algorithm.
35 //! Depending of the called method an external
36 //! reference is set in the the target document to
37 //! registred the externallink.
38 //! Provide services to set, update and perform
39 //! external references.
40 //! Warning1: Nothing is provided in this class about the
41 //! opportunity to copy, set a link or update it.
42 //! Such decisions must be under application control.
43 //! Warning2: If the document manages shapes, use after copy
44 //! TNaming::ChangeShapes(target,M) to make copy of
46 class TDocStd_XLinkTool
53 Standard_EXPORT TDocStd_XLinkTool();
55 //! Copies the content of the label <fromsource> to the label <intarget>.
56 //! The link is registred with an XLink attribute by <intarget>
57 //! label. if the content of <fromsource> is not
58 //! self-contained, and/or <intarget> has already an XLink
59 //! attribute, an exception is raised.
60 Standard_EXPORT void CopyWithLink (const TDF_Label& intarget, const TDF_Label& fromsource);
62 //! Update the external reference set at <L>.
64 //! Handle(TDocStd_Document) aDoc;
66 //! (!OCAFTest::GetDocument(1,aDoc)) return 1;
67 //! Handle(TDataStd_Reference) aRef;
68 //! TDocStd_XLinkTool xlinktool;
70 //! (!OCAFTest::Find(aDoc,2),TDataStd_Reference::GetID(),aRef) return 1;
71 //! xlinktool.UpdateLink(aRef->Label());
73 //! Standard_DomainError if <L> has no XLink attribute.
74 Standard_EXPORT void UpdateLink (const TDF_Label& L);
76 //! Copy the content of <fromsource> under
77 //! <intarget>. Noone link is registred. noone check is done.
79 //! Handle(TDocStd_Document) DOC, XDOC;
81 //! TDocStd_XLinkTool xlinktool;
82 //! xlinktool.Copy(L,XL);
84 //! Standard_DomainError if the contents of
85 //! fromsource are not entirely in the scope of this
86 //! label, in other words, are not self-contained.
88 //! If the document manages shapes use the next way:
89 //! TDocStd_XLinkTool xlinktool;
90 //! xlinktool.Copy(L,XL);
91 //! TopTools_DataMapOfShapeShape M;
92 //! TNaming::ChangeShapes(target,M);
93 Standard_EXPORT virtual void Copy (const TDF_Label& intarget, const TDF_Label& fromsource);
95 Standard_EXPORT Standard_Boolean IsDone() const;
97 Standard_EXPORT Handle(TDF_DataSet) DataSet() const;
99 Standard_EXPORT Handle(TDF_RelocationTable) RelocationTable() const;
108 Standard_Boolean isDone;
115 Handle(TDF_DataSet) myDS;
116 Handle(TDF_RelocationTable) myRT;
127 #endif // _TDocStd_XLinkTool_HeaderFile