RTPDF-32
PDF Generator Library for RTOS-32
acTable.h
Go to the documentation of this file.
1
2// //
3// Amyuni RTPDF-32 - PDF Library for On Time RTOS-32 //
4// //
5// Copyright AMYUNI Lda. - AMYUNI Technologies //
6// 1998-2021, All Rights Reserved ***** CONFIDENTIAL ***** //
7// //
8// Permission to use this work for any purpose must be expressly obtained //
9// from: AMYUNI Technologies, https://www.amyuni.com, management@amyuni.com //
10// //
12//
13// acTable.h: interface for the acTable class.
14// The acTable class is the representation of the RTPDF-32 table class
15//
17
18#if !defined(ACTABLE_H_INCLUDED_)
19#define ACTABLE_H_INCLUDED_
20
21// forward declarations
22class acReportRow;
23class acReportCell;
24
26{
110
111public:
113 virtual ~acTable();
114
125 int InitTable(UINT nRows, UINT nColumns, const RECT& rcBoundRect);
126
135 acReportCell* GetCell(UINT nRow, UINT nCol, int bReturnMainCell = 1);
136
146 int MergeCells(UINT nLeft, UINT nTop, UINT nRight, UINT nBottom);
147
157 void GetCellsBoundRect(UINT nStartX, UINT nStartY, UINT nEndX, UINT nEndY, RECT& rc);
158
167 int SetColWidth(UINT nCol, UINT nWidth, int bMoveNext);
168
177 int SetRowHeight(UINT nRow, UINT nHeight, int bMoveNext);
178
179
185 void Draw(HANDLE pdev);
186
187private:
188 UINT rows; // row count
189 UINT columns; // col count
190 RECT boundRect; // posistion and size
191
192 UINT rowCount; // number of rows in this table
193 acReportRow* rowArray; // row array
194};
195
197{
198public:
199 typedef enum
200 {
208
209 typedef enum
210 {
211 Left = 1,
213 Right = 3,
214 } HorzAlign;
215
216 typedef enum
217 {
218 Top = 1,
221 } VertAlign;
222
223 typedef enum
224 {
228 } BorderStyles;
229
230 typedef enum
231 {
236 } VertBorders;
237
238 typedef enum
239 {
244 } HorzBorders;
245
246 typedef enum
247 {
255
261 void SetText(LPCSTR lpszText);
262
268 void SetTitleText(LPCSTR lpszTitle);
269
270public:
274 long margin;
275
287 HANDLE backBmp; // background bitmap
292 COLORREF backColor;
297 COLORREF textColor;
322 COLORREF borderColor;
339 COLORREF titleColor;
352
353private:
354 acReportCell(acReportRow* parent);
355 virtual ~acReportCell();
356
357 UINT x; // horizonal position
358 UINT width; // column (cell) width
359 UINT mainX; // main cell in case of merged cells
360 UINT mainY; // main cell in case of merged cells
361 long spanX; // number of cells merged X direction
362 long spanY; // number of cells merged Y direction
363 MergeDirection merge; // type of merging for merged cells
364 acReportRow *row;
365
366 LPTSTR text; // cell text content
367 LPTSTR titleText; // title text
368
369 // draw cell content
370 void Draw(LPPDFINFO pPdfDC);
371 // get bounding rect
372 void GetBoundRect(RECT& rc);
373
374 // return containing row
375 acReportRow *GetRow() { return row; }
376
377 friend class acReportRow;
378 friend class acTable;
379};
380
382{
383private:
384 // modify cell width
385 int SetColWidth(UINT col, UINT width, int moveNext);
386
387 // get number of columns
388 UINT GetColCount() { return colCount; }
389
390 UINT y; // vertical position
391 UINT height; // row height
392
393 UINT colCount; // number of columns in this row
394 acReportCell* cells; // cell array
395
396 acTable *GetTable() { return table; }
397 acTable *table;
398
399 acReportRow(acTable *table);
400 virtual ~acReportRow();
401
402 // draw all cells to PDF device context
403 void DrawAllCells(LPPDFINFO pPdfDC);
404
405 // initialize cell array
406 int InitCellArray(UINT nCellCount, UINT nRowWidth);
407
408 friend class acTable;
409 friend class acReportCell;
410
411};
413
414#endif // !defined(ACTABLE_H_INCLUDED_)
void * LPPDFINFO
Definition: RTPDF-32.h:21
void * HANDLE
Definition: RTPDF-32.h:22
Definition: acTable.h:197
int vertical
Definition: acTable.h:330
int clipToBoundaries
Definition: acTable.h:334
COLORREF backColor
Definition: acTable.h:292
VertBorders vertBorders
Definition: acTable.h:313
BorderStyles borderStyle
Definition: acTable.h:326
HorzAlign
Definition: acTable.h:210
@ Right
Definition: acTable.h:213
@ HCentered
Definition: acTable.h:212
@ Left
Definition: acTable.h:211
COLORREF borderColor
Definition: acTable.h:322
HANDLE backBmp
Definition: acTable.h:287
HANDLE font
Definition: acTable.h:279
VertBorders
Definition: acTable.h:231
@ acVertBorderLeft
Definition: acTable.h:233
@ acVertBorderBoth
Definition: acTable.h:235
@ acVertBorderRight
Definition: acTable.h:234
@ acVertBorderNone
Definition: acTable.h:232
long margin
Definition: acTable.h:274
HorzAlign horzAlign
Definition: acTable.h:301
CellTitlePositionConstants titlePosition
Definition: acTable.h:351
HANDLE titleFont
Definition: acTable.h:343
HorzBorders
Definition: acTable.h:239
@ acHorzBorderBottom
Definition: acTable.h:242
@ acHorzBorderTop
Definition: acTable.h:241
@ acHorzBorderBoth
Definition: acTable.h:243
@ acHorzBorderNone
Definition: acTable.h:240
HorzBorders horzBorders
Definition: acTable.h:309
COLORREF titleColor
Definition: acTable.h:339
float titlePointSize
Definition: acTable.h:347
MergeDirection
Definition: acTable.h:200
@ MERGE_RIGHT
Definition: acTable.h:203
@ MERGE_MAIN
Definition: acTable.h:206
@ MERGE_NONE
Definition: acTable.h:201
@ MERGE_TOP
Definition: acTable.h:204
@ MERGE_LEFT
Definition: acTable.h:202
@ MERGE_BOTTOM
Definition: acTable.h:205
int borderWidth
Definition: acTable.h:317
COLORREF textColor
Definition: acTable.h:297
CellTitlePositionConstants
Definition: acTable.h:247
@ acCellTitlePositionBottomLeft
Definition: acTable.h:251
@ acCellTitlePositionBottomRight
Definition: acTable.h:253
@ acCellTitlePositionTopLeft
Definition: acTable.h:248
@ acCellTitlePositionBottomCenter
Definition: acTable.h:252
@ acCellTitlePositionTopCenter
Definition: acTable.h:249
@ acCellTitlePositionTopRight
Definition: acTable.h:250
void SetTitleText(LPCSTR lpszTitle)
Set the cell's title.
VertAlign vertAlign
Definition: acTable.h:305
BorderStyles
Definition: acTable.h:224
@ acDashed
Definition: acTable.h:226
@ acDotted
Definition: acTable.h:227
@ acSolid
Definition: acTable.h:225
void SetText(LPCSTR lpszText)
Set the cell's main text content.
VertAlign
Definition: acTable.h:217
@ Bottom
Definition: acTable.h:220
@ VCentered
Definition: acTable.h:219
@ Top
Definition: acTable.h:218
float pointSize
Definition: acTable.h:283
Definition: acTable.h:382
Definition: acTable.h:26
int InitTable(UINT nRows, UINT nColumns, const RECT &rcBoundRect)
Initialize a table contains nRows and nColumns and position it on the page. The default row height is...
int SetRowHeight(UINT nRow, UINT nHeight, int bMoveNext)
Set the height of a specific row.
void Draw(HANDLE pdev)
Draw the table on the page. To be called after the table is fully constructed.
virtual ~acTable()
void GetCellsBoundRect(UINT nStartX, UINT nStartY, UINT nEndX, UINT nEndY, RECT &rc)
Get the bounding rectangle for a group of cells.
int MergeCells(UINT nLeft, UINT nTop, UINT nRight, UINT nBottom)
Merge a group of cells into a single cell.
int SetColWidth(UINT nCol, UINT nWidth, int bMoveNext)
Set the width of a specific column.
acReportCell * GetCell(UINT nRow, UINT nCol, int bReturnMainCell=1)
Get the Cell object from the cell coordinates.