File indexing completed on 2024-05-05 12:14:51
0001 /** 0002 * This file is part of the DOM implementation for KDE. 0003 * 0004 * Copyright 1999 Lars Knoll (knoll@kde.org) 0005 * 0006 * This library is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU Library General Public 0008 * License as published by the Free Software Foundation; either 0009 * version 2 of the License, or (at your option) any later version. 0010 * 0011 * This library is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 * Library General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU Library General Public License 0017 * along with this library; see the file COPYING.LIB. If not, write to 0018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0019 * Boston, MA 02110-1301, USA. 0020 */ 0021 // -------------------------------------------------------------------------- 0022 0023 #include "html_base.h" 0024 #include "dom_doc.h" 0025 #include <xml/dom_docimpl.h> 0026 #include <html/html_baseimpl.h> 0027 0028 using namespace DOM; 0029 0030 HTMLBodyElement::HTMLBodyElement() : HTMLElement() 0031 { 0032 } 0033 0034 HTMLBodyElement::HTMLBodyElement(const HTMLBodyElement &other) : HTMLElement(other) 0035 { 0036 } 0037 0038 HTMLBodyElement::HTMLBodyElement(HTMLBodyElementImpl *impl) : HTMLElement(impl) 0039 { 0040 } 0041 0042 HTMLBodyElement &HTMLBodyElement::operator = (const Node &other) 0043 { 0044 assignOther(other, ID_BODY); 0045 return *this; 0046 } 0047 0048 HTMLBodyElement &HTMLBodyElement::operator = (const HTMLBodyElement &other) 0049 { 0050 HTMLElement::operator = (other); 0051 return *this; 0052 } 0053 0054 HTMLBodyElement::~HTMLBodyElement() 0055 { 0056 } 0057 0058 DOMString HTMLBodyElement::aLink() const 0059 { 0060 return impl ? ((HTMLBodyElementImpl *)impl)->aLink() : DOMString(); 0061 } 0062 0063 void HTMLBodyElement::setALink(const DOMString &value) 0064 { 0065 if (impl) { 0066 ((HTMLBodyElementImpl *)impl)->setALink(value); 0067 } 0068 } 0069 0070 DOMString HTMLBodyElement::background() const 0071 { 0072 return impl ? ((ElementImpl *)impl)->getAttribute(ATTR_BACKGROUND) : DOMString(); 0073 } 0074 0075 void HTMLBodyElement::setBackground(const DOMString &value) 0076 { 0077 if (impl) { 0078 ((ElementImpl *)impl)->setAttribute(ATTR_BACKGROUND, value); 0079 } 0080 } 0081 0082 DOMString HTMLBodyElement::bgColor() const 0083 { 0084 return impl ? ((HTMLBodyElementImpl *)impl)->bgColor() : DOMString(); 0085 } 0086 0087 void HTMLBodyElement::setBgColor(const DOMString &value) 0088 { 0089 if (impl) { 0090 ((HTMLBodyElementImpl *)impl)->setBgColor(value); 0091 } 0092 } 0093 0094 DOMString HTMLBodyElement::link() const 0095 { 0096 return impl ? ((HTMLBodyElementImpl *)impl)->link() : DOMString(); 0097 } 0098 0099 void HTMLBodyElement::setLink(const DOMString &value) 0100 { 0101 if (impl) { 0102 ((HTMLBodyElementImpl *)impl)->setLink(value); 0103 } 0104 } 0105 0106 DOMString HTMLBodyElement::text() const 0107 { 0108 return impl ? ((HTMLBodyElementImpl *)impl)->text() : DOMString(); 0109 } 0110 0111 void HTMLBodyElement::setText(const DOMString &value) 0112 { 0113 if (impl) { 0114 ((HTMLBodyElementImpl *)impl)->setText(value); 0115 } 0116 } 0117 0118 DOMString HTMLBodyElement::vLink() const 0119 { 0120 return impl ? ((HTMLBodyElementImpl *)impl)->vLink() : DOMString(); 0121 } 0122 0123 void HTMLBodyElement::setVLink(const DOMString &value) 0124 { 0125 if (impl) { 0126 ((HTMLBodyElementImpl *)impl)->setVLink(value); 0127 } 0128 } 0129 0130 // -------------------------------------------------------------------------- 0131 0132 HTMLFrameElement::HTMLFrameElement() : HTMLElement() 0133 { 0134 } 0135 0136 HTMLFrameElement::HTMLFrameElement(const HTMLFrameElement &other) : HTMLElement(other) 0137 { 0138 } 0139 0140 HTMLFrameElement::HTMLFrameElement(HTMLFrameElementImpl *impl) : HTMLElement(impl) 0141 { 0142 } 0143 0144 HTMLFrameElement &HTMLFrameElement::operator = (const Node &other) 0145 { 0146 assignOther(other, ID_FRAME); 0147 return *this; 0148 } 0149 0150 HTMLFrameElement &HTMLFrameElement::operator = (const HTMLFrameElement &other) 0151 { 0152 HTMLElement::operator = (other); 0153 return *this; 0154 } 0155 0156 HTMLFrameElement::~HTMLFrameElement() 0157 { 0158 } 0159 0160 DOMString HTMLFrameElement::frameBorder() const 0161 { 0162 if (!impl) { 0163 return DOMString(); 0164 } 0165 return ((ElementImpl *)impl)->getAttribute(ATTR_FRAMEBORDER); 0166 } 0167 0168 void HTMLFrameElement::setFrameBorder(const DOMString &value) 0169 { 0170 if (impl) { 0171 ((ElementImpl *)impl)->setAttribute(ATTR_FRAMEBORDER, value); 0172 } 0173 } 0174 0175 DOMString HTMLFrameElement::longDesc() const 0176 { 0177 if (!impl) { 0178 return DOMString(); 0179 } 0180 return ((ElementImpl *)impl)->getAttribute(ATTR_LONGDESC); 0181 } 0182 0183 void HTMLFrameElement::setLongDesc(const DOMString &value) 0184 { 0185 if (impl) { 0186 ((ElementImpl *)impl)->setAttribute(ATTR_LONGDESC, value); 0187 } 0188 } 0189 0190 DOMString HTMLFrameElement::marginHeight() const 0191 { 0192 if (!impl) { 0193 return DOMString(); 0194 } 0195 return ((ElementImpl *)impl)->getAttribute(ATTR_MARGINHEIGHT); 0196 } 0197 0198 void HTMLFrameElement::setMarginHeight(const DOMString &value) 0199 { 0200 if (impl) { 0201 ((ElementImpl *)impl)->setAttribute(ATTR_MARGINHEIGHT, value); 0202 } 0203 } 0204 0205 DOMString HTMLFrameElement::marginWidth() const 0206 { 0207 if (!impl) { 0208 return DOMString(); 0209 } 0210 return ((ElementImpl *)impl)->getAttribute(ATTR_MARGINWIDTH); 0211 } 0212 0213 void HTMLFrameElement::setMarginWidth(const DOMString &value) 0214 { 0215 if (impl) { 0216 ((ElementImpl *)impl)->setAttribute(ATTR_MARGINWIDTH, value); 0217 } 0218 } 0219 0220 DOMString HTMLFrameElement::name() const 0221 { 0222 if (!impl) { 0223 return DOMString(); 0224 } 0225 return ((ElementImpl *)impl)->getAttribute(ATTR_NAME); 0226 } 0227 0228 void HTMLFrameElement::setName(const DOMString &value) 0229 { 0230 if (impl) { 0231 ((ElementImpl *)impl)->setAttribute(ATTR_NAME, value); 0232 } 0233 } 0234 0235 bool HTMLFrameElement::noResize() const 0236 { 0237 if (!impl) { 0238 return false; 0239 } 0240 return !((ElementImpl *)impl)->getAttribute(ATTR_NORESIZE).isNull(); 0241 } 0242 0243 void HTMLFrameElement::setNoResize(bool _noResize) 0244 { 0245 if (impl) { 0246 DOMString str; 0247 if (_noResize) { 0248 str = ""; 0249 } 0250 ((ElementImpl *)impl)->setAttribute(ATTR_NORESIZE, str); 0251 } 0252 } 0253 0254 DOMString HTMLFrameElement::scrolling() const 0255 { 0256 if (!impl) { 0257 return DOMString(); 0258 } 0259 return ((ElementImpl *)impl)->getAttribute(ATTR_SCROLLING); 0260 } 0261 0262 void HTMLFrameElement::setScrolling(const DOMString &value) 0263 { 0264 if (impl) { 0265 ((ElementImpl *)impl)->setAttribute(ATTR_SCROLLING, value); 0266 } 0267 } 0268 0269 DOMString HTMLFrameElement::src() const 0270 { 0271 if (!impl) { 0272 return DOMString(); 0273 } 0274 const DOMString s = ((ElementImpl *)impl)->getAttribute(ATTR_SRC).trimSpaces(); 0275 return !s.isNull() ? impl->document()->completeURL(s.string()) : s; 0276 } 0277 0278 void HTMLFrameElement::setSrc(const DOMString &value) 0279 { 0280 if (impl) { 0281 ((ElementImpl *)impl)->setAttribute(ATTR_SRC, value); 0282 } 0283 } 0284 0285 Document HTMLFrameElement::contentDocument() const 0286 { 0287 if (impl) { 0288 return static_cast<HTMLFrameElementImpl *>(impl)->contentDocument(); 0289 } 0290 return Document(); 0291 } 0292 0293 // -------------------------------------------------------------------------- 0294 0295 HTMLIFrameElement::HTMLIFrameElement() : HTMLElement() 0296 { 0297 } 0298 0299 HTMLIFrameElement::HTMLIFrameElement(const HTMLIFrameElement &other) : HTMLElement(other) 0300 { 0301 } 0302 0303 HTMLIFrameElement::HTMLIFrameElement(HTMLIFrameElementImpl *impl) : HTMLElement(impl) 0304 { 0305 } 0306 0307 HTMLIFrameElement &HTMLIFrameElement::operator = (const Node &other) 0308 { 0309 assignOther(other, ID_IFRAME); 0310 return *this; 0311 } 0312 0313 HTMLIFrameElement &HTMLIFrameElement::operator = (const HTMLIFrameElement &other) 0314 { 0315 HTMLElement::operator = (other); 0316 return *this; 0317 } 0318 0319 HTMLIFrameElement::~HTMLIFrameElement() 0320 { 0321 } 0322 0323 DOMString HTMLIFrameElement::align() const 0324 { 0325 if (!impl) { 0326 return DOMString(); 0327 } 0328 return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN); 0329 } 0330 0331 void HTMLIFrameElement::setAlign(const DOMString &value) 0332 { 0333 if (impl) { 0334 ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value); 0335 } 0336 } 0337 0338 DOMString HTMLIFrameElement::frameBorder() const 0339 { 0340 if (!impl) { 0341 return DOMString(); 0342 } 0343 return ((ElementImpl *)impl)->getAttribute(ATTR_FRAMEBORDER); 0344 } 0345 0346 void HTMLIFrameElement::setFrameBorder(const DOMString &value) 0347 { 0348 if (impl) { 0349 ((ElementImpl *)impl)->setAttribute(ATTR_FRAMEBORDER, value); 0350 } 0351 } 0352 0353 DOMString HTMLIFrameElement::height() const 0354 { 0355 if (!impl) { 0356 return DOMString(); 0357 } 0358 return ((ElementImpl *)impl)->getAttribute(ATTR_HEIGHT); 0359 } 0360 0361 void HTMLIFrameElement::setHeight(const DOMString &value) 0362 { 0363 if (impl) { 0364 ((ElementImpl *)impl)->setAttribute(ATTR_HEIGHT, value); 0365 } 0366 } 0367 0368 DOMString HTMLIFrameElement::longDesc() const 0369 { 0370 if (!impl) { 0371 return DOMString(); 0372 } 0373 return ((ElementImpl *)impl)->getAttribute(ATTR_LONGDESC); 0374 } 0375 0376 void HTMLIFrameElement::setLongDesc(const DOMString &value) 0377 { 0378 if (impl) { 0379 ((ElementImpl *)impl)->setAttribute(ATTR_LONGDESC, value); 0380 } 0381 } 0382 0383 DOMString HTMLIFrameElement::marginHeight() const 0384 { 0385 if (!impl) { 0386 return DOMString(); 0387 } 0388 return ((ElementImpl *)impl)->getAttribute(ATTR_MARGINHEIGHT); 0389 } 0390 0391 void HTMLIFrameElement::setMarginHeight(const DOMString &value) 0392 { 0393 if (impl) { 0394 ((ElementImpl *)impl)->setAttribute(ATTR_MARGINHEIGHT, value); 0395 } 0396 } 0397 0398 DOMString HTMLIFrameElement::marginWidth() const 0399 { 0400 if (!impl) { 0401 return DOMString(); 0402 } 0403 return ((ElementImpl *)impl)->getAttribute(ATTR_MARGINWIDTH); 0404 } 0405 0406 void HTMLIFrameElement::setMarginWidth(const DOMString &value) 0407 { 0408 if (impl) { 0409 ((ElementImpl *)impl)->setAttribute(ATTR_MARGINWIDTH, value); 0410 } 0411 } 0412 0413 DOMString HTMLIFrameElement::name() const 0414 { 0415 if (!impl) { 0416 return DOMString(); 0417 } 0418 return ((ElementImpl *)impl)->getAttribute(ATTR_NAME); 0419 } 0420 0421 void HTMLIFrameElement::setName(const DOMString &value) 0422 { 0423 if (impl) { 0424 ((ElementImpl *)impl)->setAttribute(ATTR_NAME, value); 0425 } 0426 } 0427 0428 DOMString HTMLIFrameElement::scrolling() const 0429 { 0430 if (!impl) { 0431 return DOMString(); 0432 } 0433 return ((ElementImpl *)impl)->getAttribute(ATTR_SCROLLING); 0434 } 0435 0436 void HTMLIFrameElement::setScrolling(const DOMString &value) 0437 { 0438 if (impl) { 0439 ((ElementImpl *)impl)->setAttribute(ATTR_SCROLLING, value); 0440 } 0441 } 0442 0443 DOMString HTMLIFrameElement::src() const 0444 { 0445 if (!impl) { 0446 return DOMString(); 0447 } 0448 const DOMString s = ((ElementImpl *)impl)->getAttribute(ATTR_SRC).trimSpaces(); 0449 return !s.isNull() ? impl->document()->completeURL(s.string()) : s; 0450 } 0451 0452 void HTMLIFrameElement::setSrc(const DOMString &value) 0453 { 0454 if (impl) { 0455 ((ElementImpl *)impl)->setAttribute(ATTR_SRC, value); 0456 } 0457 } 0458 0459 DOMString HTMLIFrameElement::width() const 0460 { 0461 if (!impl) { 0462 return DOMString(); 0463 } 0464 return ((ElementImpl *)impl)->getAttribute(ATTR_WIDTH); 0465 } 0466 0467 void HTMLIFrameElement::setWidth(const DOMString &value) 0468 { 0469 if (impl) { 0470 ((ElementImpl *)impl)->setAttribute(ATTR_WIDTH, value); 0471 } 0472 } 0473 0474 Document HTMLIFrameElement::contentDocument() const 0475 { 0476 if (impl) { 0477 return static_cast<HTMLIFrameElementImpl *>(impl)->contentDocument(); 0478 } 0479 return Document(); 0480 } 0481 0482 // -------------------------------------------------------------------------- 0483 0484 HTMLFrameSetElement::HTMLFrameSetElement() : HTMLElement() 0485 { 0486 } 0487 0488 HTMLFrameSetElement::HTMLFrameSetElement(const HTMLFrameSetElement &other) : HTMLElement(other) 0489 { 0490 } 0491 0492 HTMLFrameSetElement::HTMLFrameSetElement(HTMLFrameSetElementImpl *impl) : HTMLElement(impl) 0493 { 0494 } 0495 0496 HTMLFrameSetElement &HTMLFrameSetElement::operator = (const Node &other) 0497 { 0498 assignOther(other, ID_FRAMESET); 0499 return *this; 0500 } 0501 0502 HTMLFrameSetElement &HTMLFrameSetElement::operator = (const HTMLFrameSetElement &other) 0503 { 0504 HTMLElement::operator = (other); 0505 return *this; 0506 } 0507 0508 HTMLFrameSetElement::~HTMLFrameSetElement() 0509 { 0510 } 0511 0512 DOMString HTMLFrameSetElement::cols() const 0513 { 0514 if (!impl) { 0515 return DOMString(); 0516 } 0517 return ((ElementImpl *)impl)->getAttribute(ATTR_COLS); 0518 } 0519 0520 void HTMLFrameSetElement::setCols(const DOMString &value) 0521 { 0522 if (impl) { 0523 ((ElementImpl *)impl)->setAttribute(ATTR_COLS, value); 0524 } 0525 } 0526 0527 DOMString HTMLFrameSetElement::rows() const 0528 { 0529 if (!impl) { 0530 return DOMString(); 0531 } 0532 return ((ElementImpl *)impl)->getAttribute(ATTR_ROWS); 0533 } 0534 0535 void HTMLFrameSetElement::setRows(const DOMString &value) 0536 { 0537 if (impl) { 0538 ((ElementImpl *)impl)->setAttribute(ATTR_ROWS, value); 0539 } 0540 } 0541 0542 // -------------------------------------------------------------------------- 0543 0544 HTMLHeadElement::HTMLHeadElement() : HTMLElement() 0545 { 0546 } 0547 0548 HTMLHeadElement::HTMLHeadElement(const HTMLHeadElement &other) : HTMLElement(other) 0549 { 0550 } 0551 0552 HTMLHeadElement::HTMLHeadElement(HTMLHeadElementImpl *impl) : HTMLElement(impl) 0553 { 0554 } 0555 0556 HTMLHeadElement &HTMLHeadElement::operator = (const Node &other) 0557 { 0558 assignOther(other, ID_HEAD); 0559 return *this; 0560 } 0561 0562 HTMLHeadElement &HTMLHeadElement::operator = (const HTMLHeadElement &other) 0563 { 0564 HTMLElement::operator = (other); 0565 return *this; 0566 } 0567 0568 HTMLHeadElement::~HTMLHeadElement() 0569 { 0570 } 0571 0572 DOMString HTMLHeadElement::profile() const 0573 { 0574 if (!impl) { 0575 return DOMString(); 0576 } 0577 return ((ElementImpl *)impl)->getAttribute(ATTR_PROFILE); 0578 } 0579 0580 void HTMLHeadElement::setProfile(const DOMString &value) 0581 { 0582 if (impl) { 0583 ((ElementImpl *)impl)->setAttribute(ATTR_PROFILE, value); 0584 } 0585 } 0586 0587 // -------------------------------------------------------------------------- 0588 0589 HTMLHtmlElement::HTMLHtmlElement() : HTMLElement() 0590 { 0591 } 0592 0593 HTMLHtmlElement::HTMLHtmlElement(const HTMLHtmlElement &other) : HTMLElement(other) 0594 { 0595 } 0596 0597 HTMLHtmlElement::HTMLHtmlElement(HTMLHtmlElementImpl *impl) : HTMLElement(impl) 0598 { 0599 } 0600 0601 HTMLHtmlElement &HTMLHtmlElement::operator = (const Node &other) 0602 { 0603 assignOther(other, ID_HTML); 0604 return *this; 0605 } 0606 0607 HTMLHtmlElement &HTMLHtmlElement::operator = (const HTMLHtmlElement &other) 0608 { 0609 HTMLElement::operator = (other); 0610 return *this; 0611 } 0612 0613 HTMLHtmlElement::~HTMLHtmlElement() 0614 { 0615 } 0616 0617 DOMString HTMLHtmlElement::version() const 0618 { 0619 if (!impl) { 0620 return DOMString(); 0621 } 0622 return ((ElementImpl *)impl)->getAttribute(ATTR_VERSION); 0623 } 0624 0625 void HTMLHtmlElement::setVersion(const DOMString &value) 0626 { 0627 if (impl) { 0628 ((ElementImpl *)impl)->setAttribute(ATTR_VERSION, value); 0629 } 0630 } 0631