KHTML
html_form.cpp
Go to the documentation of this file.
00001 00022 // -------------------------------------------------------------------------- 00023 00024 #include "dom/html_form.h" 00025 #include "dom/dom_exception.h" 00026 #include "dom/dom_doc.h" 00027 00028 #include "html/html_formimpl.h" 00029 #include "html/html_miscimpl.h" 00030 00031 #include "xml/dom_docimpl.h" 00032 00033 using namespace DOM; 00034 00035 HTMLButtonElement::HTMLButtonElement() : HTMLElement() 00036 { 00037 } 00038 00039 HTMLButtonElement::HTMLButtonElement(const HTMLButtonElement &other) : HTMLElement(other) 00040 { 00041 } 00042 00043 HTMLButtonElement::HTMLButtonElement(HTMLButtonElementImpl *impl) : HTMLElement(impl) 00044 { 00045 } 00046 00047 HTMLButtonElement &HTMLButtonElement::operator = (const Node &other) 00048 { 00049 assignOther( other, ID_BUTTON ); 00050 return *this; 00051 } 00052 00053 HTMLButtonElement &HTMLButtonElement::operator = (const HTMLButtonElement &other) 00054 { 00055 HTMLElement::operator = (other); 00056 return *this; 00057 } 00058 00059 HTMLButtonElement::~HTMLButtonElement() 00060 { 00061 } 00062 00063 HTMLFormElement HTMLButtonElement::form() const 00064 { 00065 return Element::form(); 00066 } 00067 00068 DOMString HTMLButtonElement::accessKey() const 00069 { 00070 if(!impl) return DOMString(); 00071 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_ACCESSKEY); 00072 } 00073 00074 void HTMLButtonElement::setAccessKey( const DOMString &value ) 00075 { 00076 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ACCESSKEY, value); 00077 } 00078 00079 bool HTMLButtonElement::disabled() const 00080 { 00081 if(!impl) return 0; 00082 return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_DISABLED).isNull(); 00083 } 00084 00085 void HTMLButtonElement::setDisabled( bool _disabled ) 00086 { 00087 if (impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_DISABLED, _disabled ? "" : 0); 00088 } 00089 00090 DOMString HTMLButtonElement::name() const 00091 { 00092 if(!impl) return DOMString(); 00093 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_NAME); 00094 } 00095 00096 void HTMLButtonElement::setName( const DOMString &value ) 00097 { 00098 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_NAME, value); 00099 } 00100 00101 void HTMLButtonElement::focus( ) 00102 { 00103 if(impl) 00104 static_cast<HTMLButtonElementImpl*>(impl)->focus(); 00105 } 00106 00107 void HTMLButtonElement::blur( ) 00108 { 00109 if(impl) 00110 static_cast<HTMLButtonElementImpl*>(impl)->blur(); 00111 } 00112 00113 long HTMLButtonElement::tabIndex() const 00114 { 00115 if(!impl) return 0; 00116 return static_cast<ElementImpl*>(impl)->tabIndex(); 00117 } 00118 00119 void HTMLButtonElement::setTabIndex( long _tabIndex ) 00120 { 00121 if (!impl) return; 00122 static_cast<ElementImpl*>(impl)->setTabIndex(_tabIndex); 00123 } 00124 00125 DOMString HTMLButtonElement::type() const 00126 { 00127 if(!impl) return DOMString(); 00128 return static_cast<HTMLButtonElementImpl*>(impl)->type(); 00129 } 00130 00131 DOMString HTMLButtonElement::value() const 00132 { 00133 if(!impl) return DOMString(); 00134 DOMString s = static_cast<ElementImpl*>(impl)->getAttribute(ATTR_VALUE); 00135 if (s.isNull()) return DOMString(""); 00136 return s; 00137 } 00138 00139 void HTMLButtonElement::setValue( const DOMString &value ) 00140 { 00141 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_VALUE, value); 00142 } 00143 00144 // -------------------------------------------------------------------------- 00145 00146 HTMLFieldSetElement::HTMLFieldSetElement() : HTMLElement() 00147 { 00148 } 00149 00150 HTMLFieldSetElement::HTMLFieldSetElement(const HTMLFieldSetElement &other) : HTMLElement(other) 00151 { 00152 } 00153 00154 HTMLFieldSetElement::HTMLFieldSetElement(HTMLFieldSetElementImpl *impl) : HTMLElement(impl) 00155 { 00156 } 00157 00158 HTMLFieldSetElement &HTMLFieldSetElement::operator = (const Node &other) 00159 { 00160 assignOther( other, ID_FIELDSET ); 00161 return *this; 00162 } 00163 00164 HTMLFieldSetElement &HTMLFieldSetElement::operator = (const HTMLFieldSetElement &other) 00165 { 00166 HTMLElement::operator = (other); 00167 return *this; 00168 } 00169 00170 HTMLFieldSetElement::~HTMLFieldSetElement() 00171 { 00172 } 00173 00174 HTMLFormElement HTMLFieldSetElement::form() const 00175 { 00176 return Element::form(); 00177 } 00178 00179 // -------------------------------------------------------------------------- 00180 00181 HTMLFormElement::HTMLFormElement() : HTMLElement() 00182 { 00183 } 00184 00185 HTMLFormElement::HTMLFormElement(const HTMLFormElement &other) : HTMLElement(other) 00186 { 00187 } 00188 00189 HTMLFormElement::HTMLFormElement(HTMLFormElementImpl *impl) : HTMLElement(impl) 00190 { 00191 } 00192 00193 HTMLFormElement &HTMLFormElement::operator = (const Node &other) 00194 { 00195 assignOther( other, ID_FORM ); 00196 return *this; 00197 } 00198 00199 HTMLFormElement &HTMLFormElement::operator = (const HTMLFormElement &other) 00200 { 00201 HTMLElement::operator = (other); 00202 return *this; 00203 } 00204 00205 HTMLFormElement::~HTMLFormElement() 00206 { 00207 } 00208 00209 HTMLCollection HTMLFormElement::elements() const 00210 { 00211 if(!impl) return HTMLCollection(); 00212 return HTMLFormCollection(impl); 00213 } 00214 00215 long HTMLFormElement::length() const 00216 { 00217 if(!impl) return 0; 00218 return static_cast<HTMLFormElementImpl*>(impl)->length(); 00219 } 00220 00221 DOMString HTMLFormElement::name() const 00222 { 00223 if(!impl) return DOMString(); 00224 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_NAME); 00225 } 00226 00227 void HTMLFormElement::setName( const DOMString &value ) 00228 { 00229 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_NAME, value); 00230 } 00231 00232 DOMString HTMLFormElement::acceptCharset() const 00233 { 00234 if(!impl) return DOMString(); 00235 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_ACCEPT_CHARSET); 00236 } 00237 00238 void HTMLFormElement::setAcceptCharset( const DOMString &value ) 00239 { 00240 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ACCEPT_CHARSET, value); 00241 } 00242 00243 DOMString HTMLFormElement::action() const 00244 { 00245 if(!impl) return DOMString(); 00246 return static_cast<HTMLFormElementImpl*>(impl)->action(); 00247 } 00248 00249 void HTMLFormElement::setAction( const DOMString &value ) 00250 { 00251 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ACTION, value); 00252 } 00253 00254 DOMString HTMLFormElement::enctype() const 00255 { 00256 if(!impl) return DOMString(); 00257 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_ENCTYPE); 00258 } 00259 00260 void HTMLFormElement::setEnctype( const DOMString &value ) 00261 { 00262 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ENCTYPE, value); 00263 } 00264 00265 DOMString HTMLFormElement::method() const 00266 { 00267 if(!impl) return DOMString(); 00268 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_METHOD); 00269 } 00270 00271 void HTMLFormElement::setMethod( const DOMString &value ) 00272 { 00273 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_METHOD, value); 00274 } 00275 00276 DOMString HTMLFormElement::target() const 00277 { 00278 if(!impl) return DOMString(); 00279 return static_cast<HTMLFormElementImpl*>(impl)->target(); 00280 } 00281 00282 void HTMLFormElement::setTarget( const DOMString &value ) 00283 { 00284 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_TARGET, value); 00285 } 00286 00287 void HTMLFormElement::submit( ) 00288 { 00289 if(impl) static_cast<HTMLFormElementImpl*>(impl)->submit( ); 00290 } 00291 00292 void HTMLFormElement::reset( ) 00293 { 00294 if(impl) static_cast<HTMLFormElementImpl*>(impl)->reset( ); 00295 } 00296 00297 // -------------------------------------------------------------------------- 00298 00299 HTMLInputElement::HTMLInputElement() : HTMLElement() 00300 { 00301 } 00302 00303 HTMLInputElement::HTMLInputElement(const HTMLInputElement &other) : HTMLElement(other) 00304 { 00305 } 00306 00307 HTMLInputElement::HTMLInputElement(HTMLInputElementImpl *impl) : HTMLElement(impl) 00308 { 00309 } 00310 00311 HTMLInputElement &HTMLInputElement::operator = (const Node &other) 00312 { 00313 assignOther( other, ID_INPUT ); 00314 return *this; 00315 } 00316 00317 HTMLInputElement &HTMLInputElement::operator = (const HTMLInputElement &other) 00318 { 00319 HTMLElement::operator = (other); 00320 return *this; 00321 } 00322 00323 HTMLInputElement::~HTMLInputElement() 00324 { 00325 } 00326 00327 DOMString HTMLInputElement::defaultValue() const 00328 { 00329 if(!impl) return DOMString(); 00330 DOMString s = static_cast<ElementImpl*>(impl)->getAttribute(ATTR_VALUE); 00331 if (s.isNull()) return DOMString(""); 00332 return s; 00333 00334 } 00335 00336 void HTMLInputElement::setDefaultValue( const DOMString &value ) 00337 { 00338 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_VALUE, value); 00339 } 00340 00341 bool HTMLInputElement::defaultChecked() const 00342 { 00343 if(!impl) return 0; 00344 return !((ElementImpl *)impl)->getAttribute(ATTR_CHECKED).isNull(); 00345 } 00346 00347 void HTMLInputElement::setDefaultChecked( bool _defaultChecked ) 00348 { 00349 if(impl) 00350 ((ElementImpl *)impl)->setAttribute(ATTR_CHECKED, _defaultChecked ? "" : 0); 00351 } 00352 00353 HTMLFormElement HTMLInputElement::form() const 00354 { 00355 return Element::form(); 00356 } 00357 00358 DOMString HTMLInputElement::accept() const 00359 { 00360 if(!impl) return DOMString(); 00361 return ((ElementImpl *)impl)->getAttribute(ATTR_ACCEPT); 00362 } 00363 00364 void HTMLInputElement::setAccept( const DOMString &value ) 00365 { 00366 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ACCEPT, value); 00367 } 00368 00369 DOMString HTMLInputElement::accessKey() const 00370 { 00371 if(!impl) return DOMString(); 00372 return ((ElementImpl *)impl)->getAttribute(ATTR_ACCESSKEY); 00373 } 00374 00375 void HTMLInputElement::setAccessKey( const DOMString &value ) 00376 { 00377 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ACCESSKEY, value); 00378 } 00379 00380 DOMString HTMLInputElement::align() const 00381 { 00382 if(!impl) return DOMString(); 00383 return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN); 00384 } 00385 00386 void HTMLInputElement::setAlign( const DOMString &value ) 00387 { 00388 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value); 00389 } 00390 00391 DOMString HTMLInputElement::alt() const 00392 { 00393 if(!impl) return DOMString(); 00394 return ((ElementImpl *)impl)->getAttribute(ATTR_ALT); 00395 } 00396 00397 void HTMLInputElement::setAlt( const DOMString &value ) 00398 { 00399 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALT, value); 00400 } 00401 00402 bool HTMLInputElement::checked() const 00403 { 00404 if(!impl) return 0; 00405 return ((HTMLInputElementImpl*)impl)->checked(); 00406 } 00407 00408 void HTMLInputElement::setChecked( bool _checked ) 00409 { 00410 if(impl) 00411 ((HTMLInputElementImpl*)impl)->setChecked(_checked); 00412 } 00413 00414 bool HTMLInputElement::indeterminate() const 00415 { 00416 if(!impl) return 0; 00417 return ((HTMLInputElementImpl*)impl)->indeterminate(); 00418 } 00419 00420 void HTMLInputElement::setIndeterminate( bool _indeterminate ) 00421 { 00422 if(impl) 00423 ((HTMLInputElementImpl*)impl)->setIndeterminate(_indeterminate); 00424 } 00425 00426 bool HTMLInputElement::disabled() const 00427 { 00428 if(!impl) return 0; 00429 return !((ElementImpl *)impl)->getAttribute(ATTR_DISABLED).isNull(); 00430 } 00431 00432 void HTMLInputElement::setDisabled( bool _disabled ) 00433 { 00434 if(impl) 00435 { 00436 ((ElementImpl *)impl)->setAttribute(ATTR_DISABLED, _disabled ? "" : 0); 00437 } 00438 } 00439 00440 long HTMLInputElement::maxLength() const 00441 { 00442 if(!impl) return 0; 00443 return ((HTMLInputElementImpl *)impl)->getAttribute(ATTR_MAXLENGTH).toInt(); 00444 } 00445 00446 void HTMLInputElement::setMaxLength( long _maxLength ) 00447 { 00448 if(impl) { 00449 DOMString value(QString::number(_maxLength)); 00450 ((ElementImpl *)impl)->setAttribute(ATTR_MAXLENGTH,value); 00451 } 00452 } 00453 00454 DOMString HTMLInputElement::name() const 00455 { 00456 if(!impl) return DOMString(); 00457 return static_cast<HTMLInputElementImpl* const>(impl)->name(); 00458 } 00459 00460 void HTMLInputElement::setName( const DOMString &value ) 00461 { 00462 if(impl) static_cast<HTMLInputElementImpl*>(impl)->setName(value); 00463 } 00464 00465 bool HTMLInputElement::readOnly() const 00466 { 00467 if(!impl) return 0; 00468 return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_READONLY).isNull(); 00469 } 00470 00471 void HTMLInputElement::setReadOnly( bool _readOnly ) 00472 { 00473 if(impl) 00474 static_cast<ElementImpl*>(impl)->setAttribute(ATTR_READONLY, _readOnly ? "" : 0); 00475 } 00476 00477 /* The next two are provided for backwards compatibility. */ 00478 #ifndef KDE_NO_DEPRECATED 00479 DOMString HTMLInputElement::size() const 00480 { 00481 if(!impl) return DOMString(); 00482 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_SIZE); 00483 } 00484 #endif 00485 00486 #ifndef KDE_NO_DEPRECATED 00487 void HTMLInputElement::setSize( const DOMString &value ) 00488 { 00489 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_SIZE, value); 00490 } 00491 #endif 00492 00493 long HTMLInputElement::getSize() const 00494 { 00495 if(!impl) return 0; 00496 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_SIZE).toInt(); 00497 } 00498 00499 void HTMLInputElement::setSize( long value ) 00500 { 00501 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_SIZE, QString::number(value)); 00502 } 00503 00504 DOMString HTMLInputElement::src() const 00505 { 00506 if(!impl) return DOMString(); 00507 DOMString s = static_cast<ElementImpl*>(impl)->getAttribute(ATTR_SRC); 00508 return !s.isNull() ? impl->document()->completeURL( s.string() ) : s; 00509 } 00510 00511 void HTMLInputElement::setSrc( const DOMString &value ) 00512 { 00513 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_SRC, value); 00514 } 00515 00516 long HTMLInputElement::tabIndex() const 00517 { 00518 if(!impl) return 0; 00519 return static_cast<ElementImpl*>(impl)->tabIndex(); 00520 } 00521 00522 void HTMLInputElement::setTabIndex( long _tabIndex ) 00523 { 00524 if (!impl) return; 00525 static_cast<ElementImpl*>(impl)->setTabIndex(_tabIndex); 00526 } 00527 00528 DOMString HTMLInputElement::type() const 00529 { 00530 if(!impl) return DOMString(); 00531 return ((HTMLInputElementImpl *)impl)->type(); 00532 } 00533 00534 void HTMLInputElement::setType(const DOMString& _type) 00535 { 00536 if (!impl) return; 00537 static_cast<HTMLInputElementImpl*>(impl)->setType(_type); 00538 } 00539 00540 DOMString HTMLInputElement::useMap() const 00541 { 00542 if(!impl) return DOMString(); 00543 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_USEMAP); 00544 } 00545 00546 void HTMLInputElement::setUseMap( const DOMString &value ) 00547 { 00548 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_USEMAP, value); 00549 } 00550 00551 DOMString HTMLInputElement::value() const 00552 { 00553 if(!impl) return DOMString(); 00554 return ((HTMLInputElementImpl*)impl)->value(); 00555 } 00556 00557 void HTMLInputElement::setValue( const DOMString &value ) 00558 { 00559 if (impl) 00560 ((HTMLInputElementImpl*)impl)->setValue(value); 00561 00562 } 00563 00564 void HTMLInputElement::blur( ) 00565 { 00566 if(impl) 00567 ((HTMLInputElementImpl*)impl)->blur(); 00568 } 00569 00570 void HTMLInputElement::focus( ) 00571 { 00572 if(impl) 00573 ((HTMLInputElementImpl*)impl)->focus(); 00574 } 00575 00576 void HTMLInputElement::select( ) 00577 { 00578 if(impl) 00579 ((HTMLInputElementImpl *)impl)->select( ); 00580 } 00581 00582 void HTMLInputElement::click( ) 00583 { 00584 if(impl) 00585 ((HTMLInputElementImpl *)impl)->click( ); 00586 } 00587 00588 long HTMLInputElement::selectionStart() 00589 { 00590 if (impl) 00591 return ((HTMLInputElementImpl *)impl)->selectionStart( ); 00592 return -1; 00593 } 00594 00595 long HTMLInputElement::selectionEnd() 00596 { 00597 if (impl) 00598 return ((HTMLInputElementImpl *)impl)->selectionEnd( ); 00599 return -1; 00600 } 00601 00602 void HTMLInputElement::setSelectionStart(long pos) 00603 { 00604 if (impl) 00605 ((HTMLInputElementImpl *)impl)->setSelectionStart( pos ); 00606 } 00607 00608 void HTMLInputElement::setSelectionEnd(long pos) 00609 { 00610 if (impl) 00611 ((HTMLInputElementImpl *)impl)->setSelectionEnd( pos ); 00612 } 00613 00614 void HTMLInputElement::setSelectionRange(long start, long end) 00615 { 00616 if (impl) 00617 ((HTMLInputElementImpl *)impl)->setSelectionRange( start, end ); 00618 } 00619 00620 // -------------------------------------------------------------------------- 00621 00622 HTMLLabelElement::HTMLLabelElement() : HTMLElement() 00623 { 00624 } 00625 00626 HTMLLabelElement::HTMLLabelElement(const HTMLLabelElement &other) : HTMLElement(other) 00627 { 00628 } 00629 00630 HTMLLabelElement::HTMLLabelElement(HTMLLabelElementImpl *impl) : HTMLElement(impl) 00631 { 00632 } 00633 00634 HTMLLabelElement &HTMLLabelElement::operator = (const Node &other) 00635 { 00636 assignOther( other, ID_LABEL ); 00637 return *this; 00638 } 00639 00640 HTMLLabelElement &HTMLLabelElement::operator = (const HTMLLabelElement &other) 00641 { 00642 HTMLElement::operator = (other); 00643 return *this; 00644 } 00645 00646 HTMLLabelElement::~HTMLLabelElement() 00647 { 00648 } 00649 00650 DOMString HTMLLabelElement::accessKey() const 00651 { 00652 if(!impl) return DOMString(); 00653 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_ACCESSKEY); 00654 } 00655 00656 void HTMLLabelElement::setAccessKey( const DOMString &value ) 00657 { 00658 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ACCESSKEY, value); 00659 } 00660 00661 DOMString HTMLLabelElement::htmlFor() const 00662 { 00663 if(!impl) return DOMString(); 00664 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_FOR); 00665 } 00666 00667 void HTMLLabelElement::setHtmlFor( const DOMString &value ) 00668 { 00669 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_FOR, value); 00670 } 00671 00672 // -------------------------------------------------------------------------- 00673 00674 HTMLLegendElement::HTMLLegendElement() : HTMLElement() 00675 { 00676 } 00677 00678 HTMLLegendElement::HTMLLegendElement(const HTMLLegendElement &other) : HTMLElement(other) 00679 { 00680 } 00681 00682 HTMLLegendElement::HTMLLegendElement(HTMLLegendElementImpl *impl) : HTMLElement(impl) 00683 { 00684 } 00685 00686 HTMLLegendElement &HTMLLegendElement::operator = (const Node &other) 00687 { 00688 assignOther( other, ID_LEGEND ); 00689 return *this; 00690 } 00691 00692 HTMLLegendElement &HTMLLegendElement::operator = (const HTMLLegendElement &other) 00693 { 00694 HTMLElement::operator = (other); 00695 return *this; 00696 } 00697 00698 HTMLLegendElement::~HTMLLegendElement() 00699 { 00700 } 00701 00702 HTMLFormElement HTMLLegendElement::form() const 00703 { 00704 return Element::form(); 00705 } 00706 00707 DOMString HTMLLegendElement::accessKey() const 00708 { 00709 if(!impl) return DOMString(); 00710 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_ACCESSKEY); 00711 } 00712 00713 void HTMLLegendElement::setAccessKey( const DOMString &value ) 00714 { 00715 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ACCESSKEY, value); 00716 } 00717 00718 DOMString HTMLLegendElement::align() const 00719 { 00720 if(!impl) return DOMString(); 00721 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_ALIGN); 00722 } 00723 00724 void HTMLLegendElement::setAlign( const DOMString &value ) 00725 { 00726 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ALIGN, value); 00727 } 00728 00729 // -------------------------------------------------------------------------- 00730 00731 HTMLOptGroupElement::HTMLOptGroupElement() : HTMLElement() 00732 { 00733 } 00734 00735 HTMLOptGroupElement::HTMLOptGroupElement(const HTMLOptGroupElement &other) : HTMLElement(other) 00736 { 00737 } 00738 00739 HTMLOptGroupElement::HTMLOptGroupElement(HTMLOptGroupElementImpl *impl) : HTMLElement(impl) 00740 { 00741 } 00742 00743 HTMLOptGroupElement &HTMLOptGroupElement::operator = (const Node &other) 00744 { 00745 assignOther( other, ID_OPTGROUP ); 00746 return *this; 00747 } 00748 00749 HTMLOptGroupElement &HTMLOptGroupElement::operator = (const HTMLOptGroupElement &other) 00750 { 00751 HTMLElement::operator = (other); 00752 return *this; 00753 } 00754 00755 HTMLOptGroupElement::~HTMLOptGroupElement() 00756 { 00757 } 00758 00759 bool HTMLOptGroupElement::disabled() const 00760 { 00761 if(!impl) return 0; 00762 return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_DISABLED).isNull(); 00763 } 00764 00765 void HTMLOptGroupElement::setDisabled( bool _disabled ) 00766 { 00767 if(impl) 00768 static_cast<ElementImpl*>(impl)->setAttribute(ATTR_DISABLED, _disabled ? "" : 0); 00769 } 00770 00771 DOMString HTMLOptGroupElement::label() const 00772 { 00773 if(!impl) return DOMString(); 00774 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_LABEL); 00775 } 00776 00777 void HTMLOptGroupElement::setLabel( const DOMString &value ) 00778 { 00779 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_LABEL, value); 00780 } 00781 00782 // -------------------------------------------------------------------------- 00783 00784 HTMLSelectElement::HTMLSelectElement() : HTMLElement() 00785 { 00786 } 00787 00788 HTMLSelectElement::HTMLSelectElement(const HTMLSelectElement &other) : HTMLElement(other) 00789 { 00790 } 00791 00792 HTMLSelectElement::HTMLSelectElement(HTMLSelectElementImpl *impl) : HTMLElement(impl) 00793 { 00794 } 00795 00796 HTMLSelectElement &HTMLSelectElement::operator = (const Node &other) 00797 { 00798 assignOther( other, ID_SELECT ); 00799 return *this; 00800 } 00801 00802 HTMLSelectElement &HTMLSelectElement::operator = (const HTMLSelectElement &other) 00803 { 00804 HTMLElement::operator = (other); 00805 return *this; 00806 } 00807 00808 HTMLSelectElement::~HTMLSelectElement() 00809 { 00810 } 00811 00812 DOMString HTMLSelectElement::type() const 00813 { 00814 if(!impl) return DOMString(); 00815 return ((HTMLSelectElementImpl *)impl)->type(); 00816 } 00817 00818 long HTMLSelectElement::selectedIndex() const 00819 { 00820 if(!impl) return 0; 00821 return ((HTMLSelectElementImpl *)impl)->selectedIndex(); 00822 } 00823 00824 void HTMLSelectElement::setSelectedIndex( long _selectedIndex ) 00825 { 00826 if(impl) 00827 ((HTMLSelectElementImpl *)impl)->setSelectedIndex(_selectedIndex); 00828 } 00829 00830 DOMString HTMLSelectElement::value() const 00831 { 00832 if(!impl) return DOMString(); 00833 return static_cast<HTMLSelectElementImpl*>(impl)->value(); 00834 } 00835 00836 void HTMLSelectElement::setValue( const DOMString &value ) 00837 { 00838 if(!impl || value.isNull()) return; 00839 static_cast<HTMLSelectElementImpl*>(impl)->setValue(value.implementation()); 00840 } 00841 00842 long HTMLSelectElement::length() const 00843 { 00844 if(!impl) return 0; 00845 return ((HTMLSelectElementImpl *)impl)->length(); 00846 } 00847 00848 HTMLFormElement HTMLSelectElement::form() const 00849 { 00850 return Element::form(); 00851 } 00852 00853 HTMLCollection HTMLSelectElement::options() const 00854 { 00855 if(!impl) return HTMLCollection(); 00856 return HTMLCollection(((HTMLSelectElementImpl*)impl)->options()); 00857 } 00858 00859 bool HTMLSelectElement::disabled() const 00860 { 00861 if(!impl) return 0; 00862 return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_DISABLED).isNull(); 00863 } 00864 00865 void HTMLSelectElement::setDisabled( bool _disabled ) 00866 { 00867 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_DISABLED, _disabled ? "" : 0); 00868 } 00869 00870 00871 bool HTMLSelectElement::multiple() const 00872 { 00873 if(!impl) return 0; 00874 return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_MULTIPLE).isNull(); 00875 } 00876 00877 void HTMLSelectElement::setMultiple( bool _multiple ) 00878 { 00879 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_MULTIPLE, _multiple ? "" : 0); 00880 } 00881 00882 DOMString HTMLSelectElement::name() const 00883 { 00884 if(!impl) return DOMString(); 00885 return static_cast<HTMLSelectElementImpl* const>(impl)->name(); 00886 } 00887 00888 void HTMLSelectElement::setName( const DOMString &value ) 00889 { 00890 if(impl) static_cast<HTMLSelectElementImpl*>(impl)->setName(value); 00891 } 00892 00893 long HTMLSelectElement::size() const 00894 { 00895 if(!impl) return 0; 00896 return ((HTMLSelectElementImpl *)impl)->getAttribute(ATTR_SIZE).toInt(); 00897 } 00898 00899 void HTMLSelectElement::setSize( long _size ) 00900 { 00901 00902 if(impl) { 00903 DOMString value(QString::number(_size)); 00904 static_cast<ElementImpl*>(impl)->setAttribute(ATTR_SIZE,value); 00905 } 00906 } 00907 00908 long HTMLSelectElement::tabIndex() const 00909 { 00910 if(!impl) return 0; 00911 return static_cast<ElementImpl*>(impl)->tabIndex(); 00912 } 00913 00914 void HTMLSelectElement::setTabIndex( long _tabIndex ) 00915 { 00916 if (!impl) return; 00917 static_cast<ElementImpl*>(impl)->setTabIndex(_tabIndex); 00918 } 00919 00920 void HTMLSelectElement::add( const HTMLElement &element, const HTMLElement &before ) 00921 { 00922 if (!impl) 00923 throw DOMException(DOMException::NOT_FOUND_ERR); 00924 00925 int exceptioncode = 0; 00926 static_cast<HTMLSelectElementImpl*>(impl)->add( 00927 static_cast<HTMLElementImpl*>(element.handle()), 00928 static_cast<HTMLElementImpl*>(before.handle()), exceptioncode ); 00929 if ( exceptioncode ) 00930 throw DOMException( exceptioncode ); 00931 } 00932 00933 void HTMLSelectElement::remove( long index ) 00934 { 00935 if(impl) static_cast<HTMLSelectElementImpl*>(impl)->remove( index ); 00936 } 00937 00938 void HTMLSelectElement::blur( ) 00939 { 00940 if(impl) 00941 ((HTMLSelectElementImpl*)impl)->blur(); 00942 } 00943 00944 void HTMLSelectElement::focus( ) 00945 { 00946 if(impl) 00947 ((HTMLSelectElementImpl*)impl)->focus(); 00948 } 00949 00950 // -------------------------------------------------------------------------- 00951 00952 HTMLTextAreaElement::HTMLTextAreaElement() : HTMLElement() 00953 { 00954 } 00955 00956 HTMLTextAreaElement::HTMLTextAreaElement(const HTMLTextAreaElement &other) : HTMLElement(other) 00957 { 00958 } 00959 00960 HTMLTextAreaElement::HTMLTextAreaElement(HTMLTextAreaElementImpl *impl) : HTMLElement(impl) 00961 { 00962 } 00963 00964 HTMLTextAreaElement &HTMLTextAreaElement::operator = (const Node &other) 00965 { 00966 assignOther( other, ID_TEXTAREA ); 00967 return *this; 00968 } 00969 00970 HTMLTextAreaElement &HTMLTextAreaElement::operator = (const HTMLTextAreaElement &other) 00971 { 00972 HTMLElement::operator = (other); 00973 return *this; 00974 } 00975 00976 HTMLTextAreaElement::~HTMLTextAreaElement() 00977 { 00978 } 00979 00980 DOMString HTMLTextAreaElement::defaultValue() const 00981 { 00982 if(!impl) return DOMString(); 00983 return ((HTMLTextAreaElementImpl *)impl)->defaultValue(); 00984 } 00985 00986 void HTMLTextAreaElement::setDefaultValue( const DOMString &value ) 00987 { 00988 if (impl) ((HTMLTextAreaElementImpl *)impl)->setDefaultValue(value); 00989 } 00990 00991 HTMLFormElement HTMLTextAreaElement::form() const 00992 { 00993 return Element::form(); 00994 } 00995 00996 DOMString HTMLTextAreaElement::accessKey() const 00997 { 00998 if(!impl) return DOMString(); 00999 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_ACCESSKEY); 01000 } 01001 01002 void HTMLTextAreaElement::setAccessKey( const DOMString &value ) 01003 { 01004 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ACCESSKEY, value); 01005 } 01006 01007 long HTMLTextAreaElement::cols() const 01008 { 01009 if(!impl) return 0; 01010 return ((HTMLTextAreaElementImpl *)impl)->getAttribute(ATTR_COLS).toInt(); 01011 } 01012 01013 void HTMLTextAreaElement::setCols( long _cols ) 01014 { 01015 01016 if(impl) { 01017 DOMString value(QString::number(_cols)); 01018 static_cast<ElementImpl*>(impl)->setAttribute(ATTR_COLS,value); 01019 } 01020 } 01021 01022 bool HTMLTextAreaElement::disabled() const 01023 { 01024 if(!impl) return 0; 01025 return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_DISABLED).isNull(); 01026 } 01027 01028 void HTMLTextAreaElement::setDisabled( bool _disabled ) 01029 { 01030 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_DISABLED, _disabled ? "" : 0); 01031 } 01032 01033 DOMString HTMLTextAreaElement::name() const 01034 { 01035 if(!impl) return DOMString(); 01036 return static_cast<HTMLTextAreaElementImpl* const>(impl)->name(); 01037 } 01038 01039 void HTMLTextAreaElement::setName( const DOMString &value ) 01040 { 01041 if(impl) static_cast<HTMLTextAreaElementImpl*>(impl)->setName(value); 01042 } 01043 01044 bool HTMLTextAreaElement::readOnly() const 01045 { 01046 if(!impl) return 0; 01047 return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_READONLY).isNull(); 01048 } 01049 01050 void HTMLTextAreaElement::setReadOnly( bool _readOnly ) 01051 { 01052 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_READONLY, _readOnly ? "" : 0); 01053 } 01054 01055 long HTMLTextAreaElement::rows() const 01056 { 01057 if(!impl) return 0; 01058 return ((HTMLTextAreaElementImpl *)impl)->getAttribute(ATTR_ROWS).toInt(); 01059 } 01060 01061 void HTMLTextAreaElement::setRows( long _rows ) 01062 { 01063 01064 if(impl) { 01065 DOMString value(QString::number(_rows)); 01066 static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ROWS,value); 01067 } 01068 } 01069 01070 long HTMLTextAreaElement::tabIndex() const 01071 { 01072 if(!impl) return 0; 01073 return static_cast<ElementImpl*>(impl)->tabIndex(); 01074 } 01075 01076 void HTMLTextAreaElement::setTabIndex( long _tabIndex ) 01077 { 01078 if (!impl) return; 01079 static_cast<ElementImpl*>(impl)->setTabIndex(_tabIndex); 01080 } 01081 01082 DOMString HTMLTextAreaElement::type() const 01083 { 01084 if(!impl) return DOMString(); 01085 return ((HTMLTextAreaElementImpl *)impl)->type(); 01086 } 01087 01088 DOMString HTMLTextAreaElement::value() const 01089 { 01090 if(!impl) return DOMString(); 01091 return ((HTMLTextAreaElementImpl *)impl)->value(); 01092 } 01093 01094 void HTMLTextAreaElement::setValue( const DOMString &value ) 01095 { 01096 if(impl) ((HTMLTextAreaElementImpl *)impl)->setValue(value); 01097 } 01098 01099 void HTMLTextAreaElement::blur( ) 01100 { 01101 if(impl) 01102 ((HTMLTextAreaElementImpl*)impl)->blur(); 01103 } 01104 01105 void HTMLTextAreaElement::focus( ) 01106 { 01107 if(impl) 01108 ((HTMLTextAreaElementImpl*)impl)->focus(); 01109 } 01110 01111 void HTMLTextAreaElement::select( ) 01112 { 01113 if(impl) 01114 ((HTMLTextAreaElementImpl *)impl)->select( ); 01115 } 01116 01117 long HTMLTextAreaElement::selectionStart() 01118 { 01119 if (impl) 01120 return ((HTMLTextAreaElementImpl *)impl)->selectionStart( ); 01121 return 0; 01122 } 01123 01124 long HTMLTextAreaElement::selectionEnd() 01125 { 01126 if (impl) 01127 return ((HTMLTextAreaElementImpl *)impl)->selectionEnd( ); 01128 return 0; 01129 } 01130 01131 long HTMLTextAreaElement::textLength() 01132 { 01133 if (impl) 01134 return ((HTMLTextAreaElementImpl *)impl)->textLength( ); 01135 return 0; 01136 } 01137 01138 void HTMLTextAreaElement::setSelectionStart(long pos) 01139 { 01140 if (impl) 01141 ((HTMLTextAreaElementImpl *)impl)->setSelectionStart( pos ); 01142 } 01143 01144 void HTMLTextAreaElement::setSelectionEnd(long pos) 01145 { 01146 if (impl) 01147 ((HTMLTextAreaElementImpl *)impl)->setSelectionEnd( pos ); 01148 } 01149 01150 void HTMLTextAreaElement::setSelectionRange(long start, long end) 01151 { 01152 if (impl) 01153 ((HTMLTextAreaElementImpl *)impl)->setSelectionRange( start, end ); 01154 } 01155 01156 // -------------------------------------------------------------------------- 01157 01158 HTMLOptionElement::HTMLOptionElement() : HTMLElement() 01159 { 01160 } 01161 01162 HTMLOptionElement::HTMLOptionElement(const HTMLOptionElement &other) : HTMLElement(other) 01163 { 01164 } 01165 01166 HTMLOptionElement::HTMLOptionElement(HTMLOptionElementImpl *impl) : HTMLElement(impl) 01167 { 01168 } 01169 01170 HTMLOptionElement &HTMLOptionElement::operator = (const Node &other) 01171 { 01172 assignOther( other, ID_OPTION ); 01173 return *this; 01174 } 01175 01176 HTMLOptionElement &HTMLOptionElement::operator = (const HTMLOptionElement &other) 01177 { 01178 HTMLElement::operator = (other); 01179 return *this; 01180 } 01181 01182 HTMLOptionElement::~HTMLOptionElement() 01183 { 01184 } 01185 01186 HTMLFormElement HTMLOptionElement::form() const 01187 { 01188 return Element::form(); 01189 } 01190 01191 bool HTMLOptionElement::defaultSelected() const 01192 { 01193 if(!impl) return 0; 01194 return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_SELECTED).isNull(); 01195 } 01196 01197 void HTMLOptionElement::setDefaultSelected( bool _defaultSelected ) 01198 { 01199 if(impl) static_cast<HTMLOptionElementImpl*>(impl)->setDefaultSelected(_defaultSelected); 01200 } 01201 01202 DOMString HTMLOptionElement::text() const 01203 { 01204 if(!impl) return DOMString(); 01205 return ((HTMLOptionElementImpl *)impl)->text(); 01206 } 01207 01208 long HTMLOptionElement::index() const 01209 { 01210 if(!impl) return 0; 01211 return ((HTMLOptionElementImpl *)impl)->index(); 01212 } 01213 01214 void HTMLOptionElement::setIndex( long /*_index*/ ) 01215 { 01216 throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); 01217 } 01218 01219 bool HTMLOptionElement::disabled() const 01220 { 01221 if(!impl) return 0; 01222 return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_DISABLED).isNull(); 01223 } 01224 01225 void HTMLOptionElement::setDisabled( bool _disabled ) 01226 { 01227 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_DISABLED, _disabled ? "" : 0); 01228 } 01229 01230 DOMString HTMLOptionElement::label() const 01231 { 01232 if(!impl) return DOMString(); 01233 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_LABEL); 01234 } 01235 01236 void HTMLOptionElement::setLabel( const DOMString &value ) 01237 { 01238 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_LABEL, value); 01239 } 01240 01241 bool HTMLOptionElement::selected() const 01242 { 01243 if(!impl) return 0; 01244 return ((HTMLOptionElementImpl *)impl)->selected(); 01245 } 01246 01247 void HTMLOptionElement::setSelected(bool _selected) { 01248 if(!impl) return; 01249 ((HTMLOptionElementImpl *)impl)->setSelected(_selected); 01250 } 01251 01252 DOMString HTMLOptionElement::value() const 01253 { 01254 if(!impl) return DOMString(); 01255 return static_cast<HTMLOptionElementImpl*>(impl)->value(); 01256 } 01257 01258 void HTMLOptionElement::setValue( const DOMString &value ) 01259 { 01260 if(impl) static_cast<HTMLOptionElementImpl*>(impl)->setValue(value.implementation()); 01261 } 01262 01263 // ----------------------------------------------------------------------------- 01264 01265 HTMLIsIndexElement::HTMLIsIndexElement() : HTMLElement() 01266 { 01267 } 01268 01269 HTMLIsIndexElement::HTMLIsIndexElement(const HTMLIsIndexElement &other) : HTMLElement(other) 01270 { 01271 } 01272 01273 HTMLIsIndexElement::HTMLIsIndexElement(HTMLIsIndexElementImpl *impl) : HTMLElement(impl) 01274 { 01275 } 01276 01277 HTMLIsIndexElement &HTMLIsIndexElement::operator = (const Node &other) 01278 { 01279 assignOther( other, ID_ISINDEX ); 01280 return *this; 01281 } 01282 01283 HTMLIsIndexElement &HTMLIsIndexElement::operator = (const HTMLIsIndexElement &other) 01284 { 01285 HTMLElement::operator = (other); 01286 return *this; 01287 } 01288 01289 HTMLIsIndexElement::~HTMLIsIndexElement() 01290 { 01291 } 01292 01293 HTMLFormElement HTMLIsIndexElement::form() const 01294 { 01295 return Element::form(); 01296 } 01297 01298 DOMString HTMLIsIndexElement::prompt() const 01299 { 01300 if(!impl) return DOMString(); 01301 return static_cast<HTMLIsIndexElementImpl*>(impl)->prompt(); 01302 } 01303 01304 void HTMLIsIndexElement::setPrompt( const DOMString &value ) 01305 { 01306 if(impl) static_cast<HTMLIsIndexElementImpl*>(impl)->setPrompt(value); 01307 }
KDE 4.6 API Reference