| 1 | // Copyright (C) 2014 John Layt <jlayt@kde.org> |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QPRINTDEVICE_H |
| 5 | #define QPRINTDEVICE_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists for the convenience |
| 12 | // of internal files. This header file may change from version to version |
| 13 | // without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <QtPrintSupport/private/qtprintsupportglobal_p.h> |
| 19 | #include "private/qprint_p.h" |
| 20 | |
| 21 | #include <QtCore/qsharedpointer.h> |
| 22 | #include <QtGui/qpagelayout.h> |
| 23 | |
| 24 | QT_BEGIN_NAMESPACE |
| 25 | |
| 26 | #ifndef QT_NO_PRINTER |
| 27 | |
| 28 | class QPlatformPrintDevice; |
| 29 | class QMarginsF; |
| 30 | class QMimeType; |
| 31 | class QDebug; |
| 32 | |
| 33 | class Q_PRINTSUPPORT_EXPORT QPrintDevice |
| 34 | { |
| 35 | public: |
| 36 | |
| 37 | QPrintDevice(); |
| 38 | QPrintDevice(const QString & id); |
| 39 | QPrintDevice(const QPrintDevice &other); |
| 40 | ~QPrintDevice(); |
| 41 | |
| 42 | QPrintDevice &operator=(const QPrintDevice &other); |
| 43 | QPrintDevice &operator=(QPrintDevice &&other) { swap(other); return *this; } |
| 44 | |
| 45 | void swap(QPrintDevice &other) { d.swap(other&: other.d); } |
| 46 | |
| 47 | bool operator==(const QPrintDevice &other) const; |
| 48 | |
| 49 | QString id() const; |
| 50 | QString name() const; |
| 51 | QString location() const; |
| 52 | QString makeAndModel() const; |
| 53 | |
| 54 | bool isValid() const; |
| 55 | bool isDefault() const; |
| 56 | bool isRemote() const; |
| 57 | |
| 58 | QPrint::DeviceState state() const; |
| 59 | |
| 60 | bool isValidPageLayout(const QPageLayout &layout, int resolution) const; |
| 61 | |
| 62 | bool supportsMultipleCopies() const; |
| 63 | bool supportsCollateCopies() const; |
| 64 | |
| 65 | QPageSize defaultPageSize() const; |
| 66 | QList<QPageSize> supportedPageSizes() const; |
| 67 | |
| 68 | QPageSize supportedPageSize(const QPageSize &pageSize) const; |
| 69 | QPageSize supportedPageSize(QPageSize::PageSizeId pageSizeId) const; |
| 70 | QPageSize supportedPageSize(const QString &pageName) const; |
| 71 | QPageSize supportedPageSize(const QSize &pointSize) const; |
| 72 | QPageSize supportedPageSize(const QSizeF &size, QPageSize::Unit units = QPageSize::Point) const; |
| 73 | |
| 74 | bool supportsCustomPageSizes() const; |
| 75 | |
| 76 | QSize minimumPhysicalPageSize() const; |
| 77 | QSize maximumPhysicalPageSize() const; |
| 78 | |
| 79 | QMarginsF printableMargins(const QPageSize &pageSize, QPageLayout::Orientation orientation, int resolution) const; |
| 80 | |
| 81 | int defaultResolution() const; |
| 82 | QList<int> supportedResolutions() const; |
| 83 | |
| 84 | QPrint::InputSlot defaultInputSlot() const; |
| 85 | QList<QPrint::InputSlot> supportedInputSlots() const; |
| 86 | |
| 87 | QPrint::OutputBin defaultOutputBin() const; |
| 88 | QList<QPrint::OutputBin> supportedOutputBins() const; |
| 89 | |
| 90 | QPrint::DuplexMode defaultDuplexMode() const; |
| 91 | QList<QPrint::DuplexMode> supportedDuplexModes() const; |
| 92 | |
| 93 | QPrint::ColorMode defaultColorMode() const; |
| 94 | QList<QPrint::ColorMode> supportedColorModes() const; |
| 95 | |
| 96 | enum PrintDevicePropertyKey { |
| 97 | PDPK_CustomBase = 0xff00 |
| 98 | }; |
| 99 | |
| 100 | QVariant property(PrintDevicePropertyKey key) const; |
| 101 | bool setProperty(PrintDevicePropertyKey key, const QVariant &value); |
| 102 | bool isFeatureAvailable(PrintDevicePropertyKey key, const QVariant ¶ms) const; |
| 103 | |
| 104 | #if QT_CONFIG(mimetype) |
| 105 | QList<QMimeType> supportedMimeTypes() const; |
| 106 | #endif |
| 107 | |
| 108 | # ifndef QT_NO_DEBUG_STREAM |
| 109 | void format(QDebug debug) const; |
| 110 | # endif |
| 111 | |
| 112 | private: |
| 113 | friend class QPlatformPrinterSupport; |
| 114 | friend class QPlatformPrintDevice; |
| 115 | QPrintDevice(QPlatformPrintDevice *dd); |
| 116 | QSharedPointer<QPlatformPrintDevice> d; |
| 117 | }; |
| 118 | |
| 119 | Q_DECLARE_SHARED(QPrintDevice) |
| 120 | |
| 121 | # ifndef QT_NO_DEBUG_STREAM |
| 122 | Q_PRINTSUPPORT_EXPORT QDebug operator<<(QDebug debug, const QPrintDevice &); |
| 123 | # endif |
| 124 | #endif // QT_NO_PRINTER |
| 125 | |
| 126 | QT_END_NAMESPACE |
| 127 | |
| 128 | #endif // QPLATFORMPRINTDEVICE_H |
| 129 |
