24 #include "dom/html_form.h"
25 #include "dom/dom_exception.h"
26 #include "dom/dom_doc.h"
28 #include "html/html_formimpl.h"
29 #include "html/html_miscimpl.h"
31 #include "xml/dom_docimpl.h"
32 #include "misc/htmlhashes.h"
36 HTMLButtonElement::HTMLButtonElement() :
HTMLElement()
44 HTMLButtonElement::HTMLButtonElement(HTMLButtonElementImpl *impl) :
HTMLElement(impl)
50 assignOther( other, ID_BUTTON );
56 HTMLElement::operator = (other);
60 HTMLButtonElement::~HTMLButtonElement()
72 return static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_ACCESSKEY);
77 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_ACCESSKEY, value);
83 return !
static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_DISABLED).isNull();
88 if (impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_DISABLED, _disabled ?
"" : 0);
94 return static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_NAME);
99 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_NAME, value);
105 static_cast<HTMLButtonElementImpl*
>(impl)->
focus();
111 static_cast<HTMLButtonElementImpl*
>(impl)->
blur();
117 return static_cast<ElementImpl*
>(impl)->
tabIndex();
123 static_cast<ElementImpl*
>(impl)->
setTabIndex(_tabIndex);
129 return static_cast<HTMLButtonElementImpl*
>(impl)->
type();
142 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_VALUE, value);
147 HTMLFieldSetElement::HTMLFieldSetElement() :
HTMLElement()
155 HTMLFieldSetElement::HTMLFieldSetElement(HTMLFieldSetElementImpl *impl) :
HTMLElement(impl)
161 assignOther( other, ID_FIELDSET );
167 HTMLElement::operator = (other);
171 HTMLFieldSetElement::~HTMLFieldSetElement()
190 HTMLFormElement::HTMLFormElement(HTMLFormElementImpl *impl) :
HTMLElement(impl)
196 assignOther( other, ID_FORM );
202 HTMLElement::operator = (other);
206 HTMLFormElement::~HTMLFormElement()
213 return HTMLFormCollection(impl);
219 return static_cast<HTMLFormElementImpl*
>(impl)->
length();
225 return static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_NAME);
230 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_NAME, value);
236 return static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_ACCEPT_CHARSET);
241 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_ACCEPT_CHARSET, value);
247 return static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_ACTION);
252 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_ACTION, value);
258 return static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_ENCTYPE);
263 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_ENCTYPE, value);
269 return static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_METHOD);
274 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_METHOD, value);
280 return static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_TARGET);
285 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_TARGET, value);
290 if(impl)
static_cast<HTMLFormElementImpl*
>(impl)->
submit( );
295 if(impl)
static_cast<HTMLFormElementImpl*
>(impl)->
reset( );
300 HTMLInputElement::HTMLInputElement() :
HTMLElement()
308 HTMLInputElement::HTMLInputElement(HTMLInputElementImpl *impl) :
HTMLElement(impl)
314 assignOther( other, ID_INPUT );
320 HTMLElement::operator = (other);
324 HTMLInputElement::~HTMLInputElement()
339 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_VALUE, value);
345 return !((ElementImpl *)impl)->getAttribute(ATTR_CHECKED).isNull();
351 ((ElementImpl *)impl)->setAttribute(ATTR_CHECKED, _defaultChecked ?
"" : 0);
362 return ((ElementImpl *)impl)->getAttribute(ATTR_ACCEPT);
367 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ACCEPT, value);
373 return ((ElementImpl *)impl)->getAttribute(ATTR_ACCESSKEY);
378 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ACCESSKEY, value);
384 return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
389 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
395 return ((ElementImpl *)impl)->getAttribute(ATTR_ALT);
400 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALT, value);
406 return ((HTMLInputElementImpl*)impl)->checked();
412 ((HTMLInputElementImpl*)impl)->setChecked(_checked);
418 return ((HTMLInputElementImpl*)impl)->indeterminate();
424 ((HTMLInputElementImpl*)impl)->setIndeterminate(_indeterminate);
430 return !((ElementImpl *)impl)->getAttribute(ATTR_DISABLED).isNull();
437 ((ElementImpl *)impl)->setAttribute(ATTR_DISABLED, _disabled ?
"" : 0);
444 return ((HTMLInputElementImpl *)impl)->getAttribute(ATTR_MAXLENGTH).toInt();
451 ((ElementImpl *)impl)->setAttribute(ATTR_MAXLENGTH,value);
458 return static_cast<HTMLInputElementImpl* const
>(impl)->
name();
463 if(impl)
static_cast<HTMLInputElementImpl*
>(impl)->
setName(value);
469 return !
static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_READONLY).isNull();
475 static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_READONLY, _readOnly ?
"" : 0);
482 return static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_SIZE);
487 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_SIZE, value);
493 return static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_SIZE).toInt();
498 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_SIZE, TQString::number(value));
505 return !s.isNull() ? impl->getDocument()->completeURL( s.string() ) : s;
510 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_SRC, value);
516 return static_cast<ElementImpl*
>(impl)->
tabIndex();
522 static_cast<ElementImpl*
>(impl)->
setTabIndex(_tabIndex);
528 return ((HTMLInputElementImpl *)impl)->type();
534 static_cast<HTMLInputElementImpl*
>(impl)->
setType(_type);
540 return static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_USEMAP);
545 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_USEMAP, value);
551 return ((HTMLInputElementImpl*)impl)->value();
557 ((HTMLInputElementImpl*)impl)->setValue(value);
564 ((HTMLInputElementImpl*)impl)->blur();
570 ((HTMLInputElementImpl*)impl)->focus();
576 ((HTMLInputElementImpl *)impl)->select( );
582 ((HTMLInputElementImpl *)impl)->click( );
588 return ((HTMLInputElementImpl *)impl)->selectionStart( );
595 return ((HTMLInputElementImpl *)impl)->selectionEnd( );
602 ((HTMLInputElementImpl *)impl)->setSelectionStart( pos );
608 ((HTMLInputElementImpl *)impl)->setSelectionEnd( pos );
614 ((HTMLInputElementImpl *)impl)->setSelectionRange( start, end );
619 HTMLLabelElement::HTMLLabelElement() :
HTMLElement()
627 HTMLLabelElement::HTMLLabelElement(HTMLLabelElementImpl *impl) :
HTMLElement(impl)
633 assignOther( other, ID_LABEL );
639 HTMLElement::operator = (other);
643 HTMLLabelElement::~HTMLLabelElement()
650 return static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_ACCESSKEY);
655 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_ACCESSKEY, value);
661 return static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_FOR);
666 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_FOR, value);
671 HTMLLegendElement::HTMLLegendElement() :
HTMLElement()
679 HTMLLegendElement::HTMLLegendElement(HTMLLegendElementImpl *impl) :
HTMLElement(impl)
685 assignOther( other, ID_LEGEND );
691 HTMLElement::operator = (other);
695 HTMLLegendElement::~HTMLLegendElement()
707 return static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_ACCESSKEY);
712 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_ACCESSKEY, value);
718 return static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_ALIGN);
723 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_ALIGN, value);
728 HTMLOptGroupElement::HTMLOptGroupElement() :
HTMLElement()
736 HTMLOptGroupElement::HTMLOptGroupElement(HTMLOptGroupElementImpl *impl) :
HTMLElement(impl)
742 assignOther( other, ID_OPTGROUP );
748 HTMLElement::operator = (other);
752 HTMLOptGroupElement::~HTMLOptGroupElement()
759 return !
static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_DISABLED).isNull();
765 static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_DISABLED, _disabled ?
"" : 0);
771 return static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_LABEL);
776 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_LABEL, value);
781 HTMLSelectElement::HTMLSelectElement() :
HTMLElement()
789 HTMLSelectElement::HTMLSelectElement(HTMLSelectElementImpl *impl) :
HTMLElement(impl)
795 assignOther( other, ID_SELECT );
801 HTMLElement::operator = (other);
805 HTMLSelectElement::~HTMLSelectElement()
812 return ((HTMLSelectElementImpl *)impl)->type();
818 return ((HTMLSelectElementImpl *)impl)->selectedIndex();
824 ((HTMLSelectElementImpl *)impl)->setSelectedIndex(_selectedIndex);
830 return static_cast<HTMLSelectElementImpl*
>(impl)->
value();
835 if(!impl || value.isNull())
return;
836 static_cast<HTMLSelectElementImpl*
>(impl)->
setValue(value.implementation());
842 return ((HTMLSelectElementImpl *)impl)->length();
859 return !
static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_DISABLED).isNull();
864 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_DISABLED, _disabled ?
"" : 0);
871 return !
static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_MULTIPLE).isNull();
876 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_MULTIPLE, _multiple ?
"" : 0);
882 return static_cast<HTMLSelectElementImpl* const
>(impl)->
name();
887 if(impl)
static_cast<HTMLSelectElementImpl*
>(impl)->
setName(value);
893 return ((HTMLSelectElementImpl *)impl)->getAttribute(ATTR_SIZE).toInt();
901 static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_SIZE,value);
908 return static_cast<ElementImpl*
>(impl)->
tabIndex();
914 static_cast<ElementImpl*
>(impl)->
setTabIndex(_tabIndex);
922 int exceptioncode = 0;
923 static_cast<HTMLSelectElementImpl*
>(impl)->
add( element, before, exceptioncode );
930 if(impl)
static_cast<HTMLSelectElementImpl*
>(impl)->
remove( index );
936 ((HTMLSelectElementImpl*)impl)->blur();
942 ((HTMLSelectElementImpl*)impl)->focus();
947 HTMLTextAreaElement::HTMLTextAreaElement() :
HTMLElement()
955 HTMLTextAreaElement::HTMLTextAreaElement(HTMLTextAreaElementImpl *impl) :
HTMLElement(impl)
961 assignOther( other, ID_TEXTAREA );
967 HTMLElement::operator = (other);
971 HTMLTextAreaElement::~HTMLTextAreaElement()
978 return ((HTMLTextAreaElementImpl *)impl)->defaultValue();
983 if (impl) ((HTMLTextAreaElementImpl *)impl)->setDefaultValue(value);
994 return static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_ACCESSKEY);
999 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_ACCESSKEY, value);
1005 return ((HTMLTextAreaElementImpl *)impl)->getAttribute(ATTR_COLS).toInt();
1013 static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_COLS,value);
1020 return !
static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_DISABLED).isNull();
1025 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_DISABLED, _disabled ?
"" : 0);
1031 return static_cast<HTMLTextAreaElementImpl* const
>(impl)->
name();
1036 if(impl)
static_cast<HTMLTextAreaElementImpl*
>(impl)->
setName(value);
1042 return !
static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_READONLY).isNull();
1047 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_READONLY, _readOnly ?
"" : 0);
1053 return ((HTMLTextAreaElementImpl *)impl)->getAttribute(ATTR_ROWS).toInt();
1061 static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_ROWS,value);
1068 return static_cast<ElementImpl*
>(impl)->
tabIndex();
1074 static_cast<ElementImpl*
>(impl)->
setTabIndex(_tabIndex);
1080 return ((HTMLTextAreaElementImpl *)impl)->type();
1086 return ((HTMLTextAreaElementImpl *)impl)->value();
1091 if(impl) ((HTMLTextAreaElementImpl *)impl)->setValue(value);
1097 ((HTMLTextAreaElementImpl*)impl)->blur();
1103 ((HTMLTextAreaElementImpl*)impl)->focus();
1109 ((HTMLTextAreaElementImpl *)impl)->select( );
1115 return ((HTMLTextAreaElementImpl *)impl)->selectionStart( );
1122 return ((HTMLTextAreaElementImpl *)impl)->selectionEnd( );
1129 return ((HTMLTextAreaElementImpl *)impl)->textLength( );
1136 ((HTMLTextAreaElementImpl *)impl)->setSelectionStart( pos );
1142 ((HTMLTextAreaElementImpl *)impl)->setSelectionEnd( pos );
1148 ((HTMLTextAreaElementImpl *)impl)->setSelectionRange( start, end );
1153 HTMLOptionElement::HTMLOptionElement() :
HTMLElement()
1161 HTMLOptionElement::HTMLOptionElement(HTMLOptionElementImpl *impl) :
HTMLElement(impl)
1167 assignOther( other, ID_OPTION );
1173 HTMLElement::operator = (other);
1177 HTMLOptionElement::~HTMLOptionElement()
1189 return !
static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_SELECTED).isNull();
1194 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_SELECTED, _defaultSelected ?
"" : 0);
1200 return ((HTMLOptionElementImpl *)impl)->text();
1206 return ((HTMLOptionElementImpl *)impl)->index();
1211 throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR);
1217 return !
static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_DISABLED).isNull();
1222 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_DISABLED, _disabled ?
"" : 0);
1228 return static_cast<ElementImpl*
>(impl)->
getAttribute(ATTR_LABEL);
1233 if(impl)
static_cast<ElementImpl*
>(impl)->
setAttribute(ATTR_LABEL, value);
1239 return ((HTMLOptionElementImpl *)impl)->selected();
1244 ((HTMLOptionElementImpl *)impl)->setSelected(_selected);
1250 return static_cast<HTMLOptionElementImpl*
>(impl)->
value();
1255 if(impl)
static_cast<HTMLOptionElementImpl*
>(impl)->
setValue(value.implementation());
1260 HTMLIsIndexElement::HTMLIsIndexElement() :
HTMLElement()
1268 HTMLIsIndexElement::HTMLIsIndexElement(HTMLIsIndexElementImpl *impl) :
HTMLElement(impl)
1274 assignOther( other, ID_ISINDEX );
1280 HTMLElement::operator = (other);
1284 HTMLIsIndexElement::~HTMLIsIndexElement()
1296 return static_cast<HTMLIsIndexElementImpl*
>(impl)->
prompt();
1301 if(impl)
static_cast<HTMLIsIndexElementImpl*
>(impl)->
setPrompt(value);