• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdehtml
 

tdehtml

  • tdehtml
  • dom
html_document.cpp
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 #include "misc/htmlhashes.h"
32 
33 using namespace DOM;
34 
35 HTMLDocument::HTMLDocument() : Document(false) // create the impl here
36 {
37  impl = DOMImplementationImpl::instance()->createHTMLDocument();
38  impl->ref();
39 
40 }
41 
42 HTMLDocument::HTMLDocument(TDEHTMLView *parent)
43  : Document(false) // create the impl here
44 {
45  impl = DOMImplementationImpl::instance()->createHTMLDocument(parent);
46  impl->ref();
47 }
48 
49 HTMLDocument::HTMLDocument(const HTMLDocument &other) : Document(other)
50 {
51 }
52 
53 HTMLDocument::HTMLDocument(HTMLDocumentImpl *impl) : Document(impl)
54 {
55 }
56 
57 HTMLDocument &HTMLDocument::operator = (const Node &other)
58 {
59  if(other.nodeType() != DOCUMENT_NODE) {
60  if ( impl ) impl->deref();
61  impl = 0;
62  } else {
63  DocumentImpl *d = static_cast<DocumentImpl *>(other.handle());
64  if(!d->isHTMLDocument()) {
65  if ( impl ) impl->deref();
66  impl = 0;
67  } else {
68  Node::operator =(other);
69  }
70  }
71  return *this;
72 }
73 
74 HTMLDocument &HTMLDocument::operator = (const HTMLDocument &other)
75 {
76  Document::operator =(other);
77  return *this;
78 }
79 
80 HTMLDocument::~HTMLDocument()
81 {
82 }
83 
84 DOMString HTMLDocument::title() const
85 {
86  if(!impl) return DOMString();
87  return static_cast<HTMLDocumentImpl *>(impl)->title();
88 }
89 
90 void HTMLDocument::setTitle( const DOMString &value )
91 {
92  if (impl)
93  static_cast<HTMLDocumentImpl *>(impl)->setTitle(value);
94 }
95 
96 DOMString HTMLDocument::referrer() const
97 {
98  if(!impl) return DOMString();
99  return ((HTMLDocumentImpl *)impl)->referrer();
100 }
101 
102 DOMString HTMLDocument::completeURL(const DOMString& str) const
103 {
104  if(!impl) return str;
105  DOMString parsed = tdehtml::parseURL(str);
106  return ((HTMLDocumentImpl *)impl)->completeURL(parsed.string());
107 }
108 
109 DOMString HTMLDocument::domain() const
110 {
111  if(!impl) return DOMString();
112  return ((HTMLDocumentImpl *)impl)->domain();
113 }
114 
115 DOMString HTMLDocument::lastModified() const
116 {
117  if(!impl) return DOMString();
118  return ((HTMLDocumentImpl *)impl)->lastModified();
119 }
120 
121 DOMString HTMLDocument::URL() const
122 {
123  if(!impl) return DOMString();
124  return ((HTMLDocumentImpl *)impl)->URL().url();
125 }
126 
127 HTMLElement HTMLDocument::body() const
128 {
129  if(!impl) return 0;
130  return ((HTMLDocumentImpl *)impl)->body();
131 }
132 
133 void HTMLDocument::setBody(const HTMLElement &_body)
134 {
135  if (!impl) return;
136  int exceptioncode = 0;
137  ((HTMLDocumentImpl *)impl)->setBody(static_cast<HTMLElementImpl *>(_body.handle()), exceptioncode);
138  if ( exceptioncode )
139  throw DOMException( exceptioncode );
140  return;
141 }
142 
143 HTMLCollection HTMLDocument::images() const
144 {
145  if(!impl) return HTMLCollection();
146  return HTMLCollection(impl, HTMLCollectionImpl::DOC_IMAGES);
147 }
148 
149 HTMLCollection HTMLDocument::applets() const
150 {
151  if(!impl) return HTMLCollection();
152  return HTMLCollection(impl, HTMLCollectionImpl::DOC_APPLETS);
153 }
154 
155 HTMLCollection HTMLDocument::scripts() const
156 {
157  if(!impl) return HTMLCollection();
158  return HTMLCollection(impl, HTMLCollectionImpl::DOC_SCRIPTS);
159 }
160 
161 HTMLCollection HTMLDocument::links() const
162 {
163  if(!impl) return HTMLCollection();
164  return HTMLCollection(impl, HTMLCollectionImpl::DOC_LINKS);
165 }
166 
167 HTMLCollection HTMLDocument::forms() const
168 {
169  if(!impl) return HTMLCollection();
170  return HTMLCollection(impl, HTMLCollectionImpl::DOC_FORMS);
171 }
172 
173 HTMLCollection HTMLDocument::layers() const
174 {
175  if(!impl) return HTMLCollection();
176  return HTMLCollection(impl, HTMLCollectionImpl::DOC_LAYERS);
177 }
178 
179 HTMLCollection HTMLDocument::anchors() const
180 {
181  if(!impl) return HTMLCollection();
182  return HTMLCollection(impl, HTMLCollectionImpl::DOC_ANCHORS);
183 }
184 
185 HTMLCollection HTMLDocument::all() const
186 {
187  if(!impl) return HTMLCollection();
188  return HTMLCollection(impl, HTMLCollectionImpl::DOC_ALL);
189 }
190 
191 DOMString HTMLDocument::cookie() const
192 {
193  if (!impl) return DOMString();
194  return ((HTMLDocumentImpl *)impl)->cookie();
195 }
196 
197 void HTMLDocument::setCookie( const DOMString & value )
198 {
199  if (impl)
200  ((HTMLDocumentImpl *)impl)->setCookie(value);
201 
202 }
203 
204 void HTMLDocument::open( )
205 {
206  if(impl)
207  ((HTMLDocumentImpl *)impl)->open( );
208 }
209 
210 void HTMLDocument::close( )
211 {
212  if(impl)
213  ((HTMLDocumentImpl *)impl)->close( );
214 }
215 
216 void HTMLDocument::write( const DOMString &text )
217 {
218  if(impl)
219  ((HTMLDocumentImpl *)impl)->write( text );
220 }
221 
222 void HTMLDocument::writeln( const DOMString &text )
223 {
224  if(impl)
225  ((HTMLDocumentImpl *)impl)->writeln( text );
226 }
227 
228 NodeList HTMLDocument::getElementsByName( const DOMString &elementName )
229 {
230  if(!impl) return 0;
231  return new NameNodeListImpl(impl, elementName);
232 }
233 
DOM::DOMException
DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impos...
Definition: dom_exception.h:58
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
DOM::Document
The Document interface represents the entire HTML or XML document.
Definition: dom_doc.h:246
DOM::HTMLCollection
An HTMLCollection is a list of nodes.
Definition: html_misc.h:127
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:161
DOM::HTMLDocument::close
void close()
Closes a document stream opened by open() and forces rendering.
Definition: html_document.cpp:210
DOM::HTMLDocument::cookie
DOMString cookie() const
The cookies associated with this document.
Definition: html_document.cpp:191
DOM::HTMLDocument::layers
HTMLCollection layers() const
A collection of all the layers of a document.
Definition: html_document.cpp:173
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:222
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:109
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:149
DOM::HTMLDocument::URL
DOMString URL() const
The absolute URI of the document.
Definition: html_document.cpp:121
DOM::HTMLDocument::body
HTMLElement body() const
The element that contains the content for the document.
Definition: html_document.cpp:127
DOM::HTMLDocument::referrer
DOMString referrer() const
Returns the URI of the page that linked to this page.
Definition: html_document.cpp:96
DOM::HTMLDocument::images
HTMLCollection images() const
A collection of all the IMG elements in a document.
Definition: html_document.cpp:143
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:228
DOM::HTMLDocument::forms
HTMLCollection forms() const
A collection of all the forms of a document.
Definition: html_document.cpp:167
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:84
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:179
DOM::HTMLDocument::setCookie
void setCookie(const DOMString &)
see cookie
Definition: html_document.cpp:197
DOM::HTMLDocument::lastModified
DOMString lastModified() const
Not part of the DOM.
Definition: html_document.cpp:115
DOM::HTMLDocument::open
void open()
Note.
Definition: html_document.cpp:204
DOM::HTMLDocument::completeURL
DOMString completeURL(const DOMString &url) const
not part of the DOM
Definition: html_document.cpp:102
DOM::HTMLDocument::all
HTMLCollection all() const
Not part of the DOM.
Definition: html_document.cpp:185
DOM::HTMLDocument::setBody
void setBody(const HTMLElement &)
see body
Definition: html_document.cpp:133
DOM::HTMLDocument::scripts
HTMLCollection scripts() const
A collection of all the scripts in the document.
Definition: html_document.cpp:155
DOM::HTMLDocument::write
void write(const DOMString &text)
Write a string of text to a document stream opened by open() .
Definition: html_document.cpp:216
DOM::HTMLDocument::setTitle
void setTitle(const DOMString &)
see title
Definition: html_document.cpp:90
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:932
DOM::Node
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:275
DOM::Node::nodeType
unsigned short nodeType() const
A code representing the type of the underlying object, as defined above.
Definition: dom_node.cpp:199
TDEHTMLView
Renders and displays HTML in a TQScrollView.
Definition: tdehtmlview.h:79
DOM
The Document Object Model (DOM) is divided into two parts, the COREDOM core DOM, specifying some core...
Definition: design.h:57

tdehtml

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

tdehtml

Skip menu "tdehtml"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdehtml by doxygen 1.9.1
This website is maintained by Timothy Pearson.