0024023: Revamp the OCCT Handle -- general
[occt.git] / src / TDocStd / TDocStd_XLinkTool.cdl
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
5 --
6 -- This file is part of Open CASCADE Technology software library.
7 --
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.
13 --
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
16
17 ---XLinkToolright:       Matra Datavision 1998
18
19
20 class XLinkTool from TDocStd
21
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 
37         --            shapes.
38
39 uses Label from TDF,
40      LabelMap from TDF,
41      IDFilter from TDF,
42      RelocationTable from TDF,
43      DataSet from TDF
44
45 is
46
47     Create 
48     returns XLinkTool from TDocStd;
49
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.
57    
58     UpdateLink (me : in out; L : Label);
59         ---Purpose: Update the external reference set   at <L>.
60         --    Example
61         -- Handle(TDocStd_Document) aDoc;
62         -- if
63         -- (!OCAFTest::GetDocument(1,aDoc)) return 1;
64         -- Handle(TDataStd_Reference) aRef;
65         -- TDocStd_XLinkTool xlinktool;
66         -- if
67         -- (!OCAFTest::Find(aDoc,2),TDataStd_Reference::GetID(),aRef) return 1;
68         -- xlinktool.UpdateLink(aRef->Label());
69         -- Exceptions
70         -- Standard_DomainError if <L> has no XLink attribute.
71
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.
76         -- Example
77         --  Handle(TDocStd_Document) DOC, XDOC;
78         --  TDF_Label L, XL;
79         -- TDocStd_XLinkTool xlinktool;
80         --  xlinktool.Copy(L,XL);
81         -- Exceptions:
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. 
85         -- !!! ==> Warning: 
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);
91      
92     IsDone (me)
93     returns Boolean from Standard;
94
95     DataSet (me)
96     returns DataSet from TDF;
97
98     RelocationTable (me)
99     returns RelocationTable from TDF;
100
101 fields
102
103     isDone : Boolean         from Standard is protected;
104     myDS   : DataSet         from TDF;
105     myRT   : RelocationTable from TDF;
106
107 end XLinkTool;