#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) |
Use this class if you have to include data into your PDF as an table.
typedef PdfPage*(* PoDoFo::PdfTable::CreatePageCallback)(PdfRect &rClipRect, void *pCustom) |
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. |
void PoDoFo::PdfTable::CalculateTableSize | ( | const double | dX, | |
const double | dY, | |||
const PdfCanvas * | pCanvas, | |||
double * | pdWidths, | |||
double * | pdHeights, | |||
double * | pdWidth, | |||
double * | pdHeight | |||
) | const [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 |
bool PoDoFo::PdfTable::CheckForNewPage | ( | double * | pdY, | |
double * | pdCurY, | |||
double | dRowHeight, | |||
PdfPainter * | pPainter | |||
) | [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 |
void PoDoFo::PdfTable::Draw | ( | double | dX, | |
double | dY, | |||
PdfPainter * | pPainter, | |||
const PdfRect & | rClipRect = PdfRect() , |
|||
double * | pdLastX = NULL , |
|||
double * | pdLastY = NULL | |||
) | [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) |
void PoDoFo::PdfTable::DrawHorizontalBorders | ( | int | nRow, | |
double | dX, | |||
double | dY, | |||
PdfPainter * | pPainter, | |||
double * | pdColWidths | |||
) | [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 | |
pdColWidth | an array containing all colomun widths |
bool PoDoFo::PdfTable::GetAutoPageBreak | ( | ) | const [inline] |
int PoDoFo::PdfTable::GetCols | ( | ) | const [inline] |
double PoDoFo::PdfTable::GetHeight | ( | double | dX, | |
double | dY, | |||
PdfCanvas * | pPage | |||
) | const [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 |
const PdfTableModel * PoDoFo::PdfTable::GetModel | ( | ) | const [inline] |
int PoDoFo::PdfTable::GetRows | ( | ) | const [inline] |
double PoDoFo::PdfTable::GetWidth | ( | double | dX, | |
double | dY, | |||
PdfCanvas * | pPage | |||
) | const [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 |
void PoDoFo::PdfTable::SetAutoPageBreak | ( | bool | bPageBreak, | |
CreatePageCallback | callback, | |||
void * | pCustomData = NULL | |||
) | [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 |
void PoDoFo::PdfTable::SetColumnWidth | ( | double | dWidth | ) | [inline] |
Set all columns to have the same width.
dWidth | the width of every column |
void PoDoFo::PdfTable::SetColumnWidths | ( | double * | pdWidths | ) |
void PoDoFo::PdfTable::SetModel | ( | PdfTableModel * | pModel | ) | [inline] |
Set the PdfTableModel that will supply all contents and formatting informations to the table.
pModel | a PdfTableModel |
void PoDoFo::PdfTable::SetRowHeight | ( | double | dHeight | ) | [inline] |
Set all rows to have the same height.
dHeight | the height of every row |
void PoDoFo::PdfTable::SetRowHeights | ( | double * | pdHeights | ) |
void PoDoFo::PdfTable::SetTableHeight | ( | double | dHeight | ) | [inline] |
Set the height of the table.
dHeight | the height of the whole table. |
void PoDoFo::PdfTable::SetTableWidth | ( | double | dWidth | ) | [inline] |
Set the width of the table.
dWidth | the width of the whole table. |