| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2014 John Layt <jlayt@kde.org> |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the QtPrintSupport 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 The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/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 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General |
| 28 | ** Public license version 3 or any later version approved by the KDE Free |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 31 | ** included in the packaging of this file. Please review the following |
| 32 | ** information to ensure the GNU General Public License requirements will |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 35 | ** |
| 36 | ** $QT_END_LICENSE$ |
| 37 | ** |
| 38 | ****************************************************************************/ |
| 39 | |
| 40 | #ifndef QPRINTDEVICE_H |
| 41 | #define QPRINTDEVICE_H |
| 42 | |
| 43 | // |
| 44 | // W A R N I N G |
| 45 | // ------------- |
| 46 | // |
| 47 | // This file is not part of the Qt API. It exists for the convenience |
| 48 | // of internal files. This header file may change from version to version |
| 49 | // without notice, or even be removed. |
| 50 | // |
| 51 | // We mean it. |
| 52 | // |
| 53 | |
| 54 | #include <QtPrintSupport/private/qtprintsupportglobal_p.h> |
| 55 | #include "private/qprint_p.h" |
| 56 | |
| 57 | #include <QtCore/qsharedpointer.h> |
| 58 | #include <QtGui/qpagelayout.h> |
| 59 | |
| 60 | QT_BEGIN_NAMESPACE |
| 61 | |
| 62 | #ifndef QT_NO_PRINTER |
| 63 | |
| 64 | class QPlatformPrintDevice; |
| 65 | class QMarginsF; |
| 66 | class QMimeType; |
| 67 | class QDebug; |
| 68 | |
| 69 | class Q_PRINTSUPPORT_EXPORT QPrintDevice |
| 70 | { |
| 71 | public: |
| 72 | |
| 73 | QPrintDevice(); |
| 74 | QPrintDevice(const QString & id); |
| 75 | QPrintDevice(const QPrintDevice &other); |
| 76 | ~QPrintDevice(); |
| 77 | |
| 78 | QPrintDevice &operator=(const QPrintDevice &other); |
| 79 | QPrintDevice &operator=(QPrintDevice &&other) { swap(other); return *this; } |
| 80 | |
| 81 | void swap(QPrintDevice &other) { d.swap(other&: other.d); } |
| 82 | |
| 83 | bool operator==(const QPrintDevice &other) const; |
| 84 | |
| 85 | QString id() const; |
| 86 | QString name() const; |
| 87 | QString location() const; |
| 88 | QString makeAndModel() const; |
| 89 | |
| 90 | bool isValid() const; |
| 91 | bool isDefault() const; |
| 92 | bool isRemote() const; |
| 93 | |
| 94 | QPrint::DeviceState state() const; |
| 95 | |
| 96 | bool isValidPageLayout(const QPageLayout &layout, int resolution) const; |
| 97 | |
| 98 | bool supportsMultipleCopies() const; |
| 99 | bool supportsCollateCopies() const; |
| 100 | |
| 101 | QPageSize defaultPageSize() const; |
| 102 | QList<QPageSize> supportedPageSizes() const; |
| 103 | |
| 104 | QPageSize supportedPageSize(const QPageSize &pageSize) const; |
| 105 | QPageSize supportedPageSize(QPageSize::PageSizeId pageSizeId) const; |
| 106 | QPageSize supportedPageSize(const QString &pageName) const; |
| 107 | QPageSize supportedPageSize(const QSize &pointSize) const; |
| 108 | QPageSize supportedPageSize(const QSizeF &size, QPageSize::Unit units = QPageSize::Point) const; |
| 109 | |
| 110 | bool supportsCustomPageSizes() const; |
| 111 | |
| 112 | QSize minimumPhysicalPageSize() const; |
| 113 | QSize maximumPhysicalPageSize() const; |
| 114 | |
| 115 | QMarginsF printableMargins(const QPageSize &pageSize, QPageLayout::Orientation orientation, int resolution) const; |
| 116 | |
| 117 | int defaultResolution() const; |
| 118 | QList<int> supportedResolutions() const; |
| 119 | |
| 120 | QPrint::InputSlot defaultInputSlot() const; |
| 121 | QVector<QPrint::InputSlot> supportedInputSlots() const; |
| 122 | |
| 123 | QPrint::OutputBin defaultOutputBin() const; |
| 124 | QVector<QPrint::OutputBin> supportedOutputBins() const; |
| 125 | |
| 126 | QPrint::DuplexMode defaultDuplexMode() const; |
| 127 | QVector<QPrint::DuplexMode> supportedDuplexModes() const; |
| 128 | |
| 129 | QPrint::ColorMode defaultColorMode() const; |
| 130 | QVector<QPrint::ColorMode> supportedColorModes() const; |
| 131 | |
| 132 | enum PrintDevicePropertyKey { |
| 133 | PDPK_CustomBase = 0xff00 |
| 134 | }; |
| 135 | |
| 136 | QVariant property(PrintDevicePropertyKey key) const; |
| 137 | bool setProperty(PrintDevicePropertyKey key, const QVariant &value); |
| 138 | bool isFeatureAvailable(PrintDevicePropertyKey key, const QVariant ¶ms) const; |
| 139 | |
| 140 | #if QT_CONFIG(mimetype) |
| 141 | QList<QMimeType> supportedMimeTypes() const; |
| 142 | #endif |
| 143 | |
| 144 | # ifndef QT_NO_DEBUG_STREAM |
| 145 | void format(QDebug debug) const; |
| 146 | # endif |
| 147 | |
| 148 | private: |
| 149 | friend class QPlatformPrinterSupport; |
| 150 | friend class QPlatformPrintDevice; |
| 151 | QPrintDevice(QPlatformPrintDevice *dd); |
| 152 | QSharedPointer<QPlatformPrintDevice> d; |
| 153 | }; |
| 154 | |
| 155 | Q_DECLARE_SHARED(QPrintDevice) |
| 156 | |
| 157 | # ifndef QT_NO_DEBUG_STREAM |
| 158 | Q_PRINTSUPPORT_EXPORT QDebug operator<<(QDebug debug, const QPrintDevice &); |
| 159 | # endif |
| 160 | #endif // QT_NO_PRINTER |
| 161 | |
| 162 | QT_END_NAMESPACE |
| 163 | |
| 164 | #endif // QPLATFORMPRINTDEVICE_H |
| 165 | |