1 /*
2 * Copyright (c) 2000 World Wide Web Consortium,
3 * (Massachusetts Institute of Technology, Institut National de
4 * Recherche en Informatique et en Automatique, Keio University). All
5 * Rights Reserved. This program is distributed under the W3C's Software
6 * Intellectual Property License. This program is distributed in the
7 * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
8 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9 * PURPOSE.
10 * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
11 */
13 // File: http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/ranges.idl
15 #ifndef _RANGES_IDL_
16 #define _RANGES_IDL_
18 #include "dom.idl"
20 #pragma prefix "dom.w3c.org"
21 module ranges
22 {
24 typedef dom::Node Node;
25 typedef dom::DocumentFragment DocumentFragment;
26 typedef dom::DOMString DOMString;
28 // Introduced in DOM Level 2:
29 exception RangeException {
30 unsigned short code;
31 };
32 // RangeExceptionCode
33 const unsigned short BAD_BOUNDARYPOINTS_ERR = 1;
34 const unsigned short INVALID_NODE_TYPE_ERR = 2;
37 // Introduced in DOM Level 2:
38 interface Range {
39 readonly attribute Node startContainer;
40 // raises(dom::DOMException) on retrieval
42 readonly attribute long startOffset;
43 // raises(dom::DOMException) on retrieval
45 readonly attribute Node endContainer;
46 // raises(dom::DOMException) on retrieval
48 readonly attribute long endOffset;
49 // raises(dom::DOMException) on retrieval
51 readonly attribute boolean collapsed;
52 // raises(dom::DOMException) on retrieval
54 readonly attribute Node commonAncestorContainer;
55 // raises(dom::DOMException) on retrieval
57 void setStart(in Node refNode,
58 in long offset)
59 raises(RangeException,
60 dom::DOMException);
61 void setEnd(in Node refNode,
62 in long offset)
63 raises(RangeException,
64 dom::DOMException);
65 void setStartBefore(in Node refNode)
66 raises(RangeException,
67 dom::DOMException);
68 void setStartAfter(in Node refNode)
69 raises(RangeException,
70 dom::DOMException);
71 void setEndBefore(in Node refNode)
72 raises(RangeException,
73 dom::DOMException);
74 void setEndAfter(in Node refNode)
75 raises(RangeException,
76 dom::DOMException);
77 void collapse(in boolean toStart)
78 raises(dom::DOMException);
79 void selectNode(in Node refNode)
80 raises(RangeException,
81 dom::DOMException);
82 void selectNodeContents(in Node refNode)
83 raises(RangeException,
84 dom::DOMException);
86 // CompareHow
87 const unsigned short START_TO_START = 0;
88 const unsigned short START_TO_END = 1;
89 const unsigned short END_TO_END = 2;
90 const unsigned short END_TO_START = 3;
92 short compareBoundaryPoints(in unsigned short how,
93 in Range sourceRange)
94 raises(dom::DOMException);
95 void deleteContents()
96 raises(dom::DOMException);
97 DocumentFragment extractContents()
98 raises(dom::DOMException);
99 DocumentFragment cloneContents()
100 raises(dom::DOMException);
101 void insertNode(in Node newNode)
102 raises(dom::DOMException,
103 RangeException);
104 void surroundContents(in Node newParent)
105 raises(dom::DOMException,
106 RangeException);
107 Range cloneRange()
108 raises(dom::DOMException);
109 DOMString toString()
110 raises(dom::DOMException);
111 void detach()
112 raises(dom::DOMException);
113 };
115 // Introduced in DOM Level 2:
116 interface DocumentRange {
117 Range createRange();
118 };
119 };
121 #endif // _RANGES_IDL_