painting/qpagedpaintdevice.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qpagedpaintdevice_p.h" -
43#include <qpagedpaintdevice.h> -
44 -
45QT_BEGIN_NAMESPACE -
46 -
47static const struct { -
48 float width; -
49 float height; -
50} pageSizes[] = { -
51 {210, 297}, // A4 -
52 {176, 250}, // B5 -
53 {215.9f, 279.4f}, // Letter -
54 {215.9f, 355.6f}, // Legal -
55 {190.5f, 254}, // Executive -
56 {841, 1189}, // A0 -
57 {594, 841}, // A1 -
58 {420, 594}, // A2 -
59 {297, 420}, // A3 -
60 {148, 210}, // A5 -
61 {105, 148}, // A6 -
62 {74, 105}, // A7 -
63 {52, 74}, // A8 -
64 {37, 52}, // A8 -
65 {1000, 1414}, // B0 -
66 {707, 1000}, // B1 -
67 {31, 44}, // B10 -
68 {500, 707}, // B2 -
69 {353, 500}, // B3 -
70 {250, 353}, // B4 -
71 {125, 176}, // B6 -
72 {88, 125}, // B7 -
73 {62, 88}, // B8 -
74 {33, 62}, // B9 -
75 {163, 229}, // C5E -
76 {105, 241}, // US Common -
77 {110, 220}, // DLE -
78 {210, 330}, // Folio -
79 {431.8f, 279.4f}, // Ledger -
80 {279.4f, 431.8f} // Tabloid -
81}; -
82 -
83/*! -
84 \class QPagedPaintDevice -
85 \inmodule QtGui -
86 -
87 \brief The QPagedPaintDevice class is a represents a paintdevice that supports -
88 multiple pages. -
89 -
90 \ingroup painting -
91 -
92 Paged paint devices are used to generate output for printing or for formats like PDF. -
93 QPdfWriter and QPrinter inherit from it. -
94 */ -
95 -
96/*! -
97 Constructs a new paged paint device. -
98 */ -
99QPagedPaintDevice::QPagedPaintDevice() -
100 : d(new QPagedPaintDevicePrivate) -
101{ -
102}
executed: }
Execution Count:83
83
103 -
104/*! -
105 Destroys the object. -
106 */ -
107QPagedPaintDevice::~QPagedPaintDevice() -
108{ -
109 delete d;
executed (the execution status of this line is deduced): delete d;
-
110}
executed: }
Execution Count:83
83
111 -
112/*! -
113 \enum QPagedPaintDevice::PageSize -
114 -
115 This enum type specifies the page size of the paint device. -
116 -
117 \value A0 841 x 1189 mm -
118 \value A1 594 x 841 mm -
119 \value A2 420 x 594 mm -
120 \value A3 297 x 420 mm -
121 \value A4 210 x 297 mm, 8.26 x 11.69 inches -
122 \value A5 148 x 210 mm -
123 \value A6 105 x 148 mm -
124 \value A7 74 x 105 mm -
125 \value A8 52 x 74 mm -
126 \value A9 37 x 52 mm -
127 \value B0 1000 x 1414 mm -
128 \value B1 707 x 1000 mm -
129 \value B2 500 x 707 mm -
130 \value B3 353 x 500 mm -
131 \value B4 250 x 353 mm -
132 \value B5 176 x 250 mm, 6.93 x 9.84 inches -
133 \value B6 125 x 176 mm -
134 \value B7 88 x 125 mm -
135 \value B8 62 x 88 mm -
136 \value B9 33 x 62 mm -
137 \value B10 31 x 44 mm -
138 \value C5E 163 x 229 mm -
139 \value Comm10E 105 x 241 mm, U.S. Common 10 Envelope -
140 \value DLE 110 x 220 mm -
141 \value Executive 7.5 x 10 inches, 190.5 x 254 mm -
142 \value Folio 210 x 330 mm -
143 \value Ledger 431.8 x 279.4 mm -
144 \value Legal 8.5 x 14 inches, 215.9 x 355.6 mm -
145 \value Letter 8.5 x 11 inches, 215.9 x 279.4 mm -
146 \value Tabloid 279.4 x 431.8 mm -
147 \value Custom Unknown, or a user defined size. -
148 -
149 \omitvalue NPageSize -
150 -
151 The page size can also be specified in millimeters using setPageSizeMM(). In this case the -
152 page size enum is set to Custom. -
153*/ -
154 -
155/*! -
156 \fn bool QPagedPaintDevice::newPage() -
157 -
158 Starts a new page. Returns \c true on success. -
159*/ -
160 -
161 -
162/*! -
163 Sets the size of the a page to \a size. -
164 -
165 \sa setPageSizeMM -
166 */ -
167void QPagedPaintDevice::setPageSize(PageSize size) -
168{ -
169 if (size >= Custom)
partially evaluated: size >= Custom
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:30
0-30
170 return;
never executed: return;
0
171 d->pageSize = size;
executed (the execution status of this line is deduced): d->pageSize = size;
-
172 d->pageSizeMM = QSizeF(pageSizes[A4].width, pageSizes[A4].height);
executed (the execution status of this line is deduced): d->pageSizeMM = QSizeF(pageSizes[A4].width, pageSizes[A4].height);
-
173}
executed: }
Execution Count:30
30
174 -
175/*! -
176 Returns the currently used page size. -
177 */ -
178QPagedPaintDevice::PageSize QPagedPaintDevice::pageSize() const -
179{ -
180 return d->pageSize;
never executed: return d->pageSize;
0
181} -
182 -
183/*! -
184 Sets the page size to \a size. \a size is specified in millimeters. -
185 */ -
186void QPagedPaintDevice::setPageSizeMM(const QSizeF &size) -
187{ -
188 d->pageSize = Custom;
executed (the execution status of this line is deduced): d->pageSize = Custom;
-
189 d->pageSizeMM = size;
executed (the execution status of this line is deduced): d->pageSizeMM = size;
-
190}
executed: }
Execution Count:7
7
191 -
192/*! -
193 Returns the page size in millimeters. -
194 */ -
195QSizeF QPagedPaintDevice::pageSizeMM() const -
196{ -
197 return d->pageSizeMM;
never executed: return d->pageSizeMM;
0
198} -
199 -
200/*! -
201 Sets the margins to be used to \a margins. -
202 -
203 Margins are specified in millimeters. -
204 -
205 The margins are purely a hint to the drawing method. They don't affect the -
206 coordinate system or clipping. -
207 -
208 \sa margins -
209 */ -
210void QPagedPaintDevice::setMargins(const Margins &margins) -
211{ -
212 d->margins = margins;
executed (the execution status of this line is deduced): d->margins = margins;
-
213}
executed: }
Execution Count:10
10
214 -
215/*! -
216 returns the current margins of the paint device. The default is 0. -
217 -
218 \sa setMargins -
219 */ -
220QPagedPaintDevice::Margins QPagedPaintDevice::margins() const -
221{ -
222 return d->margins;
never executed: return d->margins;
0
223} -
224 -
225QT_END_NAMESPACE -
226 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial