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

KHTML

  • 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
31using namespace DOM;
32
33HTMLDocument::HTMLDocument() : Document(false) // create the impl here
34{
35 impl = DOMImplementationImpl::createHTMLDocument();
36 impl->ref();
37
38}
39
40HTMLDocument::HTMLDocument(KHTMLView *parent)
41 : Document(false) // create the impl here
42{
43 impl = DOMImplementationImpl::createHTMLDocument(parent);
44 impl->ref();
45}
46
47HTMLDocument::HTMLDocument(const HTMLDocument &other) : Document(other)
48{
49}
50
51HTMLDocument::HTMLDocument(HTMLDocumentImpl *impl) : Document(impl)
52{
53}
54
55HTMLDocument &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
72HTMLDocument &HTMLDocument::operator = (const HTMLDocument &other)
73{
74 Document::operator =(other);
75 return *this;
76}
77
78HTMLDocument::~HTMLDocument()
79{
80}
81
82DOMString HTMLDocument::title() const
83{
84 if(!impl) return DOMString();
85 return static_cast<HTMLDocumentImpl *>(impl)->title();
86}
87
88void HTMLDocument::setTitle( const DOMString &value )
89{
90 if (impl)
91 static_cast<HTMLDocumentImpl *>(impl)->setTitle(value);
92}
93
94DOMString HTMLDocument::referrer() const
95{
96 if(!impl) return DOMString();
97 return ((HTMLDocumentImpl *)impl)->referrer();
98}
99
100DOMString HTMLDocument::completeURL(const DOMString& str) const
101{
102 if(!impl) return str;
103 return ((HTMLDocumentImpl *)impl)->completeURL(str.parsedUrl().string());
104}
105
106DOMString HTMLDocument::domain() const
107{
108 if(!impl) return DOMString();
109 return ((HTMLDocumentImpl *)impl)->domain();
110}
111
112DOMString HTMLDocument::lastModified() const
113{
114 if(!impl) return DOMString();
115 return ((HTMLDocumentImpl *)impl)->lastModified();
116}
117
118DOMString HTMLDocument::URL() const
119{
120 if(!impl) return DOMString();
121 return ((HTMLDocumentImpl *)impl)->URL().url();
122}
123
124HTMLElement HTMLDocument::body() const
125{
126 if(!impl) return 0;
127 return ((HTMLDocumentImpl *)impl)->body();
128}
129
130void 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
140HTMLCollection HTMLDocument::images() const
141{
142 if(!impl) return HTMLCollection();
143 return ((HTMLDocumentImpl*)impl)->images();
144}
145
146HTMLCollection HTMLDocument::applets() const
147{
148 if(!impl) return HTMLCollection();
149 return ((HTMLDocumentImpl*)impl)->applets();
150}
151
152HTMLCollection HTMLDocument::scripts() const
153{
154 if(!impl) return HTMLCollection();
155 return ((HTMLDocumentImpl*)impl)->scripts();
156}
157
158HTMLCollection HTMLDocument::links() const
159{
160 if(!impl) return HTMLCollection();
161 return ((HTMLDocumentImpl*)impl)->links();
162}
163
164HTMLCollection HTMLDocument::forms() const
165{
166 if(!impl) return HTMLCollection();
167 return ((HTMLDocumentImpl*)impl)->forms();
168}
169
170HTMLCollection HTMLDocument::layers() const
171{
172 if(!impl) return HTMLCollection();
173 return ((HTMLDocumentImpl*)impl)->layers();
174}
175
176HTMLCollection HTMLDocument::anchors() const
177{
178 if(!impl) return HTMLCollection();
179 return ((HTMLDocumentImpl*)impl)->anchors();
180}
181
182HTMLCollection HTMLDocument::all() const
183{
184 if(!impl) return HTMLCollection();
185 return ((HTMLDocumentImpl*)impl)->all();
186}
187
188DOMString HTMLDocument::cookie() const
189{
190 if (!impl) return DOMString();
191 return ((HTMLDocumentImpl *)impl)->cookie();
192}
193
194void HTMLDocument::setCookie( const DOMString & value )
195{
196 if (impl)
197 ((HTMLDocumentImpl *)impl)->setCookie(value);
198
199}
200
201void HTMLDocument::open( )
202{
203 if(impl)
204 ((HTMLDocumentImpl *)impl)->open( );
205}
206
207void HTMLDocument::close( )
208{
209 if(impl)
210 ((HTMLDocumentImpl *)impl)->close( );
211}
212
213void HTMLDocument::write( const DOMString &text )
214{
215 if(impl)
216 ((HTMLDocumentImpl *)impl)->write( text );
217}
218
219void HTMLDocument::writeln( const DOMString &text )
220{
221 if(impl)
222 ((HTMLDocumentImpl *)impl)->writeln( text );
223}
224
225NodeList HTMLDocument::getElementsByName( const DOMString &elementName )
226{
227 if(!impl) return 0;
228 return ((HTMLDocumentImpl *)impl)->getElementsByName(elementName);
229}
230
DOM::DOMException
DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impos...
Definition: dom_exception.h:59
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
DOM::DOMString::parsedUrl
DOMString parsedUrl() const
Return a parsed url.
Definition: dom_string.cpp:300
DOM::DOMString::string
QString string() const
Definition: dom_string.cpp:236
DOM::Document
The Document interface represents the entire HTML or XML document.
Definition: dom_doc.h:246
DOM::Document::operator=
Document & operator=(const Node &other)
Definition: dom_doc.cpp:180
DOM::HTMLCollection
An HTMLCollection is a list of nodes.
Definition: html_misc.h:131
DOM::HTMLDocument
An HTMLDocument is the root of the HTML hierarchy and holds the entire content.
Definition: html_document.h:74
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::close
void close()
Closes a document stream opened by open() and forces rendering.
Definition: html_document.cpp:207
DOM::HTMLDocument::cookie
DOMString cookie() const
The cookies associated with this document.
Definition: html_document.cpp:188
DOM::HTMLDocument::layers
HTMLCollection layers() const
A collection of all the layers of a document.
Definition: html_document.cpp:170
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::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::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::operator=
HTMLDocument & operator=(const HTMLDocument &other)
Definition: html_document.cpp:72
DOM::HTMLDocument::URL
DOMString URL() const
The absolute URI of the document.
Definition: html_document.cpp:118
DOM::HTMLDocument::body
HTMLElement body() const
The element that contains the content for the document.
Definition: html_document.cpp:124
DOM::HTMLDocument::referrer
DOMString referrer() const
Returns the URI of the page that linked to this page.
Definition: html_document.cpp:94
DOM::HTMLDocument::images
HTMLCollection images() const
A collection of all the IMG elements in a document.
Definition: html_document.cpp:140
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::forms
HTMLCollection forms() const
A collection of all the forms of a document.
Definition: html_document.cpp:164
DOM::HTMLDocument::HTMLDocument
HTMLDocument()
Definition: html_document.cpp:33
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::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
DOM::HTMLDocument::setCookie
void setCookie(const DOMString &)
see cookie
Definition: html_document.cpp:194
DOM::HTMLDocument::lastModified
DOMString lastModified() const
Not part of the DOM.
Definition: html_document.cpp:112
DOM::HTMLDocument::open
void open()
Note.
Definition: html_document.cpp:201
DOM::HTMLDocument::completeURL
DOMString completeURL(const DOMString &url) const
not part of the DOM
Definition: html_document.cpp:100
DOM::HTMLDocument::all
HTMLCollection all() const
Not part of the DOM.
Definition: html_document.cpp:182
DOM::HTMLDocument::setBody
void setBody(const HTMLElement &)
see body
Definition: html_document.cpp:130
DOM::HTMLDocument::~HTMLDocument
~HTMLDocument()
Definition: html_document.cpp:78
DOM::HTMLDocument::scripts
HTMLCollection scripts() const
A collection of all the scripts in the document.
Definition: html_document.cpp:152
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
DOM::HTMLDocument::setTitle
void setTitle(const DOMString &)
see title
Definition: html_document.cpp:88
DOM::HTMLElement
All HTML element interfaces derive from this class.
Definition: html_element.h:70
DOM::NodeList
The NodeList interface provides the abstraction of an ordered collection of nodes,...
Definition: dom_node.h:964
DOM::Node
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:271
DOM::Node::handle
NodeImpl * handle() const
Definition: dom_node.h:925
DOM::Node::operator=
Node & operator=(const Node &other)
Definition: dom_node.cpp:145
DOM::Node::DOCUMENT_NODE
@ DOCUMENT_NODE
Definition: dom_node.h:390
DOM::Node::impl
NodeImpl * impl
Definition: dom_node.h:948
DOM::Node::nodeType
unsigned short nodeType() const
A code representing the type of the underlying object, as defined above.
Definition: dom_node.cpp:193
KHTMLView
Renders and displays HTML in a QScrollArea.
Definition: khtmlview.h:93
dom_exception.h
html_document.h
html_misc.h
d
#define d
Definition: khtmlfind.cpp:42
DOM
This library provides a full-featured HTML parser and widget.
Definition: design.h:55
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
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