30 #ifndef _dom2_range_h_
31 #define _dom2_range_h_
33 #include <dom/dom_doc.h>
34 #include <dom/dom_misc.h>
38 class DocumentFragment;
47 class TDEHTML_EXPORT RangeException {
49 RangeException(
unsigned short _code) { code = _code; }
50 RangeException(
const RangeException &other) { code = other.code; }
52 RangeException & operator = (
const RangeException &other)
53 { code = other.code;
return *
this; }
55 virtual ~RangeException() {}
60 enum RangeExceptionCode {
61 BAD_BOUNDARYPOINTS_ERR = 1,
62 INVALID_NODE_TYPE_ERR = 2,
63 _EXCEPTION_OFFSET = 2000,
70 class TDEHTML_EXPORT Range
72 friend class DocumentImpl;
73 friend class Document;
74 friend class RangeImpl;
77 Range(
const Document rootContainer);
78 Range(
const Range &other);
79 Range(
const Node startContainer,
const long startOffset,
const Node endContainer,
const long endOffset);
81 Range & operator = (
const Range &other);
89 Node startContainer()
const;
95 long startOffset()
const;
101 Node endContainer()
const;
107 long endOffset()
const;
113 bool collapsed()
const;
121 Node commonAncestorContainer();
144 void setStart (
const Node &refNode,
long offset );
164 void setEnd (
const Node &refNode,
long offset );
180 void setStartBefore (
const Node &refNode );
196 void setStartAfter (
const Node &refNode );
212 void setEndBefore (
const Node &refNode );
228 void setEndAfter (
const Node &refNode );
239 void collapse (
bool toStart );
255 void selectNode (
const Node &refNode );
270 void selectNodeContents (
const Node &refNode );
295 short compareBoundaryPoints ( CompareHow how,
const Range &sourceRange );
308 bool boundaryPointsValid ( );
323 void deleteContents ( );
340 DocumentFragment extractContents ( );
353 DocumentFragment cloneContents ( );
381 void insertNode (
const Node &newNode );
415 void surroundContents (
const Node &newParent );
424 Range cloneRange ( );
432 DOMString toString ( );
437 DOMString toHTML ( );
440 DocumentFragment createContextualFragment (
const DOMString &html);
457 bool isDetached()
const;
463 RangeImpl *handle()
const;
470 void throwException(
int exceptioncode)
const;
The Document Object Model (DOM) is divided into two parts, the COREDOM core DOM, specifying some core...