1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2016 The Qt Company Ltd. 4 ** Contact: https://www.qt.io/licensing/ 5 ** 6 ** This file is part of the QtGui module of the Qt Toolkit. 7 ** 8 ** $QT_BEGIN_LICENSE:LGPL$ 9 ** Commercial License Usage 10 ** Licensees holding valid commercial Qt licenses may use this file in 11 ** accordance with the commercial license agreement provided with the 12 ** Software or, alternatively, in accordance with the terms contained in 13 ** a written agreement between you and The Qt Company. For licensing terms 14 ** and conditions see https://www.qt.io/terms-conditions. For further 15 ** information use the contact form at https://www.qt.io/contact-us. 16 ** 17 ** GNU Lesser General Public License Usage 18 ** Alternatively, this file may be used under the terms of the GNU Lesser 19 ** General Public License version 3 as published by the Free Software 20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 ** packaging of this file. Please review the following information to 22 ** ensure the GNU Lesser General Public License version 3 requirements 23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 ** 25 ** GNU General Public License Usage 26 ** Alternatively, this file may be used under the terms of the GNU 27 ** General Public License version 2.0 or (at your option) the GNU General 28 ** Public license version 3 or any later version approved by the KDE Free 29 ** Qt Foundation. The licenses are as published by the Free Software 30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 ** included in the packaging of this file. Please review the following 32 ** information to ensure the GNU General Public License requirements will 33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 ** https://www.gnu.org/licenses/gpl-3.0.html. 35 ** 36 ** $QT_END_LICENSE$ 37 ** 38 ****************************************************************************/ 39 40 #ifndef QPAGEDPAINTDEVICE_H 41 #define QPAGEDPAINTDEVICE_H 42 43 #include <QtGui/qtguiglobal.h> 44 #include <QtGui/qpaintdevice.h> 45 #include <QtGui/qpagelayout.h> 46 47 QT_BEGIN_NAMESPACE 48 49 #if defined(B0) 50 #undef B0 // Terminal hang-up. We assume that you do not want that. 51 #endif 52 53 class QPagedPaintDevicePrivate; 54 55 class Q_GUI_EXPORT QPagedPaintDevice : public QPaintDevice 56 { 57 public: 58 QT_DEPRECATED QPagedPaintDevice(); 59 ~QPagedPaintDevice(); 60 61 virtual bool newPage() = 0; 62 63 // ### Qt6 Remove in favor of QPage::PageSize 64 // NOTE: Must keep in sync with QPageSize and QPrinter 65 enum PageSize { 66 // Existing Qt sizes 67 A4, 68 B5, 69 Letter, 70 Legal, 71 Executive, 72 A0, 73 A1, 74 A2, 75 A3, 76 A5, 77 A6, 78 A7, 79 A8, 80 A9, 81 B0, 82 B1, 83 B10, 84 B2, 85 B3, 86 B4, 87 B6, 88 B7, 89 B8, 90 B9, 91 C5E, 92 Comm10E, 93 DLE, 94 Folio, 95 Ledger, 96 Tabloid, 97 Custom, 98 99 // New values derived from PPD standard 100 A10, 101 A3Extra, 102 A4Extra, 103 A4Plus, 104 A4Small, 105 A5Extra, 106 B5Extra, 107 108 JisB0, 109 JisB1, 110 JisB2, 111 JisB3, 112 JisB4, 113 JisB5, 114 JisB6, 115 JisB7, 116 JisB8, 117 JisB9, 118 JisB10, 119 120 // AnsiA = Letter, 121 // AnsiB = Ledger, 122 AnsiC, 123 AnsiD, 124 AnsiE, 125 LegalExtra, 126 LetterExtra, 127 LetterPlus, 128 LetterSmall, 129 TabloidExtra, 130 131 ArchA, 132 ArchB, 133 ArchC, 134 ArchD, 135 ArchE, 136 137 Imperial7x9, 138 Imperial8x10, 139 Imperial9x11, 140 Imperial9x12, 141 Imperial10x11, 142 Imperial10x13, 143 Imperial10x14, 144 Imperial12x11, 145 Imperial15x11, 146 147 ExecutiveStandard, 148 Note, 149 Quarto, 150 Statement, 151 SuperA, 152 SuperB, 153 Postcard, 154 DoublePostcard, 155 Prc16K, 156 Prc32K, 157 Prc32KBig, 158 159 FanFoldUS, 160 FanFoldGerman, 161 FanFoldGermanLegal, 162 163 EnvelopeB4, 164 EnvelopeB5, 165 EnvelopeB6, 166 EnvelopeC0, 167 EnvelopeC1, 168 EnvelopeC2, 169 EnvelopeC3, 170 EnvelopeC4, 171 // EnvelopeC5 = C5E, 172 EnvelopeC6, 173 EnvelopeC65, 174 EnvelopeC7, 175 // EnvelopeDL = DLE, 176 177 Envelope9, 178 // Envelope10 = Comm10E, 179 Envelope11, 180 Envelope12, 181 Envelope14, 182 EnvelopeMonarch, 183 EnvelopePersonal, 184 185 EnvelopeChou3, 186 EnvelopeChou4, 187 EnvelopeInvite, 188 EnvelopeItalian, 189 EnvelopeKaku2, 190 EnvelopeKaku3, 191 EnvelopePrc1, 192 EnvelopePrc2, 193 EnvelopePrc3, 194 EnvelopePrc4, 195 EnvelopePrc5, 196 EnvelopePrc6, 197 EnvelopePrc7, 198 EnvelopePrc8, 199 EnvelopePrc9, 200 EnvelopePrc10, 201 EnvelopeYou4, 202 203 // Last item, with commonly used synynoms from QPagedPrintEngine / QPrinter 204 LastPageSize = EnvelopeYou4, 205 NPageSize = LastPageSize, 206 NPaperSize = LastPageSize, 207 208 // Convenience overloads for naming consistency 209 AnsiA = Letter, 210 AnsiB = Ledger, 211 EnvelopeC5 = C5E, 212 EnvelopeDL = DLE, 213 Envelope10 = Comm10E 214 }; 215 216 // keep in sync with QPdfEngine::PdfVersion! 217 enum PdfVersion { PdfVersion_1_4, PdfVersion_A1b, PdfVersion_1_6 }; 218 219 // ### Qt6 Make these virtual 220 bool setPageLayout(const QPageLayout &pageLayout); 221 bool setPageSize(const QPageSize &pageSize); 222 bool setPageOrientation(QPageLayout::Orientation orientation); 223 bool setPageMargins(const QMarginsF &margins); 224 bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units); 225 QPageLayout pageLayout() const; 226 227 #if QT_DEPRECATED_SINCE(5,15) 228 QT_DEPRECATED_VERSION_X_5_15("Use setPageSize(QPageSize) instead.") 229 virtual void setPageSize(PageSize size); 230 QT_DEPRECATED_VERSION_X_5_15("Use pageLayout().pageSize().id() instead.") 231 PageSize pageSize() const; 232 233 QT_DEPRECATED_VERSION_X_5_15("Use setPageSize(QPageSize) instead.") 234 virtual void setPageSizeMM(const QSizeF &size); 235 QT_DEPRECATED_VERSION_X_5_15("Use pageLayout().pageSize() instead.") 236 QSizeF pageSizeMM() const; 237 #endif 238 239 // ### Qt6 Remove in favor of QMarginsF 240 struct Margins { 241 qreal left; 242 qreal right; 243 qreal top; 244 qreal bottom; 245 }; 246 247 #if QT_DEPRECATED_SINCE(5,15) 248 QT_DEPRECATED_VERSION_X_5_15("Use setPageMargins(QMarginsF, QPageLayout::Unit) instead.") 249 virtual void setMargins(const Margins &margins); 250 QT_DEPRECATED_VERSION_X_5_15("Use pageLayout().margins() instead.") 251 Margins margins() const; 252 #endif 253 254 protected: 255 QPagedPaintDevice(QPagedPaintDevicePrivate *dd); 256 QPagedPaintDevicePrivate *dd(); 257 QT_DEPRECATED QPageLayout devicePageLayout() const; 258 QT_DEPRECATED QPageLayout &devicePageLayout(); 259 friend class QPagedPaintDevicePrivate; 260 QPagedPaintDevicePrivate *d; 261 }; 262 263 QT_END_NAMESPACE 264 265 #endif 266