Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwindowsprintdevice_p.h
Go to the documentation of this file.
1// Copyright (C) 2014 John Layt <jlayt@kde.org>
2// Copyright (C) 2020 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4// Qt-Security score:significant reason:default
5
6#ifndef QWINDOWSPRINTDEVICE_H
7#define QWINDOWSPRINTDEVICE_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists for the convenience
14// of internal files. This header file may change from version to version
15// without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <qpa/qplatformprintdevice.h>
21
22#include <QtPrintSupport/qtprintsupportglobal.h>
23#include <QtCore/qt_windows.h>
24#include <QtCore/private/qglobal_p.h>
25
27
29{
30public:
31 bool operator==(const QWindowsPrinterInfo &other) const
32 {
33 // We only need to check if these are the same for matching up
34 return m_id == other.m_id && m_name == other.m_name &&
35 m_location == other.m_location &&
36 m_makeAndModel == other.m_makeAndModel &&
37 m_isRemote == other.m_isRemote;
38 }
39 QString m_id;
40 QString m_name;
41 QString m_location;
42 QString m_makeAndModel;
43 QList<QPageSize> m_pageSizes;
44 QList<int> m_resolutions;
45 QList<QPrint::InputSlot> m_inputSlots;
46 QList<QPrint::OutputBin> m_outputBins;
47 QList<QPrint::DuplexMode> m_duplexModes;
48 QList<QPrint::ColorMode> m_colorModes;
49 QSize m_minimumPhysicalPageSize;
50 QSize m_maximumPhysicalPageSize;
51 bool m_isRemote = false;
52 bool m_havePageSizes = false;
53 bool m_haveResolutions = false;
54 bool m_haveCopies = false;
55 bool m_supportsMultipleCopies = false;
56 bool m_supportsCollateCopies = false;
57 bool m_haveMinMaxPageSizes = false;
58 bool m_supportsCustomPageSizes = false;
59 bool m_haveInputSlots = false;
60 bool m_haveOutputBins = false;
61 bool m_haveDuplexModes = false;
62 bool m_haveColorModes = false;
63};
64
65class Q_PRINTSUPPORT_EXPORT QWindowsPrintDevice : public QPlatformPrintDevice
66{
67public:
68 QWindowsPrintDevice();
69 explicit QWindowsPrintDevice(const QString &id);
70 virtual ~QWindowsPrintDevice();
71
72 bool isValid() const override;
73 bool isDefault() const override;
74
75 QPrint::DeviceState state() const override;
76
77 QPageSize defaultPageSize() const override;
78
79 QMarginsF printableMargins(const QPageSize &pageSize, QPageLayout::Orientation orientation,
80 int resolution) const override;
81
82 int defaultResolution() const override;
83
84 QPrint::InputSlot defaultInputSlot() const override;
85
86 QPrint::DuplexMode defaultDuplexMode() const override;
87
88 QPrint::ColorMode defaultColorMode() const override;
89
90 static QStringList availablePrintDeviceIds();
91 static QString defaultPrintDeviceId();
92
93 bool supportsCollateCopies() const override;
94 bool supportsMultipleCopies() const override;
95 bool supportsCustomPageSizes() const override;
96 QSize minimumPhysicalPageSize() const override;
97 QSize maximumPhysicalPageSize() const override;
98
99protected:
100 void loadPageSizes() const override;
101 void loadResolutions() const override;
102 void loadInputSlots() const override;
103 void loadOutputBins() const override;
104 void loadDuplexModes() const override;
105 void loadColorModes() const override;
106 void loadCopiesSupport() const;
107 void loadMinMaxPageSizes() const;
108
109private:
110 LPCWSTR wcharId() const { return reinterpret_cast<LPCWSTR>(m_id.utf16()); }
111
112 HANDLE m_hPrinter;
113 mutable bool m_haveCopies;
114 mutable bool m_haveMinMaxPageSizes;
115 int m_infoIndex;
116};
117
118QT_END_NAMESPACE
119
120#endif // QWINDOWSPRINTDEVICE_H
Q_GLOBAL_STATIC(QReadWriteLock, g_updateMutex)
qreal qt_pointMultiplier(QPageLayout::Unit unit)
#define DC_COLLATE
static LPDEVMODE getDevmode(HANDLE hPrinter, const QString &printerId)
static uint qwcsnlen(const wchar_t *str, uint maxlen)