KHTML
dom_node.h
Go to the documentation of this file.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
00028
00029 #ifndef _DOM_Node_h_
00030 #define _DOM_Node_h_
00031
00032 #include <khtml_export.h>
00033 #include <QtCore/QString>
00034
00035 class QRect;
00036
00037 namespace KJS {
00038 class HTMLDocument;
00039 class Window;
00040 }
00041 namespace DOM {
00042
00043 class Node;
00044 class DOMString;
00045 class NodeImpl;
00046 class NamedNodeMapImpl;
00047 class EventListener;
00048 class Event;
00049
00062 class KHTML_EXPORT NamedNodeMap
00063 {
00064 public:
00065 NamedNodeMap();
00066 NamedNodeMap(const NamedNodeMap &other);
00067
00068 NamedNodeMap & operator = (const NamedNodeMap &other);
00069
00070 ~NamedNodeMap();
00071
00077 unsigned long length() const;
00078
00089 Node getNamedItem ( const DOMString &name ) const;
00090
00123 Node setNamedItem ( const Node &arg );
00124
00140 Node removeNamedItem ( const DOMString &name );
00141
00154 Node item ( unsigned long index ) const;
00155
00169 Node getNamedItemNS( const DOMString &namespaceURI,
00170 const DOMString &localName ) const;
00171
00196 Node setNamedItemNS( const Node &arg );
00197
00222 Node removeNamedItemNS( const DOMString &namespaceURI,
00223 const DOMString &localName );
00224
00229 NamedNodeMapImpl *handle() const { return impl; }
00230 bool isNull() const { return !impl; }
00231
00232 protected:
00233 NamedNodeMap( NamedNodeMapImpl *i);
00234 NamedNodeMapImpl *impl;
00235
00236 friend class Node;
00237 friend class DocumentType;
00238 friend class NodeImpl;
00239 };
00240
00241 class NamedNodeMap;
00242 class NodeList;
00243 class Document;
00244 class DOMString;
00245 class StyleSheet;
00246
00247 class NodeImpl;
00248
00270 class KHTML_EXPORT Node
00271 {
00272 friend class NamedNodeMap;
00273 friend class NodeList;
00274 friend class HTMLCollection;
00275 friend class StyleSheet;
00276
00277 public:
00278 Node() : impl(0) {}
00279 Node(const Node &other);
00280
00284 Node( NodeImpl *_impl);
00285
00286 Node & operator = (const Node &other);
00287
00288 bool operator == (const Node &other) const;
00289
00290 bool operator != (const Node &other) const;
00291
00292 virtual ~Node();
00381 enum NodeType {
00382 ELEMENT_NODE = 1,
00383 ATTRIBUTE_NODE = 2,
00384 TEXT_NODE = 3,
00385 CDATA_SECTION_NODE = 4,
00386 ENTITY_REFERENCE_NODE = 5,
00387 ENTITY_NODE = 6,
00388 PROCESSING_INSTRUCTION_NODE = 7,
00389 COMMENT_NODE = 8,
00390 DOCUMENT_NODE = 9,
00391 DOCUMENT_TYPE_NODE = 10,
00392 DOCUMENT_FRAGMENT_NODE = 11,
00393 NOTATION_NODE = 12
00394 };
00395
00401 DOMString nodeName() const;
00402
00413 DOMString nodeValue() const;
00414
00421 void setNodeValue( const DOMString & );
00422
00428 unsigned short nodeType() const;
00429
00438 Node parentNode() const;
00439
00453 NodeList childNodes() const;
00454
00460 Node firstChild() const;
00461
00467 Node lastChild() const;
00468
00474 Node previousSibling() const;
00475
00481 Node nextSibling() const;
00482
00489 NamedNodeMap attributes() const;
00490
00498 Document ownerDocument() const;
00499
00534 Node insertBefore ( const Node &newChild, const Node &refChild );
00535
00564 Node replaceChild ( const Node &newChild, const Node &oldChild );
00565
00581 Node removeChild ( const Node &oldChild );
00582
00609 Node appendChild ( const Node &newChild );
00610
00619 bool hasChildNodes ( );
00620
00641 Node cloneNode ( bool deep );
00642
00660 void normalize ( );
00661
00679 bool isSupported( const DOMString &feature,
00680 const DOMString &version ) const;
00681
00698 DOMString namespaceURI( ) const;
00699
00715 DOMString prefix( ) const;
00716
00734 void setPrefix(const DOMString &prefix );
00735
00744 DOMString localName( ) const;
00745
00751 bool hasAttributes ( );
00752
00781 void addEventListener(const DOMString &type,
00782 EventListener *listener,
00783 const bool useCapture);
00784
00810 void removeEventListener(const DOMString &type,
00811 EventListener *listener,
00812 bool useCapture);
00813
00837 bool dispatchEvent(const Event &evt);
00838
00856 DOMString textContent() const;
00857
00864 void setTextContent(const DOMString& text);
00865
00874 enum DocumentPosition {
00875 DOCUMENT_POSITION_DISCONNECTED = 0x01,
00876 DOCUMENT_POSITION_PRECEDING = 0x02,
00877 DOCUMENT_POSITION_FOLLOWING = 0x04,
00878 DOCUMENT_POSITION_CONTAINS = 0x08,
00879 DOCUMENT_POSITION_CONTAINED_BY = 0x10,
00880 DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20
00881 };
00882
00898 unsigned compareDocumentPosition(const DOM::Node& other);
00899
00905 quint32 elementId() const;
00906
00919 bool isNull() const { return !impl; }
00920
00924 NodeImpl *handle() const { return impl; }
00925
00929 unsigned long index() const;
00930 KDE_DEPRECATED QString toHTML();
00931 void applyChanges();
00935 KDE_DEPRECATED void getCursor(int offset, int &_x, int &_y, int &height);
00940 QRect getRect();
00941
00942 protected:
00943 NodeImpl *impl;
00944 };
00945
00946
00947 class NodeListImpl;
00948
00958 class KHTML_EXPORT NodeList
00959 {
00960 friend class Element;
00961 friend class Node;
00962 friend class Document;
00963 friend class HTMLDocument;
00964 friend class KJS::HTMLDocument;
00965 friend class KJS::Window;
00966
00967 public:
00968 NodeList();
00969 NodeList(const NodeList &other);
00970
00971 NodeList & operator = (const NodeList &other);
00972
00973 ~NodeList();
00974
00980 unsigned long length() const;
00981
00994 Node item ( unsigned long index ) const;
00995
01000 NodeListImpl *handle() const { return impl; }
01001 bool isNull() const { return !impl; }
01002
01003 protected:
01004 NodeList(const NodeListImpl *i);
01005 NodeListImpl *impl;
01006 };
01007
01008
01009
01014 typedef unsigned long long DOMTimeStamp;
01015
01016
01017 }
01018 #endif