2 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 * (C) 1997 Torben Weis (weis@kde.org)
4 * (C) 1998 Waldo Bastian (bastian@kde.org)
5 * (C) 1999 Lars Knoll (knoll@kde.org)
6 * (C) 1999 Antti Koivisto (koivisto@kde.org)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
19 * You should have received a copy of the GNU Library General Public License
20 * along with this library; see the file COPYING.LIB. If not, write to
21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
26 #ifndef HTMLTableElement_h
27 #define HTMLTableElement_h
29 #include "HTMLElement.h"
34 class HTMLTableCaptionElement
;
35 class HTMLTableSectionElement
;
37 class HTMLTableElement
: public HTMLElement
{
39 HTMLTableElement(const QualifiedName
&, Document
*);
41 virtual HTMLTagStatus
endTagRequirement() const { return TagStatusRequired
; }
42 virtual int tagPriority() const { return 9; }
43 virtual bool checkDTD(const Node
*);
45 HTMLTableCaptionElement
* caption() const;
46 void setCaption(PassRefPtr
<HTMLTableCaptionElement
>, ExceptionCode
&);
48 HTMLTableSectionElement
* tHead() const;
49 void setTHead(PassRefPtr
<HTMLTableSectionElement
>, ExceptionCode
&);
51 HTMLTableSectionElement
* tFoot() const;
52 void setTFoot(PassRefPtr
<HTMLTableSectionElement
>, ExceptionCode
&);
54 PassRefPtr
<HTMLElement
> createTHead();
56 PassRefPtr
<HTMLElement
> createTFoot();
58 PassRefPtr
<HTMLElement
> createCaption();
60 PassRefPtr
<HTMLElement
> insertRow(int index
, ExceptionCode
&);
61 void deleteRow(int index
, ExceptionCode
&);
63 PassRefPtr
<HTMLCollection
> rows();
64 PassRefPtr
<HTMLCollection
> tBodies();
67 void setAlign(const String
&);
69 String
bgColor() const;
70 void setBgColor(const String
&);
72 String
border() const;
73 void setBorder(const String
&);
75 String
cellPadding() const;
76 void setCellPadding(const String
&);
78 String
cellSpacing() const;
79 void setCellSpacing(const String
&);
82 void setFrame(const String
&);
85 void setRules(const String
&);
87 String
summary() const;
88 void setSummary(const String
&);
91 void setWidth(const String
&);
93 virtual ContainerNode
* addChild(PassRefPtr
<Node
>);
94 virtual bool mapToEntry(const QualifiedName
&, MappedAttributeEntry
&) const;
95 virtual void parseMappedAttribute(MappedAttribute
*);
96 virtual void attach();
97 virtual bool isURLAttribute(Attribute
*) const;
99 // Used to obtain either a solid or outset border decl and to deal with the frame
100 // and rules attributes.
101 virtual bool canHaveAdditionalAttributeStyleDecls() const { return true; }
102 virtual void additionalAttributeStyleDecls(Vector
<CSSMutableStyleDeclaration
*>&);
103 void addSharedCellDecls(Vector
<CSSMutableStyleDeclaration
*>&);
104 void addSharedGroupDecls(bool rows
, Vector
<CSSMutableStyleDeclaration
*>&);
106 virtual void addSubresourceAttributeURLs(ListHashSet
<KURL
>&) const;
109 void addSharedCellBordersDecl(Vector
<CSSMutableStyleDeclaration
*>&);
110 void addSharedCellPaddingDecl(Vector
<CSSMutableStyleDeclaration
*>&);
112 enum TableRules
{ UnsetRules
, NoneRules
, GroupsRules
, RowsRules
, ColsRules
, AllRules
};
113 enum CellBorders
{ NoBorders
, SolidBorders
, InsetBorders
, SolidBordersColsOnly
, SolidBordersRowsOnly
};
115 CellBorders
cellBorders() const;
117 HTMLTableSectionElement
* lastBody() const;
119 bool m_borderAttr
; // Sets a precise border width and creates an outset border for the table and for its cells.
120 bool m_borderColorAttr
; // Overrides the outset border and makes it solid for the table and cells instead.
121 bool m_frameAttr
; // Implies a thin border width if no border is set and then a certain set of solid/hidden borders based off the value.
122 TableRules m_rulesAttr
; // Implies a thin border width, a collapsing border model, and all borders on the table becoming set to hidden (if frame/border
123 // are present, to none otherwise).
125 unsigned short m_padding
;
126 RefPtr
<CSSMappedAttributeDeclaration
> m_paddingDecl
;