1 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
2 
3 /* AbiWord
4  * Copyright (C) 1998 AbiSource, Inc.
5  * Copyright (C) 2002 Martin Sevior <msevior@physics.unimelb.edu.au>
6  *
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  * 02110-1301 USA.
22  *
23  */
24 /* GTK - The GIMP Toolkit
25  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
26  *
27  * This library is free software; you can redistribute it and/or
28  * modify it under the terms of the GNU Library General Public
29  * License as published by the Free Software Foundation; either
30  * version 2 of the License, or (at your option) any later version.
31  *
32  * This library is distributed in the hope that it will be useful,
33  * but WITHOUT ANY WARRANTY; without even the implied warranty of
34  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
35  * Library General Public License for more details.
36  *
37  * You should have received a copy of the GNU Library General Public
38  * License along with this library; if not, write to the
39  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
40  * Boston, MA 02110-1301 USA.
41  */
42 
43 /*
44  * Modified by the GTK+ Team and others 1997-1999.  See the AUTHORS
45  * file for a list of people on the GTK+ Team.  See the ChangeLog
46  * files for a list of changes.  These files are distributed with
47  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
48  */
49 
50 #ifndef TABLECONTAINER_H
51 #define TABLECONTAINER_H
52 
53 #ifdef FMT_TEST
54 #include <stdio.h>
55 #endif
56 
57 #include "ut_misc.h"
58 #include "ut_types.h"
59 #include "ut_vector.h"
60 #include "pt_Types.h"
61 #include "fp_Page.h"
62 #include "fp_ContainerObject.h"
63 #include "fp_Column.h"
64 #include "gr_Graphics.h"
65 #include "fl_TableLayout.h"
66 
67 #define FP_TABLE_MIN_BROKEN_HEIGHT 60
68 
69 class fl_TableLayout;
70 
71 class ABI_EXPORT fp_TableRowColumn
72 {
73 public:
74 	fp_TableRowColumn(UT_sint32 defaultSpacing = 0);
75 	virtual ~fp_TableRowColumn(void);
76 	UT_sint32 requisition;
77 	UT_sint32 allocation;
78 	UT_sint32 spacing;
79 	UT_sint32 position;
80 	bool need_expand;
81 	bool need_shrink;
82 	bool expand;
83 	bool shrink;
84 	bool empty;
85 };
86 
87 class fp_VerticalContainer;
88 class fp_Column;
89 class fl_EndnoteSectionLayout;
90 class fl_HdrFtrSectionLayout;
91 class fl_DocSectionLayout;
92 class fl_SectionLayout;
93 class fl_HdrFtrShadow;
94 class fp_Page;
95 class PP_AttrProp;
96 class GR_Graphics;
97 class fp_TableContainer;
98 struct dg_DrawArgs;
99 struct fp_Sliver;
100 
101 class ABI_EXPORT fp_CellContainer : public fp_VerticalContainer
102 {
103 public:
104 	fp_CellContainer(fl_SectionLayout* pSectionLayout);
105 	virtual ~fp_CellContainer();
106 
107 	void                sizeRequest(fp_Requisition * pRequest);
108 	void                sizeAllocate(fp_Allocation * pAllocate);
109 	void				layout(void);
110 	fp_Container *      drawSelectedCell(fp_Line * pLine);
isSelected(void)111 	bool			    isSelected(void) const
112 	{ return m_bIsSelected; }
clearSelection(void)113 	void                clearSelection(void)
114 	{ m_bIsSelected = false;
115 	  m_bLinesDrawn = true;
116 	}
117 	bool                doesOverlapBrokenTable(fp_TableContainer * pBroke) const;
118 	void		        drawBroken(dg_DrawArgs* pDa, fp_TableContainer * pTab);
119 	virtual void		clearScreen(void);
120 	void		        clearScreen(bool bNoRecursive);
121 	void                getScreenPositions(fp_TableContainer * pBroke,GR_Graphics * pG,UT_sint32 & iLeft, UT_sint32 & iRight,UT_sint32 & iTop,UT_sint32 & iBot,UT_sint32 & col_y, fp_Column *& pCol, fp_ShadowContainer *& pShadow, bool & bDoClear );
122 	void                drawLines(fp_TableContainer * pBroke,GR_Graphics * pG,bool bDoClear);
123 	void                drawLinesAdjacent(void);
124 	void                draw(fp_Line * pLine);
125 	fp_TableContainer * getBrokenTable(fp_Container * pCon) const;
126 	fp_VerticalContainer * getColumn(fp_Container *pCon); // FIXME: see if we can make it const
127 	fp_Container *      getFirstContainerInBrokenTable(fp_TableContainer * pBroke) const;
128 	UT_sint32           wantCellVBreakAt(UT_sint32,UT_sint32);
129 	virtual void		draw(dg_DrawArgs*);
draw(GR_Graphics *)130 	virtual void		draw(GR_Graphics*) {}
131 	virtual void        setContainer(fp_Container * pContainer);
132 	virtual void        setWidth(UT_sint32 iWidth);
133 	virtual void        setHeight(UT_sint32 iHeight);
134 	        void        _drawBoundaries(dg_DrawArgs* pDA, fp_TableContainer *pBroke);
135 	virtual bool        isVBreakable(void);
isHBreakable(void)136 	virtual bool        isHBreakable(void) {return false;}
wantHBreakAt(UT_sint32)137 	virtual UT_sint32   wantHBreakAt(UT_sint32) {return 0;}
138 	virtual fp_ContainerObject * VBreakAt(UT_sint32);
HBreakAt(UT_sint32)139 	virtual fp_ContainerObject * HBreakAt(UT_sint32) {return NULL;}
140 	void                recalcMaxWidth(bool bDontClearIfNeeded = false)
141 	{ UT_UNUSED(bDontClearIfNeeded); }
setAssignedScreenHeight(UT_sint32)142 	virtual void        setAssignedScreenHeight(UT_sint32) {}
143 	virtual fp_Container * getNextContainerInSection(void) const;
144 	virtual fp_Container * getPrevContainerInSection(void) const;
145 	fp_TableContainer * getTopmostTable(void) const;
146 	void                extendLeftTop(PP_PropertyMap::Line & line,GR_Graphics * pG,UT_sint32 & iextTop);
147 	void                extendLeftBot(PP_PropertyMap::Line & line,GR_Graphics * pG,UT_sint32 & iextBot);
148 	void                extendRightTop(PP_PropertyMap::Line & line,GR_Graphics * pG,UT_sint32 & iextTop);
149 	void                extendRightBot(PP_PropertyMap::Line & line,GR_Graphics * pG,UT_sint32 & iextBot);
150 	void                extendTopLeft(PP_PropertyMap::Line & line,GR_Graphics * pG,UT_sint32 & iextLeft);
151 	void                extendTopRight(PP_PropertyMap::Line & line,GR_Graphics * pG,UT_sint32 & iextRight);
152 	void                extendBotLeft(PP_PropertyMap::Line & line,GR_Graphics * pG,UT_sint32 & iextLeft);
153 	void                extendBotRight(PP_PropertyMap::Line & line,GR_Graphics * pG,UT_sint32 & iextRight);
154 
155 	UT_sint32           getCellX(fp_Line * pLine) const;
156 	UT_sint32           getCellY(fp_Line * pLine) const;
157 	UT_sint32           getSpannedHeight(void);
158 	void                setLineMarkers(void);
159 	void                deleteBrokenTables(bool bClearFirst=true);
160 	void                deleteBrokenAfter(bool bClearFirst,UT_sint32 iOldBottom);
161 	bool                containsFootnoteReference(fp_TableContainer * pBroke = NULL) const;
162 	bool                getFootnoteContainers(UT_GenericVector<fp_FootnoteContainer*>* pvecFoots, fp_TableContainer * pBroke = NULL);
163 	bool                containsAnnotations(fp_TableContainer * pBroke = NULL) const;
164 	bool                getAnnotationContainers(UT_GenericVector<fp_AnnotationContainer*>* pvecAnns, fp_TableContainer * pBroke = NULL);
165 	void                getLeftTopOffsets(UT_sint32 & xoff, UT_sint32 & yoff) const;
getLeftAttach(void)166    UT_sint32           getLeftAttach(void) const
167 		{ return m_iLeftAttach;}
getRightAttach(void)168     UT_sint32           getRightAttach(void) const
169 		{ return m_iRightAttach;}
getTopAttach(void)170     UT_sint32           getTopAttach(void) const
171 		{ return m_iTopAttach;}
getBottomAttach(void)172     UT_sint32           getBottomAttach(void) const
173 		{ return m_iBottomAttach;}
setLeftAttach(UT_sint32 i)174     void                setLeftAttach(UT_sint32 i)
175 		{ m_iLeftAttach = i;}
setRightAttach(UT_sint32 i)176     void                setRightAttach(UT_sint32 i)
177 		{ m_iRightAttach = i;}
setTopAttach(UT_sint32 i)178     void                setTopAttach(UT_sint32 i)
179 		{ m_iTopAttach = i;}
setBottomAttach(UT_sint32 i)180     void                setBottomAttach(UT_sint32 i)
181 		{ m_iBottomAttach = i;}
182 	void                setToAllocation(void);
getLeftPad(void)183 	UT_sint32           getLeftPad(void) const
184 		{ return m_iLeftPad;}
getRightPad(void)185 	UT_sint32           getRightPad(void) const
186 		{ return m_iRightPad;}
getTopPad(void)187 	UT_sint32           getTopPad(void) const
188 		{ return m_iTopPad;}
getBotPad(void)189 	UT_sint32           getBotPad(void) const
190 		{ return m_iBotPad;}
setLeftPad(UT_sint32 i)191 	void                setLeftPad(UT_sint32 i)
192 		{ m_iLeftPad = i;}
setRightPad(UT_sint32 i)193 	void                setRightPad(UT_sint32 i)
194 		{ m_iRightPad = i;}
setTopPad(UT_sint32 i)195 	void                setTopPad(UT_sint32 i)
196 		{ m_iTopPad = i;}
setBotPad(UT_sint32 i)197 	void                setBotPad(UT_sint32 i)
198 		{ m_iBotPad = i;}
199 
200 	PP_PropertyMap::Background getBackground () const;
201 
202 	void setBackground (const PP_PropertyMap::Background & style);
203 
204 
205 	PP_PropertyMap::Line getBottomStyle (const fl_TableLayout * table) const;
206 	PP_PropertyMap::Line getLeftStyle   (const fl_TableLayout * table) const;
207 	PP_PropertyMap::Line getRightStyle  (const fl_TableLayout * table) const;
208 	PP_PropertyMap::Line getTopStyle    (const fl_TableLayout * table) const;
209 
setBottomStyle(const PP_PropertyMap::Line & style)210 	void setBottomStyle (const PP_PropertyMap::Line & style) { m_lineBottom = style; }
setLeftStyle(const PP_PropertyMap::Line & style)211 	void setLeftStyle   (const PP_PropertyMap::Line & style) { m_lineLeft   = style; }
setRightStyle(const PP_PropertyMap::Line & style)212 	void setRightStyle  (const PP_PropertyMap::Line & style) { m_lineRight  = style; }
setTopStyle(const PP_PropertyMap::Line & style)213 	void setTopStyle    (const PP_PropertyMap::Line & style) { m_lineTop    = style; }
214 
getXexpand(void)215 	bool                getXexpand(void) const
216 		{ return m_bXexpand;}
getYexpand(void)217 	bool                getYexpand(void) const
218 		{ return m_bYexpand;}
getXshrink(void)219 	bool                getXshrink(void) const
220 		{ return m_bXshrink;}
getYshrink(void)221 	bool                getYshrink(void) const
222 		{ return m_bYshrink;}
setXexpand(bool b)223 	void                setXexpand(bool b)
224 		{ m_bXexpand = b;}
setYexpand(bool b)225 	void                setYexpand(bool b)
226 		{ m_bYexpand = b;}
setXshrink(bool b)227 	void                setXshrink(bool b)
228 		{ m_bXshrink = b;}
setYshrink(bool b)229 	void                setYshrink(bool b)
230 		{ m_bYshrink = b;}
getXfill(void)231 	bool                getXfill(void) const
232 		{return m_bXfill;}
getYfill(void)233 	bool                getYfill(void)const
234 		{return m_bYfill;}
setXfill(bool b)235 	void                setXfill(bool b)
236 		{ m_bXfill = b;}
setYfill(bool b)237 	void                setYfill(bool b)
238 		{ m_bYfill = b;}
getStartY(void)239 	UT_sint32           getStartY(void) const
240 		{ return m_iTopY;}
getStopY(void)241 	UT_sint32           getStopY(void) const
242 		{ return m_iBotY;}
getLeftPos(void)243 	UT_sint32           getLeftPos(void) const
244 		{  return m_iLeft; }
getRightPos(void)245 	UT_sint32           getRightPos(void) const
246 		{  return m_iRight; }
markAsDirty(void)247 	void                markAsDirty(void) { m_bDirty = true;}
isDirty(void)248 	bool                isDirty(void) const
249 	    {  return m_bDirty;}
250 	bool                doesIntersectClip(fp_TableContainer * pBroke, const UT_Rect * rClip);
251 	bool                isInNestedTable(void) const;
252 	bool                containsNestedTables(void);
253 	bool                isRepeated(void) const;
setVertAlign(UT_sint32 i)254 	void                setVertAlign(UT_sint32 i) { m_iVertAlign = i; }
255 	void doVertAlign(void);
256 #ifdef FMT_TEST
257 	void				__dump(FILE * fp) const;
258 #endif
259 
260 private:
261 
262 	void                _clear(fp_TableContainer * pBroke);
263 	void				_getBrokenRect(fp_TableContainer * pBroke, fp_Page* &pPage, UT_Rect &bRec, GR_Graphics * pG);
264 
265 //
266 // These variables describe where the cell is attached to the table.
267 // The first cell in the Table is at (0,0)
268 //
269 // m_iLeftAttach is the leftmost column containing the cell.
270 //
271 	UT_sint32           m_iLeftAttach;
272 
273 // m_iRightAttach is the first column to the right of the cell.
274 
275 	UT_sint32           m_iRightAttach;
276 
277 // m_iTopAttach is the topmost row containing the cell.
278 
279 	UT_sint32           m_iTopAttach;
280 
281 // m_iBottomAttach is the row immediately below the cell.
282 
283 	UT_sint32           m_iBottomAttach;
284 
285 // a default color to use the a cell border style is set to "off"
286 
287 	UT_RGBColor			m_borderColorNone;
288 
289 //
290 // Padding left,right, top and bottom
291 //
292 	UT_sint32           m_iLeftPad;
293 	UT_sint32           m_iRightPad;
294 	UT_sint32           m_iTopPad;
295 	UT_sint32           m_iBotPad;
296 //
297 // Needed since a cell can span multiple pages.
298 //
299 	fp_CellContainer *  m_pNextInTable;
300 	fp_CellContainer *  m_pPrevInTable;
301 //
302 // Should the cell expand or shrink in the x and y directitions.
303 //
304 	bool                m_bXexpand;
305 	bool                m_bYexpand;
306 	bool                m_bXshrink;
307 	bool                m_bYshrink;
308 //
309 // Should we fill the container in x and y?
310 //
311 	bool                m_bXfill;
312 	bool                m_bYfill;
313 
314 // Local size request and allocation.
315 
316 	fp_Allocation       m_MyAllocation;
317 	fp_Requisition      m_MyRequest;
318 
319 // Coordinates of the cell used for drawing lines around it.
320 
321 	UT_sint32           m_iLeft;
322 	UT_sint32           m_iRight;
323 	UT_sint32           m_iTopY;
324 	UT_sint32           m_iBotY;
325 	bool                m_bDrawLeft;
326 	bool                m_bDrawTop;
327 	bool                m_bDrawBot;
328 	bool                m_bDrawRight;
329 	bool                m_bLinesDrawn;
330 
331 // bool to see if the background needs to be redrawn
332 	bool				m_bBgDirty;
333 
334 // cell-background properties
335 	PP_PropertyMap::Background	m_background;
336 
337 // cell-border properties
338 	PP_PropertyMap::Line   m_lineBottom;
339 	PP_PropertyMap::Line   m_lineLeft;
340 	PP_PropertyMap::Line   m_lineRight;
341 	PP_PropertyMap::Line   m_lineTop;
342 
343 // Flag to see if this cell is drawn "selected"
344 	bool		           m_bIsSelected;
345 	bool                   m_bDirty;
346 
347 	bool                   m_bIsRepeated;
348 
349 // Vertical alignment property
350 
351 	UT_sint32	m_iVertAlign;
352 };
353 
354 class ABI_EXPORT fp_TableContainer : public fp_VerticalContainer
355 {
356 public:
357 	fp_TableContainer(fl_SectionLayout* pSectionLayout);
358 	fp_TableContainer(fl_SectionLayout* pSectionLayout, fp_TableContainer * pMaster);
359 	~fp_TableContainer();
360 
361 	void                sizeRequest(fp_Requisition * pRequest);
362 	void                sizeAllocate(fp_Allocation * pAllocate);
363     virtual void        mapXYToPosition(UT_sint32 x, UT_sint32 y,
364 										PT_DocPosition& pos,
365 										bool& bBOL, bool& bEOL, bool &isTOC);
366 	virtual fp_Page *   getPage(void);
367 	fp_Line *           getFirstLineInColumn(fp_Column * pCol);
368 	fp_Line *           getLastLineInColumn(fp_Column * pCol);
369 	void				layout(void);
370 	virtual void        setY(UT_sint32 iY);
371 	virtual UT_sint32   getHeight(void) const;
372 	virtual void        setHeight(UT_sint32 iHeight);
373 	virtual void        setContainer(fp_Container * pContainer);
374 	virtual void		draw(dg_DrawArgs*);
draw(GR_Graphics *)375 	virtual void		draw(GR_Graphics*) {}
376 	virtual UT_sint32   getMarginBefore(void) const;
377 	virtual UT_sint32   getMarginAfter(void) const;
setAdditionalMargin(UT_sint32 iMarg)378 	void                setAdditionalMargin(UT_sint32 iMarg)
379 	{m_iAdditionalMarginAfter = iMarg;}
380 fp_Column *         getBrokenColumn(void);
381 	void                drawLines();
382 	bool                containsFootnoteReference(void);
383 	bool                getFootnoteContainers(UT_GenericVector<fp_FootnoteContainer*>* pvecFoots);
384 	bool                containsAnnotations(void);
385 	bool                getAnnotationContainers(UT_GenericVector<fp_AnnotationContainer*>* pvecAnns);
386     virtual void        clearScreen(void);
387 	virtual bool        isVBreakable(void);
isHBreakable(void)388 	virtual bool        isHBreakable(void) {return false;}
389 	virtual UT_sint32   wantVBreakAt(UT_sint32);
wantHBreakAt(UT_sint32)390 	virtual UT_sint32   wantHBreakAt(UT_sint32) {return 0;}
391 	UT_sint32           wantVBreakAtNoFootnotes(UT_sint32);
392 	UT_sint32           wantVBreakAtWithFootnotes(UT_sint32);
393 	UT_sint32           sumFootnoteHeight(void);
394 	virtual fp_ContainerObject * VBreakAt(UT_sint32);
395 	void                breakCellsAt(UT_sint32 vpos);
HBreakAt(UT_sint32)396 	virtual fp_ContainerObject * HBreakAt(UT_sint32) {return NULL;}
397 	UT_sint32           getBrokenNumber(void) const;
398 	void                setToAllocation(void);
399 	void                tableAttach(fp_CellContainer * pCell);
400 	void                setHomogeneous (bool bIsHomogeneous);
401 	void                setColSpacings (UT_sint32  spacing);
402 	void                setRowSpacings ( UT_sint32 spacing);
403 	void                setColSpacing(UT_sint32 column,UT_sint32 spacing);
404 	void                setRowSpacing (UT_sint32 row, UT_sint32  spacing);
405 	void                resize(UT_sint32 n_rows, UT_sint32 n_cols);
406 	void                setBorderWidth(UT_sint32 i);
getBorderWidth(void)407 	UT_sint32           getBorderWidth(void) const
408 		{ return m_iBorderWidth;}
setLineThickness(UT_sint32 iLineThickness)409 	void                setLineThickness(UT_sint32 iLineThickness)
410 		{ m_iLineThickness = iLineThickness;}
getLineThickness(void)411 	UT_sint32           getLineThickness(void)
412 		{ return m_iLineThickness;}
413 	void                queueResize(void);
414 	UT_sint32           getYOfRowOrColumn(UT_sint32 row, bool bRow) const;
415 	UT_sint32           getYOfRow(UT_sint32 row) const;
416 	UT_sint32           getXOfColumn(UT_sint32 col) const;
417 	fp_CellContainer *  getCellAtRowColumn(UT_sint32 row, UT_sint32 column) const;
418 	fp_CellContainer *  getCellAtRowColumnLinear(UT_sint32 row, UT_sint32 column) const;
419 	virtual fp_Container * getNextContainerInSection(void) const;
420 	virtual fp_Container * getPrevContainerInSection(void) const;
getMasterTable(void)421 	fp_TableContainer * getMasterTable(void) const
422 		{ return m_pMasterTable; }
423 	bool                isThisBroken(void) const;
424 	void                setYBreakHere(UT_sint32 iBreakHere);
425 	void                setYBottom(UT_sint32 iBotContainer);
426 	bool                isInBrokenTable(const fp_CellContainer * pCell,
427 										fp_Container * pCon) const;
428 
429 //
430 // This is the smallest Y value of the Table allowed in this
431 // broken Table.
432 //
getYBreak(void)433 	UT_sint32           getYBreak(void) const
434 		{return m_iYBreakHere;}
435 //
436 // This is the largest Y value of the Table allowed in this broken table
437 //
getYBottom(void)438 	UT_sint32           getYBottom(void) const
439 		{return m_iYBottom;}
440 	fp_TableContainer * getFirstBrokenTable(void) const;
441 	fp_TableContainer * getLastBrokenTable(void) const;
442 	fp_CellContainer *  getFirstBrokenCell(bool bCacheResultOnly = false) const;
443 	void                setFirstBrokenTable(fp_TableContainer * pBroke);
444 	void                setLastBrokenTable(fp_TableContainer * pBroke);
445 	void                deleteBrokenTables(bool bClearFirst, bool bRecurseUp = true);
getAdditionalBottomSpace(void)446 	UT_sint32           getAdditionalBottomSpace(void) const
447 		{ return m_iAdditionalBottomSpace;}
setAdditionalBottomSpace(UT_sint32 space)448 	void                setAdditionalBottomSpace(UT_sint32 space)
449 		{ m_iAdditionalBottomSpace = space;}
getBrokenTop(void)450 	bool                getBrokenTop(void) const
451 		{ return m_bBrokenTop;}
getBrokenBottom(void)452 	bool                getBrokenBottom(void) const
453 		{ return m_bBrokenBottom;}
setBrokenTop(bool bTop)454 	void                setBrokenTop(bool bTop)
455 		{ m_bBrokenTop = bTop;}
setBrokenBottom(bool bBot)456 	void                setBrokenBottom(bool bBot)
457 		{ m_bBrokenBottom = bBot;}
458 	UT_sint32           getNumRows(void) const;
459 	UT_sint32           getNumCols(void) const;
460 	UT_sint32           getRowHeight(UT_sint32 iRow, UT_sint32 iMeasHeight);
461 	UT_sint32           getTotalTableHeight(void) const;
462 	UT_sint32           getRowOrColumnAtPosition(UT_sint32 y, bool bRow) const;
setRedrawLines(void)463 	void                setRedrawLines(void)
464 		{ m_bRedrawLines = true;}
doRedrawLines(void)465 	bool                doRedrawLines(void) const
466 		{ return m_bRedrawLines;}
467 	fp_TableRowColumn *     getNthCol(UT_sint32 i) const;
468 	fp_TableRowColumn *     getNthRow(UT_sint32 i) const;
469 	bool                    containsNestedTables(void);
setRowHeightType(FL_RowHeightType iType)470 	void setRowHeightType(FL_RowHeightType iType)
471 		{
472 	      m_iRowHeightType = iType;
473 		}
setRowHeight(UT_sint32 iHeight)474 	void setRowHeight(UT_sint32 iHeight)
475 		{
476 	      m_iRowHeight = iHeight;
477 		}
setLastWantedVBreak(UT_sint32 iBreakAt)478 	virtual void setLastWantedVBreak(UT_sint32 iBreakAt)
479 		{m_iLastWantedVBreak = iBreakAt;}
getLastWantedVBreak(void)480 	virtual UT_sint32 getLastWantedVBreak(void) const
481 		{return m_iLastWantedVBreak;}
482 	virtual fp_Container * getFirstBrokenContainer() const;
483 	virtual void deleteBrokenAfter(bool bClearFirst);
484 #ifdef FMT_TEST
485 	void				__dump(FILE * fp) const;
486 #endif
487 private:
488 	void                    _size_request_init(void);
489 	void                    _size_request_pass1(void);
490 	void                    _size_request_pass2(void);
491 	void                    _size_request_pass3(void);
492 
493     void                    _size_allocate_init(void);
494     void                    _size_allocate_pass1(void);
495 	void                    _size_allocate_pass2(void);
496 	UT_uint32 				_getBottomOfLastContainer(void) const;
497 	void					_drawBoundaries(dg_DrawArgs* pDA);
498 	void					_drawBrokenBoundaries(dg_DrawArgs* pDA);
499 	void					_brokenDraw(dg_DrawArgs* pDA);
500 
501 	UT_sint32               m_iRows;
502 	UT_sint32               m_iCols;
503 	UT_sint32               m_iBorderWidth;
504 	bool                    m_bIsHomogeneous;
505 
506 	UT_GenericVector<fp_TableRowColumn *> m_vecRows;
507 	UT_GenericVector<fp_TableRowColumn *> m_vecColumns;
508 
509 // Local size request and allocation.
510 
511 	fp_Allocation           m_MyAllocation;
512 	fp_Requisition          m_MyRequest;
513 
514 	UT_sint32               m_iRowSpacing;
515 	UT_sint32               m_iColSpacing;
516 //
517 // Variables for Tables broken across Vertical Containers.
518 //
519 	fp_TableContainer *     m_pFirstBrokenTable;
520 	fp_TableContainer *     m_pLastBrokenTable;
521 	bool                    m_bIsBroken;
522 	fp_TableContainer *     m_pMasterTable;
523 	UT_sint32               m_iYBreakHere;
524 	UT_sint32               m_iYBottom;
525 	UT_sint32               m_iAdditionalBottomSpace;
526 	bool                    m_bBrokenTop;
527 	bool                    m_bBrokenBottom;
528 	bool                    m_bRedrawLines;
529 //
530 // Global Table properties
531 //
532 	UT_sint32               m_iLineThickness;
533 
534 // Global row height type
535 	FL_RowHeightType    m_iRowHeightType;
536 // Global row height
537 	UT_sint32           m_iRowHeight;
538 
539 // Last requested vbreak height and next one (for nested tables)
540 	UT_sint32           m_iLastWantedVBreak;
541 	UT_sint32           m_iNextWantedVBreak;
542 
543 // Cache the first cell of a broken table
544 
545 	fp_CellContainer *  m_pFirstBrokenCell;
546 	UT_sint32           m_iAdditionalMarginAfter;
547 };
548 
549 #endif /* TABLECONTAINER_H */
550