author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Thu, 29 Apr 2010 15:15:16 +0300 | |
branch | RCL_3 |
changeset 16 | 4b6ee5efea19 |
parent 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the Qt Linguist of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef PRINTOUT_H |
|
43 |
#define PRINTOUT_H |
|
44 |
||
45 |
#include <QFont> |
|
46 |
#include <QPainter> |
|
47 |
#include <QRect> |
|
48 |
#include <QTextOption> |
|
49 |
#include <QList> |
|
50 |
#include <QDateTime> |
|
51 |
||
52 |
QT_BEGIN_NAMESPACE |
|
53 |
||
54 |
class QPrinter; |
|
55 |
class QFontMetrics; |
|
56 |
||
57 |
class PrintOut |
|
58 |
{ |
|
59 |
public: |
|
60 |
enum Rule { NoRule, ThinRule, ThickRule }; |
|
61 |
enum Style { Normal, Strong, Emphasis }; |
|
62 |
||
63 |
PrintOut(QPrinter *printer); |
|
64 |
~PrintOut(); |
|
65 |
||
66 |
void setRule(Rule rule); |
|
67 |
void setGuide(const QString &guide); |
|
68 |
void vskip(); |
|
69 |
void flushLine(bool mayBreak = false); |
|
70 |
void addBox(int percent, const QString &text = QString(), |
|
71 |
Style style = Normal, |
|
72 |
Qt::Alignment halign = Qt::AlignLeft); |
|
73 |
||
74 |
int pageNum() const { return page; } |
|
75 |
||
76 |
struct Box |
|
77 |
{ |
|
78 |
QRect rect; |
|
79 |
QString text; |
|
80 |
QFont font; |
|
81 |
QTextOption options; |
|
82 |
||
83 |
Box( const QRect& r, const QString& t, const QFont& f, const QTextOption &o ) |
|
84 |
: rect( r ), text( t ), font( f ), options( o ) { } |
|
85 |
}; |
|
86 |
||
87 |
private: |
|
88 |
void breakPage(bool init = false); |
|
89 |
void drawRule( Rule rule ); |
|
90 |
||
91 |
struct Paragraph { |
|
92 |
QRect rect; |
|
93 |
QList<Box> boxes; |
|
94 |
||
95 |
Paragraph() { } |
|
96 |
Paragraph( QPoint p ) : rect( p, QSize(0, 0) ) { } |
|
97 |
}; |
|
98 |
||
99 |
QPrinter *pr; |
|
100 |
QPainter p; |
|
101 |
QFont f8; |
|
102 |
QFont f10; |
|
103 |
QFontMetrics *fmetrics; |
|
104 |
Rule nextRule; |
|
105 |
Paragraph cp; |
|
106 |
int page; |
|
107 |
bool firstParagraph; |
|
108 |
QString g; |
|
109 |
QDateTime dateTime; |
|
110 |
||
111 |
int hmargin; |
|
112 |
int vmargin; |
|
113 |
int voffset; |
|
114 |
int hsize; |
|
115 |
int vsize; |
|
116 |
}; |
|
117 |
||
118 |
QT_END_NAMESPACE |
|
119 |
||
120 |
#endif |