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
qcocoaprintdevice_p.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#ifndef QCOCOAPRINTDEVICE_H
6#define QCOCOAPRINTDEVICE_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 <qpa/qplatformprintdevice.h>
20#include <private/qglobal_p.h>
21
22#ifndef QT_NO_PRINTER
23
24#include <QtCore/qhash.h>
25#include <ApplicationServices/ApplicationServices.h>
26
27#include <QtPrintSupport/qtprintsupportglobal.h>
28
29#include <cups/ppd.h>
30
31QT_BEGIN_NAMESPACE
32
33class QCocoaPrintDevice : public QPlatformPrintDevice
34{
35public:
36 QCocoaPrintDevice();
37 explicit QCocoaPrintDevice(const QString &id);
38 virtual ~QCocoaPrintDevice();
39
40 bool isValid() const override;
41 bool isDefault() const override;
42
43 QPrint::DeviceState state() const override;
44
45 QPageSize defaultPageSize() const override;
46
47 QMarginsF printableMargins(const QPageSize &pageSize, QPageLayout::Orientation orientation,
48 int resolution) const override;
49
50 int defaultResolution() const override;
51
52 QPrint::InputSlot defaultInputSlot() const override;
53
54 QPrint::OutputBin defaultOutputBin() const override;
55
56 QPrint::DuplexMode defaultDuplexMode() const override;
57
58 QPrint::ColorMode defaultColorMode() const override;
59
60 PMPrinter macPrinter() const;
61 PMPaper macPaper(const QPageSize &pageSize) const;
62
63protected:
64 void loadPageSizes() const override;
65 void loadResolutions() const override;
66 void loadInputSlots() const override;
67 void loadOutputBins() const override;
68 void loadDuplexModes() const override;
69 void loadColorModes() const override;
70#if QT_CONFIG(mimetype)
71 void loadMimeTypes() const override;
72#endif
73
74private:
75 QPageSize createPageSize(const PMPaper &paper) const;
76 bool openPpdFile();
77
78 // Mac Core Printing
79 PMPrinter m_printer;
80 PMPrintSession m_session;
81 mutable QHash<QString, PMPaper> m_macPapers;
82
83 // PPD File
84 ppd_file_t *m_ppd;
85
86 QMarginsF m_customMargins;
87 mutable QHash<QString, QMarginsF> m_printableMargins;
88};
89
90QT_END_NAMESPACE
91
92#endif // QT_NO_PRINTER
93#endif // QCOCOAPRINTDEVICE_H
static QT_BEGIN_NAMESPACE QPrint::DuplexMode macToDuplexMode(const PMDuplexMode &mode)