1 | // Copyright (C) 2014 John Layt <jlayt@kde.org> |
2 | // Copyright (C) 2018 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 | |
5 | #ifndef QPLATFORMPRINTDEVICE_H |
6 | #define QPLATFORMPRINTDEVICE_H |
7 | |
8 | // |
9 | // W A R N I N G |
10 | // ------------- |
11 | // |
12 | // This file is not part of the Qt API. It exists for the convenience |
13 | // of internal files. This header file may change from version to version |
14 | // without notice, or even be removed. |
15 | // |
16 | // We mean it. |
17 | // |
18 | |
19 | #include <QtPrintSupport/qtprintsupportglobal.h> |
20 | #include <private/qprint_p.h> |
21 | #include <private/qprintdevice_p.h> |
22 | |
23 | #include <QtCore/qlist.h> |
24 | #include <QtCore/qvariant.h> |
25 | #if QT_CONFIG(mimetype) |
26 | #include <QtCore/qmimetype.h> |
27 | #endif |
28 | #include <QtGui/qpagelayout.h> |
29 | |
30 | |
31 | QT_BEGIN_NAMESPACE |
32 | |
33 | #ifndef QT_NO_PRINTER |
34 | |
35 | class Q_PRINTSUPPORT_EXPORT QPlatformPrintDevice |
36 | { |
37 | Q_DISABLE_COPY(QPlatformPrintDevice) |
38 | public: |
39 | explicit QPlatformPrintDevice(const QString &id = QString()); |
40 | virtual ~QPlatformPrintDevice(); |
41 | |
42 | virtual QString id() const; |
43 | virtual QString name() const; |
44 | virtual QString location() const; |
45 | virtual QString makeAndModel() const; |
46 | |
47 | virtual bool isValid() const; |
48 | virtual bool isDefault() const; |
49 | virtual bool isRemote() const; |
50 | |
51 | virtual QPrint::DeviceState state() const; |
52 | |
53 | virtual bool isValidPageLayout(const QPageLayout &layout, int resolution) const; |
54 | |
55 | virtual bool supportsMultipleCopies() const; |
56 | virtual bool supportsCollateCopies() const; |
57 | |
58 | virtual QPageSize defaultPageSize() const; |
59 | virtual QList<QPageSize> supportedPageSizes() const; |
60 | |
61 | virtual QPageSize supportedPageSize(const QPageSize &pageSize) const; |
62 | virtual QPageSize supportedPageSize(QPageSize::PageSizeId pageSizeId) const; |
63 | virtual QPageSize supportedPageSize(const QString &pageName) const; |
64 | virtual QPageSize supportedPageSize(const QSize &pointSize) const; |
65 | virtual QPageSize supportedPageSize(const QSizeF &size, QPageSize::Unit units) const; |
66 | |
67 | virtual bool supportsCustomPageSizes() const; |
68 | |
69 | virtual QSize minimumPhysicalPageSize() const; |
70 | virtual QSize maximumPhysicalPageSize() const; |
71 | |
72 | virtual QMarginsF printableMargins(const QPageSize &pageSize, QPageLayout::Orientation orientation, |
73 | int resolution) const; |
74 | |
75 | virtual int defaultResolution() const; |
76 | virtual QList<int> supportedResolutions() const; |
77 | |
78 | virtual QPrint::InputSlot defaultInputSlot() const; |
79 | virtual QList<QPrint::InputSlot> supportedInputSlots() const; |
80 | |
81 | virtual QPrint::OutputBin defaultOutputBin() const; |
82 | virtual QList<QPrint::OutputBin> supportedOutputBins() const; |
83 | |
84 | virtual QPrint::DuplexMode defaultDuplexMode() const; |
85 | virtual QList<QPrint::DuplexMode> supportedDuplexModes() const; |
86 | |
87 | virtual QPrint::ColorMode defaultColorMode() const; |
88 | virtual QList<QPrint::ColorMode> supportedColorModes() const; |
89 | |
90 | virtual QVariant property(QPrintDevice::PrintDevicePropertyKey key) const; |
91 | virtual bool setProperty(QPrintDevice::PrintDevicePropertyKey key, const QVariant &value); |
92 | virtual bool isFeatureAvailable(QPrintDevice::PrintDevicePropertyKey key, const QVariant ¶ms) const; |
93 | |
94 | #if QT_CONFIG(mimetype) |
95 | virtual QList<QMimeType> supportedMimeTypes() const; |
96 | #endif |
97 | |
98 | static QPageSize createPageSize(const QString &key, const QSize &size, const QString &localizedName); |
99 | static QPageSize createPageSize(int windowsId, const QSize &size, const QString &localizedName); |
100 | |
101 | protected: |
102 | virtual void loadPageSizes() const; |
103 | virtual void loadResolutions() const; |
104 | virtual void loadInputSlots() const; |
105 | virtual void loadOutputBins() const; |
106 | virtual void loadDuplexModes() const; |
107 | virtual void loadColorModes() const; |
108 | #if QT_CONFIG(mimetype) |
109 | virtual void loadMimeTypes() const; |
110 | #endif |
111 | |
112 | QPageSize supportedPageSizeMatch(const QPageSize &pageSize) const; |
113 | |
114 | QString m_id; |
115 | QString m_name; |
116 | QString m_location; |
117 | QString m_makeAndModel; |
118 | |
119 | bool m_isRemote; |
120 | |
121 | mutable bool m_supportsMultipleCopies; |
122 | mutable bool m_supportsCollateCopies; |
123 | |
124 | mutable bool m_havePageSizes; |
125 | mutable QList<QPageSize> m_pageSizes; |
126 | |
127 | mutable bool m_supportsCustomPageSizes; |
128 | |
129 | mutable QSize m_minimumPhysicalPageSize; |
130 | mutable QSize m_maximumPhysicalPageSize; |
131 | |
132 | mutable bool m_haveResolutions; |
133 | mutable QList<int> m_resolutions; |
134 | |
135 | mutable bool m_haveInputSlots; |
136 | mutable QList<QPrint::InputSlot> m_inputSlots; |
137 | |
138 | mutable bool m_haveOutputBins; |
139 | mutable QList<QPrint::OutputBin> m_outputBins; |
140 | |
141 | mutable bool m_haveDuplexModes; |
142 | mutable QList<QPrint::DuplexMode> m_duplexModes; |
143 | |
144 | mutable bool m_haveColorModes; |
145 | mutable QList<QPrint::ColorMode> m_colorModes; |
146 | |
147 | #if QT_CONFIG(mimetype) |
148 | mutable bool m_haveMimeTypes; |
149 | mutable QList<QMimeType> m_mimeTypes; |
150 | #endif |
151 | }; |
152 | |
153 | #endif // QT_NO_PRINTER |
154 | |
155 | QT_END_NAMESPACE |
156 | |
157 | #endif // QPLATFORMPRINTDEVICE_H |
158 | |