dom2_range.h Source File (khtml Library)

| # khtml Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# dom2_range.h

    00001 /*
    00002  * This file is part of the DOM implementation for KDE.
    00003  *
    00004  * (C) 1999 Lars Knoll (knoll@kde.org)
    00005  * (C) 2000 Gunnstein Lye (gunnstein@netcom.no)
    00006  * (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
    00007  * (C) 2001 Peter Kelly (pmk@post.com)
    00008  *
    00009  * This library is free software; you can redistribute it and/or
    00010  * modify it under the terms of the GNU Library General Public
    00011  * License as published by the Free Software Foundation; either
    00012  * version 2 of the License, or (at your option) any later version.
    00013  *
    00014  * This library is distributed in the hope that it will be useful,
    00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00017  * Library General Public License for more details.
    00018  *
    00019  * You should have received a copy of the GNU Library General Public License
    00020  * along with this library; see the file COPYING.LIB.  If not, write to
    00021  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00022  * Boston, MA 02111-1307, USA.
    00023  *
    00024  * This file includes excerpts from the Document Object Model (DOM)
    00025  * Level 2 Specification (Candidate Recommendation)
    00026  * http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/
    00027  * Copyright © 2000 W3C® (MIT, INRIA, Keio), All Rights Reserved.
    00028  *
    00029  * $Id: dom2_range.h,v 1.18.2.1 2003/05/18 12:34:37 mueller Exp $
    00030  */
    00031 #ifndef _dom2_range_h_
    00032 #define _dom2_range_h_
    00033
    00034 #include <dom/dom_doc.h>
    00035 #include <dom/dom_misc.h>
    00036
    00037 namespace DOM {
    00038
    00039 class DocumentFragment;
    00040 class Node;
    00041 class DOMString;
    00042 class DocumentImpl;
    00043 class RangeImpl;
    00044
    00045 class DOMException;
    00046
    00047 // Introduced in DOM Level 2:
    00048 class RangeException {
    00049 public:
    00050     RangeException(unsigned short _code) { code = _code; }
    00051     RangeException(const RangeException &other) { code = other.code; }
    00052
    00053     RangeException & operator = (const RangeException &other)
    00054         { code = other.code; return *this; }
    00055
    00056     virtual ~RangeException() {}
    00061     enum RangeExceptionCode {
    00062         BAD_BOUNDARYPOINTS_ERR         = 1,
    00063         INVALID_NODE_TYPE_ERR          = 2,
    00064         _EXCEPTION_OFFSET              = 2000,
    00065         _EXCEPTION_MAX                 = 2999
    00066     };
    00067     unsigned short code;
    00068 };
    00069
    00070
    00071 class Range
    00072 {
    00073     friend class DocumentImpl;
    00074     friend class Document;
    00075     friend class RangeImpl;
    00076 public:
    00077     Range();
    00078     Range(const Document rootContainer);
    00079     Range(const Range &other);
    00080     Range(const Node startContainer, const long startOffset, const Node endContainer, const long endOffset);
    00081
    00082     Range & operator = (const Range &other);
    00083
    00084     ~Range();
    00085
    00090     Node startContainer() const;
    00091
    00096     long startOffset() const;
    00097
    00102     Node endContainer() const;
    00103
    00108     long endOffset() const;
    00109
    00114     bool collapsed() const;
    00115
    00121     // ### BIC make const in the next release
    00122     Node commonAncestorContainer();
    00123
    00146     void setStart ( const Node &refNode, long offset );
    00147
    00167     void setEnd ( const Node &refNode, long offset );
    00168
    00183     void setStartBefore ( const Node &refNode );
    00184
    00199     void setStartAfter ( const Node &refNode );
    00200
    00215     void setEndBefore ( const Node &refNode );
    00216
    00231     void setEndAfter ( const Node &refNode );
    00232
    00242     void collapse ( bool toStart );
    00243
    00258     void selectNode ( const Node &refNode );
    00259
    00273     void selectNodeContents ( const Node &refNode );
    00274
    00275     enum CompareHow {
    00276         START_TO_START = 0,
    00277         START_TO_END = 1,
    00278         END_TO_END = 2,
    00279         END_TO_START = 3
    00280     };
    00281
    00298     short compareBoundaryPoints ( CompareHow how, const Range &sourceRange );
    00299
    00311     bool boundaryPointsValid (  );
    00312
    00326     void deleteContents (  );
    00327
    00343     DocumentFragment extractContents (  );
    00344
    00356     DocumentFragment cloneContents (  );
    00357
    00384     void insertNode ( const Node &newNode );
    00385
    00418     void surroundContents ( const Node &newParent );
    00419
    00427     Range cloneRange (  );
    00428
    00435     DOMString toString (  );
    00436
    00440     DOMString toHTML (  );
    00441
    00450     void detach (  );
    00451
    00457     bool isDetached() const;
    00458
    00463     RangeImpl *handle() const;
    00464     bool isNull() const;
    00465
    00466 protected:
    00467     RangeImpl *impl;
    00468     Range(RangeImpl *i);
    00469 private:
    00470     void throwException(int exceptioncode) const;
    00471 };
    00472
    00473 } // namespace
    00474
    00475 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:33:37 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001