khtml Library API Documentation

dom2_rangeimpl.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  * $Id: dom2_rangeimpl.h,v 1.16.2.1 2003/07/15 10:42:18 mueller Exp $
00025  */
00026 
00027 #ifndef _DOM2_RangeImpl_h_
00028 #define _DOM2_RangeImpl_h_
00029 
00030 #include "dom/dom2_range.h"
00031 #include "misc/shared.h"
00032 
00033 namespace DOM {
00034 
00035 class RangeImpl : public khtml::Shared<RangeImpl>
00036 {
00037     friend class DocumentImpl;
00038 public:
00039     RangeImpl(DocumentPtr *_ownerDocument);
00040     RangeImpl(DocumentPtr *_ownerDocument,
00041               NodeImpl *_startContainer, long _startOffset,
00042               NodeImpl *_endContainer, long _endOffset);
00043 
00044     ~RangeImpl();
00045 
00046     // ### remove the get from these methods (i.e. getStartContainer() -> startContainer())
00047     NodeImpl *startContainer(int &exceptioncode) const;
00048     long startOffset(int &exceptioncode) const;
00049     NodeImpl *endContainer(int &exceptioncode) const;
00050     long endOffset(int &exceptioncode) const;
00051     bool collapsed(int &exceptioncode) const;
00052 
00053     NodeImpl *commonAncestorContainer(int &exceptioncode);
00054     static NodeImpl *commonAncestorContainer(NodeImpl *containerA, NodeImpl *containerB);
00055     void setStart ( NodeImpl *refNode, long offset, int &exceptioncode );
00056     void setEnd ( NodeImpl *refNode, long offset, int &exceptioncode );
00057     void collapse ( bool toStart, int &exceptioncode );
00058     short compareBoundaryPoints ( Range::CompareHow how, RangeImpl *sourceRange, int &exceptioncode );
00059     short compareBoundaryPoints ( NodeImpl *containerA, long offsetA, NodeImpl *containerB, long offsetB );
00060     bool boundaryPointsValid (  );
00061     void deleteContents ( int &exceptioncode );
00062     DocumentFragmentImpl *extractContents ( int &exceptioncode );
00063     DocumentFragmentImpl *cloneContents ( int &exceptioncode );
00064     void insertNode( NodeImpl *newNode, int &exceptioncode );
00065     DOMString toString ( int &exceptioncode );
00066     DOMString toHTML (  );
00067     void detach ( int &exceptioncode );
00068     bool isDetached() const;
00069     RangeImpl *cloneRange(int &exceptioncode);
00070 
00071     void setStartAfter( NodeImpl *refNode, int &exceptioncode );
00072     void setEndBefore( NodeImpl *refNode, int &exceptioncode );
00073     void setEndAfter( NodeImpl *refNode, int &exceptioncode );
00074     void selectNode( NodeImpl *refNode, int &exceptioncode );
00075     void selectNodeContents( NodeImpl *refNode, int &exceptioncode );
00076     void surroundContents( NodeImpl *newParent, int &exceptioncode );
00077     void setStartBefore( NodeImpl *refNode, int &exceptioncode );
00078 
00079     enum ActionType {
00080         DELETE_CONTENTS,
00081         EXTRACT_CONTENTS,
00082         CLONE_CONTENTS
00083     };
00084     DocumentFragmentImpl *processContents ( ActionType action, int &exceptioncode );
00085 
00086     bool readOnly() { return false; }
00087 
00088 protected:
00089     DocumentPtr *m_ownerDocument;
00090     NodeImpl *m_startContainer;
00091     unsigned long m_startOffset;
00092     NodeImpl *m_endContainer;
00093     unsigned long m_endOffset;
00094     bool m_detached;
00095 
00096 private:
00097     void checkNodeWOffset( NodeImpl *n, int offset, int &exceptioncode) const;
00098     void checkNodeBA( NodeImpl *n, int &exceptioncode ) const;
00099     void setStartContainer(NodeImpl *_startContainer);
00100     void setEndContainer(NodeImpl *_endContainer);
00101     void checkDeleteExtract(int &exceptioncode);
00102     bool containedByReadOnly();
00103 };
00104 
00105 } // namespace
00106 
00107 #endif
00108 
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 27 22:16:32 2005 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001