24 #include "dom/html_misc.h" 25 #include "dom/html_table.h" 26 #include "dom/dom_exception.h" 28 #include "html/html_miscimpl.h" 29 #include "html/html_tableimpl.h" 30 #include "misc/htmlhashes.h" 34 HTMLTableCaptionElement::HTMLTableCaptionElement() :
HTMLElement()
42 HTMLTableCaptionElement::HTMLTableCaptionElement(HTMLTableCaptionElementImpl *impl) :
HTMLElement(impl)
48 assignOther( other, ID_CAPTION );
54 HTMLElement::operator = (other);
58 HTMLTableCaptionElement::~HTMLTableCaptionElement()
65 return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
70 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
75 HTMLTableCellElement::HTMLTableCellElement() :
HTMLElement()
83 HTMLTableCellElement::HTMLTableCellElement(HTMLTableCellElementImpl *impl) :
HTMLElement(impl)
89 if( other.elementId() != ID_TD &&
90 other.elementId() != ID_TH )
92 if ( impl ) impl->deref();
95 Node::operator = (other);
102 HTMLElement::operator = (other);
106 HTMLTableCellElement::~HTMLTableCellElement()
113 return ((HTMLTableCellElementImpl *)impl)->cellIndex();
118 throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR);
124 return ((ElementImpl *)impl)->getAttribute(ATTR_ABBR);
129 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ABBR, value);
135 return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
140 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
146 return ((ElementImpl *)impl)->getAttribute(ATTR_AXIS);
151 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_AXIS, value);
157 return ((ElementImpl *)impl)->getAttribute(ATTR_BGCOLOR);
162 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_BGCOLOR, value);
168 return ((ElementImpl *)impl)->getAttribute(ATTR_CHAR);
173 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CHAR, value);
179 return ((ElementImpl *)impl)->getAttribute(ATTR_CHAROFF);
184 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CHAROFF, value);
190 return ((ElementImpl *)impl)->getAttribute(ATTR_COLSPAN).toInt();
197 ((ElementImpl *)impl)->setAttribute(ATTR_COLSPAN,value);
204 return ((ElementImpl *)impl)->getAttribute(ATTR_HEADERS);
209 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_HEADERS, value);
215 return ((ElementImpl *)impl)->getAttribute(ATTR_HEIGHT);
220 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_HEIGHT, value);
225 if(!impl)
return false;
226 return !((ElementImpl *)impl)->getAttribute(ATTR_NOWRAP).isNull();
232 ((ElementImpl *)impl)->setAttribute(ATTR_NOWRAP, _noWrap ?
"" : 0);
238 return ((ElementImpl *)impl)->getAttribute(ATTR_ROWSPAN).toInt();
245 ((ElementImpl *)impl)->setAttribute(ATTR_ROWSPAN,value);
252 return ((ElementImpl *)impl)->getAttribute(ATTR_SCOPE);
257 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_SCOPE, value);
263 return ((ElementImpl *)impl)->getAttribute(ATTR_VALIGN);
268 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_VALIGN, value);
274 return ((ElementImpl *)impl)->getAttribute(ATTR_WIDTH);
279 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_WIDTH, value);
284 HTMLTableColElement::HTMLTableColElement() :
HTMLElement()
292 HTMLTableColElement::HTMLTableColElement(HTMLTableColElementImpl *impl) :
HTMLElement(impl)
298 if( other.elementId() != ID_COL &&
299 other.elementId() != ID_COLGROUP )
301 if ( impl ) impl->deref();
304 Node::operator = (other);
311 HTMLElement::operator = (other);
315 HTMLTableColElement::~HTMLTableColElement()
322 return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
327 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
333 return ((ElementImpl *)impl)->getAttribute(ATTR_CHAR);
338 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CHAR, value);
344 return ((ElementImpl *)impl)->getAttribute(ATTR_CHAROFF);
349 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CHAROFF, value);
355 return ((ElementImpl *)impl)->getAttribute(ATTR_SPAN).toInt();
362 ((ElementImpl *)impl)->setAttribute(ATTR_SPAN,value);
369 return ((ElementImpl *)impl)->getAttribute(ATTR_VALIGN);
374 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_VALIGN, value);
380 return ((ElementImpl *)impl)->getAttribute(ATTR_WIDTH);
385 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_WIDTH, value);
390 HTMLTableElement::HTMLTableElement() :
HTMLElement()
398 HTMLTableElement::HTMLTableElement(HTMLTableElementImpl *impl) :
HTMLElement(impl)
404 assignOther( other, ID_TABLE );
410 HTMLElement::operator = (other);
414 HTMLTableElement::~HTMLTableElement()
421 return ((HTMLTableElementImpl *)impl)->caption();
427 ((HTMLTableElementImpl *)impl)
428 ->setCaption( ((HTMLTableCaptionElementImpl *)_caption.impl) );
434 return ((HTMLTableElementImpl *)impl)->tHead();
441 ((HTMLTableElementImpl *)impl)
442 ->setTHead( ((HTMLTableSectionElementImpl *)_tHead.impl) );
448 return ((HTMLTableElementImpl *)impl)->tFoot();
455 ((HTMLTableElementImpl *)impl)
456 ->setTFoot( ((HTMLTableSectionElementImpl *)_tFoot.impl) );
474 return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
479 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
485 return ((ElementImpl *)impl)->getAttribute(ATTR_BGCOLOR);
490 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_BGCOLOR, value);
496 return ((ElementImpl *)impl)->getAttribute(ATTR_BORDER);
501 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_BORDER, value);
507 return ((ElementImpl *)impl)->getAttribute(ATTR_CELLPADDING);
512 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CELLPADDING, value);
518 return ((ElementImpl *)impl)->getAttribute(ATTR_CELLSPACING);
523 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CELLSPACING, value);
529 return ((ElementImpl *)impl)->getAttribute(ATTR_FRAME);
534 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_FRAME, value);
540 return ((ElementImpl *)impl)->getAttribute(ATTR_RULES);
545 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_RULES, value);
551 return ((ElementImpl *)impl)->getAttribute(ATTR_SUMMARY);
556 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_SUMMARY, value);
562 return ((ElementImpl *)impl)->getAttribute(ATTR_WIDTH);
567 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_WIDTH, value);
573 return ((HTMLTableElementImpl *)impl)->createTHead( );
579 ((HTMLTableElementImpl *)impl)->deleteTHead( );
585 return ((HTMLTableElementImpl *)impl)->createTFoot( );
591 ((HTMLTableElementImpl *)impl)->deleteTFoot( );
597 return ((HTMLTableElementImpl *)impl)->createCaption( );
603 ((HTMLTableElementImpl *)impl)->deleteCaption( );
609 int exceptioncode = 0;
610 HTMLElementImpl* ret = ((HTMLTableElementImpl *)impl)->insertRow( index, exceptioncode );
618 int exceptioncode = 0;
620 ((HTMLTableElementImpl *)impl)->deleteRow( index, exceptioncode );
627 HTMLTableRowElement::HTMLTableRowElement() :
HTMLElement()
635 HTMLTableRowElement::HTMLTableRowElement(HTMLTableRowElementImpl *impl) :
HTMLElement(impl)
641 assignOther( other, ID_TR );
647 HTMLElement::operator = (other);
651 HTMLTableRowElement::~HTMLTableRowElement()
658 return ((HTMLTableRowElementImpl *)impl)->rowIndex();
663 throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR);
669 return ((HTMLTableRowElementImpl *)impl)->sectionRowIndex();
674 throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR);
685 throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR);
691 return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
696 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
702 return ((ElementImpl *)impl)->getAttribute(ATTR_BGCOLOR);
707 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_BGCOLOR, value);
713 return ((ElementImpl *)impl)->getAttribute(ATTR_CHAR);
718 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CHAR, value);
724 return ((ElementImpl *)impl)->getAttribute(ATTR_CHAROFF);
729 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CHAROFF, value);
735 return ((ElementImpl *)impl)->getAttribute(ATTR_VALIGN);
740 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_VALIGN, value);
746 int exceptioncode = 0;
747 HTMLElementImpl* ret = ((HTMLTableRowElementImpl *)impl)->insertCell( index, exceptioncode );
755 int exceptioncode = 0;
757 ((HTMLTableRowElementImpl *)impl)->deleteCell( index, exceptioncode );
764 HTMLTableSectionElement::HTMLTableSectionElement() :
HTMLElement()
772 HTMLTableSectionElement::HTMLTableSectionElement(HTMLTableSectionElementImpl *impl) :
HTMLElement(impl)
778 if(other.elementId() != ID_TBODY &&
779 other.elementId() != ID_THEAD &&
780 other.elementId() != ID_TFOOT )
782 if ( impl ) impl->deref();
785 Node::operator = (other);
792 HTMLElement::operator = (other);
796 HTMLTableSectionElement::~HTMLTableSectionElement()
803 return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
808 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
814 return ((ElementImpl *)impl)->getAttribute(ATTR_CHAR);
819 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CHAR, value);
825 return ((ElementImpl *)impl)->getAttribute(ATTR_CHAROFF);
830 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CHAROFF, value);
836 return ((ElementImpl *)impl)->getAttribute(ATTR_VALIGN);
841 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_VALIGN, value);
853 int exceptioncode = 0;
854 HTMLElementImpl* ret = ((HTMLTableSectionElementImpl *)impl)->insertRow( index, exceptioncode );
862 int exceptioncode = 0;
864 ((HTMLTableSectionElementImpl *)impl)->deleteRow( index, exceptioncode );
void setCells(const HTMLCollection &)
see cells
DOMString scope() const
Scope covered by header cells.
void setBgColor(const DOMString &)
see bgColor
void setChOff(const DOMString &)
see chOff
long sectionRowIndex() const
The index of this row, relative to the current section ( THEAD , TFOOT , or TBODY )...
void setCh(const DOMString &)
see ch
void setCellSpacing(const DOMString &)
see cellSpacing
void setVAlign(const DOMString &)
see vAlign
void setVAlign(const DOMString &)
see vAlign
DOMString border() const
The width of the border around the table.
The Node interface is the primary datatype for the entire Document Object Model.
DOMString cellPadding() const
Specifies the horizontal and vertical space between cell content and cell borders.
HTMLCollection rows() const
The collection of rows in this table section.
Table caption See the CAPTION element definition in HTML 4.0.
void setAxis(const DOMString &)
see axis
void deleteTFoot()
Delete the footer from the table, if one exists.
DOMString width() const
Default column width.
void deleteRow(long index)
Delete a table row.
DOMString rules() const
Specifies which internal table borders to render.
DOMString ch() const
Alignment character for cells in a column.
The THEAD , TFOOT , and TBODY elements.
void setBgColor(const DOMString &)
see bgColor
long colSpan() const
Number of columns spanned by cell.
DOMString width() const
Specifies the desired table width.
The object used to represent the TH and TD elements.
DOMString chOff() const
Offset of alignment character.
void setAlign(const DOMString &)
see align
DOMString align() const
Horizontal alignment of data in cells.
void setNoWrap(bool)
see noWrap
DOMString chOff() const
Offset of alignment character.
void setAlign(const DOMString &)
see align
long rowSpan() const
Number of rows spanned by cell.
DOMString bgColor() const
Background color for rows.
long cellIndex() const
The index of this cell in the row.
DOMString value() const
The value of a run-time parameter.
DOMString abbr() const
Abbreviation for header cells.
void setSpan(long)
see span
void setRules(const DOMString &)
see rules
DOMString bgColor() const
Cell background color.
HTMLTableSectionElement tFoot() const
Returns the table's TFOOT , or null if none exists.
DOMString bgColor() const
Cell background color.
void setSectionRowIndex(long)
see sectionRowIndex
DOMString align() const
Horizontal alignment of data within cells of this row.
void setTHead(const HTMLTableSectionElement &)
see tHead
DOMString vAlign() const
Vertical alignment of data in cells.
void setScope(const DOMString &)
see scope
DOMString align() const
Horizontal alignment of cell data in column.
DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impos...
DOMString width() const
Cell width.
void setCh(const DOMString &)
see ch
DOMString height() const
Cell height.
Regroups the COL and COLGROUP elements.
void setAlign(const DOMString &)
see align
An HTMLCollection is a list of nodes.
void setChOff(const DOMString &)
see chOff
HTMLElement insertCell(long index)
Insert an empty TD cell into this row.
void setAlign(const DOMString &)
see align
void setVAlign(const DOMString &)
see vAlign
void deleteCaption()
Delete the table caption, if one exists.
DOMString ch() const
Alignment character for cells in a column.
void setCellPadding(const DOMString &)
see cellPadding
void setWidth(const DOMString &)
see width
void deleteRow(long index)
Delete a row from this section.
This class implements the basic string we use in the DOM.
DOMString align() const
Caption alignment with respect to the table.
HTMLCollection tBodies() const
Returns a collection of the table bodies (including implicit ones).
long span() const
Indicates the number of columns in a group or affected by a grouping.
void setHeaders(const DOMString &)
see headers
void setWidth(const DOMString &)
see width
HTMLCollection cells() const
The collection of cells in this row.
void setAlign(const DOMString &)
see align
HTMLElement insertRow(long index)
Insert a row into this section.
void setCaption(const HTMLTableCaptionElement &)
see caption
HTMLElement insertRow(long index)
Insert a new empty row in the table.
HTMLCollection rows() const
Returns a collection of all the rows in the table, including all in THEAD , TFOOT ...
HTMLElement createTHead()
Create a table header row or return an existing one.
void setCh(const DOMString &)
see ch
DOMString chOff() const
Offset of alignment character.
void setAlign(const DOMString &)
see align
void setFrame(const DOMString &)
see frame
DOMString align() const
Specifies the table's position with respect to the rest of the document.
void setTFoot(const HTMLTableSectionElement &)
see tFoot
void setBorder(const DOMString &)
see border
DOMString ch() const
Alignment character for cells in a column.
DOMString ch() const
Alignment character for cells in a column.
void setChOff(const DOMString &)
see chOff
DOMString vAlign() const
Vertical alignment of cell data in column.
DOMString align() const
Horizontal alignment of data in cell.
The Document Object Model (DOM) is divided into two parts, the COREDOM core DOM, specifying some core...
DOMString chOff() const
Offset of alignment character.
void setRowIndex(long)
see rowIndex
void setBgColor(const DOMString &)
see bgColor
HTMLElement createTFoot()
Create a table footer row or return an existing one.
void setCellIndex(long)
see cellIndex
DOMString frame() const
Specifies which external table borders to render.
void setHeight(const DOMString &)
see height
void setAbbr(const DOMString &)
see abbr
void deleteTHead()
Delete the header from the table, if one exists.
void setWidth(const DOMString &)
see width
void setChOff(const DOMString &)
see chOff
long rowIndex() const
The index of this row, relative to the entire table.
DOMString vAlign() const
Vertical alignment of data within cells of this row.
void setColSpan(long)
see colSpan
DOMString headers() const
List of id attribute values for header cells.
HTMLTableSectionElement tHead() const
Returns the table's THEAD , or null if none exists.
HTMLElement createCaption()
Create a new table caption object or return an existing one.
void deleteCell(long index)
Delete a cell from the current row.
DOMString cellSpacing() const
Specifies the horizontal and vertical separation between cells.
void setRowSpan(long)
see rowSpan
bool noWrap() const
Suppress word wrapping.
void setCh(const DOMString &)
see ch
HTMLTableCaptionElement caption() const
Returns the table's CAPTION , or void if none exists.
The create* and delete* methods on the table allow authors to construct and modify tables...
DOMString summary() const
Supplementary description about the purpose or structure of a table.
DOMString vAlign() const
Vertical alignment of data in cell.
All HTML element interfaces derive from this class.
DOMString axis() const
Names group of related headers.
void setSummary(const DOMString &)
see summary
void setVAlign(const DOMString &)
see vAlign