blob: 71bc2e0b3ff0982b1781d99a1c965f2ffc166d2d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/***************************************************************************
* *
* copyright (C) 2003 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
#ifndef PRINTTEXT_H
#define PRINTTEXT_H
#include <kprinter.h>
#include <qpainter.h>
#include <q3paintdevicemetrics.h>
#include <qrect.h>
#include <qpoint.h>
/** prints text "raw" to a printer */
class PrintText : public KPrinter
{
public:
PrintText();
~PrintText();
/** begin printing. Call this before drawing to the device! */
void beginPrint();
/** prints a line */
void printLine(QString t);
/** returns a pointer to the paint object */
QPainter* getPaint()
{ return paint; }
/** sets the header-text */
void setHeader(const QString &left, const QString &middle);
/** returns the header-text */
void getHeader(QString *left, QString *middle);
protected:
/** painter object */
QPainter *paint;
/** metrics */
Q3PaintDeviceMetrics *metrics;
/** left field of header */
QString headerLeft;
/** middle field of header */
QString headerMiddle;
/** right field of header */
QString headerRight;
/** current Y-Position */
int curYPos;
/** text-body rectangle */
QRect body;
/** line-spacing */
int ls;
/** top-left point for beginning printing */
QPoint topLeft;
/** current page number */
int page;
protected:
/** prints the header on the page */
void printHeader();
};
#endif
|