table_layout.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef TABLE_LAYOUT_H
00025 #define TABLE_LAYOUT_H
00026
00027 #include <qmemarray.h>
00028 #include <misc/khtmllayout.h>
00029
00030 namespace khtml {
00031
00032 class RenderTable;
00033 class RenderTableCell;
00034
00035
00036
00037 class TableLayout
00038 {
00039 public:
00040 TableLayout( RenderTable *t ) : table( t ) {}
00041 virtual ~TableLayout() {};
00042
00043 virtual void calcMinMaxWidth() = 0;
00044 virtual void layout() = 0;
00045
00046 protected:
00047 RenderTable *table;
00048 };
00049
00050
00051
00052 class FixedTableLayout : public TableLayout
00053 {
00054 public:
00055 FixedTableLayout( RenderTable *table );
00056 ~FixedTableLayout();
00057
00058 void calcMinMaxWidth();
00059 void layout();
00060
00061 protected:
00062 int calcWidthArray( int tableWidth );
00063
00064 QMemArray<Length> width;
00065 };
00066
00067
00068
00069 class AutoTableLayout : public TableLayout
00070 {
00071 public:
00072 AutoTableLayout( RenderTable *table );
00073 ~AutoTableLayout();
00074
00075 void calcMinMaxWidth();
00076 void layout();
00077
00078
00079 protected:
00080 void fullRecalc();
00081 void recalcColumn( int effCol );
00082 int totalPercent() const {
00083 if ( percentagesDirty )
00084 calcPercentages();
00085 return total_percent;
00086 }
00087 void calcPercentages() const;
00088 int calcEffectiveWidth();
00089 void insertSpanCell( RenderTableCell *cell );
00090
00091 struct Layout {
00092 Layout() : minWidth( 1 ), maxWidth( 1 ),
00093 effMinWidth( 0 ), effMaxWidth( 0 ),
00094 calcWidth( 0 ) {}
00095 Length width;
00096 Length effWidth;
00097 short minWidth;
00098 short maxWidth;
00099 short effMinWidth;
00100 short effMaxWidth;
00101 short calcWidth;
00102 };
00103
00104 QMemArray<Layout> layoutStruct;
00105 QMemArray<RenderTableCell *>spanCells;
00106 bool hasPercent : 1;
00107 mutable bool percentagesDirty : 1;
00108 mutable bool effWidthDirty : 1;
00109 mutable unsigned short total_percent;
00110 };
00111
00112 }
00113 #endif
This file is part of the documentation for kdelibs Version 3.1.4.