1// Copyright (C) 2016 The Qt Company Ltd.
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 QPRINTENGINE_PDF_P_H
5#define QPRINTENGINE_PDF_P_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 purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "QtPrintSupport/qprintengine.h"
19
20#ifndef QT_NO_PRINTER
21#include "QtCore/qdatastream.h"
22#include "QtCore/qmap.h"
23#include "QtCore/qstring.h"
24#include "QtGui/qpaintengine.h"
25#include "QtGui/qpainterpath.h"
26
27#include "private/qfontengine_p.h"
28#include "private/qpdf_p.h"
29#include "private/qpaintengine_p.h"
30#include "qprintengine.h"
31#include "qprint_p.h"
32
33QT_BEGIN_NAMESPACE
34
35class QImage;
36class QDataStream;
37class QPen;
38class QPointF;
39class QRegion;
40class QFile;
41
42class QPdfPrintEnginePrivate;
43
44class Q_PRINTSUPPORT_EXPORT QPdfPrintEngine : public QPdfEngine, public QPrintEngine
45{
46 Q_DECLARE_PRIVATE(QPdfPrintEngine)
47public:
48 QPdfPrintEngine(QPrinter::PrinterMode m, QPdfEngine::PdfVersion version = QPdfEngine::Version_1_4);
49 virtual ~QPdfPrintEngine();
50
51 // reimplementations QPaintEngine
52 bool begin(QPaintDevice *pdev) override;
53 bool end() override;
54 // end reimplementations QPaintEngine
55
56 // reimplementations QPrintEngine
57 bool abort() override {return false;}
58 QPrinter::PrinterState printerState() const override {return state;}
59
60 bool newPage() override;
61 int metric(QPaintDevice::PaintDeviceMetric) const override;
62 virtual void setProperty(PrintEnginePropertyKey key, const QVariant &value) override;
63 virtual QVariant property(PrintEnginePropertyKey key) const override;
64 // end reimplementations QPrintEngine
65
66 QPrinter::PrinterState state;
67
68protected:
69 QPdfPrintEngine(QPdfPrintEnginePrivate &p);
70
71private:
72 Q_DISABLE_COPY(QPdfPrintEngine)
73};
74
75class Q_PRINTSUPPORT_EXPORT QPdfPrintEnginePrivate : public QPdfEnginePrivate
76{
77 Q_DECLARE_PUBLIC(QPdfPrintEngine)
78public:
79 QPdfPrintEnginePrivate(QPrinter::PrinterMode m);
80 ~QPdfPrintEnginePrivate();
81
82 virtual bool openPrintDevice();
83 virtual void closePrintDevice();
84
85private:
86 Q_DISABLE_COPY(QPdfPrintEnginePrivate)
87
88 friend class QCupsPrintEngine;
89 friend class QCupsPrintEnginePrivate;
90
91 QString printerName;
92 QString printProgram;
93 QString selectionOption;
94
95 bool collate;
96 int copies;
97 QPrinter::PageOrder pageOrder;
98 QPrinter::PaperSource paperSource;
99
100 int fd;
101};
102
103QT_END_NAMESPACE
104
105#endif // QT_NO_PRINTER
106
107#endif // QPRINTENGINE_PDF_P_H
108

source code of qtbase/src/printsupport/kernel/qprintengine_pdf_p.h