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);
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);
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();
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);
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;
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);
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();
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);
1005 return ((HTMLTextAreaElementImpl *)impl)->getAttribute(ATTR_COLS).toInt();
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();
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);
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);
DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impos...
This class implements the basic string we use in the DOM.
DOMString getAttribute(const DOMString &name)
Retrieves an attribute value by name.
void setAttribute(const DOMString &name, const DOMString &value)
Adds a new attribute.
Element form() const
TDEHTML extension to DOM This method returns the associated form element.
An HTMLCollection is a list of nodes.
All HTML element interfaces derive from this class.
Organizes form controls into logical groups.
HTMLFormElement form() const
This element is used for single-line text input.
DOMString prompt() const
The prompt message.
void setPrompt(const DOMString &)
see prompt
HTMLFormElement form() const
void setHtmlFor(const DOMString &)
see htmlFor
DOMString accessKey() const
A single character access key to give access to the form control.
DOMString htmlFor() const
This attribute links this label with another form control by id attribute.
void setAccessKey(const DOMString &)
see accessKey
Provides a caption for a FIELDSET grouping.
void setAlign(const DOMString &)
see align
HTMLFormElement form() const
void setAccessKey(const DOMString &)
see accessKey
DOMString align() const
Text alignment relative to FIELDSET .
DOMString accessKey() const
A single character access key to give access to the form control.
Group options together in logical subdivisions.
void setDisabled(bool)
see disabled
bool disabled() const
The control is unavailable in this context.
void setLabel(const DOMString &)
see label
DOMString label() const
Assigns a label to this option group.
bool disabled() const
The control is unavailable in this context.
void setDefaultSelected(bool)
see defaultSelected
long index() const
The index of this OPTION in its parent SELECT .
void setLabel(const DOMString &)
see label
void setSelected(bool)
see selected
void setDisabled(bool)
see disabled
HTMLFormElement form() const
DOMString value() const
The current form control value.
DOMString label() const
Option label for use in hierarchical menus.
void setValue(const DOMString &)
see value
bool defaultSelected() const
Stores the initial value of the selected attribute.
bool selected() const
Means that this option is initially selected.
void setIndex(long)
see index
DOMString text() const
The text contained within the option element.
The select element allows the selection of an option.
long size() const
Number of visible rows.
bool multiple() const
If true, multiple OPTION elements may be selected in this SELECT .
void setValue(const DOMString &)
see value
void setTabIndex(long)
see tabIndex
void blur()
Removes keyboard focus from this element.
DOMString value() const
The current form control value.
void add(const HTMLElement &element, const HTMLElement &before)
Add a new element to the collection of OPTION elements for this SELECT .
DOMString type() const
The type of control created.
bool disabled() const
The control is unavailable in this context.
HTMLCollection options() const
The collection of OPTION elements contained by this element.
void setSelectedIndex(long)
see selectedIndex
long length() const
The number of options in this SELECT .
DOMString name() const
Form control or object name when submitted with a form.
long selectedIndex() const
The ordinal index of the selected option.
void remove(long index)
Remove an element from the collection of OPTION elements for this SELECT .
long tabIndex() const
Index that represents the element's position in the tabbing order.
void setName(const DOMString &)
see name
void setSize(long)
see size
HTMLFormElement form() const
void focus()
Gives keyboard focus to this element.
void setMultiple(bool)
see multiple
void setDisabled(bool)
see disabled
long tabIndex() const
Index that represents the element's position in the tabbing order.
void setTabIndex(long)
see tabIndex
void setSelectionStart(long offset)
Move the beginning of the selection to the given offset in text NOTE: this method is not part of the ...
bool disabled() const
The control is unavailable in this context.
void setDisabled(bool)
see disabled
long textLength()
Returns the length of the text.
long selectionEnd()
Returns the character offset of end of selection, or if none, the cursor position.
void focus()
Gives keyboard focus to this element.
long rows() const
Number of text rows.
void select()
Select the contents of the TEXTAREA .
void setRows(long)
see rows
void setReadOnly(bool)
see readOnly
DOMString value() const
The current textual content of the multi-line text field.
void setAccessKey(const DOMString &)
see accessKey
DOMString type() const
The type of this form control.
DOMString accessKey() const
A single character access key to give access to the form control.
void setValue(const DOMString &)
see value
void setDefaultValue(const DOMString &)
see defaultValue
HTMLFormElement form() const
void setSelectionRange(long start, long end)
Selects the text from start to end, and positions the cursor after the selection.
bool readOnly() const
This control is read-only.
void setName(const DOMString &)
see name
void blur()
Removes keyboard focus from this element.
DOMString defaultValue() const
Stores the initial control value (i.e., the initial value of value ).
long cols() const
Width of control (in characters).
void setSelectionEnd(long offset)
Move the end of the selection (and the cursor) to the given offset in text NOTE: this method is not p...
void setCols(long)
see cols
long selectionStart()
Returns the character offset of beginning of selection, or if none, the cursor position.
DOMString name() const
Form control or object name when submitted with a form.
The Node interface is the primary datatype for the entire Document Object Model.
The Document Object Model (DOM) is divided into two parts, the COREDOM core DOM, specifying some core...