23#include <tqbitarray.h>
48 kdDebug(30522) <<
"Destruction of a list of frames" << endl;
54EEnv Table::getCellFlow(
int col)
56 for(
int row = 0; row<=
getMaxRow(); row++)
59 if(elt->getType() == ST_TEXT)
61 kdDebug(30522) << ((TextFrame*) elt)->getFirstPara()->getEnv() << endl;
62 return ((TextFrame*) elt)->getFirstPara()->getEnv();
65 kdDebug(30522) <<
"Default flow for cell" << endl;
72double Table::getCellSize(
int col)
75 for(
int row = 0; row<=
getMaxRow(); row++)
78 if(elt->getType() == ST_TEXT)
80 kdDebug(30522) <<
"size : " << ((TextFrame*) elt)->getLeft() << endl;
81 return ((TextFrame*) elt)->getRight() - ((TextFrame*) elt)->getLeft();
84 kdDebug(30522) <<
"Default size for cell" << endl;
96 for(current = first(); current != 0; current = next())
98 kdDebug(30522) <<
"+" << current->getRow() <<
"," << current->getCol() << endl;
99 if(current->getRow() == row && current->getCol() == col)
108void Table::append(
Element* elt)
113 if(elt->getCol() > getMaxCol())
114 setMaxCol(elt->getCol());
116 TQPtrList<Element>::append(elt);
122void Table::generate(TQTextStream& out)
125 kdDebug(30522) <<
"GENERATION OF A TABLE " << count() << endl;
126 out << endl <<
"\\begin{tabular}";
127 generateTableHeader(out);
129 Config::instance()->indent();
134 generateTopLineBorder(out, row);
135 for(
int col= 0; col <= getMaxCol(); col++)
137 Config::instance()->writeIndent(out);
142 out <<
"\\multicolumn{1}{";
145 out <<
"m{" << getCellSize(col) <<
"pt}";
147 if(elt->hasRightBorder())
151 generateCell(out, row, col);
153 if(col < getMaxCol())
156 out <<
"\\\\" << endl;
157 Config::instance()->writeIndent(out);
160 generateBottomLineBorder(out, row - 1);
161 out <<
"\\end{tabular}" << endl << endl;
162 Config::instance()->desindent();
163 kdDebug(30522) <<
"END OF GENERATINO OF A TABLE" << endl;
169void Table::generateTopLineBorder(TQTextStream& out,
int row)
172 TQBitArray border(getMaxCol());
173 bool fullLine =
true;
175 for(
int index = 0; index <= getMaxCol(); index++)
179 kdDebug(30522) << endl <<
"name (" << row <<
", " << index <<
") = " << elt->getName() << endl << endl;
182 if(elt->hasTopBorder())
196 Config::instance()->writeIndent(out);
197 out <<
"\\hline" << endl;
202 while(index <= getMaxCol())
208 while(border[index] && index < getMaxCol())
213 out <<
"\\cline{" << (begin + 1) <<
"-" << (end + 1) <<
"} " << endl;
223void Table::generateBottomLineBorder(TQTextStream& out,
int row)
226 TQBitArray border(getMaxCol());
227 bool fullLine =
true;
229 for(
int index = 0; index <= getMaxCol(); index++)
235 if(elt->hasBottomBorder())
249 Config::instance()->writeIndent(out);
250 out <<
"\\hline" << endl;
255 while(index <= getMaxCol())
261 while(border[index] && index <= getMaxCol())
266 out <<
"\\cline{" << (begin + 1) <<
"-" << (end + 1) <<
"} " << endl;
276void Table::generateCell(TQTextStream& out,
int row,
int col)
280 kdDebug(30522) <<
"NEW CELL : " << row <<
"," << col << endl;
288 kdDebug(30522) <<
"END OF A CELL" << endl;
294void Table::generateTableHeader(TQTextStream& out)
297 bool fullRightBorder =
true;
298 bool fullLeftBorder =
true;
302 for(
int col = 0; col <= getMaxCol(); col++)
304 for(
int row = 0; row <
getMaxRow(); row++)
310 if(!elt->hasRightBorder())
311 fullRightBorder =
false;
313 fullLeftBorder =
false;
317 out <<
"m{" << getCellSize(col) <<
"pt}";
bool hasLeftBorder() const
Accessors.
Cell * searchCell(int col, int row)
Helpfull functions.
int getMaxRow() const
getters
void setMaxRow(int r)
setters