KHtml

html_head.cpp
1 /**
2  * This file is part of the DOM implementation for KDE.
3  *
4  * Copyright 1999 Lars Knoll ([email protected])
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  */
22 // --------------------------------------------------------------------------
23 
24 #include "dom/html_head.h"
25 #include "html/html_headimpl.h"
26 #include "xml/dom_docimpl.h"
27 
28 using namespace DOM;
29 
30 HTMLBaseElement::HTMLBaseElement() : HTMLElement()
31 {
32 }
33 
34 HTMLBaseElement::HTMLBaseElement(const HTMLBaseElement &other) : HTMLElement(other)
35 {
36 }
37 
38 HTMLBaseElement::HTMLBaseElement(HTMLBaseElementImpl *impl) : HTMLElement(impl)
39 {
40 }
41 
42 HTMLBaseElement &HTMLBaseElement::operator = (const Node &other)
43 {
44  assignOther(other, ID_BASE);
45  return *this;
46 }
47 
48 HTMLBaseElement &HTMLBaseElement::operator = (const HTMLBaseElement &other)
49 {
50  HTMLElement::operator = (other);
51  return *this;
52 }
53 
54 HTMLBaseElement::~HTMLBaseElement()
55 {
56 }
57 
59 {
60  if (!impl) {
61  return DOMString();
62  }
63  const DOMString href = static_cast<ElementImpl *>(impl)->getAttribute(ATTR_HREF).trimSpaces();
64  return !href.isNull() ? impl->document()->completeURL(href.string()) : href;
65 }
66 
68 {
69  if (impl) {
70  ((ElementImpl *)impl)->setAttribute(ATTR_HREF, value);
71  }
72 }
73 
75 {
76  if (!impl) {
77  return DOMString();
78  }
79  return ((ElementImpl *)impl)->getAttribute(ATTR_TARGET);
80 }
81 
83 {
84  if (impl) {
85  ((ElementImpl *)impl)->setAttribute(ATTR_TARGET, value);
86  }
87 }
88 
89 // --------------------------------------------------------------------------
90 
91 HTMLLinkElement::HTMLLinkElement() : HTMLElement()
92 {
93 }
94 
95 HTMLLinkElement::HTMLLinkElement(const HTMLLinkElement &other) : HTMLElement(other)
96 {
97 }
98 
99 HTMLLinkElement::HTMLLinkElement(HTMLLinkElementImpl *impl) : HTMLElement(impl)
100 {
101 }
102 
103 HTMLLinkElement &HTMLLinkElement::operator = (const Node &other)
104 {
105  assignOther(other, ID_LINK);
106  return *this;
107 }
108 
109 HTMLLinkElement &HTMLLinkElement::operator = (const HTMLLinkElement &other)
110 {
111  HTMLElement::operator = (other);
112  return *this;
113 }
114 
115 HTMLLinkElement::~HTMLLinkElement()
116 {
117 }
118 
120 {
121  if (!impl) {
122  return 0;
123  }
124  return !((ElementImpl *)impl)->getAttribute(ATTR_DISABLED).isNull();
125 }
126 
127 void HTMLLinkElement::setDisabled(bool _disabled)
128 {
129  if (impl) {
130  ((ElementImpl *)impl)->setAttribute(ATTR_DISABLED, _disabled ? "" : nullptr);
131  }
132 }
133 
135 {
136  if (!impl) {
137  return DOMString();
138  }
139  return ((ElementImpl *)impl)->getAttribute(ATTR_CHARSET);
140 }
141 
143 {
144  if (impl) {
145  ((ElementImpl *)impl)->setAttribute(ATTR_CHARSET, value);
146  }
147 }
148 
150 {
151  if (!impl) {
152  return DOMString();
153  }
154  const DOMString href = static_cast<ElementImpl *>(impl)->getAttribute(ATTR_HREF).trimSpaces();
155  return !href.isNull() ? impl->document()->completeURL(href.string()) : href;
156 }
157 
159 {
160  if (impl) {
161  ((ElementImpl *)impl)->setAttribute(ATTR_HREF, value);
162  }
163 }
164 
166 {
167  if (!impl) {
168  return DOMString();
169  }
170  return ((ElementImpl *)impl)->getAttribute(ATTR_HREFLANG);
171 }
172 
174 {
175  if (impl) {
176  ((ElementImpl *)impl)->setAttribute(ATTR_HREFLANG, value);
177  }
178 }
179 
181 {
182  if (!impl) {
183  return DOMString();
184  }
185  return ((ElementImpl *)impl)->getAttribute(ATTR_MEDIA);
186 }
187 
189 {
190  if (impl) {
191  ((ElementImpl *)impl)->setAttribute(ATTR_MEDIA, value);
192  }
193 }
194 
196 {
197  if (!impl) {
198  return DOMString();
199  }
200  return ((ElementImpl *)impl)->getAttribute(ATTR_REL);
201 }
202 
204 {
205  if (impl) {
206  ((ElementImpl *)impl)->setAttribute(ATTR_REL, value);
207  }
208 }
209 
211 {
212  if (!impl) {
213  return DOMString();
214  }
215  return ((ElementImpl *)impl)->getAttribute(ATTR_REV);
216 }
217 
219 {
220  if (impl) {
221  ((ElementImpl *)impl)->setAttribute(ATTR_REV, value);
222  }
223 }
224 
226 {
227  if (!impl) {
228  return DOMString();
229  }
230  return ((ElementImpl *)impl)->getAttribute(ATTR_TARGET);
231 }
232 
234 {
235  if (impl) {
236  ((ElementImpl *)impl)->setAttribute(ATTR_TARGET, value);
237  }
238 }
239 
241 {
242  if (!impl) {
243  return DOMString();
244  }
245  return ((ElementImpl *)impl)->getAttribute(ATTR_TYPE);
246 }
247 
249 {
250  if (impl) {
251  ((ElementImpl *)impl)->setAttribute(ATTR_TYPE, value);
252  }
253 }
254 
256 {
257  if (!impl) {
258  return nullptr;
259  }
260  return ((HTMLLinkElementImpl *)impl)->sheet();
261 }
262 
263 // --------------------------------------------------------------------------
264 
265 HTMLMetaElement::HTMLMetaElement() : HTMLElement()
266 {
267 }
268 
269 HTMLMetaElement::HTMLMetaElement(const HTMLMetaElement &other) : HTMLElement(other)
270 {
271 }
272 
273 HTMLMetaElement::HTMLMetaElement(HTMLMetaElementImpl *impl) : HTMLElement(impl)
274 {
275 }
276 
277 HTMLMetaElement &HTMLMetaElement::operator = (const Node &other)
278 {
279  assignOther(other, ID_META);
280  return *this;
281 }
282 
283 HTMLMetaElement &HTMLMetaElement::operator = (const HTMLMetaElement &other)
284 {
285  HTMLElement::operator = (other);
286  return *this;
287 }
288 
289 HTMLMetaElement::~HTMLMetaElement()
290 {
291 }
292 
294 {
295  if (!impl) {
296  return DOMString();
297  }
298  return ((ElementImpl *)impl)->getAttribute(ATTR_CONTENT);
299 }
300 
302 {
303  if (impl) {
304  ((ElementImpl *)impl)->setAttribute(ATTR_CONTENT, value);
305  }
306 }
307 
309 {
310  if (!impl) {
311  return DOMString();
312  }
313  return ((ElementImpl *)impl)->getAttribute(ATTR_HTTP_EQUIV);
314 }
315 
317 {
318  if (impl) {
319  ((ElementImpl *)impl)->setAttribute(ATTR_HTTP_EQUIV, value);
320  }
321 }
322 
324 {
325  if (!impl) {
326  return DOMString();
327  }
328  return ((ElementImpl *)impl)->getAttribute(ATTR_NAME);
329 }
330 
332 {
333  if (impl) {
334  ((ElementImpl *)impl)->setAttribute(ATTR_NAME, value);
335  }
336 }
337 
339 {
340  if (!impl) {
341  return DOMString();
342  }
343  return ((ElementImpl *)impl)->getAttribute(ATTR_SCHEME);
344 }
345 
347 {
348  if (impl) {
349  ((ElementImpl *)impl)->setAttribute(ATTR_SCHEME, value);
350  }
351 }
352 
353 // --------------------------------------------------------------------------
354 
355 HTMLScriptElement::HTMLScriptElement() : HTMLElement()
356 {
357 }
358 
359 HTMLScriptElement::HTMLScriptElement(const HTMLScriptElement &other) : HTMLElement(other)
360 {
361 }
362 
363 HTMLScriptElement::HTMLScriptElement(HTMLScriptElementImpl *impl) : HTMLElement(impl)
364 {
365 }
366 
367 HTMLScriptElement &HTMLScriptElement::operator = (const Node &other)
368 {
369  assignOther(other, ID_SCRIPT);
370  return *this;
371 }
372 
373 HTMLScriptElement &HTMLScriptElement::operator = (const HTMLScriptElement &other)
374 {
375  HTMLElement::operator = (other);
376  return *this;
377 }
378 
379 HTMLScriptElement::~HTMLScriptElement()
380 {
381 }
382 
384 {
385  if (!impl) {
386  return DOMString();
387  }
388  return ((HTMLScriptElementImpl *)impl)->text();
389 }
390 
392 {
393  if (impl) {
394  ((HTMLScriptElementImpl *)impl)->setText(value);
395  }
396 }
397 
399 {
400  // DOM Level 1 says: reserved for future use...
401  return DOMString();
402 }
403 
405 {
406  // DOM Level 1 says: reserved for future use...
407 }
408 
410 {
411  // DOM Level 1 says: reserved for future use...
412  return DOMString();
413 }
414 
416 {
417  // DOM Level 1 says: reserved for future use...
418 }
419 
421 {
422  if (!impl) {
423  return DOMString();
424  }
425  return ((ElementImpl *)impl)->getAttribute(ATTR_CHARSET);
426 }
427 
429 {
430  if (impl) {
431  ((ElementImpl *)impl)->setAttribute(ATTR_CHARSET, value);
432  }
433 }
434 
436 {
437  if (!impl) {
438  return 0;
439  }
440  return !((ElementImpl *)impl)->getAttribute(ATTR_DEFER).isNull();
441 }
442 
444 {
445 
446  if (impl) {
447  ((ElementImpl *)impl)->setAttribute(ATTR_DEFER, _defer ? "" : nullptr);
448  }
449 }
450 
452 {
453  if (!impl) {
454  return DOMString();
455  }
456  const DOMString s = ((ElementImpl *)impl)->getAttribute(ATTR_SRC).trimSpaces();
457  return !s.isNull() ? impl->document()->completeURL(s.string()) : s;
458 }
459 
461 {
462  if (impl) {
463  ((ElementImpl *)impl)->setAttribute(ATTR_SRC, value);
464  }
465 }
466 
468 {
469  if (!impl) {
470  return DOMString();
471  }
472  return ((ElementImpl *)impl)->getAttribute(ATTR_TYPE);
473 }
474 
476 {
477  if (impl) {
478  ((ElementImpl *)impl)->setAttribute(ATTR_TYPE, value);
479  }
480 }
481 
482 // --------------------------------------------------------------------------
483 
484 HTMLStyleElement::HTMLStyleElement() : HTMLElement()
485 {
486 }
487 
488 HTMLStyleElement::HTMLStyleElement(const HTMLStyleElement &other) : HTMLElement(other)
489 {
490 }
491 
492 HTMLStyleElement::HTMLStyleElement(HTMLStyleElementImpl *impl) : HTMLElement(impl)
493 {
494 }
495 
496 HTMLStyleElement &HTMLStyleElement::operator = (const Node &other)
497 {
498  assignOther(other, ID_STYLE);
499  return *this;
500 }
501 
502 HTMLStyleElement &HTMLStyleElement::operator = (const HTMLStyleElement &other)
503 {
504  HTMLElement::operator = (other);
505  return *this;
506 }
507 
508 HTMLStyleElement::~HTMLStyleElement()
509 {
510 }
511 
513 {
514  if (!impl) {
515  return 0;
516  }
517  return !((HTMLStyleElementImpl *)impl)->getAttribute(ATTR_DISABLED).isNull();
518 }
519 
520 void HTMLStyleElement::setDisabled(bool _disabled)
521 {
522 
523  if (impl) {
524  ((ElementImpl *)impl)->setAttribute(ATTR_DISABLED, _disabled ? "" : nullptr);
525  }
526 }
527 
529 {
530  if (!impl) {
531  return DOMString();
532  }
533  return ((ElementImpl *)impl)->getAttribute(ATTR_MEDIA);
534 }
535 
537 {
538  if (impl) {
539  ((ElementImpl *)impl)->setAttribute(ATTR_MEDIA, value);
540  }
541 }
542 
544 {
545  if (!impl) {
546  return DOMString();
547  }
548  return ((ElementImpl *)impl)->getAttribute(ATTR_TYPE);
549 }
550 
552 {
553  if (impl) {
554  ((ElementImpl *)impl)->setAttribute(ATTR_TYPE, value);
555  }
556 }
557 
559 {
560  if (!impl) {
561  return nullptr;
562  }
563  return ((HTMLStyleElementImpl *)impl)->sheet();
564 }
565 
566 // --------------------------------------------------------------------------
567 
568 HTMLTitleElement::HTMLTitleElement() : HTMLElement()
569 {
570 }
571 
572 HTMLTitleElement::HTMLTitleElement(const HTMLTitleElement &other) : HTMLElement(other)
573 {
574 }
575 
576 HTMLTitleElement::HTMLTitleElement(HTMLTitleElementImpl *impl) : HTMLElement(impl)
577 {
578 }
579 
580 HTMLTitleElement &HTMLTitleElement::operator = (const Node &other)
581 {
582  assignOther(other, ID_TITLE);
583  return *this;
584 }
585 
586 HTMLTitleElement &HTMLTitleElement::operator = (const HTMLTitleElement &other)
587 {
588  HTMLElement::operator = (other);
589  return *this;
590 }
591 
592 HTMLTitleElement::~HTMLTitleElement()
593 {
594 }
595 
597 {
598  if (!impl) {
599  return DOMString();
600  }
601  return ((HTMLTitleElementImpl *)impl)->text();
602 }
603 
605 {
606  if (impl) {
607  ((HTMLTitleElementImpl *)impl)->setText(value);
608  }
609 }
610 
DOMString htmlFor() const
Reserved for future use.
Definition: html_head.cpp:398
DOMString media() const
Designed for use with one or more target media.
Definition: html_head.cpp:180
void setType(const DOMString &)
see type
Definition: html_head.cpp:248
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:278
void setTarget(const DOMString &)
see target
Definition: html_head.cpp:82
void setSrc(const DOMString &)
see src
Definition: html_head.cpp:460
bool disabled() const
Enables/disables the link.
Definition: html_head.cpp:119
The document title.
Definition: html_head.h:533
void setText(const DOMString &)
see text
Definition: html_head.cpp:604
DOMString content() const
Associated information.
Definition: html_head.cpp:293
void setHreflang(const DOMString &)
see hreflang
Definition: html_head.cpp:173
void setDefer(bool)
see defer
Definition: html_head.cpp:443
void setHtmlFor(const DOMString &)
see htmlFor
Definition: html_head.cpp:404
bool defer() const
Indicates that the user agent can defer processing of the script.
Definition: html_head.cpp:435
void setCharset(const DOMString &)
see charset
Definition: html_head.cpp:428
void setName(const DOMString &)
see name
Definition: html_head.cpp:331
DOMString text() const
The script content of the element.
Definition: html_head.cpp:383
void setType(const DOMString &)
see type
Definition: html_head.cpp:475
DOMString name() const
Meta information name.
Definition: html_head.cpp:323
DOMString charset() const
The character encoding of the resource being linked to.
Definition: html_head.cpp:134
DOMString charset() const
The character encoding of the linked resource.
Definition: html_head.cpp:420
DOMString httpEquiv() const
HTTP response header name.
Definition: html_head.cpp:308
DOMString type() const
The content type of the script language.
Definition: html_head.cpp:467
void setEvent(const DOMString &)
see event
Definition: html_head.cpp:415
DOMString hreflang() const
Language code of the linked resource.
Definition: html_head.cpp:165
DOMString target() const
Frame to render the resource in.
Definition: html_head.cpp:225
void setType(const DOMString &)
see type
Definition: html_head.cpp:551
bool disabled() const
Enables/disables the style sheet.
Definition: html_head.cpp:512
void setHref(const DOMString &)
see href
Definition: html_head.cpp:158
DOMString text() const
The specified title as a string.
Definition: html_head.cpp:596
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
StyleSheet sheet() const
Introduced in DOM Level 2 This method is from the LinkStyle interface.
Definition: html_head.cpp:558
DOMString media() const
Designed for use with one or more target media.
Definition: html_head.cpp:528
void setMedia(const DOMString &)
see media
Definition: html_head.cpp:188
void setRel(const DOMString &)
see rel
Definition: html_head.cpp:203
DOMString type() const
The style sheet language (Internet media type).
Definition: html_head.cpp:543
void setHttpEquiv(const DOMString &)
see httpEquiv
Definition: html_head.cpp:316
DOMString rel() const
Forward link type.
Definition: html_head.cpp:195
DOMString target() const
The default target frame.
Definition: html_head.cpp:74
void setDisabled(bool)
see disabled
Definition: html_head.cpp:127
Style information.
Definition: html_head.h:458
void setTarget(const DOMString &)
see target
Definition: html_head.cpp:233
This library provides a full-featured HTML parser and widget.
StyleSheet sheet() const
Introduced in DOM Level 2 This method is from the LinkStyle interface.
Definition: html_head.cpp:255
void setDisabled(bool)
see disabled
Definition: html_head.cpp:520
The StyleSheet interface is the abstract base interface for any type of style sheet.
DOMString event() const
Reserved for future use.
Definition: html_head.cpp:409
DOMString getAttribute(const DOMString &name)
Retrieves an attribute value by name.
Script statements.
Definition: html_head.h:342
void setScheme(const DOMString &)
see scheme
Definition: html_head.cpp:346
The LINK element specifies a link to an external resource, and defines this document&#39;s relationship t...
Definition: html_head.h:104
void setContent(const DOMString &)
see content
Definition: html_head.cpp:301
DOMString src() const
URI designating an external script.
Definition: html_head.cpp:451
This contains generic meta-information about the document.
Definition: html_head.h:261
DOMString type() const
Advisory content type.
Definition: html_head.cpp:240
void setText(const DOMString &)
see text
Definition: html_head.cpp:391
DOMString scheme() const
Select form of content.
Definition: html_head.cpp:338
DOMString rev() const
Reverse link type.
Definition: html_head.cpp:210
void setCharset(const DOMString &)
see charset
Definition: html_head.cpp:142
Document base URI.
Definition: html_head.h:47
DOMString href() const
The URI of the linked resource.
Definition: html_head.cpp:149
All HTML element interfaces derive from this class.
Definition: html_element.h:70
void setMedia(const DOMString &)
see media
Definition: html_head.cpp:536
void setHref(const DOMString &)
see href
Definition: html_head.cpp:67
void setRev(const DOMString &)
see rev
Definition: html_head.cpp:218
DOMString href() const
The base URI See the href attribute definition in HTML 4.0.
Definition: html_head.cpp:58
DOMString trimSpaces() const
Returns a string with Space Characters removed from the start and the end.
Definition: dom_string.cpp:345
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Oct 24 2021 22:48:02 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.