OSDN Git Service

645f9d7cf6f7f7897431c5ef3da7416e40022ff7
[kde/Katie.git] / src / gui / painting / qprinter_p.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Copyright (C) 2016-2019 Ivailo Monev
5 **
6 ** This file is part of the QtGui module of the Katie Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** Alternatively, this file may be used under the terms of the GNU Lesser
11 ** General Public License version 2.1 or version 3 as published by the Free
12 ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
13 ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
14 ** following information to ensure the GNU Lesser General Public License
15 ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 **
18 ** As a special exception, The Qt Company gives you certain additional
19 ** rights. These rights are described in The Qt Company LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 **
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU
24 ** General Public License version 3.0 as published by the Free Software
25 ** Foundation and appearing in the file LICENSE.GPL included in the
26 ** packaging of this file.  Please review the following information to
27 ** ensure the GNU General Public License version 3.0 requirements will be
28 ** met: http://www.gnu.org/copyleft/gpl.html.
29 **
30 ** $QT_END_LICENSE$
31 **
32 ****************************************************************************/
33
34 #ifndef QPRINTER_P_H
35 #define QPRINTER_P_H
36
37 //
38 //  W A R N I N G
39 //  -------------
40 //
41 // This file is not part of the Katie API.  It exists purely as an
42 // implementation detail.  This header file may change from version to
43 // version without notice, or even be removed.
44 //
45 // We mean it.
46 //
47
48
49 #include "QtCore/qglobal.h"
50
51 #ifndef QT_NO_PRINTER
52
53 #include "QtGui/qprinter.h"
54 #include "QtGui/qprintengine.h"
55 #include "QtGui/qprintdialog.h"
56 #include "QtCore/qpointer.h"
57
58 #include <limits.h>
59
60 QT_BEGIN_NAMESPACE
61
62 class QPrintEngine;
63 class QPreviewPaintEngine;
64 class QImage;
65
66 class QPrinterPrivate
67 {
68     Q_DECLARE_PUBLIC(QPrinter)
69 public:
70     QPrinterPrivate(QPrinter *printer)
71         : printEngine(0)
72         , paintEngine(0)
73         , q_ptr(printer)
74         , options(QAbstractPrintDialog::PrintToFile | QAbstractPrintDialog::PrintPageRange |
75                 QAbstractPrintDialog::PrintCollateCopies | QAbstractPrintDialog::PrintShowPageSize)
76         , printRange(QAbstractPrintDialog::AllPages)
77         , minPage(1)
78         , maxPage(INT_MAX)
79         , fromPage(0)
80         , toPage(0)
81         , use_default_engine(true)
82         , validPrinter(false)
83         , hasCustomPageMargins(false)
84         , hasUserSetPageSize(false)
85     {
86     }
87
88     ~QPrinterPrivate() {
89
90     }
91
92     void createDefaultEngines();
93 #ifndef QT_NO_PRINTPREVIEWWIDGET
94     QList<const QImage *> previewPages() const;
95     void setPreviewMode(bool);
96 #endif
97
98     void addToManualSetList(QPrintEngine::PrintEnginePropertyKey key);
99
100     QPrinter::PrinterMode printerMode;
101     QPrinter::OutputFormat outputFormat;
102     QPrintEngine *printEngine;
103     QPaintEngine *paintEngine;
104
105     QPrintEngine *realPrintEngine;
106     QPaintEngine *realPaintEngine;
107 #ifndef QT_NO_PRINTPREVIEWWIDGET
108     QPreviewPaintEngine *previewEngine;
109 #endif
110
111     QPrinter *q_ptr;
112
113     QAbstractPrintDialog::PrintDialogOptions options;
114     QAbstractPrintDialog::PrintRange printRange;
115     int minPage, maxPage, fromPage, toPage;
116
117     uint use_default_engine : 1;
118     uint had_default_engines : 1;
119
120     uint validPrinter : 1;
121     uint hasCustomPageMargins : 1;
122     uint hasUserSetPageSize : 1;
123
124     // Used to remember which properties have been manually set by the user.
125     QList<QPrintEngine::PrintEnginePropertyKey> manualSetList;
126 };
127
128 QT_END_NAMESPACE
129
130 #endif // QT_NO_PRINTER
131
132 #endif // QPRINTER_P_H