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