PoDoFo
0.9.6
|
#include <PdfTable.h>
Public Types | |
typedef PdfPage *(* | CreatePageCallback) (PdfRect &rClipRect, void *pCustom) |
Public Member Functions | |
PdfTable (int nCols, int nRows) | |
virtual void | Draw (double dX, double dY, PdfPainter *pPainter, const PdfRect &rClipRect=PdfRect(), double *pdLastX=NULL, double *pdLastY=NULL) |
virtual double | GetWidth (double dX, double dY, PdfCanvas *pPage) const |
virtual double | GetHeight (double dX, double dY, PdfCanvas *pPage) const |
void | SetModel (PdfTableModel *pModel) |
const PdfTableModel * | GetModel () const |
void | SetColumnWidths (double *pdWidths) |
void | SetRowHeights (double *pdHeights) |
void | SetColumnWidth (double dWidth) |
void | SetRowHeight (double dHeight) |
void | SetTableWidth (double dWidth) |
void | SetTableHeight (double dHeight) |
void | SetAutoPageBreak (bool bPageBreak, CreatePageCallback callback, void *pCustomData=NULL) |
bool | GetAutoPageBreak () const |
int | GetCols () const |
int | GetRows () const |
Protected Member Functions | |
void | CalculateTableSize (const double dX, const double dY, const PdfCanvas *pCanvas, double *pdWidths, double *pdHeights, double *pdWidth, double *pdHeight) const |
void | DrawHorizontalBorders (int nRow, double dX, double dY, PdfPainter *pPainter, double *pdColWidths) |
bool | CheckForNewPage (double *pdY, double *pdCurY, double dRowHeight, PdfPainter *pPainter) |
This is a high level class of a table which can be drawn to a PdfPainter.
Use this class if you have to include data into your PDF as an table.
Callback to create a new page for PdfTable.
rClipRect | this is an output parameter which has to be set to the clipping rectangle of the new page. If the new page has no clipping rectangle set it to PdfRect( 0, 0, PdfPage::GetPageSize().GetWidth(), PdfPage::GetPageSize().GetHeight() ) |
pCustom | pointer to user defined data |
PoDoFo::PdfTable::PdfTable | ( | int | nCols, |
int | nRows | ||
) |
Create a new PdfTable object.
nCols | number of columns in the table. |
nRows | number of rows in the table. |
|
protected |
Internal functions that calculates the total table size for a table with the current settings when drawn on a certain page.
dX | the X coordinate of top left at which is drawn |
dY | the Y coordinate of top left at which is drawn |
pCanvas | the canvas object (usually a page) on which the table will be drawn. |
pdWidths | pointer to an array with GetCols() doubles where the width for each column will be stored |
pdHeights | pointer to an array with GetRows() doublesd where the height for each row will be stored |
pdWidth | pointer to a double where the total width of the table will be stored |
pdHeight | pointer to a double where the total height of the table will be stored |
|
protected |
Checks if there is enough space on the current page for one row! If necessary a new page is created.
If GetAutoPageBreak is false, this method does nothing.
pdY | top of the table |
pdCurY | pointer to the current y position on the page. Might be reset to a new y position. |
dRowHeight | height of the next row. |
pPainter | painter used for drawing |
|
virtual |
Draw the table with its current settings on a PdfPainter.
dX | x coordinate of top left of the table |
dY | y coordinate of top left of the table |
pPainter | the painter to draw on. The painter has to have a page set currently. |
rClipRect | the clipping rectangle on the current page |
pdLastX | the last used X position by the table on the current page will be written to this value (usually bottom right) |
pdLastY | the last used Y positon by the table on the current page will be written to this value (usually bottom right) |
|
protected |
Draw one row of horizontal cell borders using the correct color for each cell.
nRow | the current row |
dX | left x coordinate |
dY | y coordinate |
pPainter | use this painter object |
pdColWidths | an array containing all colomun widths |
|
inline |
|
inline |
|
virtual |
Get the width of the table when drawn with the current settings at a certain position.
dX | x coordinate of top left of the table |
dY | y coordinate of top left of the table |
pPage | the page on which the table will be drawn |
|
inline |
Get the current PdfTableModel
|
inline |
|
virtual |
Get the width of the table when drawn with the current settings at a certain position.
dX | x coordinate of top left of the table |
dY | y coordinate of top left of the table |
pPage | the page on which the table will be drawn |
|
inline |
Automatically create a new page and continue drawing the table on the new page, if there is not enough space on the current page.
The newly created page will be set as the current page on the painter used to draw and will be created using the same size as the old page.
bPageBreak | if true automatically create new pages if required. |
callback | a callback function that is called to create a new page. Please note: PdfTable cannot create new pages on its own. You always have to implement a callback which does the new page creation for the PdfTable. |
pCustomData | custom data that is passed to the callback |
By default this feature is turned off and contents are clipped that do not fit on the current page.
|
inline |
Set all columns to have the same width.
dWidth | the width of every column |
By default the column with is calculated automatically from either the table width or if no table width is set from the width of the page on which the table is drawn.
void PoDoFo::PdfTable::SetColumnWidths | ( | double * | pdWidths | ) |
|
inline |
Set the PdfTableModel that will supply all contents and formatting informations to the table.
pModel | a PdfTableModel |
The model will not be owned by the PdfTable and has to be deleted by the caller.
|
inline |
Set all rows to have the same height.
dHeight | the height of every row |
By default the row height is calculated automatically from either the table height or if no table height is set from the height of the page on which the table is drawn.
void PoDoFo::PdfTable::SetRowHeights | ( | double * | pdHeights | ) |
|
inline |
Set the height of the table.
dHeight | the height of the whole table. |
This height is used if no row height is set to calculate the height of every row. If this height is not set, the height of the page on which this table is drawn is used.
|
inline |
Set the width of the table.
dWidth | the width of the whole table. |
This width is used if no column width is set to calculate the width of every column. If this width is not set, the width of the page on which this table is drawn is used.