00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #ifndef TABLECONTAINER_H
00051 #define TABLECONTAINER_H
00052
00053 #ifdef FMT_TEST
00054 #include <stdio.h>
00055 #endif
00056
00057 #include "ut_misc.h"
00058 #include "ut_types.h"
00059 #include "ut_vector.h"
00060 #include "pt_Types.h"
00061 #include "fp_Page.h"
00062 #include "fp_ContainerObject.h"
00063 #include "fp_Column.h"
00064 #include "gr_Graphics.h"
00065 #include "fl_TableLayout.h"
00066
00067 class fl_TableLayout;
00068
00069 class ABI_EXPORT fp_TableRowColumn
00070 {
00071 public:
00072 fp_TableRowColumn(void);
00073 virtual ~fp_TableRowColumn(void);
00074 UT_sint32 requisition;
00075 UT_sint32 allocation;
00076 UT_sint32 spacing;
00077 bool need_expand;
00078 bool need_shrink;
00079 bool expand;
00080 bool shrink;
00081 bool empty;
00082 };
00083
00084 class fp_VerticalContainer;
00085 class fp_Column;
00086 class fl_EndnoteSectionLayout;
00087 class fl_HdrFtrSectionLayout;
00088 class fl_DocSectionLayout;
00089 class fl_SectionLayout;
00090 class fl_HdrFtrShadow;
00091 class fp_Page;
00092 class PP_AttrProp;
00093 class GR_Graphics;
00094 class fp_TableContainer;
00095 struct dg_DrawArgs;
00096 struct fp_Sliver;
00097
00098 class ABI_EXPORT fp_CellContainer : public fp_VerticalContainer
00099 {
00100 public:
00101 fp_CellContainer(fl_SectionLayout* pSectionLayout);
00102 virtual ~fp_CellContainer();
00103
00104 void sizeRequest(fp_Requisition * pRequest);
00105 void sizeAllocate(fp_Allocation * pAllocate);
00106 void layout(void);
00107 fp_Container * drawSelectedCell(fp_Line * pLine);
00108 bool isSelected(void) const
00109 { return m_bIsSelected; }
00110 void clearSelection(void)
00111 { m_bIsSelected = false;
00112 m_bLinesDrawn = true;
00113 }
00114 bool doesOverlapBrokenTable(fp_TableContainer * pBroke);
00115 void drawBroken(dg_DrawArgs* pDa, fp_TableContainer * pTab);
00116 virtual void clearScreen(void);
00117 void clearScreen(bool bNoRecursive);
00118 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 );
00119 void drawLines(fp_TableContainer * pBroke,GR_Graphics * pG);
00120 void drawLinesAdjacent(void);
00121 void draw(fp_Line * pLine);
00122 fp_TableContainer * getBrokenTable(fp_Container * pCon);
00123 fp_VerticalContainer * getColumn(fp_Container *pCon);
00124 UT_sint32 tweakBrokenTable(fp_TableContainer * pBroke);
00125 virtual void draw(dg_DrawArgs*);
00126 virtual void draw(GR_Graphics*) {}
00127 virtual void setContainer(fp_Container * pContainer);
00128 virtual void setWidth(UT_sint32 iWidth);
00129 virtual void setHeight(UT_sint32 iHeight);
00130 void _drawBoundaries(dg_DrawArgs* pDA, fp_TableContainer *pBroke);
00131 virtual bool isVBreakable(void);
00132 virtual bool isHBreakable(void) {return false;}
00133 virtual UT_sint32 wantVBreakAt(UT_sint32);
00134 virtual UT_sint32 wantHBreakAt(UT_sint32) {return 0;}
00135 virtual fp_ContainerObject * VBreakAt(UT_sint32);
00136 virtual fp_ContainerObject * HBreakAt(UT_sint32) {return NULL;}
00137 void recalcMaxWidth(bool bDontClearIfNeeded = false)
00138 { UT_UNUSED(bDontClearIfNeeded); }
00139 virtual void setAssignedScreenHeight(UT_sint32) {}
00140 virtual fp_Container * getNextContainerInSection(void) const;
00141 virtual fp_Container * getPrevContainerInSection(void) const;
00142 fp_TableContainer * getTopmostTable(void) const;
00143 UT_sint32 getCellX(fp_Line * pLine) const;
00144 UT_sint32 getCellY(fp_Line * pLine) const;
00145 UT_sint32 getSpannedHeight(void);
00146 void setLineMarkers(void);
00147 void deleteBrokenTables(bool bClearFirst=true);
00148 bool containsFootnoteReference(void);
00149 bool getFootnoteContainers(UT_GenericVector<fp_FootnoteContainer*>* pvecFoots);
00150 bool containsAnnotations(void);
00151 bool getAnnotationContainers(UT_GenericVector<fp_AnnotationContainer*>* pvecAnns);
00152 void getLeftTopOffsets(UT_sint32 & xoff, UT_sint32 & yoff);
00153 UT_sint32 getLeftAttach(void) const
00154 { return m_iLeftAttach;}
00155 UT_sint32 getRightAttach(void) const
00156 { return m_iRightAttach;}
00157 UT_sint32 getTopAttach(void) const
00158 { return m_iTopAttach;}
00159 UT_sint32 getBottomAttach(void) const
00160 { return m_iBottomAttach;}
00161 void setLeftAttach(UT_sint32 i)
00162 { m_iLeftAttach = i;}
00163 void setRightAttach(UT_sint32 i)
00164 { m_iRightAttach = i;}
00165 void setTopAttach(UT_sint32 i)
00166 { m_iTopAttach = i;}
00167 void setBottomAttach(UT_sint32 i)
00168 { m_iBottomAttach = i;}
00169 void setToAllocation(void);
00170 UT_sint32 getLeftPad(void) const
00171 { return m_iLeftPad;}
00172 UT_sint32 getRightPad(void) const
00173 { return m_iRightPad;}
00174 UT_sint32 getTopPad(void) const
00175 { return m_iTopPad;}
00176 UT_sint32 getBotPad(void) const
00177 { return m_iBotPad;}
00178 void setLeftPad(UT_sint32 i)
00179 { m_iLeftPad = i;}
00180 void setRightPad(UT_sint32 i)
00181 { m_iRightPad = i;}
00182 void setTopPad(UT_sint32 i)
00183 { m_iTopPad = i;}
00184 void setBotPad(UT_sint32 i)
00185 { m_iBotPad = i;}
00186
00187 PP_PropertyMap::Background getBackground () const;
00188
00189 void setBackground (const PP_PropertyMap::Background & style);
00190
00191
00192 PP_PropertyMap::Line getBottomStyle (const fl_TableLayout * table) const;
00193 PP_PropertyMap::Line getLeftStyle (const fl_TableLayout * table) const;
00194 PP_PropertyMap::Line getRightStyle (const fl_TableLayout * table) const;
00195 PP_PropertyMap::Line getTopStyle (const fl_TableLayout * table) const;
00196
00197 void setBottomStyle (const PP_PropertyMap::Line & style) { m_lineBottom = style; }
00198 void setLeftStyle (const PP_PropertyMap::Line & style) { m_lineLeft = style; }
00199 void setRightStyle (const PP_PropertyMap::Line & style) { m_lineRight = style; }
00200 void setTopStyle (const PP_PropertyMap::Line & style) { m_lineTop = style; }
00201
00202 bool getXexpand(void) const
00203 { return m_bXexpand;}
00204 bool getYexpand(void) const
00205 { return m_bYexpand;}
00206 bool getXshrink(void) const
00207 { return m_bXshrink;}
00208 bool getYshrink(void) const
00209 { return m_bYshrink;}
00210 void setXexpand(bool b)
00211 { m_bXexpand = b;}
00212 void setYexpand(bool b)
00213 { m_bYexpand = b;}
00214 void setXshrink(bool b)
00215 { m_bXshrink = b;}
00216 void setYshrink(bool b)
00217 { m_bYshrink = b;}
00218 bool getXfill(void) const
00219 {return m_bXfill;}
00220 bool getYfill(void)const
00221 {return m_bYfill;}
00222 void setXfill(bool b)
00223 { m_bXfill = b;}
00224 void setYfill(bool b)
00225 { m_bYfill = b;}
00226 UT_sint32 getStartY(void) const
00227 { return m_iTopY;}
00228 UT_sint32 getStopY(void) const
00229 { return m_iBotY;}
00230 UT_sint32 getLeftPos(void) const
00231 { return m_iLeft; }
00232 UT_sint32 getRightPos(void) const
00233 { return m_iRight; }
00234 void markAsDirty(void) { m_bDirty = true;}
00235 bool isDirty(void) const
00236 { return m_bDirty;}
00237 bool doesIntersectClip(fp_TableContainer * pBroke, const UT_Rect * rClip);
00238 bool isInNestedTable(void);
00239 bool containsNestedTables(void);
00240 bool isRepeated(void) const;
00241 #ifdef FMT_TEST
00242 void __dump(FILE * fp) const;
00243 #endif
00244
00245 private:
00246
00247 void _clear(fp_TableContainer * pBroke);
00248 void _drawLine(const PP_PropertyMap::Line & style,
00249 UT_sint32 left, UT_sint32 top, UT_sint32 right, UT_sint32 bot,GR_Graphics * pG);
00250 void _getBrokenRect(fp_TableContainer * pBroke, fp_Page* &pPage, UT_Rect &bRec, GR_Graphics * pG);
00251
00252
00253
00254
00255
00256
00257
00258 UT_sint32 m_iLeftAttach;
00259
00260
00261
00262 UT_sint32 m_iRightAttach;
00263
00264
00265
00266 UT_sint32 m_iTopAttach;
00267
00268
00269
00270 UT_sint32 m_iBottomAttach;
00271
00272
00273
00274 UT_RGBColor m_borderColorNone;
00275
00276
00277
00278
00279 UT_sint32 m_iLeftPad;
00280 UT_sint32 m_iRightPad;
00281 UT_sint32 m_iTopPad;
00282 UT_sint32 m_iBotPad;
00283
00284
00285
00286 fp_CellContainer * m_pNextInTable;
00287 fp_CellContainer * m_pPrevInTable;
00288
00289
00290
00291 bool m_bXexpand;
00292 bool m_bYexpand;
00293 bool m_bXshrink;
00294 bool m_bYshrink;
00295
00296
00297
00298 bool m_bXfill;
00299 bool m_bYfill;
00300
00301
00302
00303 fp_Allocation m_MyAllocation;
00304 fp_Requisition m_MyRequest;
00305
00306
00307
00308 UT_sint32 m_iLeft;
00309 UT_sint32 m_iRight;
00310 UT_sint32 m_iTopY;
00311 UT_sint32 m_iBotY;
00312 bool m_bDrawLeft;
00313 bool m_bDrawTop;
00314 bool m_bDrawBot;
00315 bool m_bDrawRight;
00316 bool m_bLinesDrawn;
00317
00318
00319 bool m_bBgDirty;
00320
00321
00322 PP_PropertyMap::Background m_background;
00323
00324
00325 PP_PropertyMap::Line m_lineBottom;
00326 PP_PropertyMap::Line m_lineLeft;
00327 PP_PropertyMap::Line m_lineRight;
00328 PP_PropertyMap::Line m_lineTop;
00329
00330
00331 bool m_bIsSelected;
00332 bool m_bDirty;
00333
00334 bool m_bIsRepeated;
00335 };
00336
00337 class ABI_EXPORT fp_TableContainer : public fp_VerticalContainer
00338 {
00339 public:
00340 fp_TableContainer(fl_SectionLayout* pSectionLayout);
00341 fp_TableContainer(fl_SectionLayout* pSectionLayout, fp_TableContainer * pMaster);
00342 ~fp_TableContainer();
00343
00344 void sizeRequest(fp_Requisition * pRequest);
00345 void sizeAllocate(fp_Allocation * pAllocate);
00346 virtual void mapXYToPosition(UT_sint32 x, UT_sint32 y,
00347 PT_DocPosition& pos,
00348 bool& bBOL, bool& bEOL, bool &isTOC);
00349 virtual fp_Page * getPage(void);
00350 fp_Line * getFirstLineInColumn(fp_Column * pCol);
00351 fp_Line * getLastLineInColumn(fp_Column * pCol);
00352 void layout(void);
00353 virtual void setY(UT_sint32 iY);
00354 virtual UT_sint32 getHeight(void);
00355 virtual void setHeight(UT_sint32 iHeight);
00356 virtual void setContainer(fp_Container * pContainer);
00357 virtual void draw(dg_DrawArgs*);
00358 virtual void draw(GR_Graphics*) {}
00359 virtual UT_sint32 getMarginBefore(void) const;
00360 virtual UT_sint32 getMarginAfter(void) const;
00361 void setAdditionalMargin(UT_sint32 iMarg)
00362 {m_iAdditionalMarginAfter = iMarg;}
00363 fp_Column * getBrokenColumn(void);
00364 void drawLines();
00365 bool containsFootnoteReference(void);
00366 bool getFootnoteContainers(UT_GenericVector<fp_FootnoteContainer*>* pvecFoots);
00367 bool containsAnnotations(void);
00368 bool getAnnotationContainers(UT_GenericVector<fp_AnnotationContainer*>* pvecAnns);
00369 UT_sint32 tweakBrokenTable(fp_TableContainer * pBroke);
00370 virtual void clearScreen(void);
00371 virtual bool isVBreakable(void);
00372 virtual bool isHBreakable(void) {return false;}
00373 virtual UT_sint32 wantVBreakAt(UT_sint32);
00374 virtual UT_sint32 wantHBreakAt(UT_sint32) {return 0;}
00375 virtual fp_ContainerObject * VBreakAt(UT_sint32);
00376 void breakCellsAt(UT_sint32 vpos);
00377 virtual fp_ContainerObject * HBreakAt(UT_sint32) {return NULL;}
00378 UT_sint32 getBrokenNumber(void);
00379 void setToAllocation(void);
00380 void tableAttach(fp_CellContainer * pCell);
00381 void setHomogeneous (bool bIsHomogeneous);
00382 void setColSpacings (UT_sint32 spacing);
00383 void setRowSpacings ( UT_sint32 spacing);
00384 void setColSpacing(UT_sint32 column,UT_sint32 spacing);
00385 void setRowSpacing (UT_sint32 row, UT_sint32 spacing);
00386 void resize(UT_sint32 n_rows, UT_sint32 n_cols);
00387 void setBorderWidth(UT_sint32 i);
00388 UT_sint32 getBorderWidth(void) const
00389 { return m_iBorderWidth;}
00390 void setLeftOffset(UT_sint32 iLeftOff)
00391 { m_iLeftOffset = iLeftOff;}
00392 void setRightOffset(UT_sint32 iRightOff)
00393 { m_iRightOffset = iRightOff;}
00394 void setTopOffset(UT_sint32 iTopOff)
00395 { m_iTopOffset = iTopOff;}
00396 void setBottomOffset(UT_sint32 iBotOff)
00397 { m_iBottomOffset = iBotOff;}
00398 void setLineThickness(UT_sint32 iLineThickness)
00399 { m_iLineThickness = iLineThickness;}
00400 UT_sint32 getLineThickness(void)
00401 { return m_iLineThickness;}
00402 void queueResize(void);
00403 UT_sint32 getYOfRow(UT_sint32 row);
00404 fp_CellContainer * getCellAtRowColumn(UT_sint32 row, UT_sint32 column);
00405 fp_CellContainer * getCellAtRowColumnLinear(UT_sint32 row, UT_sint32 column);
00406 virtual fp_Container * getNextContainerInSection(void) const;
00407 virtual fp_Container * getPrevContainerInSection(void) const;
00408 fp_TableContainer * getMasterTable(void) const
00409 { return m_pMasterTable; }
00410 bool isThisBroken(void) const
00411 { return m_bIsBroken;}
00412 void setYBreakHere(UT_sint32 iBreakHere);
00413 void setYBottom(UT_sint32 iBotContainer);
00414 bool isInBrokenTable(fp_CellContainer * pCell,
00415 fp_Container * pCon);
00416
00417
00418
00419
00420
00421 UT_sint32 getYBreak(void) const
00422 {return m_iYBreakHere;}
00423
00424
00425
00426 UT_sint32 getYBottom(void) const
00427 {return m_iYBottom;}
00428 fp_TableContainer * getFirstBrokenTable(void) const;
00429 fp_TableContainer * getLastBrokenTable(void) const;
00430 void setFirstBrokenTable(fp_TableContainer * pBroke);
00431 void setLastBrokenTable(fp_TableContainer * pBroke);
00432 void deleteBrokenTables(bool bClearFirst, bool bRecurseUp = true);
00433 void adjustBrokenTables(void);
00434 UT_sint32 getBrokenTop(void);
00435 UT_sint32 getBrokenBot(void);
00436 void setBrokenTop(UT_sint32 iTop)
00437 { m_iBrokenTop = iTop;}
00438 void setBrokenBot(UT_sint32 iBot)
00439 { m_iBrokenBottom = iBot;}
00440 UT_sint32 getNumRows(void) const;
00441 UT_sint32 getNumCols(void) const;
00442 UT_sint32 getRowHeight(UT_sint32 iRow, UT_sint32 iMeasHeight);
00443 void setRedrawLines(void)
00444 { m_bRedrawLines = true;}
00445 bool doRedrawLines(void) const
00446 { return m_bRedrawLines;}
00447 fp_TableRowColumn * getNthCol(UT_sint32 i);
00448 fp_TableRowColumn * getNthRow(UT_sint32 i);
00449 bool containsNestedTables(void);
00450 void setRowHeightType(FL_RowHeightType iType)
00451 {
00452 m_iRowHeightType = iType;
00453 }
00454 void setRowHeight(UT_sint32 iHeight)
00455 {
00456 m_iRowHeight = iHeight;
00457 }
00458 void setLastWantedVBreak(UT_sint32 iBreakAt)
00459 {
00460 m_iLastWantedVBreak = iBreakAt;
00461 }
00462 UT_sint32 getLastWantedVBreak(void) const
00463 {
00464 return m_iLastWantedVBreak;
00465 }
00466 #ifdef FMT_TEST
00467 void __dump(FILE * fp) const;
00468 #endif
00469 private:
00470 void _size_request_init(void);
00471 void _size_request_pass1(void);
00472 void _size_request_pass2(void);
00473 void _size_request_pass3(void);
00474
00475 void _size_allocate_init(void);
00476 void _size_allocate_pass1(void);
00477 void _size_allocate_pass2(void);
00478 UT_uint32 _getBottomOfLastContainer(void) const;
00479 void _drawBoundaries(dg_DrawArgs* pDA);
00480 void _drawBrokenBoundaries(dg_DrawArgs* pDA);
00481 void _brokenDraw(dg_DrawArgs* pDA);
00482
00483 UT_sint32 m_iRows;
00484 UT_sint32 m_iCols;
00485 UT_sint32 m_iBorderWidth;
00486 bool m_bIsHomogeneous;
00487
00488 UT_GenericVector<fp_TableRowColumn *> m_vecRows;
00489 UT_GenericVector<fp_TableRowColumn *> m_vecColumns;
00490
00491
00492
00493 fp_Allocation m_MyAllocation;
00494 fp_Requisition m_MyRequest;
00495
00496 UT_sint32 m_iRowSpacing;
00497 UT_sint32 m_iColSpacing;
00498
00499
00500
00501 fp_TableContainer * m_pFirstBrokenTable;
00502 fp_TableContainer * m_pLastBrokenTable;
00503 bool m_bIsBroken;
00504 fp_TableContainer * m_pMasterTable;
00505 UT_sint32 m_iYBreakHere;
00506 UT_sint32 m_iYBottom;
00507 UT_sint32 m_iBrokenTop;
00508 UT_sint32 m_iBrokenBottom;
00509 bool m_bRedrawLines;
00510
00511
00512
00513 UT_sint32 m_iRepeatedRowNumber;
00514 UT_sint32 m_iRepeatedRowHeight;
00515
00516
00517
00518 UT_sint32 m_iLeftOffset;
00519 UT_sint32 m_iRightOffset;
00520 UT_sint32 m_iTopOffset;
00521 UT_sint32 m_iBottomOffset;
00522 UT_sint32 m_iLineThickness;
00523
00524
00525 FL_RowHeightType m_iRowHeightType;
00526
00527
00528 UT_sint32 m_iRowHeight;
00529
00530
00531
00532 UT_sint32 m_iLastWantedVBreak;
00533
00534
00535
00536 fp_CellContainer * m_pFirstBrokenCell;
00537 fp_CellContainer * m_pLastBrokenCell;
00538 bool m_bRecursiveClear;
00539 UT_sint32 m_iAdditionalMarginAfter;
00540 };
00541
00542 #endif