KHtml

table_layout.h
1 /*
2  * This file is part of the HTML rendering engine for KDE.
3  *
4  * Copyright (C) 2002 Lars Knoll ([email protected])
5  * (C) 2002 Dirk Mueller ([email protected])
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public License
18  * along with this library; see the file COPYING.LIB. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  *
22  */
23 #ifndef TABLE_LAYOUT_H
24 #define TABLE_LAYOUT_H
25 
26 #include <misc/khtmllayout.h>
27 #include <QVector>
28 namespace khtml
29 {
30 
31 class RenderTable;
32 class RenderTableCell;
33 
34 // -------------------------------------------------------------------------
35 
36 class TableLayout
37 {
38 public:
39  TableLayout(RenderTable *t) : table(t) {}
40  virtual ~TableLayout() {}
41 
42  virtual void calcMinMaxWidth() = 0;
43  virtual void layout() = 0;
44 
45 protected:
46  RenderTable *table;
47 };
48 
49 // -------------------------------------------------------------------------
50 
51 class FixedTableLayout : public TableLayout
52 {
53 public:
54  FixedTableLayout(RenderTable *table);
55  ~FixedTableLayout();
56 
57  void calcMinMaxWidth() override;
58  void layout() override;
59 
60 protected:
61  int calcWidthArray();
62 
63  QVector<Length> width;
64 };
65 
66 // -------------------------------------------------------------------------
67 
68 class AutoTableLayout : public TableLayout
69 {
70 public:
71  AutoTableLayout(RenderTable *table);
72  ~AutoTableLayout();
73 
74  void calcMinMaxWidth() override;
75  void layout() override;
76 
77 protected:
78  void fullRecalc();
79  void recalcColumn(int effCol);
80  int calcEffectiveWidth();
81  void insertSpanCell(RenderTableCell *cell);
82 
83  struct Layout {
84  Layout() : minWidth(1), maxWidth(1),
85  effMinWidth(0), effMaxWidth(0),
86  calcWidth(0), emptyCellsOnly(true) {}
87  Length width;
88  Length effWidth;
89  short minWidth;
90  int maxWidth;
91  short effMinWidth;
92  int effMaxWidth;
93  int calcWidth;
94  bool emptyCellsOnly;
95  };
96 
97  QVector<Layout> layoutStruct;
99  bool hasPercent : 1;
100  mutable bool effWidthDirty : 1;
101 };
102 
103 }
104 #endif
This file is part of the HTML rendering engine for KDE.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Oct 25 2021 22:48:23 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.