2 * This file is part of the DOM implementation for KDE.
4 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
5 * (C) 1997 Torben Weis (weis@kde.org)
6 * (C) 1998 Waldo Bastian (bastian@kde.org)
7 * (C) 1999 Lars Knoll (knoll@kde.org)
8 * (C) 1999 Antti Koivisto (koivisto@kde.org)
9 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
21 * You should have received a copy of the GNU Library General Public License
22 * along with this library; see the file COPYING.LIB. If not, write to
23 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 * Boston, MA 02111-1307, USA.
27 #ifndef RenderTableCell_H
28 #define RenderTableCell_H
30 #include "RenderTableSection.h"
34 class RenderTableCell : public RenderBlock {
36 RenderTableCell(Node*);
38 virtual void destroy();
40 virtual const char* renderName() const { return "RenderTableCell"; }
41 virtual bool isTableCell() const { return true; }
43 // FIXME: need to implement cellIndex
44 int cellIndex() const { return 0; }
45 void setCellIndex(int) { }
47 int colSpan() const { return cSpan; }
48 void setColSpan(int c) { cSpan = c; }
50 int rowSpan() const { return rSpan; }
51 void setRowSpan(int r) { rSpan = r; }
53 int col() const { return _col; }
54 void setCol(int col) { _col = col; }
55 int row() const { return _row; }
56 void setRow(int r) { _row = r; }
58 Length styleOrColWidth();
60 virtual bool requiresLayer();
62 virtual void calcMinMaxWidth();
63 virtual void calcWidth();
64 virtual void setWidth(int);
65 virtual void setStyle(RenderStyle*);
67 int borderLeft() const;
68 int borderRight() const;
69 int borderTop() const;
70 int borderBottom() const;
72 CollapsedBorderValue collapsedLeftBorder(bool rtl) const;
73 CollapsedBorderValue collapsedRightBorder(bool rtl) const;
74 CollapsedBorderValue collapsedTopBorder() const;
75 CollapsedBorderValue collapsedBottomBorder() const;
76 virtual void collectBorders(DeprecatedValueList<CollapsedBorderValue>&);
78 virtual void updateFromElement();
80 virtual void layout();
82 void setCellTopExtra(int p) { _topExtra = p; }
83 void setCellBottomExtra(int p) { _bottomExtra = p; }
85 virtual void paint(PaintInfo& i, int tx, int ty);
87 void paintCollapsedBorder(GraphicsContext* p, int x, int y, int w, int h);
89 // lie about position to outside observers
90 virtual int yPos() const { return m_y + _topExtra; }
92 virtual void computeAbsoluteRepaintRect(IntRect&, bool f=false);
93 virtual bool absolutePosition(int& xPos, int& yPos, bool f = false);
95 virtual short baselinePosition(bool = false) const;
97 virtual int borderTopExtra() const { return _topExtra; }
98 virtual int borderBottomExtra() const { return _bottomExtra; }
100 RenderTable* table() const { return static_cast<RenderTable*>(parent()->parent()->parent()); }
101 RenderTableSection* section() const { return static_cast<RenderTableSection*>(parent()->parent()); }
104 virtual void dump(QTextStream *stream, DeprecatedString ind = "") const;
107 void paintBackgroundsBehindCell(PaintInfo&, int tx, int ty, RenderObject* backgroundObject);
110 virtual void paintBoxDecorations(PaintInfo&, int tx, int ty);
118 int _bottomExtra : 31;
119 bool m_widthChanged : 1;
121 int m_percentageHeight;