KHtml

html_base.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 #include "html_base.h"
24 #include "dom_doc.h"
25 #include <xml/dom_docimpl.h>
26 #include <html/html_baseimpl.h>
27 
28 using namespace DOM;
29 
30 HTMLBodyElement::HTMLBodyElement() : HTMLElement()
31 {
32 }
33 
34 HTMLBodyElement::HTMLBodyElement(const HTMLBodyElement &other) : HTMLElement(other)
35 {
36 }
37 
38 HTMLBodyElement::HTMLBodyElement(HTMLBodyElementImpl *impl) : HTMLElement(impl)
39 {
40 }
41 
42 HTMLBodyElement &HTMLBodyElement::operator = (const Node &other)
43 {
44  assignOther(other, ID_BODY);
45  return *this;
46 }
47 
48 HTMLBodyElement &HTMLBodyElement::operator = (const HTMLBodyElement &other)
49 {
50  HTMLElement::operator = (other);
51  return *this;
52 }
53 
54 HTMLBodyElement::~HTMLBodyElement()
55 {
56 }
57 
59 {
60  return impl ? ((HTMLBodyElementImpl *)impl)->aLink() : DOMString();
61 }
62 
64 {
65  if (impl) {
66  ((HTMLBodyElementImpl *)impl)->setALink(value);
67  }
68 }
69 
71 {
72  return impl ? ((ElementImpl *)impl)->getAttribute(ATTR_BACKGROUND) : DOMString();
73 }
74 
76 {
77  if (impl) {
78  ((ElementImpl *)impl)->setAttribute(ATTR_BACKGROUND, value);
79  }
80 }
81 
83 {
84  return impl ? ((HTMLBodyElementImpl *)impl)->bgColor() : DOMString();
85 }
86 
88 {
89  if (impl) {
90  ((HTMLBodyElementImpl *)impl)->setBgColor(value);
91  }
92 }
93 
95 {
96  return impl ? ((HTMLBodyElementImpl *)impl)->link() : DOMString();
97 }
98 
100 {
101  if (impl) {
102  ((HTMLBodyElementImpl *)impl)->setLink(value);
103  }
104 }
105 
107 {
108  return impl ? ((HTMLBodyElementImpl *)impl)->text() : DOMString();
109 }
110 
112 {
113  if (impl) {
114  ((HTMLBodyElementImpl *)impl)->setText(value);
115  }
116 }
117 
119 {
120  return impl ? ((HTMLBodyElementImpl *)impl)->vLink() : DOMString();
121 }
122 
124 {
125  if (impl) {
126  ((HTMLBodyElementImpl *)impl)->setVLink(value);
127  }
128 }
129 
130 // --------------------------------------------------------------------------
131 
132 HTMLFrameElement::HTMLFrameElement() : HTMLElement()
133 {
134 }
135 
136 HTMLFrameElement::HTMLFrameElement(const HTMLFrameElement &other) : HTMLElement(other)
137 {
138 }
139 
140 HTMLFrameElement::HTMLFrameElement(HTMLFrameElementImpl *impl) : HTMLElement(impl)
141 {
142 }
143 
144 HTMLFrameElement &HTMLFrameElement::operator = (const Node &other)
145 {
146  assignOther(other, ID_FRAME);
147  return *this;
148 }
149 
150 HTMLFrameElement &HTMLFrameElement::operator = (const HTMLFrameElement &other)
151 {
152  HTMLElement::operator = (other);
153  return *this;
154 }
155 
156 HTMLFrameElement::~HTMLFrameElement()
157 {
158 }
159 
161 {
162  if (!impl) {
163  return DOMString();
164  }
165  return ((ElementImpl *)impl)->getAttribute(ATTR_FRAMEBORDER);
166 }
167 
169 {
170  if (impl) {
171  ((ElementImpl *)impl)->setAttribute(ATTR_FRAMEBORDER, value);
172  }
173 }
174 
176 {
177  if (!impl) {
178  return DOMString();
179  }
180  return ((ElementImpl *)impl)->getAttribute(ATTR_LONGDESC);
181 }
182 
184 {
185  if (impl) {
186  ((ElementImpl *)impl)->setAttribute(ATTR_LONGDESC, value);
187  }
188 }
189 
191 {
192  if (!impl) {
193  return DOMString();
194  }
195  return ((ElementImpl *)impl)->getAttribute(ATTR_MARGINHEIGHT);
196 }
197 
199 {
200  if (impl) {
201  ((ElementImpl *)impl)->setAttribute(ATTR_MARGINHEIGHT, value);
202  }
203 }
204 
206 {
207  if (!impl) {
208  return DOMString();
209  }
210  return ((ElementImpl *)impl)->getAttribute(ATTR_MARGINWIDTH);
211 }
212 
214 {
215  if (impl) {
216  ((ElementImpl *)impl)->setAttribute(ATTR_MARGINWIDTH, value);
217  }
218 }
219 
221 {
222  if (!impl) {
223  return DOMString();
224  }
225  return ((ElementImpl *)impl)->getAttribute(ATTR_NAME);
226 }
227 
229 {
230  if (impl) {
231  ((ElementImpl *)impl)->setAttribute(ATTR_NAME, value);
232  }
233 }
234 
236 {
237  if (!impl) {
238  return false;
239  }
240  return !((ElementImpl *)impl)->getAttribute(ATTR_NORESIZE).isNull();
241 }
242 
243 void HTMLFrameElement::setNoResize(bool _noResize)
244 {
245  if (impl) {
246  DOMString str;
247  if (_noResize) {
248  str = "";
249  }
250  ((ElementImpl *)impl)->setAttribute(ATTR_NORESIZE, str);
251  }
252 }
253 
255 {
256  if (!impl) {
257  return DOMString();
258  }
259  return ((ElementImpl *)impl)->getAttribute(ATTR_SCROLLING);
260 }
261 
263 {
264  if (impl) {
265  ((ElementImpl *)impl)->setAttribute(ATTR_SCROLLING, value);
266  }
267 }
268 
270 {
271  if (!impl) {
272  return DOMString();
273  }
274  const DOMString s = ((ElementImpl *)impl)->getAttribute(ATTR_SRC).trimSpaces();
275  return !s.isNull() ? impl->document()->completeURL(s.string()) : s;
276 }
277 
279 {
280  if (impl) {
281  ((ElementImpl *)impl)->setAttribute(ATTR_SRC, value);
282  }
283 }
284 
286 {
287  if (impl) {
288  return static_cast<HTMLFrameElementImpl *>(impl)->contentDocument();
289  }
290  return Document();
291 }
292 
293 // --------------------------------------------------------------------------
294 
295 HTMLIFrameElement::HTMLIFrameElement() : HTMLElement()
296 {
297 }
298 
299 HTMLIFrameElement::HTMLIFrameElement(const HTMLIFrameElement &other) : HTMLElement(other)
300 {
301 }
302 
303 HTMLIFrameElement::HTMLIFrameElement(HTMLIFrameElementImpl *impl) : HTMLElement(impl)
304 {
305 }
306 
307 HTMLIFrameElement &HTMLIFrameElement::operator = (const Node &other)
308 {
309  assignOther(other, ID_IFRAME);
310  return *this;
311 }
312 
313 HTMLIFrameElement &HTMLIFrameElement::operator = (const HTMLIFrameElement &other)
314 {
315  HTMLElement::operator = (other);
316  return *this;
317 }
318 
319 HTMLIFrameElement::~HTMLIFrameElement()
320 {
321 }
322 
324 {
325  if (!impl) {
326  return DOMString();
327  }
328  return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
329 }
330 
332 {
333  if (impl) {
334  ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
335  }
336 }
337 
339 {
340  if (!impl) {
341  return DOMString();
342  }
343  return ((ElementImpl *)impl)->getAttribute(ATTR_FRAMEBORDER);
344 }
345 
347 {
348  if (impl) {
349  ((ElementImpl *)impl)->setAttribute(ATTR_FRAMEBORDER, value);
350  }
351 }
352 
354 {
355  if (!impl) {
356  return DOMString();
357  }
358  return ((ElementImpl *)impl)->getAttribute(ATTR_HEIGHT);
359 }
360 
362 {
363  if (impl) {
364  ((ElementImpl *)impl)->setAttribute(ATTR_HEIGHT, value);
365  }
366 }
367 
369 {
370  if (!impl) {
371  return DOMString();
372  }
373  return ((ElementImpl *)impl)->getAttribute(ATTR_LONGDESC);
374 }
375 
377 {
378  if (impl) {
379  ((ElementImpl *)impl)->setAttribute(ATTR_LONGDESC, value);
380  }
381 }
382 
384 {
385  if (!impl) {
386  return DOMString();
387  }
388  return ((ElementImpl *)impl)->getAttribute(ATTR_MARGINHEIGHT);
389 }
390 
392 {
393  if (impl) {
394  ((ElementImpl *)impl)->setAttribute(ATTR_MARGINHEIGHT, value);
395  }
396 }
397 
399 {
400  if (!impl) {
401  return DOMString();
402  }
403  return ((ElementImpl *)impl)->getAttribute(ATTR_MARGINWIDTH);
404 }
405 
407 {
408  if (impl) {
409  ((ElementImpl *)impl)->setAttribute(ATTR_MARGINWIDTH, value);
410  }
411 }
412 
414 {
415  if (!impl) {
416  return DOMString();
417  }
418  return ((ElementImpl *)impl)->getAttribute(ATTR_NAME);
419 }
420 
422 {
423  if (impl) {
424  ((ElementImpl *)impl)->setAttribute(ATTR_NAME, value);
425  }
426 }
427 
429 {
430  if (!impl) {
431  return DOMString();
432  }
433  return ((ElementImpl *)impl)->getAttribute(ATTR_SCROLLING);
434 }
435 
437 {
438  if (impl) {
439  ((ElementImpl *)impl)->setAttribute(ATTR_SCROLLING, value);
440  }
441 }
442 
444 {
445  if (!impl) {
446  return DOMString();
447  }
448  const DOMString s = ((ElementImpl *)impl)->getAttribute(ATTR_SRC).trimSpaces();
449  return !s.isNull() ? impl->document()->completeURL(s.string()) : s;
450 }
451 
453 {
454  if (impl) {
455  ((ElementImpl *)impl)->setAttribute(ATTR_SRC, value);
456  }
457 }
458 
460 {
461  if (!impl) {
462  return DOMString();
463  }
464  return ((ElementImpl *)impl)->getAttribute(ATTR_WIDTH);
465 }
466 
468 {
469  if (impl) {
470  ((ElementImpl *)impl)->setAttribute(ATTR_WIDTH, value);
471  }
472 }
473 
475 {
476  if (impl) {
477  return static_cast<HTMLIFrameElementImpl *>(impl)->contentDocument();
478  }
479  return Document();
480 }
481 
482 // --------------------------------------------------------------------------
483 
484 HTMLFrameSetElement::HTMLFrameSetElement() : HTMLElement()
485 {
486 }
487 
488 HTMLFrameSetElement::HTMLFrameSetElement(const HTMLFrameSetElement &other) : HTMLElement(other)
489 {
490 }
491 
492 HTMLFrameSetElement::HTMLFrameSetElement(HTMLFrameSetElementImpl *impl) : HTMLElement(impl)
493 {
494 }
495 
496 HTMLFrameSetElement &HTMLFrameSetElement::operator = (const Node &other)
497 {
498  assignOther(other, ID_FRAMESET);
499  return *this;
500 }
501 
502 HTMLFrameSetElement &HTMLFrameSetElement::operator = (const HTMLFrameSetElement &other)
503 {
504  HTMLElement::operator = (other);
505  return *this;
506 }
507 
508 HTMLFrameSetElement::~HTMLFrameSetElement()
509 {
510 }
511 
513 {
514  if (!impl) {
515  return DOMString();
516  }
517  return ((ElementImpl *)impl)->getAttribute(ATTR_COLS);
518 }
519 
521 {
522  if (impl) {
523  ((ElementImpl *)impl)->setAttribute(ATTR_COLS, value);
524  }
525 }
526 
528 {
529  if (!impl) {
530  return DOMString();
531  }
532  return ((ElementImpl *)impl)->getAttribute(ATTR_ROWS);
533 }
534 
536 {
537  if (impl) {
538  ((ElementImpl *)impl)->setAttribute(ATTR_ROWS, value);
539  }
540 }
541 
542 // --------------------------------------------------------------------------
543 
544 HTMLHeadElement::HTMLHeadElement() : HTMLElement()
545 {
546 }
547 
548 HTMLHeadElement::HTMLHeadElement(const HTMLHeadElement &other) : HTMLElement(other)
549 {
550 }
551 
552 HTMLHeadElement::HTMLHeadElement(HTMLHeadElementImpl *impl) : HTMLElement(impl)
553 {
554 }
555 
556 HTMLHeadElement &HTMLHeadElement::operator = (const Node &other)
557 {
558  assignOther(other, ID_HEAD);
559  return *this;
560 }
561 
562 HTMLHeadElement &HTMLHeadElement::operator = (const HTMLHeadElement &other)
563 {
564  HTMLElement::operator = (other);
565  return *this;
566 }
567 
568 HTMLHeadElement::~HTMLHeadElement()
569 {
570 }
571 
573 {
574  if (!impl) {
575  return DOMString();
576  }
577  return ((ElementImpl *)impl)->getAttribute(ATTR_PROFILE);
578 }
579 
581 {
582  if (impl) {
583  ((ElementImpl *)impl)->setAttribute(ATTR_PROFILE, value);
584  }
585 }
586 
587 // --------------------------------------------------------------------------
588 
589 HTMLHtmlElement::HTMLHtmlElement() : HTMLElement()
590 {
591 }
592 
593 HTMLHtmlElement::HTMLHtmlElement(const HTMLHtmlElement &other) : HTMLElement(other)
594 {
595 }
596 
597 HTMLHtmlElement::HTMLHtmlElement(HTMLHtmlElementImpl *impl) : HTMLElement(impl)
598 {
599 }
600 
601 HTMLHtmlElement &HTMLHtmlElement::operator = (const Node &other)
602 {
603  assignOther(other, ID_HTML);
604  return *this;
605 }
606 
607 HTMLHtmlElement &HTMLHtmlElement::operator = (const HTMLHtmlElement &other)
608 {
609  HTMLElement::operator = (other);
610  return *this;
611 }
612 
613 HTMLHtmlElement::~HTMLHtmlElement()
614 {
615 }
616 
618 {
619  if (!impl) {
620  return DOMString();
621  }
622  return ((ElementImpl *)impl)->getAttribute(ATTR_VERSION);
623 }
624 
626 {
627  if (impl) {
628  ((ElementImpl *)impl)->setAttribute(ATTR_VERSION, value);
629  }
630 }
631 
void setRows(const DOMString &)
see rows
Definition: html_base.cpp:535
void setFrameBorder(const DOMString &)
see frameBorder
Definition: html_base.cpp:168
void setFrameBorder(const DOMString &)
see frameBorder
Definition: html_base.cpp:346
DOMString trimSpaces() const
Returns a string with Space Characters removed from the start and the end.
Definition: dom_string.cpp:345
void setLongDesc(const DOMString &)
see longDesc
Definition: html_base.cpp:183
All HTML element interfaces derive from this class.
Definition: html_element.h:70
void setWidth(const DOMString &)
see width
Definition: html_base.cpp:467
DOMString text() const
Document text color.
Definition: html_base.cpp:106
void setText(const DOMString &)
see text
Definition: html_base.cpp:111
DOMString aLink() const
Color of active links (after mouse-button down, but before mouse-button up).
Definition: html_base.cpp:58
DOMString bgColor() const
Document background color.
Definition: html_base.cpp:82
DOMString vLink() const
Color of links that have been visited by the user.
Definition: html_base.cpp:118
void setScrolling(const DOMString &)
see scrolling
Definition: html_base.cpp:436
DOMString marginWidth() const
Frame margin width, in pixels.
Definition: html_base.cpp:205
Root of an HTML document.
Definition: html_base.h:587
DOMString link() const
Color of links that are not active and unvisited.
Definition: html_base.cpp:94
void setCols(const DOMString &)
see cols
Definition: html_base.cpp:520
DOMString cols() const
The number of columns of frames in the frameset.
Definition: html_base.cpp:512
This library provides a full-featured HTML parser and widget.
void setSrc(const DOMString &)
see src
Definition: html_base.cpp:278
void setVLink(const DOMString &)
see vLink
Definition: html_base.cpp:123
void setMarginWidth(const DOMString &)
see marginWidth
Definition: html_base.cpp:406
Document contentDocument() const
Introduced in DOM Level 2.
Definition: html_base.cpp:285
DOMString name() const
The frame name (object of the target attribute).
Definition: html_base.cpp:413
The HTML document body.
Definition: html_base.h:50
DOMString version() const
Version information about the document's DTD.
Definition: html_base.cpp:617
void setALink(const DOMString &)
see aLink
Definition: html_base.cpp:63
DOMString name() const
The frame name (object of the target attribute).
Definition: html_base.cpp:220
void setName(const DOMString &)
see name
Definition: html_base.cpp:228
DOMString align() const
Aligns this object (vertically or horizontally) with respect to its surrounding text.
Definition: html_base.cpp:323
void setBackground(const DOMString &)
see background
Definition: html_base.cpp:75
void setVersion(const DOMString &)
see version
Definition: html_base.cpp:625
DOMString frameBorder() const
Request frame borders.
Definition: html_base.cpp:338
void setMarginHeight(const DOMString &)
see marginHeight
Definition: html_base.cpp:391
The Document interface represents the entire HTML or XML document.
Definition: dom_doc.h:246
DOMString marginHeight() const
Frame margin height, in pixels.
Definition: html_base.cpp:383
DOMString longDesc() const
URI designating a long description of this image or frame.
Definition: html_base.cpp:368
DOMString background() const
URI of the background texture tile image.
Definition: html_base.cpp:70
Document contentDocument() const
Introduced in DOM Level 2.
Definition: html_base.cpp:474
void setHeight(const DOMString &)
see height
Definition: html_base.cpp:361
DOMString scrolling() const
Specify whether or not the frame should have scrollbars.
Definition: html_base.cpp:428
void setMarginWidth(const DOMString &)
see marginWidth
Definition: html_base.cpp:213
void setProfile(const DOMString &)
see profile
Definition: html_base.cpp:580
DOMString rows() const
The number of rows of frames in the frameset.
Definition: html_base.cpp:527
DOMString src() const
A URI designating the initial frame contents.
Definition: html_base.cpp:269
DOMString scrolling() const
Specify whether or not the frame should have scrollbars.
Definition: html_base.cpp:254
void setAlign(const DOMString &)
see align
Definition: html_base.cpp:331
DOMString longDesc() const
URI designating a long description of this image or frame.
Definition: html_base.cpp:175
void setLongDesc(const DOMString &)
see longDesc
Definition: html_base.cpp:376
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
DOMString profile() const
URI designating a metadata profile.
Definition: html_base.cpp:572
void setNoResize(bool)
see noResize
Definition: html_base.cpp:243
DOMString marginHeight() const
Frame margin height, in pixels.
Definition: html_base.cpp:190
DOMString marginWidth() const
Frame margin width, in pixels.
Definition: html_base.cpp:398
Create a frame.
Definition: html_base.h:165
DOMString width() const
Frame width.
Definition: html_base.cpp:459
void setSrc(const DOMString &)
see src
Definition: html_base.cpp:452
DOMString src() const
A URI designating the initial frame contents.
Definition: html_base.cpp:443
Document head information.
Definition: html_base.h:544
Create a grid of frames.
Definition: html_base.h:313
Inline subwindows.
Definition: html_base.h:368
void setName(const DOMString &)
see name
Definition: html_base.cpp:421
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:278
bool noResize() const
When true, forbid user from resizing frame.
Definition: html_base.cpp:235
DOMString height() const
Frame height.
Definition: html_base.cpp:353
void setBgColor(const DOMString &)
see bgColor
Definition: html_base.cpp:87
void setScrolling(const DOMString &)
see scrolling
Definition: html_base.cpp:262
void setLink(const DOMString &)
see link
Definition: html_base.cpp:99
DOMString frameBorder() const
Request frame borders.
Definition: html_base.cpp:160
void setMarginHeight(const DOMString &)
see marginHeight
Definition: html_base.cpp:198
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Nov 30 2023 04:08:33 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.