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();
196 DOMString value(TQString::number(_colSpan));
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();
244 DOMString value(TQString::number(_rowSpan));
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();
361 DOMString value(TQString::number(_span));
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 );
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.
An HTMLCollection is a list of nodes.
All HTML element interfaces derive from this class.
Table caption See the CAPTION element definition in HTML 4.0.
DOMString align() const
Caption alignment with respect to the table.
void setAlign(const DOMString &)
see align
The object used to represent the TH and TD elements.
DOMString height() const
Cell height.
void setColSpan(long)
see colSpan
DOMString axis() const
Names group of related headers.
DOMString vAlign() const
Vertical alignment of data in cell.
DOMString chOff() const
Offset of alignment character.
void setCellIndex(long)
see cellIndex
void setHeight(const DOMString &)
see height
void setHeaders(const DOMString &)
see headers
void setVAlign(const DOMString &)
see vAlign
void setBgColor(const DOMString &)
see bgColor
void setAbbr(const DOMString &)
see abbr
long cellIndex() const
The index of this cell in the row.
DOMString headers() const
List of id attribute values for header cells.
void setScope(const DOMString &)
see scope
void setChOff(const DOMString &)
see chOff
long rowSpan() const
Number of rows spanned by cell.
DOMString ch() const
Alignment character for cells in a column.
DOMString width() const
Cell width.
void setNoWrap(bool)
see noWrap
void setCh(const DOMString &)
see ch
bool noWrap() const
Suppress word wrapping.
DOMString abbr() const
Abbreviation for header cells.
DOMString align() const
Horizontal alignment of data in cell.
void setWidth(const DOMString &)
see width
void setAxis(const DOMString &)
see axis
void setAlign(const DOMString &)
see align
void setRowSpan(long)
see rowSpan
DOMString bgColor() const
Cell background color.
long colSpan() const
Number of columns spanned by cell.
DOMString scope() const
Scope covered by header cells.
Regroups the COL and COLGROUP elements.
DOMString width() const
Default column width.
void setChOff(const DOMString &)
see chOff
void setWidth(const DOMString &)
see width
void setVAlign(const DOMString &)
see vAlign
void setAlign(const DOMString &)
see align
DOMString align() const
Horizontal alignment of cell data in column.
long span() const
Indicates the number of columns in a group or affected by a grouping.
void setSpan(long)
see span
DOMString chOff() const
Offset of alignment character.
DOMString ch() const
Alignment character for cells in a column.
DOMString vAlign() const
Vertical alignment of cell data in column.
void setCh(const DOMString &)
see ch
The create* and delete* methods on the table allow authors to construct and modify tables.
HTMLTableSectionElement tFoot() const
Returns the table's TFOOT , or null if none exists.
void deleteTFoot()
Delete the footer from the table, if one exists.
HTMLElement insertRow(long index)
Insert a new empty row in the table.
HTMLTableCaptionElement caption() const
Returns the table's CAPTION , or void if none exists.
HTMLElement createTHead()
Create a table header row or return an existing one.
void setAlign(const DOMString &)
see align
void setBorder(const DOMString &)
see border
void setFrame(const DOMString &)
see frame
void setCellPadding(const DOMString &)
see cellPadding
void setSummary(const DOMString &)
see summary
void setCellSpacing(const DOMString &)
see cellSpacing
DOMString summary() const
Supplementary description about the purpose or structure of a table.
void setRules(const DOMString &)
see rules
HTMLCollection rows() const
Returns a collection of all the rows in the table, including all in THEAD , TFOOT ,...
DOMString bgColor() const
Cell background color.
DOMString frame() const
Specifies which external table borders to render.
HTMLCollection tBodies() const
Returns a collection of the table bodies (including implicit ones).
void deleteRow(long index)
Delete a table row.
void setBgColor(const DOMString &)
see bgColor
DOMString cellPadding() const
Specifies the horizontal and vertical space between cell content and cell borders.
HTMLElement createCaption()
Create a new table caption object or return an existing one.
HTMLElement createTFoot()
Create a table footer row or return an existing one.
DOMString rules() const
Specifies which internal table borders to render.
void setCaption(const HTMLTableCaptionElement &)
see caption
void deleteCaption()
Delete the table caption, if one exists.
void setTFoot(const HTMLTableSectionElement &)
see tFoot
DOMString width() const
Specifies the desired table width.
HTMLTableSectionElement tHead() const
Returns the table's THEAD , or null if none exists.
DOMString border() const
The width of the border around the table.
DOMString align() const
Specifies the table's position with respect to the rest of the document.
void setTHead(const HTMLTableSectionElement &)
see tHead
void deleteTHead()
Delete the header from the table, if one exists.
void setWidth(const DOMString &)
see width
DOMString cellSpacing() const
Specifies the horizontal and vertical separation between cells.
DOMString align() const
Horizontal alignment of data within cells of this row.
DOMString ch() const
Alignment character for cells in a column.
void deleteCell(long index)
Delete a cell from the current row.
void setSectionRowIndex(long)
see sectionRowIndex
void setCh(const DOMString &)
see ch
DOMString chOff() const
Offset of alignment character.
long sectionRowIndex() const
The index of this row, relative to the current section ( THEAD , TFOOT , or TBODY ).
void setVAlign(const DOMString &)
see vAlign
void setBgColor(const DOMString &)
see bgColor
HTMLCollection cells() const
The collection of cells in this row.
DOMString vAlign() const
Vertical alignment of data within cells of this row.
HTMLElement insertCell(long index)
Insert an empty TD cell into this row.
DOMString bgColor() const
Background color for rows.
void setAlign(const DOMString &)
see align
void setCells(const HTMLCollection &)
see cells
void setChOff(const DOMString &)
see chOff
long rowIndex() const
The index of this row, relative to the entire table.
void setRowIndex(long)
see rowIndex
The THEAD , TFOOT , and TBODY elements.
void setCh(const DOMString &)
see ch
DOMString vAlign() const
Vertical alignment of data in cells.
void setVAlign(const DOMString &)
see vAlign
DOMString chOff() const
Offset of alignment character.
HTMLCollection rows() const
The collection of rows in this table section.
DOMString ch() const
Alignment character for cells in a column.
void setChOff(const DOMString &)
see chOff
void setAlign(const DOMString &)
see align
HTMLElement insertRow(long index)
Insert a row into this section.
DOMString align() const
Horizontal alignment of data in cells.
void deleteRow(long index)
Delete a row from this section.
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...