qplatformprintdevice.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/printsupport/kernel/qplatformprintdevice.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8QPlatformPrintDevice::QPlatformPrintDevice()-
9 : m_isRemote(false),-
10 m_supportsMultipleCopies(false),-
11 m_supportsCollateCopies(false),-
12 m_havePageSizes(false),-
13 m_supportsCustomPageSizes(false),-
14 m_haveResolutions(false),-
15 m_haveInputSlots(false),-
16 m_haveOutputBins(false),-
17 m_haveDuplexModes(false),-
18 m_haveColorModes(false)-
19-
20 , m_haveMimeTypes(false)-
21-
22{-
23}-
24-
25QPlatformPrintDevice::QPlatformPrintDevice(const QString &id)-
26 : m_id(id),-
27 m_isRemote(false),-
28 m_supportsMultipleCopies(false),-
29 m_supportsCollateCopies(false),-
30 m_havePageSizes(false),-
31 m_supportsCustomPageSizes(false),-
32 m_haveResolutions(false),-
33 m_haveInputSlots(false),-
34 m_haveOutputBins(false),-
35 m_haveDuplexModes(false),-
36 m_haveColorModes(false)-
37-
38 , m_haveMimeTypes(false)-
39-
40{-
41}-
42-
43QPlatformPrintDevice::~QPlatformPrintDevice()-
44{-
45}-
46-
47QString QPlatformPrintDevice::id() const-
48{-
49 return m_id;-
50}-
51-
52QString QPlatformPrintDevice::name() const-
53{-
54 return m_name;-
55}-
56-
57QString QPlatformPrintDevice::location() const-
58{-
59 return m_location;-
60}-
61-
62QString QPlatformPrintDevice::makeAndModel() const-
63{-
64 return m_makeAndModel;-
65}-
66-
67bool QPlatformPrintDevice::isValid() const-
68{-
69 return false;-
70}-
71-
72bool QPlatformPrintDevice::isDefault() const-
73{-
74 return false;-
75}-
76-
77bool QPlatformPrintDevice::isRemote() const-
78{-
79 return m_isRemote;-
80}-
81-
82bool QPlatformPrintDevice::isValidPageLayout(const QPageLayout &layout, int resolution) const-
83{-
84-
85 if (!supportedPageSize(layout.pageSize()).isValid())-
86 return false;-
87-
88-
89 QMarginsF pointMargins = layout.margins(QPageLayout::Point);-
90 QMarginsF printMargins = printableMargins(layout.pageSize(), layout.orientation(), resolution);-
91 return pointMargins.left() >= printMargins.left()-
92 && pointMargins.right() >= printMargins.right()-
93 && pointMargins.top() >= printMargins.top()-
94 && pointMargins.bottom() >= printMargins.bottom();-
95}-
96-
97QPrint::DeviceState QPlatformPrintDevice::state() const-
98{-
99 return QPrint::Error;-
100}-
101-
102bool QPlatformPrintDevice::supportsMultipleCopies() const-
103{-
104 return m_supportsMultipleCopies;-
105}-
106-
107bool QPlatformPrintDevice::supportsCollateCopies() const-
108{-
109 return m_supportsCollateCopies;-
110}-
111-
112void QPlatformPrintDevice::loadPageSizes() const-
113{-
114}-
115-
116QPageSize QPlatformPrintDevice::defaultPageSize() const-
117{-
118 return QPageSize();-
119}-
120-
121QList<QPageSize> QPlatformPrintDevice::supportedPageSizes() const-
122{-
123 if (!m_havePageSizes)-
124 loadPageSizes();-
125 return m_pageSizes.toList();-
126}-
127-
128QPageSize QPlatformPrintDevice::supportedPageSize(const QPageSize &pageSize) const-
129{-
130 if (!pageSize.isValid()
!pageSize.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
131 return
never executed: return QPageSize();
QPageSize();
never executed: return QPageSize();
0
132-
133 if (!m_havePageSizes
!m_havePageSizesDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
134 loadPageSizes();
never executed: loadPageSizes();
0
135-
136-
137-
138-
139 if (pageSize.id() != QPageSize::Custom
pageSize.id() ...geSize::CustomDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
140 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(m_pageSizes)>::type> _container_((m_pageSizes)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QPageSize &ps = *_container_.i; _container_.control; _container_.control = 0: m_pageSizes) {-
141 if (ps.id() == pageSize.id()
ps.id() == pageSize.id()Description
TRUEnever evaluated
FALSEnever evaluated
&& ps.name() == pageSize.name()
ps.name() == pageSize.name()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
142 return
never executed: return ps;
ps;
never executed: return ps;
0
143 }
never executed: end of block
0
144 }
never executed: end of block
0
145-
146-
147 if (pageSize.id() != QPageSize::Custom
pageSize.id() ...geSize::CustomDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
148 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(m_pageSizes)>::type> _container_((m_pageSizes)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)for (const QPageSize &ps = *_container_.i; _container_.control; _container_.control = 0: m_pageSizes) {-
149 if (ps.id() == pageSize.id()
ps.id() == pageSize.id()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
150 return
never executed: return ps;
ps;
never executed: return ps;
0
151 }
never executed: end of block
0
152 }
never executed: end of block
0
153-
154-
155 return
never executed: return supportedPageSizeMatch(pageSize);
supportedPageSizeMatch(pageSize);
never executed: return supportedPageSizeMatch(pageSize);
0
156}-
157-
158QPageSize QPlatformPrintDevice::supportedPageSize(QPageSize::PageSizeId pageSizeId) const-
159{-
160 if (!m_havePageSizes
!m_havePageSizesDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
161 loadPageSizes();
never executed: loadPageSizes();
0
162-
163 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(m_pageSizes)>::type> _container_((m_pageSizes)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)for (const QPageSize &ps = *_container_.i; _container_.control; _container_.control = 0: m_pageSizes) {-
164 if (ps.id() == pageSizeId
ps.id() == pageSizeIdDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
165 return
never executed: return ps;
ps;
never executed: return ps;
0
166 }
never executed: end of block
0
167-
168-
169 return
never executed: return supportedPageSizeMatch(QPageSize(pageSizeId));
supportedPageSizeMatch(QPageSize(pageSizeId));
never executed: return supportedPageSizeMatch(QPageSize(pageSizeId));
0
170}-
171-
172QPageSize QPlatformPrintDevice::supportedPageSize(const QString &pageName) const-
173{-
174 if (!m_havePageSizes
!m_havePageSizesDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
175 loadPageSizes();
never executed: loadPageSizes();
0
176-
177 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(m_pageSizes)>::type> _container_((m_pageSizes)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)for (const QPageSize &ps = *_container_.i; _container_.control; _container_.control = 0: m_pageSizes) {-
178 if (ps.name() == pageName
ps.name() == pageNameDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
179 return
never executed: return ps;
ps;
never executed: return ps;
0
180 }
never executed: end of block
0
181-
182 return
never executed: return QPageSize();
QPageSize();
never executed: return QPageSize();
0
183}-
184-
185QPageSize QPlatformPrintDevice::supportedPageSize(const QSize &sizePoints) const-
186{-
187 if (!m_havePageSizes)-
188 loadPageSizes();-
189-
190-
191 return supportedPageSizeMatch(QPageSize(sizePoints));-
192}-
193-
194QPageSize QPlatformPrintDevice::supportedPageSize(const QSizeF &size, QPageSize::Unit units) const-
195{-
196 if (!m_havePageSizes)-
197 loadPageSizes();-
198-
199-
200 return supportedPageSizeMatch(QPageSize(size, units));-
201}-
202-
203QPageSize QPlatformPrintDevice::supportedPageSizeMatch(const QPageSize &pageSize) const-
204{-
205-
206 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(m_pageSizes)>::type> _container_((m_pageSizes)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)for (const QPageSize &ps = *_container_.i; _container_.control; _container_.control = 0: m_pageSizes) {-
207 if (ps.sizePoints() == pageSize.sizePoints()
ps.sizePoints(...e.sizePoints()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
208 return
never executed: return ps;
ps;
never executed: return ps;
0
209 }
never executed: end of block
0
210 return
never executed: return QPageSize();
QPageSize();
never executed: return QPageSize();
0
211}-
212-
213bool QPlatformPrintDevice::supportsCustomPageSizes() const-
214{-
215 return m_supportsCustomPageSizes;-
216}-
217-
218QSize QPlatformPrintDevice::minimumPhysicalPageSize() const-
219{-
220 return m_minimumPhysicalPageSize;-
221}-
222-
223QSize QPlatformPrintDevice::maximumPhysicalPageSize() const-
224{-
225 return m_maximumPhysicalPageSize;-
226}-
227-
228QMarginsF QPlatformPrintDevice::printableMargins(const QPageSize &pageSize,-
229 QPageLayout::Orientation orientation,-
230 int resolution) const-
231{-
232 (void)pageSize;-
233 (void)orientation;-
234 (void)resolution;-
235 return QMarginsF(0, 0, 0, 0);-
236}-
237-
238void QPlatformPrintDevice::loadResolutions() const-
239{-
240}-
241-
242int QPlatformPrintDevice::defaultResolution() const-
243{-
244 return 0;-
245}-
246-
247QList<int> QPlatformPrintDevice::supportedResolutions() const-
248{-
249 if (!m_haveResolutions)-
250 loadResolutions();-
251 return m_resolutions.toList();-
252}-
253-
254void QPlatformPrintDevice::loadInputSlots() const-
255{-
256}-
257-
258QPrint::InputSlot QPlatformPrintDevice::defaultInputSlot() const-
259{-
260 QPrint::InputSlot input;-
261 input.key = ([]() -> QByteArray { enum { Size = sizeof("Auto") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "Auto" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }());-
262 input.name = QPrintDialog::tr("Automatic");-
263 input.id = QPrint::Auto;-
264 return input;-
265}-
266-
267QList<QPrint::InputSlot> QPlatformPrintDevice::supportedInputSlots() const-
268{-
269 if (!m_haveInputSlots)-
270 loadInputSlots();-
271 return m_inputSlots.toList();-
272}-
273-
274void QPlatformPrintDevice::loadOutputBins() const-
275{-
276}-
277-
278QPrint::OutputBin QPlatformPrintDevice::defaultOutputBin() const-
279{-
280 QPrint::OutputBin output;-
281 output.key = ([]() -> QByteArray { enum { Size = sizeof("Auto") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "Auto" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }());-
282 output.name = QPrintDialog::tr("Automatic");-
283 output.id = QPrint::AutoOutputBin;-
284 return output;-
285}-
286-
287QList<QPrint::OutputBin> QPlatformPrintDevice::supportedOutputBins() const-
288{-
289 if (!m_haveOutputBins)-
290 loadOutputBins();-
291 return m_outputBins.toList();-
292}-
293-
294void QPlatformPrintDevice::loadDuplexModes() const-
295{-
296}-
297-
298QPrint::DuplexMode QPlatformPrintDevice::defaultDuplexMode() const-
299{-
300 return QPrint::DuplexNone;-
301}-
302-
303QList<QPrint::DuplexMode> QPlatformPrintDevice::supportedDuplexModes() const-
304{-
305 if (!m_haveDuplexModes)-
306 loadDuplexModes();-
307 return m_duplexModes.toList();-
308}-
309-
310void QPlatformPrintDevice::loadColorModes() const-
311{-
312}-
313-
314QPrint::ColorMode QPlatformPrintDevice::defaultColorMode() const-
315{-
316 return QPrint::GrayScale;-
317}-
318-
319QList<QPrint::ColorMode> QPlatformPrintDevice::supportedColorModes() const-
320{-
321 if (!m_haveColorModes)-
322 loadColorModes();-
323 return m_colorModes.toList();-
324}-
325-
326-
327void QPlatformPrintDevice::loadMimeTypes() const-
328{-
329}-
330-
331QList<QMimeType> QPlatformPrintDevice::supportedMimeTypes() const-
332{-
333 if (!m_haveMimeTypes)-
334 loadMimeTypes();-
335 return m_mimeTypes.toList();-
336}-
337-
338-
339QPageSize QPlatformPrintDevice::createPageSize(const QString &key, const QSize &size, const QString &localizedName)-
340{-
341 return QPageSize(key, size, localizedName);-
342}-
343-
344QPageSize QPlatformPrintDevice::createPageSize(int windowsId, const QSize &size, const QString &localizedName)-
345{-
346 return QPageSize(windowsId, size, localizedName);-
347}-
348-
349-
350-
351-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9