• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdehtml
 

tdehtml

  • tdehtml
  • dom
dom2_range.h
1 /*
2  * This file is part of the DOM implementation for KDE.
3  *
4  * (C) 1999 Lars Knoll (knoll@kde.org)
5  * (C) 2000 Gunnstein Lye (gunnstein@netcom.no)
6  * (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
7  * (C) 2001 Peter Kelly (pmk@post.com)
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Library General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Library General Public License for more details.
18  *
19  * You should have received a copy of the GNU Library General Public License
20  * along with this library; see the file COPYING.LIB. If not, write to
21  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  * Boston, MA 02110-1301, USA.
23  *
24  * This file includes excerpts from the Document Object Model (DOM)
25  * Level 2 Specification (Candidate Recommendation)
26  * http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/
27  * Copyright © 2000 W3C® (MIT, INRIA, Keio), All Rights Reserved.
28  *
29  */
30 #ifndef _dom2_range_h_
31 #define _dom2_range_h_
32 
33 #include <dom/dom_doc.h>
34 #include <dom/dom_misc.h>
35 
36 namespace DOM {
37 
38 class DocumentFragment;
39 class Node;
40 class DOMString;
41 class DocumentImpl;
42 class RangeImpl;
43 
44 class DOMException;
45 
46 // Introduced in DOM Level 2:
47 class TDEHTML_EXPORT RangeException {
48 public:
49  RangeException(unsigned short _code) { code = _code; }
50  RangeException(const RangeException &other) { code = other.code; }
51 
52  RangeException & operator = (const RangeException &other)
53  { code = other.code; return *this; }
54 
55  virtual ~RangeException() {}
60  enum RangeExceptionCode {
61  BAD_BOUNDARYPOINTS_ERR = 1,
62  INVALID_NODE_TYPE_ERR = 2,
63  _EXCEPTION_OFFSET = 2000,
64  _EXCEPTION_MAX = 2999
65  };
66  unsigned short code;
67 };
68 
69 
70 class TDEHTML_EXPORT Range
71 {
72  friend class DocumentImpl;
73  friend class Document;
74  friend class RangeImpl;
75 public:
76  Range();
77  Range(const Document rootContainer);
78  Range(const Range &other);
79  Range(const Node startContainer, const long startOffset, const Node endContainer, const long endOffset);
80 
81  Range & operator = (const Range &other);
82 
83  ~Range();
84 
89  Node startContainer() const;
90 
95  long startOffset() const;
96 
101  Node endContainer() const;
102 
107  long endOffset() const;
108 
113  bool collapsed() const;
114 
120  // ### BIC make const in the next release
121  Node commonAncestorContainer();
122 
144  void setStart ( const Node &refNode, long offset );
145 
164  void setEnd ( const Node &refNode, long offset );
165 
180  void setStartBefore ( const Node &refNode );
181 
196  void setStartAfter ( const Node &refNode );
197 
212  void setEndBefore ( const Node &refNode );
213 
228  void setEndAfter ( const Node &refNode );
229 
239  void collapse ( bool toStart );
240 
255  void selectNode ( const Node &refNode );
256 
270  void selectNodeContents ( const Node &refNode );
271 
272  enum CompareHow {
273  START_TO_START = 0,
274  START_TO_END = 1,
275  END_TO_END = 2,
276  END_TO_START = 3
277  };
278 
295  short compareBoundaryPoints ( CompareHow how, const Range &sourceRange );
296 
308  bool boundaryPointsValid ( );
309 
323  void deleteContents ( );
324 
340  DocumentFragment extractContents ( );
341 
353  DocumentFragment cloneContents ( );
354 
381  void insertNode ( const Node &newNode );
382 
415  void surroundContents ( const Node &newParent );
416 
424  Range cloneRange ( );
425 
432  DOMString toString ( );
433 
437  DOMString toHTML ( );
438 
439  /* Mozilla extension - only works for HTML documents. */
440  DocumentFragment createContextualFragment (const DOMString &html);
441 
450  void detach ( );
451 
457  bool isDetached() const;
458 
463  RangeImpl *handle() const;
464  bool isNull() const;
465 
466 protected:
467  RangeImpl *impl;
468  Range(RangeImpl *i);
469 private:
470  void throwException(int exceptioncode) const;
471 };
472 
473 } // namespace
474 
475 #endif
DOM
The Document Object Model (DOM) is divided into two parts, the COREDOM core DOM, specifying some core...
Definition: design.h:57

tdehtml

Skip menu "tdehtml"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdehtml

Skip menu "tdehtml"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdehtml by doxygen 1.9.1
This website is maintained by Timothy Pearson.