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