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 QPRINTER_P_H
5#define QPRINTER_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
19#include <QtPrintSupport/private/qtprintsupportglobal_p.h>
20
21#ifndef QT_NO_PRINTER
22
23#include "QtPrintSupport/qprinter.h"
24#include "QtPrintSupport/qprinterinfo.h"
25#include "QtPrintSupport/qprintengine.h"
26#include "QtCore/qpointer.h"
27#include "QtCore/qset.h"
28
29#include <limits.h>
30
31QT_BEGIN_NAMESPACE
32
33class QPrintEngine;
34class QPreviewPaintEngine;
35class QPicture;
36
37class Q_PRINTSUPPORT_EXPORT QPrinterPrivate
38{
39 Q_DECLARE_PUBLIC(QPrinter)
40public:
41 QPrinterPrivate(QPrinter *printer)
42 : pdfVersion(QPrinter::PdfVersion_1_4),
43 printEngine(nullptr),
44 paintEngine(nullptr),
45 realPrintEngine(nullptr),
46 realPaintEngine(nullptr),
47#if QT_CONFIG(printpreviewwidget)
48 previewEngine(nullptr),
49#endif
50 q_ptr(printer),
51 printRange(QPrinter::AllPages),
52 use_default_engine(true),
53 validPrinter(false)
54 {
55 }
56
57 ~QPrinterPrivate() {
58
59 }
60
61 static QPrinterPrivate *get(QPrinter *printer) {
62 return printer->d_ptr.get();
63 }
64
65 void init(const QPrinterInfo &printer, QPrinter::PrinterMode mode);
66
67 QPrinterInfo findValidPrinter(const QPrinterInfo &printer = QPrinterInfo());
68 void initEngines(QPrinter::OutputFormat format, const QPrinterInfo &printer);
69 void changeEngines(QPrinter::OutputFormat format, const QPrinterInfo &printer);
70#if QT_CONFIG(printpreviewwidget)
71 QList<const QPicture *> previewPages() const;
72 void setPreviewMode(bool);
73#endif
74
75 void setProperty(QPrintEngine::PrintEnginePropertyKey key, const QVariant &value);
76
77 QPrinter::PrinterMode printerMode;
78 QPrinter::OutputFormat outputFormat;
79 QPrinter::PdfVersion pdfVersion;
80 QPrintEngine *printEngine;
81 QPaintEngine *paintEngine;
82
83 QPrintEngine *realPrintEngine;
84 QPaintEngine *realPaintEngine;
85#if QT_CONFIG(printpreviewwidget)
86 QPreviewPaintEngine *previewEngine;
87#endif
88
89 QPrinter *q_ptr;
90
91 QPrinter::PrintRange printRange;
92
93 uint use_default_engine : 1;
94 uint had_default_engines : 1;
95
96 uint validPrinter : 1;
97 uint hasCustomPageMargins : 1;
98
99 // Used to remember which properties have been manually set by the user.
100 QSet<QPrintEngine::PrintEnginePropertyKey> m_properties;
101};
102
103QT_END_NAMESPACE
104
105#endif // QT_NO_PRINTER
106
107#endif // QPRINTER_P_H
108

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