Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qpdfwriter.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | - | |||||||
5 | - | |||||||
6 | - | |||||||
7 | class QPdfWriterPrivate : public QObjectPrivate | - | ||||||
8 | { | - | ||||||
9 | public: | - | ||||||
10 | QPdfWriterPrivate() | - | ||||||
11 | : QObjectPrivate() | - | ||||||
12 | { | - | ||||||
13 | engine = new QPdfEngine(); | - | ||||||
14 | output = 0; | - | ||||||
15 | } never executed: end of block | 0 | ||||||
16 | ~QPdfWriterPrivate() | - | ||||||
17 | { | - | ||||||
18 | delete engine; | - | ||||||
19 | delete output; | - | ||||||
20 | } never executed: end of block | 0 | ||||||
21 | - | |||||||
22 | QPdfEngine *engine; | - | ||||||
23 | QFile *output; | - | ||||||
24 | }; | - | ||||||
25 | - | |||||||
26 | class QPdfPagedPaintDevicePrivate : public QPagedPaintDevicePrivate | - | ||||||
27 | { | - | ||||||
28 | public: | - | ||||||
29 | QPdfPagedPaintDevicePrivate(QPdfWriterPrivate *d) | - | ||||||
30 | : QPagedPaintDevicePrivate(), pd(d) | - | ||||||
31 | {} never executed: end of block | 0 | ||||||
32 | - | |||||||
33 | virtual ~QPdfPagedPaintDevicePrivate() | - | ||||||
34 | {} | - | ||||||
35 | - | |||||||
36 | bool setPageLayout(const QPageLayout &newPageLayout) override | - | ||||||
37 | { | - | ||||||
38 | - | |||||||
39 | pd->engine->setPageLayout(newPageLayout); | - | ||||||
40 | - | |||||||
41 | m_pageLayout = pd->engine->pageLayout(); | - | ||||||
42 | return never executed: m_pageLayout.isEquivalentTo(newPageLayout);return m_pageLayout.isEquivalentTo(newPageLayout); never executed: return m_pageLayout.isEquivalentTo(newPageLayout); | 0 | ||||||
43 | } | - | ||||||
44 | - | |||||||
45 | bool setPageSize(const QPageSize &pageSize) override | - | ||||||
46 | { | - | ||||||
47 | - | |||||||
48 | pd->engine->setPageSize(pageSize); | - | ||||||
49 | - | |||||||
50 | m_pageLayout = pd->engine->pageLayout(); | - | ||||||
51 | return never executed: m_pageLayout.pageSize().isEquivalentTo(pageSize);return m_pageLayout.pageSize().isEquivalentTo(pageSize); never executed: return m_pageLayout.pageSize().isEquivalentTo(pageSize); | 0 | ||||||
52 | } | - | ||||||
53 | - | |||||||
54 | bool setPageOrientation(QPageLayout::Orientation orientation) override | - | ||||||
55 | { | - | ||||||
56 | - | |||||||
57 | pd->engine->setPageOrientation(orientation); | - | ||||||
58 | - | |||||||
59 | m_pageLayout = pd->engine->pageLayout(); | - | ||||||
60 | return never executed: m_pageLayout.orientation() == orientation;return m_pageLayout.orientation() == orientation; never executed: return m_pageLayout.orientation() == orientation; | 0 | ||||||
61 | } | - | ||||||
62 | - | |||||||
63 | bool setPageMargins(const QMarginsF &margins) override | - | ||||||
64 | { | - | ||||||
65 | return never executed: setPageMargins(margins, pageLayout().units());return setPageMargins(margins, pageLayout().units()); never executed: return setPageMargins(margins, pageLayout().units()); | 0 | ||||||
66 | } | - | ||||||
67 | - | |||||||
68 | bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units) override | - | ||||||
69 | { | - | ||||||
70 | - | |||||||
71 | pd->engine->setPageMargins(margins, units); | - | ||||||
72 | - | |||||||
73 | m_pageLayout = pd->engine->pageLayout(); | - | ||||||
74 | return never executed: m_pageLayout.margins() == margins && m_pageLayout.units() == units;return m_pageLayout.margins() == margins && m_pageLayout.units() == units; never executed: return m_pageLayout.margins() == margins && m_pageLayout.units() == units; | 0 | ||||||
75 | } | - | ||||||
76 | - | |||||||
77 | QPageLayout pageLayout() const override | - | ||||||
78 | { | - | ||||||
79 | return never executed: pd->engine->pageLayout();return pd->engine->pageLayout(); never executed: return pd->engine->pageLayout(); | 0 | ||||||
80 | } | - | ||||||
81 | - | |||||||
82 | QPdfWriterPrivate *pd; | - | ||||||
83 | }; | - | ||||||
84 | QPdfWriter::QPdfWriter(const QString &filename) | - | ||||||
85 | : QObject(*new QPdfWriterPrivate), | - | ||||||
86 | QPagedPaintDevice(new QPdfPagedPaintDevicePrivate(d_func())) | - | ||||||
87 | { | - | ||||||
88 | QPdfWriterPrivate * const d = d_func(); | - | ||||||
89 | - | |||||||
90 | d->engine->setOutputFilename(filename); | - | ||||||
91 | - | |||||||
92 | - | |||||||
93 | devicePageLayout() = d->engine->pageLayout(); | - | ||||||
94 | } never executed: end of block | 0 | ||||||
95 | - | |||||||
96 | - | |||||||
97 | - | |||||||
98 | - | |||||||
99 | QPdfWriter::QPdfWriter(QIODevice *device) | - | ||||||
100 | : QObject(*new QPdfWriterPrivate), | - | ||||||
101 | QPagedPaintDevice(new QPdfPagedPaintDevicePrivate(d_func())) | - | ||||||
102 | { | - | ||||||
103 | QPdfWriterPrivate * const d = d_func(); | - | ||||||
104 | - | |||||||
105 | d->engine->d_func()->outDevice = device; | - | ||||||
106 | - | |||||||
107 | - | |||||||
108 | devicePageLayout() = d->engine->pageLayout(); | - | ||||||
109 | } never executed: end of block | 0 | ||||||
110 | - | |||||||
111 | - | |||||||
112 | - | |||||||
113 | - | |||||||
114 | QPdfWriter::~QPdfWriter() | - | ||||||
115 | { | - | ||||||
116 | - | |||||||
117 | } | - | ||||||
118 | - | |||||||
119 | - | |||||||
120 | - | |||||||
121 | - | |||||||
122 | QString QPdfWriter::title() const | - | ||||||
123 | { | - | ||||||
124 | const QPdfWriterPrivate * const d = d_func(); | - | ||||||
125 | return never executed: d->engine->d_func()->title;return d->engine->d_func()->title; never executed: return d->engine->d_func()->title; | 0 | ||||||
126 | } | - | ||||||
127 | - | |||||||
128 | - | |||||||
129 | - | |||||||
130 | - | |||||||
131 | void QPdfWriter::setTitle(const QString &title) | - | ||||||
132 | { | - | ||||||
133 | QPdfWriterPrivate * const d = d_func(); | - | ||||||
134 | d->engine->d_func()->title = title; | - | ||||||
135 | } never executed: end of block | 0 | ||||||
136 | - | |||||||
137 | - | |||||||
138 | - | |||||||
139 | - | |||||||
140 | QString QPdfWriter::creator() const | - | ||||||
141 | { | - | ||||||
142 | const QPdfWriterPrivate * const d = d_func(); | - | ||||||
143 | return never executed: d->engine->d_func()->creator;return d->engine->d_func()->creator; never executed: return d->engine->d_func()->creator; | 0 | ||||||
144 | } | - | ||||||
145 | - | |||||||
146 | - | |||||||
147 | - | |||||||
148 | - | |||||||
149 | void QPdfWriter::setCreator(const QString &creator) | - | ||||||
150 | { | - | ||||||
151 | QPdfWriterPrivate * const d = d_func(); | - | ||||||
152 | d->engine->d_func()->creator = creator; | - | ||||||
153 | } never executed: end of block | 0 | ||||||
154 | - | |||||||
155 | - | |||||||
156 | - | |||||||
157 | - | |||||||
158 | QPaintEngine *QPdfWriter::paintEngine() const | - | ||||||
159 | { | - | ||||||
160 | const QPdfWriterPrivate * const d = d_func(); | - | ||||||
161 | - | |||||||
162 | return never executed: d->engine;return d->engine; never executed: return d->engine; | 0 | ||||||
163 | } | - | ||||||
164 | void QPdfWriter::setResolution(int resolution) | - | ||||||
165 | { | - | ||||||
166 | const QPdfWriterPrivate * const d = d_func(); | - | ||||||
167 | if (resolution > 0
| 0 | ||||||
168 | d->engine->setResolution(resolution); never executed: d->engine->setResolution(resolution); | 0 | ||||||
169 | } never executed: end of block | 0 | ||||||
170 | int QPdfWriter::resolution() const | - | ||||||
171 | { | - | ||||||
172 | const QPdfWriterPrivate * const d = d_func(); | - | ||||||
173 | return never executed: d->engine->resolution();return d->engine->resolution(); never executed: return d->engine->resolution(); | 0 | ||||||
174 | } | - | ||||||
175 | void QPdfWriter::setPageSize(PageSize size) | - | ||||||
176 | { | - | ||||||
177 | setPageSize(QPageSize(QPageSize::PageSizeId(size))); | - | ||||||
178 | } never executed: end of block | 0 | ||||||
179 | void QPdfWriter::setPageSizeMM(const QSizeF &size) | - | ||||||
180 | { | - | ||||||
181 | setPageSize(QPageSize(size, QPageSize::Millimeter)); | - | ||||||
182 | } never executed: end of block | 0 | ||||||
183 | - | |||||||
184 | - | |||||||
185 | - | |||||||
186 | - | |||||||
187 | - | |||||||
188 | - | |||||||
189 | int QPdfWriter::metric(PaintDeviceMetric id) const | - | ||||||
190 | { | - | ||||||
191 | const QPdfWriterPrivate * const d = d_func(); | - | ||||||
192 | return never executed: d->engine->metric(id);return d->engine->metric(id); never executed: return d->engine->metric(id); | 0 | ||||||
193 | } | - | ||||||
194 | - | |||||||
195 | - | |||||||
196 | - | |||||||
197 | - | |||||||
198 | bool QPdfWriter::newPage() | - | ||||||
199 | { | - | ||||||
200 | QPdfWriterPrivate * const d = d_func(); | - | ||||||
201 | - | |||||||
202 | return never executed: d->engine->newPage();return d->engine->newPage(); never executed: return d->engine->newPage(); | 0 | ||||||
203 | } | - | ||||||
204 | void QPdfWriter::setMargins(const Margins &m) | - | ||||||
205 | { | - | ||||||
206 | setPageMargins(QMarginsF(m.left, m.top, m.right, m.bottom), QPageLayout::Millimeter); | - | ||||||
207 | } never executed: end of block | 0 | ||||||
208 | - | |||||||
209 | - | |||||||
Switch to Source code | Preprocessed file |