• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KHTML

  • sources
  • kde-4.14
  • kdelibs
  • khtml
  • dom
html_document.cpp
Go to the documentation of this file.
1 
22 // --------------------------------------------------------------------------
23 
24 #include "html_document.h"
25 #include "dom/html_misc.h"
26 #include "dom/dom_exception.h"
27 #include "xml/dom_textimpl.h"
28 #include "html/html_documentimpl.h"
29 #include "html/html_miscimpl.h"
30 
31 using namespace DOM;
32 
33 HTMLDocument::HTMLDocument() : Document(false) // create the impl here
34 {
35  impl = DOMImplementationImpl::createHTMLDocument();
36  impl->ref();
37 
38 }
39 
40 HTMLDocument::HTMLDocument(KHTMLView *parent)
41  : Document(false) // create the impl here
42 {
43  impl = DOMImplementationImpl::createHTMLDocument(parent);
44  impl->ref();
45 }
46 
47 HTMLDocument::HTMLDocument(const HTMLDocument &other) : Document(other)
48 {
49 }
50 
51 HTMLDocument::HTMLDocument(HTMLDocumentImpl *impl) : Document(impl)
52 {
53 }
54 
55 HTMLDocument &HTMLDocument::operator = (const Node &other)
56 {
57  if(other.nodeType() != DOCUMENT_NODE) {
58  if ( impl ) impl->deref();
59  impl = 0;
60  } else {
61  DocumentImpl *d = static_cast<DocumentImpl *>(other.handle());
62  if(!d->isHTMLDocument()) {
63  if ( impl ) impl->deref();
64  impl = 0;
65  } else {
66  Node::operator =(other);
67  }
68  }
69  return *this;
70 }
71 
72 HTMLDocument &HTMLDocument::operator = (const HTMLDocument &other)
73 {
74  Document::operator =(other);
75  return *this;
76 }
77 
78 HTMLDocument::~HTMLDocument()
79 {
80 }
81 
82 DOMString HTMLDocument::title() const
83 {
84  if(!impl) return DOMString();
85  return static_cast<HTMLDocumentImpl *>(impl)->title();
86 }
87 
88 void HTMLDocument::setTitle( const DOMString &value )
89 {
90  if (impl)
91  static_cast<HTMLDocumentImpl *>(impl)->setTitle(value);
92 }
93 
94 DOMString HTMLDocument::referrer() const
95 {
96  if(!impl) return DOMString();
97  return ((HTMLDocumentImpl *)impl)->referrer();
98 }
99 
100 DOMString HTMLDocument::completeURL(const DOMString& str) const
101 {
102  if(!impl) return str;
103  return ((HTMLDocumentImpl *)impl)->completeURL(str.parsedUrl().string());
104 }
105 
106 DOMString HTMLDocument::domain() const
107 {
108  if(!impl) return DOMString();
109  return ((HTMLDocumentImpl *)impl)->domain();
110 }
111 
112 DOMString HTMLDocument::lastModified() const
113 {
114  if(!impl) return DOMString();
115  return ((HTMLDocumentImpl *)impl)->lastModified();
116 }
117 
118 DOMString HTMLDocument::URL() const
119 {
120  if(!impl) return DOMString();
121  return ((HTMLDocumentImpl *)impl)->URL().url();
122 }
123 
124 HTMLElement HTMLDocument::body() const
125 {
126  if(!impl) return 0;
127  return ((HTMLDocumentImpl *)impl)->body();
128 }
129 
130 void HTMLDocument::setBody(const HTMLElement &_body)
131 {
132  if (!impl) return;
133  int exceptioncode = 0;
134  ((HTMLDocumentImpl *)impl)->setBody(static_cast<HTMLElementImpl *>(_body.handle()), exceptioncode);
135  if ( exceptioncode )
136  throw DOMException( exceptioncode );
137  return;
138 }
139 
140 HTMLCollection HTMLDocument::images() const
141 {
142  if(!impl) return HTMLCollection();
143  return ((HTMLDocumentImpl*)impl)->images();
144 }
145 
146 HTMLCollection HTMLDocument::applets() const
147 {
148  if(!impl) return HTMLCollection();
149  return ((HTMLDocumentImpl*)impl)->applets();
150 }
151 
152 HTMLCollection HTMLDocument::scripts() const
153 {
154  if(!impl) return HTMLCollection();
155  return ((HTMLDocumentImpl*)impl)->scripts();
156 }
157 
158 HTMLCollection HTMLDocument::links() const
159 {
160  if(!impl) return HTMLCollection();
161  return ((HTMLDocumentImpl*)impl)->links();
162 }
163 
164 HTMLCollection HTMLDocument::forms() const
165 {
166  if(!impl) return HTMLCollection();
167  return ((HTMLDocumentImpl*)impl)->forms();
168 }
169 
170 HTMLCollection HTMLDocument::layers() const
171 {
172  if(!impl) return HTMLCollection();
173  return ((HTMLDocumentImpl*)impl)->layers();
174 }
175 
176 HTMLCollection HTMLDocument::anchors() const
177 {
178  if(!impl) return HTMLCollection();
179  return ((HTMLDocumentImpl*)impl)->anchors();
180 }
181 
182 HTMLCollection HTMLDocument::all() const
183 {
184  if(!impl) return HTMLCollection();
185  return ((HTMLDocumentImpl*)impl)->all();
186 }
187 
188 DOMString HTMLDocument::cookie() const
189 {
190  if (!impl) return DOMString();
191  return ((HTMLDocumentImpl *)impl)->cookie();
192 }
193 
194 void HTMLDocument::setCookie( const DOMString & value )
195 {
196  if (impl)
197  ((HTMLDocumentImpl *)impl)->setCookie(value);
198 
199 }
200 
201 void HTMLDocument::open( )
202 {
203  if(impl)
204  ((HTMLDocumentImpl *)impl)->open( );
205 }
206 
207 void HTMLDocument::close( )
208 {
209  if(impl)
210  ((HTMLDocumentImpl *)impl)->close( );
211 }
212 
213 void HTMLDocument::write( const DOMString &text )
214 {
215  if(impl)
216  ((HTMLDocumentImpl *)impl)->write( text );
217 }
218 
219 void HTMLDocument::writeln( const DOMString &text )
220 {
221  if(impl)
222  ((HTMLDocumentImpl *)impl)->writeln( text );
223 }
224 
225 NodeList HTMLDocument::getElementsByName( const DOMString &elementName )
226 {
227  if(!impl) return 0;
228  return ((HTMLDocumentImpl *)impl)->getElementsByName(elementName);
229 }
230 
DOM::HTMLDocument::~HTMLDocument
~HTMLDocument()
Definition: html_document.cpp:78
DOM::HTMLDocument::images
HTMLCollection images() const
A collection of all the IMG elements in a document.
Definition: html_document.cpp:140
DOM::Document::operator=
Document & operator=(const Node &other)
Definition: dom_doc.cpp:180
DOM::Node
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:270
DOM::HTMLDocument
An HTMLDocument is the root of the HTML hierarchy and holds the entire content.
Definition: html_document.h:73
DOM::HTMLDocument::layers
HTMLCollection layers() const
A collection of all the layers of a document.
Definition: html_document.cpp:170
DOM::HTMLDocument::write
void write(const DOMString &text)
Write a string of text to a document stream opened by open() .
Definition: html_document.cpp:213
d
#define d
Definition: khtmlfind.cpp:42
DOM::HTMLDocument::setCookie
void setCookie(const DOMString &)
see cookie
Definition: html_document.cpp:194
html_document.h
DOM::DOMString::string
QString string() const
Definition: dom_string.cpp:236
KHTMLView
Renders and displays HTML in a QScrollArea.
Definition: khtmlview.h:92
DOM::HTMLDocument::cookie
DOMString cookie() const
The cookies associated with this document.
Definition: html_document.cpp:188
DOM::Node::operator=
Node & operator=(const Node &other)
Definition: dom_node.cpp:145
DOM::DOMException
DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impos...
Definition: dom_exception.h:58
DOM::HTMLDocument::close
void close()
Closes a document stream opened by open() and forces rendering.
Definition: html_document.cpp:207
DOM::HTMLDocument::applets
HTMLCollection applets() const
A collection of all the OBJECT elements that include applets and APPLET ( deprecated ) elements in a ...
Definition: html_document.cpp:146
DOM::HTMLDocument::completeURL
DOMString completeURL(const DOMString &url) const
not part of the DOM
Definition: html_document.cpp:100
DOM::HTMLDocument::title
DOMString title() const
The title of a document as specified by the TITLE element in the head of the document.
Definition: html_document.cpp:82
DOM::HTMLCollection
An HTMLCollection is a list of nodes.
Definition: html_misc.h:130
DOM::HTMLDocument::setBody
void setBody(const HTMLElement &)
see body
Definition: html_document.cpp:130
DOM::HTMLDocument::setTitle
void setTitle(const DOMString &)
see title
Definition: html_document.cpp:88
DOM::HTMLDocument::scripts
HTMLCollection scripts() const
A collection of all the scripts in the document.
Definition: html_document.cpp:152
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:43
DOM::Document
The Document interface represents the entire HTML or XML document.
Definition: dom_doc.h:245
dom_exception.h
DOM::HTMLDocument::referrer
DOMString referrer() const
Returns the URI of the page that linked to this page.
Definition: html_document.cpp:94
DOM::HTMLDocument::forms
HTMLCollection forms() const
A collection of all the forms of a document.
Definition: html_document.cpp:164
DOM::Node::impl
NodeImpl * impl
Definition: dom_node.h:948
DOM::HTMLDocument::HTMLDocument
HTMLDocument()
Definition: html_document.cpp:33
DOM::HTMLDocument::getElementsByName
NodeList getElementsByName(const DOMString &elementName)
Returns the (possibly empty) collection of elements whose name value is given by elementName ...
Definition: html_document.cpp:225
DOM::HTMLDocument::links
HTMLCollection links() const
A collection of all AREA elements and anchor ( A ) elements in a document with a value for the href a...
Definition: html_document.cpp:158
DOM::HTMLDocument::all
HTMLCollection all() const
Not part of the DOM.
Definition: html_document.cpp:182
DOM::NodeList
The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented.
Definition: dom_node.h:963
DOM::Node::DOCUMENT_NODE
Definition: dom_node.h:390
DOM::HTMLDocument::lastModified
DOMString lastModified() const
Not part of the DOM.
Definition: html_document.cpp:112
DOM::DOMString::parsedUrl
DOMString parsedUrl() const
Return a parsed url.
Definition: dom_string.cpp:300
DOM::HTMLDocument::anchors
HTMLCollection anchors() const
A collection of all the anchor ( A ) elements in a document with a value for the name attribute...
Definition: html_document.cpp:176
html_misc.h
DOM::Node::HTMLCollection
friend class HTMLCollection
Definition: dom_node.h:274
DOM::HTMLDocument::writeln
void writeln(const DOMString &text)
Write a string of text followed by a newline character to a document stream opened by open() ...
Definition: html_document.cpp:219
DOM::HTMLDocument::open
void open()
Note.
Definition: html_document.cpp:201
DOM::Node::handle
NodeImpl * handle() const
Definition: dom_node.h:925
DOM::HTMLElement
All HTML element interfaces derive from this class.
Definition: html_element.h:69
DOM::HTMLDocument::URL
DOMString URL() const
The absolute URI of the document.
Definition: html_document.cpp:118
DOM::HTMLDocument::domain
DOMString domain() const
The domain name of the server that served the document, or a null string if the server cannot be iden...
Definition: html_document.cpp:106
DOM::HTMLDocument::operator=
HTMLDocument & operator=(const HTMLDocument &other)
Definition: html_document.cpp:72
DOM::HTMLDocument::body
HTMLElement body() const
The element that contains the content for the document.
Definition: html_document.cpp:124
DOM::Node::nodeType
unsigned short nodeType() const
A code representing the type of the underlying object, as defined above.
Definition: dom_node.cpp:193
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:26:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHTML

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal