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) const;
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,bool bDoClear);
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 void extendLeftTop(PP_PropertyMap::Line & line,GR_Graphics * pG,UT_sint32 & iextTop);
00144 void extendLeftBot(PP_PropertyMap::Line & line,GR_Graphics * pG,UT_sint32 & iextBot);
00145 void extendRightTop(PP_PropertyMap::Line & line,GR_Graphics * pG,UT_sint32 & iextTop);
00146 void extendRightBot(PP_PropertyMap::Line & line,GR_Graphics * pG,UT_sint32 & iextBot);
00147 void extendTopLeft(PP_PropertyMap::Line & line,GR_Graphics * pG,UT_sint32 & iextLeft);
00148 void extendTopRight(PP_PropertyMap::Line & line,GR_Graphics * pG,UT_sint32 & iextRight);
00149 void extendBotLeft(PP_PropertyMap::Line & line,GR_Graphics * pG,UT_sint32 & iextLeft);
00150 void extendBotRight(PP_PropertyMap::Line & line,GR_Graphics * pG,UT_sint32 & iextRight);
00151
00152 UT_sint32 getCellX(fp_Line * pLine) const;
00153 UT_sint32 getCellY(fp_Line * pLine) const;
00154 UT_sint32 getSpannedHeight(void);
00155 void setLineMarkers(void);
00156 void deleteBrokenTables(bool bClearFirst=true);
00157 bool containsFootnoteReference(void);
00158 bool getFootnoteContainers(UT_GenericVector<fp_FootnoteContainer*>* pvecFoots);
00159 bool containsAnnotations(void);
00160 bool getAnnotationContainers(UT_GenericVector<fp_AnnotationContainer*>* pvecAnns);
00161 void getLeftTopOffsets(UT_sint32 & xoff, UT_sint32 & yoff) const;
00162 UT_sint32 getLeftAttach(void) const
00163 { return m_iLeftAttach;}
00164 UT_sint32 getRightAttach(void) const
00165 { return m_iRightAttach;}
00166 UT_sint32 getTopAttach(void) const
00167 { return m_iTopAttach;}
00168 UT_sint32 getBottomAttach(void) const
00169 { return m_iBottomAttach;}
00170 void setLeftAttach(UT_sint32 i)
00171 { m_iLeftAttach = i;}
00172 void setRightAttach(UT_sint32 i)
00173 { m_iRightAttach = i;}
00174 void setTopAttach(UT_sint32 i)
00175 { m_iTopAttach = i;}
00176 void setBottomAttach(UT_sint32 i)
00177 { m_iBottomAttach = i;}
00178 void setToAllocation(void);
00179 UT_sint32 getLeftPad(void) const
00180 { return m_iLeftPad;}
00181 UT_sint32 getRightPad(void) const
00182 { return m_iRightPad;}
00183 UT_sint32 getTopPad(void) const
00184 { return m_iTopPad;}
00185 UT_sint32 getBotPad(void) const
00186 { return m_iBotPad;}
00187 void setLeftPad(UT_sint32 i)
00188 { m_iLeftPad = i;}
00189 void setRightPad(UT_sint32 i)
00190 { m_iRightPad = i;}
00191 void setTopPad(UT_sint32 i)
00192 { m_iTopPad = i;}
00193 void setBotPad(UT_sint32 i)
00194 { m_iBotPad = i;}
00195
00196 PP_PropertyMap::Background getBackground () const;
00197
00198 void setBackground (const PP_PropertyMap::Background & style);
00199
00200
00201 PP_PropertyMap::Line getBottomStyle (const fl_TableLayout * table) const;
00202 PP_PropertyMap::Line getLeftStyle (const fl_TableLayout * table) const;
00203 PP_PropertyMap::Line getRightStyle (const fl_TableLayout * table) const;
00204 PP_PropertyMap::Line getTopStyle (const fl_TableLayout * table) const;
00205
00206 void setBottomStyle (const PP_PropertyMap::Line & style) { m_lineBottom = style; }
00207 void setLeftStyle (const PP_PropertyMap::Line & style) { m_lineLeft = style; }
00208 void setRightStyle (const PP_PropertyMap::Line & style) { m_lineRight = style; }
00209 void setTopStyle (const PP_PropertyMap::Line & style) { m_lineTop = style; }
00210
00211 bool getXexpand(void) const
00212 { return m_bXexpand;}
00213 bool getYexpand(void) const
00214 { return m_bYexpand;}
00215 bool getXshrink(void) const
00216 { return m_bXshrink;}
00217 bool getYshrink(void) const
00218 { return m_bYshrink;}
00219 void setXexpand(bool b)
00220 { m_bXexpand = b;}
00221 void setYexpand(bool b)
00222 { m_bYexpand = b;}
00223 void setXshrink(bool b)
00224 { m_bXshrink = b;}
00225 void setYshrink(bool b)
00226 { m_bYshrink = b;}
00227 bool getXfill(void) const
00228 {return m_bXfill;}
00229 bool getYfill(void)const
00230 {return m_bYfill;}
00231 void setXfill(bool b)
00232 { m_bXfill = b;}
00233 void setYfill(bool b)
00234 { m_bYfill = b;}
00235 UT_sint32 getStartY(void) const
00236 { return m_iTopY;}
00237 UT_sint32 getStopY(void) const
00238 { return m_iBotY;}
00239 UT_sint32 getLeftPos(void) const
00240 { return m_iLeft; }
00241 UT_sint32 getRightPos(void) const
00242 { return m_iRight; }
00243 void markAsDirty(void) { m_bDirty = true;}
00244 bool isDirty(void) const
00245 { return m_bDirty;}
00246 bool doesIntersectClip(fp_TableContainer * pBroke, const UT_Rect * rClip);
00247 bool isInNestedTable(void) const;
00248 bool containsNestedTables(void);
00249 bool isRepeated(void) const;
00250 void setVertAlign(UT_sint32 i) { m_iVertAlign = i; }
00251 void doVertAlign(void);
00252 #ifdef FMT_TEST
00253 void __dump(FILE * fp) const;
00254 #endif
00255
00256 private:
00257
00258 void _clear(fp_TableContainer * pBroke);
00259 void _getBrokenRect(fp_TableContainer * pBroke, fp_Page* &pPage, UT_Rect &bRec, GR_Graphics * pG);
00260
00261
00262
00263
00264
00265
00266
00267 UT_sint32 m_iLeftAttach;
00268
00269
00270
00271 UT_sint32 m_iRightAttach;
00272
00273
00274
00275 UT_sint32 m_iTopAttach;
00276
00277
00278
00279 UT_sint32 m_iBottomAttach;
00280
00281
00282
00283 UT_RGBColor m_borderColorNone;
00284
00285
00286
00287
00288 UT_sint32 m_iLeftPad;
00289 UT_sint32 m_iRightPad;
00290 UT_sint32 m_iTopPad;
00291 UT_sint32 m_iBotPad;
00292
00293
00294
00295 fp_CellContainer * m_pNextInTable;
00296 fp_CellContainer * m_pPrevInTable;
00297
00298
00299
00300 bool m_bXexpand;
00301 bool m_bYexpand;
00302 bool m_bXshrink;
00303 bool m_bYshrink;
00304
00305
00306
00307 bool m_bXfill;
00308 bool m_bYfill;
00309
00310
00311
00312 fp_Allocation m_MyAllocation;
00313 fp_Requisition m_MyRequest;
00314
00315
00316
00317 UT_sint32 m_iLeft;
00318 UT_sint32 m_iRight;
00319 UT_sint32 m_iTopY;
00320 UT_sint32 m_iBotY;
00321 bool m_bDrawLeft;
00322 bool m_bDrawTop;
00323 bool m_bDrawBot;
00324 bool m_bDrawRight;
00325 bool m_bLinesDrawn;
00326
00327
00328 bool m_bBgDirty;
00329
00330
00331 PP_PropertyMap::Background m_background;
00332
00333
00334 PP_PropertyMap::Line m_lineBottom;
00335 PP_PropertyMap::Line m_lineLeft;
00336 PP_PropertyMap::Line m_lineRight;
00337 PP_PropertyMap::Line m_lineTop;
00338
00339
00340 bool m_bIsSelected;
00341 bool m_bDirty;
00342
00343 bool m_bIsRepeated;
00344
00345
00346
00347 UT_sint32 m_iVertAlign;
00348 };
00349
00350 class ABI_EXPORT fp_TableContainer : public fp_VerticalContainer
00351 {
00352 public:
00353 fp_TableContainer(fl_SectionLayout* pSectionLayout);
00354 fp_TableContainer(fl_SectionLayout* pSectionLayout, fp_TableContainer * pMaster);
00355 ~fp_TableContainer();
00356
00357 void sizeRequest(fp_Requisition * pRequest);
00358 void sizeAllocate(fp_Allocation * pAllocate);
00359 virtual void mapXYToPosition(UT_sint32 x, UT_sint32 y,
00360 PT_DocPosition& pos,
00361 bool& bBOL, bool& bEOL, bool &isTOC);
00362 virtual fp_Page * getPage(void);
00363 fp_Line * getFirstLineInColumn(fp_Column * pCol);
00364 fp_Line * getLastLineInColumn(fp_Column * pCol);
00365 void layout(void);
00366 virtual void setY(UT_sint32 iY);
00367 virtual UT_sint32 getHeight(void) const;
00368 virtual void setHeight(UT_sint32 iHeight);
00369 virtual void setContainer(fp_Container * pContainer);
00370 virtual void draw(dg_DrawArgs*);
00371 virtual void draw(GR_Graphics*) {}
00372 virtual UT_sint32 getMarginBefore(void) const;
00373 virtual UT_sint32 getMarginAfter(void) const;
00374 void setAdditionalMargin(UT_sint32 iMarg)
00375 {m_iAdditionalMarginAfter = iMarg;}
00376 fp_Column * getBrokenColumn(void);
00377 void drawLines();
00378 bool containsFootnoteReference(void);
00379 bool getFootnoteContainers(UT_GenericVector<fp_FootnoteContainer*>* pvecFoots);
00380 bool containsAnnotations(void);
00381 bool getAnnotationContainers(UT_GenericVector<fp_AnnotationContainer*>* pvecAnns);
00382 UT_sint32 tweakBrokenTable(fp_TableContainer * pBroke);
00383 virtual void clearScreen(void);
00384 virtual bool isVBreakable(void);
00385 virtual bool isHBreakable(void) {return false;}
00386 virtual UT_sint32 wantVBreakAt(UT_sint32);
00387 virtual UT_sint32 wantHBreakAt(UT_sint32) {return 0;}
00388 virtual fp_ContainerObject * VBreakAt(UT_sint32);
00389 void breakCellsAt(UT_sint32 vpos);
00390 virtual fp_ContainerObject * HBreakAt(UT_sint32) {return NULL;}
00391 UT_sint32 getBrokenNumber(void);
00392 void setToAllocation(void);
00393 void tableAttach(fp_CellContainer * pCell);
00394 void setHomogeneous (bool bIsHomogeneous);
00395 void setColSpacings (UT_sint32 spacing);
00396 void setRowSpacings ( UT_sint32 spacing);
00397 void setColSpacing(UT_sint32 column,UT_sint32 spacing);
00398 void setRowSpacing (UT_sint32 row, UT_sint32 spacing);
00399 void resize(UT_sint32 n_rows, UT_sint32 n_cols);
00400 void setBorderWidth(UT_sint32 i);
00401 UT_sint32 getBorderWidth(void) const
00402 { return m_iBorderWidth;}
00403 void setLeftOffset(UT_sint32 iLeftOff)
00404 { m_iLeftOffset = iLeftOff;}
00405 void setRightOffset(UT_sint32 iRightOff)
00406 { m_iRightOffset = iRightOff;}
00407 void setTopOffset(UT_sint32 iTopOff)
00408 { m_iTopOffset = iTopOff;}
00409 void setBottomOffset(UT_sint32 iBotOff)
00410 { m_iBottomOffset = iBotOff;}
00411 void setLineThickness(UT_sint32 iLineThickness)
00412 { m_iLineThickness = iLineThickness;}
00413 UT_sint32 getLineThickness(void)
00414 { return m_iLineThickness;}
00415 void queueResize(void);
00416 UT_sint32 getYOfRow(UT_sint32 row);
00417 fp_CellContainer * getCellAtRowColumn(UT_sint32 row, UT_sint32 column);
00418 fp_CellContainer * getCellAtRowColumnLinear(UT_sint32 row, UT_sint32 column);
00419 virtual fp_Container * getNextContainerInSection(void) const;
00420 virtual fp_Container * getPrevContainerInSection(void) const;
00421 fp_TableContainer * getMasterTable(void) const
00422 { return m_pMasterTable; }
00423 bool isThisBroken(void) const;
00424 void setYBreakHere(UT_sint32 iBreakHere);
00425 void setYBottom(UT_sint32 iBotContainer);
00426 bool isInBrokenTable(const fp_CellContainer * pCell,
00427 fp_Container * pCon) const;
00428
00429
00430
00431
00432
00433 UT_sint32 getYBreak(void) const
00434 {return m_iYBreakHere;}
00435
00436
00437
00438 UT_sint32 getYBottom(void) const
00439 {return m_iYBottom;}
00440 fp_TableContainer * getFirstBrokenTable(void) const;
00441 fp_TableContainer * getLastBrokenTable(void) const;
00442 void setFirstBrokenTable(fp_TableContainer * pBroke);
00443 void setLastBrokenTable(fp_TableContainer * pBroke);
00444 void deleteBrokenTables(bool bClearFirst, bool bRecurseUp = true);
00445 void adjustBrokenTables(void);
00446 UT_sint32 getBrokenTop(void);
00447 UT_sint32 getBrokenBot(void);
00448 void setBrokenTop(UT_sint32 iTop)
00449 { m_iBrokenTop = iTop;}
00450 void setBrokenBot(UT_sint32 iBot)
00451 { m_iBrokenBottom = iBot;}
00452 UT_sint32 getNumRows(void) const;
00453 UT_sint32 getNumCols(void) const;
00454 UT_sint32 getRowHeight(UT_sint32 iRow, UT_sint32 iMeasHeight);
00455 void setRedrawLines(void)
00456 { m_bRedrawLines = true;}
00457 bool doRedrawLines(void) const
00458 { return m_bRedrawLines;}
00459 fp_TableRowColumn * getNthCol(UT_sint32 i);
00460 fp_TableRowColumn * getNthRow(UT_sint32 i);
00461 bool containsNestedTables(void);
00462 void setRowHeightType(FL_RowHeightType iType)
00463 {
00464 m_iRowHeightType = iType;
00465 }
00466 void setRowHeight(UT_sint32 iHeight)
00467 {
00468 m_iRowHeight = iHeight;
00469 }
00470 void setLastWantedVBreak(UT_sint32 iBreakAt)
00471 {
00472 m_iLastWantedVBreak = iBreakAt;
00473 }
00474 UT_sint32 getLastWantedVBreak(void) const
00475 {
00476 return m_iLastWantedVBreak;
00477 }
00478 #ifdef FMT_TEST
00479 void __dump(FILE * fp) const;
00480 #endif
00481 private:
00482 void _size_request_init(void);
00483 void _size_request_pass1(void);
00484 void _size_request_pass2(void);
00485 void _size_request_pass3(void);
00486
00487 void _size_allocate_init(void);
00488 void _size_allocate_pass1(void);
00489 void _size_allocate_pass2(void);
00490 UT_uint32 _getBottomOfLastContainer(void) const;
00491 void _drawBoundaries(dg_DrawArgs* pDA);
00492 void _drawBrokenBoundaries(dg_DrawArgs* pDA);
00493 void _brokenDraw(dg_DrawArgs* pDA);
00494
00495 UT_sint32 m_iRows;
00496 UT_sint32 m_iCols;
00497 UT_sint32 m_iBorderWidth;
00498 bool m_bIsHomogeneous;
00499
00500 UT_GenericVector<fp_TableRowColumn *> m_vecRows;
00501 UT_GenericVector<fp_TableRowColumn *> m_vecColumns;
00502
00503
00504
00505 fp_Allocation m_MyAllocation;
00506 fp_Requisition m_MyRequest;
00507
00508 UT_sint32 m_iRowSpacing;
00509 UT_sint32 m_iColSpacing;
00510
00511
00512
00513 fp_TableContainer * m_pFirstBrokenTable;
00514 fp_TableContainer * m_pLastBrokenTable;
00515 bool m_bIsBroken;
00516 fp_TableContainer * m_pMasterTable;
00517 UT_sint32 m_iYBreakHere;
00518 UT_sint32 m_iYBottom;
00519 UT_sint32 m_iBrokenTop;
00520 UT_sint32 m_iBrokenBottom;
00521 bool m_bRedrawLines;
00522
00523
00524
00525 UT_sint32 m_iRepeatedRowNumber;
00526 UT_sint32 m_iRepeatedRowHeight;
00527
00528
00529
00530 UT_sint32 m_iLeftOffset;
00531 UT_sint32 m_iRightOffset;
00532 UT_sint32 m_iTopOffset;
00533 UT_sint32 m_iBottomOffset;
00534 UT_sint32 m_iLineThickness;
00535
00536
00537 FL_RowHeightType m_iRowHeightType;
00538
00539
00540 UT_sint32 m_iRowHeight;
00541
00542
00543
00544 UT_sint32 m_iLastWantedVBreak;
00545
00546
00547
00548 fp_CellContainer * m_pFirstBrokenCell;
00549 fp_CellContainer * m_pLastBrokenCell;
00550 bool m_bRecursiveClear;
00551 UT_sint32 m_iAdditionalMarginAfter;
00552 };
00553
00554 #endif