gSAFE  1.3.8
printlib.h
1 /* gSAFE - LIB
2  general Sql dAtabase FrontEnd
3  http://hyperprog.com/gsafe/
4 
5  (C) 2005-2013 Peter Deak (hyper80@gmail.com)
6 
7  License: GPLv2 http://www.gnu.org/licenses/gpl-2.0.html
8 
9  printlib.h
10 */
11 
12 #ifndef GSAFE__PRINTOUT_LIB_HEADER__
13 #define GSAFE__PRINTOUT_LIB_HEADER__
14 
15 #include <QtCore>
16 #include <QtGui>
17 
18 #ifndef COMPILED_WITH_QT4X
19 #include <QtWidgets>
20 #include <QPrinter>
21 #include <QPrintDialog>
22 #endif
23 
25 /* @{ */
26 
27 class HBase;
28 class HTableBase;
29 class HPrintTable;
30 
34 class HPreviewFrame : public QFrame
35 {
36  Q_OBJECT
37 
38  private:
39  int dx,dy;
40  double scale;
41  HPrintTable *pt;
42  QPixmap *gr;
43 
44  public:
45  int panx,pany;
46 
47  public:
51  HPreviewFrame(HPrintTable *p,QWidget *parent);
53  ~HPreviewFrame(void);
54  void reset(void);
55 
56  protected:
57  void paintEvent(QPaintEvent *e);
58  void wheelEvent(QWheelEvent *e);
59  void keyPressEvent(QKeyEvent *e);
60 
61  void mousePressEvent(QMouseEvent *e);
62  void mouseReleaseEvent(QMouseEvent *e);
63  void mouseMoveEvent(QMouseEvent *e);
64  void resizeEvent(QResizeEvent *e);
65 
66  signals:
67  void scrollSignal(int x,int y);
68 
69 };
70 
95 class HPrintTable : public QDialog
96 {
97  Q_OBJECT
98 
99  protected:
100  int page; //page number (calculated)
101  int pagerun; //page number, during the drawing
102  int cellh; //cellheight
103  QList<int> cellw; //cellwidth by column
104  QList<int> cellrh; //cellheight by row
105  int rownum,column; //row/column number
106 
107  bool hide;
108 
109  HBase *data;
110  QVBoxLayout *layout;
111 
112  QLabel *pn;
113  HPreviewFrame *preview;
114  QScrollArea *scrollp;
115  QPrinter *printer;
116 
117  QFont printfont;
118 
119  public:
124  HPrintTable(QWidget *parent,HBase *d,QFont *pf = NULL);
125 
126  public slots:
127  void scanIt (void);
128  int drawIt (QPainter *p,double scale=1.0,bool print=false);
129  int updateDisplay(void);
130  int printIt (void);
131 
132  protected:
133  void scanList (void);
134  void scanTable(void);
135  void scanPlainDataMatrix(void);
136 
137  int drawList(QPainter *p,bool print=false);
138  int drawTable(QPainter *p,bool print=false);
139  int drawPlainDataMatrix(QPainter *p,bool print=false);
140  int newPage (QPainter *p,bool print=false);
141 
142  protected:
143  void resizeEvent(QResizeEvent *e);
144  void keyPressEvent(QKeyEvent *e);
145 
146  signals:
149  void updateDisplaySignal(void);
150 };
151 
152 /* @} */
153 
154 #endif
HPrintTable(QWidget *parent, HBase *d, QFont *pf=NULL)
HPtintTable //////////////////////////////////////////////////////////////.
Definition: printlib.cpp:196
HPreviewFrame(HPrintTable *p, QWidget *parent)
PreviewTable ///////////////////////////////////////////////////////////////.
Definition: printlib.cpp:41
void updateDisplaySignal(void)
Definition: datalib.h:312
~HPreviewFrame(void)
Definition: printlib.cpp:63