dom2_rangeimpl.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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
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 };
00106
00107 #endif
00108
This file is part of the documentation for kdelibs Version 3.1.0.