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

KHTML

  • sources
  • kde-4.12
  • kdelibs
  • khtml
  • dom
html_document.cpp
Go to the documentation of this file.
1 
22 // --------------------------------------------------------------------------
23 
24 #include "html_document.h"
25 #include "css/csshelper.h"
26 #include "dom/html_misc.h"
27 #include "dom/dom_exception.h"
28 #include "xml/dom_textimpl.h"
29 #include "html/html_documentimpl.h"
30 #include "html/html_miscimpl.h"
31 
32 using namespace DOM;
33 
34 HTMLDocument::HTMLDocument() : Document(false) // create the impl here
35 {
36  impl = DOMImplementationImpl::createHTMLDocument();
37  impl->ref();
38 
39 }
40 
41 HTMLDocument::HTMLDocument(KHTMLView *parent)
42  : Document(false) // create the impl here
43 {
44  impl = DOMImplementationImpl::createHTMLDocument(parent);
45  impl->ref();
46 }
47 
48 HTMLDocument::HTMLDocument(const HTMLDocument &other) : Document(other)
49 {
50 }
51 
52 HTMLDocument::HTMLDocument(HTMLDocumentImpl *impl) : Document(impl)
53 {
54 }
55 
56 HTMLDocument &HTMLDocument::operator = (const Node &other)
57 {
58  if(other.nodeType() != DOCUMENT_NODE) {
59  if ( impl ) impl->deref();
60  impl = 0;
61  } else {
62  DocumentImpl *d = static_cast<DocumentImpl *>(other.handle());
63  if(!d->isHTMLDocument()) {
64  if ( impl ) impl->deref();
65  impl = 0;
66  } else {
67  Node::operator =(other);
68  }
69  }
70  return *this;
71 }
72 
73 HTMLDocument &HTMLDocument::operator = (const HTMLDocument &other)
74 {
75  Document::operator =(other);
76  return *this;
77 }
78 
79 HTMLDocument::~HTMLDocument()
80 {
81 }
82 
83 DOMString HTMLDocument::title() const
84 {
85  if(!impl) return DOMString();
86  return static_cast<HTMLDocumentImpl *>(impl)->title();
87 }
88 
89 void HTMLDocument::setTitle( const DOMString &value )
90 {
91  if (impl)
92  static_cast<HTMLDocumentImpl *>(impl)->setTitle(value);
93 }
94 
95 DOMString HTMLDocument::referrer() const
96 {
97  if(!impl) return DOMString();
98  return ((HTMLDocumentImpl *)impl)->referrer();
99 }
100 
101 DOMString HTMLDocument::completeURL(const DOMString& str) const
102 {
103  if(!impl) return str;
104  DOMString parsed = khtml::parseURL(str);
105  return ((HTMLDocumentImpl *)impl)->completeURL(parsed.string());
106 }
107 
108 DOMString HTMLDocument::domain() const
109 {
110  if(!impl) return DOMString();
111  return ((HTMLDocumentImpl *)impl)->domain();
112 }
113 
114 DOMString HTMLDocument::lastModified() const
115 {
116  if(!impl) return DOMString();
117  return ((HTMLDocumentImpl *)impl)->lastModified();
118 }
119 
120 DOMString HTMLDocument::URL() const
121 {
122  if(!impl) return DOMString();
123  return ((HTMLDocumentImpl *)impl)->URL().url();
124 }
125 
126 HTMLElement HTMLDocument::body() const
127 {
128  if(!impl) return 0;
129  return ((HTMLDocumentImpl *)impl)->body();
130 }
131 
132 void HTMLDocument::setBody(const HTMLElement &_body)
133 {
134  if (!impl) return;
135  int exceptioncode = 0;
136  ((HTMLDocumentImpl *)impl)->setBody(static_cast<HTMLElementImpl *>(_body.handle()), exceptioncode);
137  if ( exceptioncode )
138  throw DOMException( exceptioncode );
139  return;
140 }
141 
142 HTMLCollection HTMLDocument::images() const
143 {
144  if(!impl) return HTMLCollection();
145  return ((HTMLDocumentImpl*)impl)->images();
146 }
147 
148 HTMLCollection HTMLDocument::applets() const
149 {
150  if(!impl) return HTMLCollection();
151  return ((HTMLDocumentImpl*)impl)->applets();
152 }
153 
154 HTMLCollection HTMLDocument::scripts() const
155 {
156  if(!impl) return HTMLCollection();
157  return ((HTMLDocumentImpl*)impl)->scripts();
158 }
159 
160 HTMLCollection HTMLDocument::links() const
161 {
162  if(!impl) return HTMLCollection();
163  return ((HTMLDocumentImpl*)impl)->links();
164 }
165 
166 HTMLCollection HTMLDocument::forms() const
167 {
168  if(!impl) return HTMLCollection();
169  return ((HTMLDocumentImpl*)impl)->forms();
170 }
171 
172 HTMLCollection HTMLDocument::layers() const
173 {
174  if(!impl) return HTMLCollection();
175  return ((HTMLDocumentImpl*)impl)->layers();
176 }
177 
178 HTMLCollection HTMLDocument::anchors() const
179 {
180  if(!impl) return HTMLCollection();
181  return ((HTMLDocumentImpl*)impl)->anchors();
182 }
183 
184 HTMLCollection HTMLDocument::all() const
185 {
186  if(!impl) return HTMLCollection();
187  return ((HTMLDocumentImpl*)impl)->all();
188 }
189 
190 DOMString HTMLDocument::cookie() const
191 {
192  if (!impl) return DOMString();
193  return ((HTMLDocumentImpl *)impl)->cookie();
194 }
195 
196 void HTMLDocument::setCookie( const DOMString & value )
197 {
198  if (impl)
199  ((HTMLDocumentImpl *)impl)->setCookie(value);
200 
201 }
202 
203 void HTMLDocument::open( )
204 {
205  if(impl)
206  ((HTMLDocumentImpl *)impl)->open( );
207 }
208 
209 void HTMLDocument::close( )
210 {
211  if(impl)
212  ((HTMLDocumentImpl *)impl)->close( );
213 }
214 
215 void HTMLDocument::write( const DOMString &text )
216 {
217  if(impl)
218  ((HTMLDocumentImpl *)impl)->write( text );
219 }
220 
221 void HTMLDocument::writeln( const DOMString &text )
222 {
223  if(impl)
224  ((HTMLDocumentImpl *)impl)->writeln( text );
225 }
226 
227 NodeList HTMLDocument::getElementsByName( const DOMString &elementName )
228 {
229  if(!impl) return 0;
230  return ((HTMLDocumentImpl *)impl)->getElementsByName(elementName);
231 }
232 
DOM::HTMLDocument::~HTMLDocument
~HTMLDocument()
Definition: html_document.cpp:79
DOM::HTMLDocument::images
HTMLCollection images() const
A collection of all the IMG elements in a document.
Definition: html_document.cpp:142
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:172
DOM::HTMLDocument::write
void write(const DOMString &text)
Write a string of text to a document stream opened by open() .
Definition: html_document.cpp:215
d
#define d
Definition: khtmlfind.cpp:42
DOM::HTMLDocument::setCookie
void setCookie(const DOMString &)
see cookie
Definition: html_document.cpp:196
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:190
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:209
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:148
DOM::HTMLDocument::completeURL
DOMString completeURL(const DOMString &url) const
not part of the DOM
Definition: html_document.cpp:101
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:83
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:132
DOM::HTMLDocument::setTitle
void setTitle(const DOMString &)
see title
Definition: html_document.cpp:89
DOM::HTMLDocument::scripts
HTMLCollection scripts() const
A collection of all the scripts in the document.
Definition: html_document.cpp:154
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:95
DOM::HTMLDocument::forms
HTMLCollection forms() const
A collection of all the forms of a document.
Definition: html_document.cpp:166
DOM::Node::impl
NodeImpl * impl
Definition: dom_node.h:948
DOM::HTMLDocument::HTMLDocument
HTMLDocument()
Definition: html_document.cpp:34
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:227
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:160
DOM::HTMLDocument::all
HTMLCollection all() const
Not part of the DOM.
Definition: html_document.cpp:184
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:114
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:178
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:221
DOM::HTMLDocument::open
void open()
Note.
Definition: html_document.cpp:203
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:120
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:108
DOM::HTMLDocument::operator=
HTMLDocument & operator=(const HTMLDocument &other)
Definition: html_document.cpp:73
DOM::HTMLDocument::body
HTMLElement body() const
The element that contains the content for the document.
Definition: html_document.cpp:126
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-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:51:20 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
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • 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