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 ---XLinkToolright: Matra Datavision 1998
20 class XLinkTool from TDocStd
22 ---Purpose: This tool class is used to copy the content of
23 -- source label under target label. Only child
24 -- labels and attributes of source are copied.
25 -- attributes located out of source scope are not
26 -- copied by this algorithm.
27 -- Depending of the called method an external
28 -- reference is set in the the target document to
29 -- registred the externallink.
30 -- Provide services to set, update and perform
31 -- external references.
32 -- Warning1: Nothing is provided in this class about the
33 -- opportunity to copy, set a link or update it.
34 -- Such decisions must be under application control.
35 -- Warning2: If the document manages shapes, use after copy
36 -- TNaming::ChangeShapes(target,M) to make copy of
42 RelocationTable from TDF,
48 returns XLinkTool from TDocStd;
50 CopyWithLink (me : in out; intarget : Label from TDF;
51 fromsource : Label from TDF);
52 ---Purpose: Copies the content of the label <fromsource> to the label <intarget>.
53 -- The link is registred with an XLink attribute by <intarget>
54 -- label. if the content of <fromsource> is not
55 -- self-contained, and/or <intarget> has already an XLink
56 -- attribute, an exception is raised.
58 UpdateLink (me : in out; L : Label);
59 ---Purpose: Update the external reference set at <L>.
61 -- Handle(TDocStd_Document) aDoc;
63 -- (!OCAFTest::GetDocument(1,aDoc)) return 1;
64 -- Handle(TDataStd_Reference) aRef;
65 -- TDocStd_XLinkTool xlinktool;
67 -- (!OCAFTest::Find(aDoc,2),TDataStd_Reference::GetID(),aRef) return 1;
68 -- xlinktool.UpdateLink(aRef->Label());
70 -- Standard_DomainError if <L> has no XLink attribute.
72 Copy (me : in out; intarget : Label from TDF;
73 fromsource : Label from TDF) is virtual;
74 ---Purpose: Copy the content of <fromsource> under
75 -- <intarget>. Noone link is registred. noone check is done.
77 -- Handle(TDocStd_Document) DOC, XDOC;
79 -- TDocStd_XLinkTool xlinktool;
80 -- xlinktool.Copy(L,XL);
82 -- Standard_DomainError if the contents of
83 -- fromsource are not entirely in the scope of this
84 -- label, in other words, are not self-contained.
86 -- If the document manages shapes use the next way:
87 -- TDocStd_XLinkTool xlinktool;
88 -- xlinktool.Copy(L,XL);
89 -- TopTools_DataMapOfShapeShape M;
90 -- TNaming::ChangeShapes(target,M);
93 returns Boolean from Standard;
96 returns DataSet from TDF;
99 returns RelocationTable from TDF;
103 isDone : Boolean from Standard is protected;
104 myDS : DataSet from TDF;
105 myRT : RelocationTable from TDF;