]> git.saurik.com Git - wxWidgets.git/blame - src/msw/printdlg.cpp
wxSplitterWindow mouse capture improvements and cleanup.
[wxWidgets.git] / src / msw / printdlg.cpp
CommitLineData
2bda0e17 1/////////////////////////////////////////////////////////////////////////////
6d50343d 2// Name: src/msw/printdlg.cpp
2bda0e17
KB
3// Purpose: wxPrintDialog, wxPageSetupDialog
4// Author: Julian Smart
5// Modified by:
6// Created: 04/01/98
7// RCS-ID: $Id$
6c9a19aa 8// Copyright: (c) Julian Smart
65571936 9// Licence: wxWindows licence
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
103aec29
VZ
12// ===========================================================================
13// declarations
14// ===========================================================================
15
16// ---------------------------------------------------------------------------
17// headers
18// ---------------------------------------------------------------------------
19
2bda0e17 20// For compilers that support precompilation, includes "wx.h".
2bda0e17
KB
21#include "wx/wxprec.h"
22
a3b46648 23#ifdef __BORLANDC__
103aec29 24 #pragma hdrstop
2bda0e17
KB
25#endif
26
12bdd77c
JS
27// Don't use the Windows print dialog if we're in wxUniv mode and using
28// the PostScript architecture
29#if wxUSE_PRINTING_ARCHITECTURE && (!defined(__WXUNIVERSAL__) || !wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW)
f6bcfd97
BP
30
31#ifndef WX_PRECOMP
57bd4c60 32 #include "wx/msw/wrapcdlg.h"
f6bcfd97 33 #include "wx/app.h"
6d50343d 34 #include "wx/dcprint.h"
ce5d92e1 35 #include "wx/cmndata.h"
f6bcfd97
BP
36#endif
37
2bda0e17 38#include "wx/printdlg.h"
08680429 39#include "wx/msw/printdlg.h"
888dde65 40#include "wx/msw/dcprint.h"
8850cbd3 41#include "wx/paper.h"
2bda0e17 42
2bda0e17 43#include <stdlib.h>
42e69d6b 44
8850cbd3
RR
45//----------------------------------------------------------------------------
46// wxWindowsPrintNativeData
47//----------------------------------------------------------------------------
48
d021f94f
VZ
49#if wxDEBUG_LEVEL
50
8850cbd3
RR
51static wxString wxGetPrintDlgError()
52{
53 DWORD err = CommDlgExtendedError();
54 wxString msg = wxT("Unknown");
55 switch (err)
56 {
57 case CDERR_FINDRESFAILURE: msg = wxT("CDERR_FINDRESFAILURE"); break;
58 case CDERR_INITIALIZATION: msg = wxT("CDERR_INITIALIZATION"); break;
59 case CDERR_LOADRESFAILURE: msg = wxT("CDERR_LOADRESFAILURE"); break;
60 case CDERR_LOADSTRFAILURE: msg = wxT("CDERR_LOADSTRFAILURE"); break;
61 case CDERR_LOCKRESFAILURE: msg = wxT("CDERR_LOCKRESFAILURE"); break;
62 case CDERR_MEMALLOCFAILURE: msg = wxT("CDERR_MEMALLOCFAILURE"); break;
63 case CDERR_MEMLOCKFAILURE: msg = wxT("CDERR_MEMLOCKFAILURE"); break;
64 case CDERR_NOHINSTANCE: msg = wxT("CDERR_NOHINSTANCE"); break;
65 case CDERR_NOHOOK: msg = wxT("CDERR_NOHOOK"); break;
66 case CDERR_NOTEMPLATE: msg = wxT("CDERR_NOTEMPLATE"); break;
67 case CDERR_STRUCTSIZE: msg = wxT("CDERR_STRUCTSIZE"); break;
68 case PDERR_RETDEFFAILURE: msg = wxT("PDERR_RETDEFFAILURE"); break;
69 case PDERR_PRINTERNOTFOUND: msg = wxT("PDERR_PRINTERNOTFOUND"); break;
70 case PDERR_PARSEFAILURE: msg = wxT("PDERR_PARSEFAILURE"); break;
71 case PDERR_NODEVICES: msg = wxT("PDERR_NODEVICES"); break;
72 case PDERR_NODEFAULTPRN: msg = wxT("PDERR_NODEFAULTPRN"); break;
73 case PDERR_LOADDRVFAILURE: msg = wxT("PDERR_LOADDRVFAILURE"); break;
74 case PDERR_INITFAILURE: msg = wxT("PDERR_INITFAILURE"); break;
75 case PDERR_GETDEVMODEFAIL: msg = wxT("PDERR_GETDEVMODEFAIL"); break;
76 case PDERR_DNDMMISMATCH: msg = wxT("PDERR_DNDMMISMATCH"); break;
77 case PDERR_DEFAULTDIFFERENT: msg = wxT("PDERR_DEFAULTDIFFERENT"); break;
78 case PDERR_CREATEICFAILURE: msg = wxT("PDERR_CREATEICFAILURE"); break;
79 default: break;
80 }
81 return msg;
82}
8850cbd3 83
d021f94f
VZ
84#endif // wxDEBUG_LEVEL
85
86
bd84061d
VZ
87static HGLOBAL
88wxCreateDevNames(const wxString& driverName,
89 const wxString& printerName,
90 const wxString& portName)
8850cbd3
RR
91{
92 HGLOBAL hDev = NULL;
f31a4098
WS
93 // if (!driverName.empty() && !printerName.empty() && !portName.empty())
94 if (driverName.empty() && printerName.empty() && portName.empty())
8850cbd3
RR
95 {
96 }
97 else
98 {
99 hDev = GlobalAlloc(GPTR, 4*sizeof(WORD)+
6d50343d
WS
100 ( driverName.length() + 1 +
101 printerName.length() + 1 +
102 portName.length()+1 ) * sizeof(wxChar) );
8850cbd3
RR
103 LPDEVNAMES lpDev = (LPDEVNAMES)GlobalLock(hDev);
104 lpDev->wDriverOffset = sizeof(WORD) * 4 / sizeof(wxChar);
105 wxStrcpy((wxChar*)lpDev + lpDev->wDriverOffset, driverName);
106
107 lpDev->wDeviceOffset = (WORD)( lpDev->wDriverOffset +
6d50343d 108 driverName.length() + 1 );
8850cbd3
RR
109 wxStrcpy((wxChar*)lpDev + lpDev->wDeviceOffset, printerName);
110
111 lpDev->wOutputOffset = (WORD)( lpDev->wDeviceOffset +
6d50343d 112 printerName.length() + 1 );
8850cbd3
RR
113 wxStrcpy((wxChar*)lpDev + lpDev->wOutputOffset, portName);
114
115 lpDev->wDefault = 0;
116
117 GlobalUnlock(hDev);
118 }
119
120 return hDev;
121}
122
123IMPLEMENT_CLASS(wxWindowsPrintNativeData, wxPrintNativeDataBase)
124
125wxWindowsPrintNativeData::wxWindowsPrintNativeData()
126{
dca0f651
VZ
127 m_devMode = NULL;
128 m_devNames = NULL;
3168b4c3 129 m_customWindowsPaperId = 0;
8850cbd3
RR
130}
131
132wxWindowsPrintNativeData::~wxWindowsPrintNativeData()
133{
dca0f651 134 if ( m_devMode )
5c33522f 135 ::GlobalFree(static_cast<HGLOBAL>(m_devMode));
dca0f651
VZ
136
137 if ( m_devNames )
5c33522f 138 ::GlobalFree(static_cast<HGLOBAL>(m_devNames));
8850cbd3
RR
139}
140
b7cacb43 141bool wxWindowsPrintNativeData::IsOk() const
8850cbd3
RR
142{
143 return (m_devMode != NULL) ;
144}
145
fd64de59 146bool wxWindowsPrintNativeData::TransferTo( wxPrintData &data )
8850cbd3 147{
dca0f651 148 if ( !m_devMode )
8850cbd3 149 return false;
8850cbd3 150
dca0f651 151 GlobalPtrLock lockDevMode(m_devMode);
8850cbd3 152
5c33522f 153 LPDEVMODE devMode = static_cast<LPDEVMODE>(lockDevMode.Get());
8850cbd3 154
dca0f651
VZ
155 //// Orientation
156 if (devMode->dmFields & DM_ORIENTATION)
157 data.SetOrientation( devMode->dmOrientation );
8850cbd3 158
dca0f651
VZ
159 //// Collation
160 if (devMode->dmFields & DM_COLLATE)
161 {
162 if (devMode->dmCollate == DMCOLLATE_TRUE)
163 data.SetCollate( true );
8850cbd3 164 else
dca0f651
VZ
165 data.SetCollate( false );
166 }
167
168 //// Number of copies
169 if (devMode->dmFields & DM_COPIES)
170 data.SetNoCopies( devMode->dmCopies );
171
172 //// Bin
173 if (devMode->dmFields & DM_DEFAULTSOURCE) {
174 switch (devMode->dmDefaultSource) {
175 case DMBIN_ONLYONE : data.SetBin(wxPRINTBIN_ONLYONE ); break;
176 case DMBIN_LOWER : data.SetBin(wxPRINTBIN_LOWER ); break;
177 case DMBIN_MIDDLE : data.SetBin(wxPRINTBIN_MIDDLE ); break;
178 case DMBIN_MANUAL : data.SetBin(wxPRINTBIN_MANUAL ); break;
179 case DMBIN_ENVELOPE : data.SetBin(wxPRINTBIN_ENVELOPE ); break;
180 case DMBIN_ENVMANUAL : data.SetBin(wxPRINTBIN_ENVMANUAL ); break;
181 case DMBIN_AUTO : data.SetBin(wxPRINTBIN_AUTO ); break;
182 case DMBIN_TRACTOR : data.SetBin(wxPRINTBIN_TRACTOR ); break;
183 case DMBIN_SMALLFMT : data.SetBin(wxPRINTBIN_SMALLFMT ); break;
184 case DMBIN_LARGEFMT : data.SetBin(wxPRINTBIN_LARGEFMT ); break;
185 case DMBIN_LARGECAPACITY : data.SetBin(wxPRINTBIN_LARGECAPACITY ); break;
186 case DMBIN_CASSETTE : data.SetBin(wxPRINTBIN_CASSETTE ); break;
187 case DMBIN_FORMSOURCE : data.SetBin(wxPRINTBIN_FORMSOURCE ); break;
188 default:
bd84061d 189 if (devMode->dmDefaultSource >= DMBIN_USER)
dca0f651 190 data.SetBin((wxPrintBin)((devMode->dmDefaultSource)-DMBIN_USER+(int)wxPRINTBIN_USER));
bd84061d 191 else
dca0f651 192 data.SetBin(wxPRINTBIN_DEFAULT);
dca0f651
VZ
193 }
194 } else {
195 data.SetBin(wxPRINTBIN_DEFAULT);
196 }
197 if (devMode->dmFields & DM_MEDIATYPE)
198 {
199 wxASSERT( (int)devMode->dmMediaType != wxPRINTMEDIA_DEFAULT );
200 data.SetMedia(devMode->dmMediaType);
201 }
202 //// Printer name
203 if (devMode->dmDeviceName[0] != 0)
204 // This syntax fixes a crash when using VS 7.1
205 data.SetPrinterName( wxString(devMode->dmDeviceName, CCHDEVICENAME) );
206
207 //// Colour
208 if (devMode->dmFields & DM_COLOR)
209 {
210 if (devMode->dmColor == DMCOLOR_COLOR)
8850cbd3 211 data.SetColour( true );
dca0f651
VZ
212 else
213 data.SetColour( false );
214 }
215 else
216 data.SetColour( true );
8850cbd3 217
dca0f651 218 //// Paper size
8850cbd3 219
dca0f651
VZ
220 // We don't know size of user defined paper and some buggy drivers
221 // set both DM_PAPERSIZE and DM_PAPERWIDTH & DM_PAPERLENGTH. Since
222 // dmPaperSize >= DMPAPER_USER wouldn't be in wxWin's database, this
223 // code wouldn't set m_paperSize correctly.
21c358b2 224
dca0f651
VZ
225 bool foundPaperSize = false;
226 if ((devMode->dmFields & DM_PAPERSIZE) && (devMode->dmPaperSize < DMPAPER_USER))
227 {
228 if (wxThePrintPaperDatabase)
8850cbd3 229 {
dca0f651
VZ
230 wxPrintPaperType* paper = wxThePrintPaperDatabase->FindPaperTypeByPlatformId(devMode->dmPaperSize);
231 if (paper)
8850cbd3 232 {
dca0f651
VZ
233 data.SetPaperId( paper->GetId() );
234 data.SetPaperSize( wxSize(paper->GetWidth() / 10,paper->GetHeight() / 10) );
3168b4c3 235 m_customWindowsPaperId = 0;
dca0f651 236 foundPaperSize = true;
8850cbd3
RR
237 }
238 }
dca0f651
VZ
239 else
240 {
241 // Shouldn't really get here
242 wxFAIL_MSG(wxT("Paper database wasn't initialized in wxPrintData::ConvertFromNative."));
243 data.SetPaperId( wxPAPER_NONE );
244 data.SetPaperSize( wxSize(0,0) );
245 m_customWindowsPaperId = 0;
3168b4c3 246
dca0f651 247 return false;
8850cbd3 248 }
dca0f651 249 }
8850cbd3 250
dca0f651
VZ
251 if (!foundPaperSize) {
252 if ((devMode->dmFields & DM_PAPERWIDTH) && (devMode->dmFields & DM_PAPERLENGTH))
8850cbd3 253 {
dca0f651
VZ
254 // DEVMODE is in tenths of a millimeter
255 data.SetPaperSize( wxSize(devMode->dmPaperWidth / 10, devMode->dmPaperLength / 10) );
256 data.SetPaperId( wxPAPER_NONE );
257 m_customWindowsPaperId = devMode->dmPaperSize;
8850cbd3
RR
258 }
259 else
dca0f651
VZ
260 {
261 // Often will reach this for non-standard paper sizes (sizes which
262 // wouldn't be in wxWidget's paper database). Setting
263 // m_customWindowsPaperId to devMode->dmPaperSize should be enough
264 // to get this paper size working.
265 data.SetPaperSize( wxSize(0,0) );
266 data.SetPaperId( wxPAPER_NONE );
267 m_customWindowsPaperId = devMode->dmPaperSize;
268 }
269 }
8850cbd3 270
dca0f651
VZ
271 //// Duplex
272
273 if (devMode->dmFields & DM_DUPLEX)
274 {
275 switch (devMode->dmDuplex)
276 {
277 case DMDUP_HORIZONTAL: data.SetDuplex( wxDUPLEX_HORIZONTAL ); break;
278 case DMDUP_VERTICAL: data.SetDuplex( wxDUPLEX_VERTICAL ); break;
279 default:
280 case DMDUP_SIMPLEX: data.SetDuplex( wxDUPLEX_SIMPLEX ); break;
281 }
282 }
283 else
284 data.SetDuplex( wxDUPLEX_SIMPLEX );
8850cbd3 285
dca0f651
VZ
286 //// Quality
287
288 if (devMode->dmFields & DM_PRINTQUALITY)
289 {
290 switch (devMode->dmPrintQuality)
8850cbd3 291 {
dca0f651
VZ
292 case DMRES_MEDIUM: data.SetQuality( wxPRINT_QUALITY_MEDIUM ); break;
293 case DMRES_LOW: data.SetQuality( wxPRINT_QUALITY_LOW ); break;
294 case DMRES_DRAFT: data.SetQuality( wxPRINT_QUALITY_DRAFT ); break;
295 case DMRES_HIGH: data.SetQuality( wxPRINT_QUALITY_HIGH ); break;
296 default:
8850cbd3 297 {
dca0f651
VZ
298 // TODO: if the printer fills in the resolution in DPI, how
299 // will the application know if it's high, low, draft etc.??
300 // wxFAIL_MSG("Warning: DM_PRINTQUALITY was not one of the standard values.");
301 data.SetQuality( devMode->dmPrintQuality );
302 break;
8850cbd3 303
8850cbd3
RR
304 }
305 }
8850cbd3 306 }
dca0f651
VZ
307 else
308 data.SetQuality( wxPRINT_QUALITY_HIGH );
309
310 if (devMode->dmDriverExtra > 0)
311 data.SetPrivData( (char *)devMode+devMode->dmSize, devMode->dmDriverExtra );
312 else
313 data.SetPrivData( NULL, 0 );
8850cbd3 314
dca0f651 315 if ( m_devNames )
8850cbd3 316 {
dca0f651 317 GlobalPtrLock lockDevNames(m_devNames);
5c33522f 318 LPDEVNAMES lpDevNames = static_cast<LPDEVNAMES>(lockDevNames.Get());
8850cbd3 319
dca0f651 320 // TODO: Unicode-ification
8850cbd3 321
dca0f651
VZ
322 // Get the port name
323 // port is obsolete in WIN32
324 // m_printData.SetPortName((LPSTR)lpDevNames + lpDevNames->wDriverOffset);
8850cbd3 325
dca0f651
VZ
326 // Get the printer name
327 wxString printerName = (LPTSTR)lpDevNames + lpDevNames->wDeviceOffset;
8850cbd3 328
dca0f651
VZ
329 // Not sure if we should check for this mismatch
330// wxASSERT_MSG( (m_printerName.empty() || (devName == m_printerName)), "Printer name obtained from DEVMODE and DEVNAMES were different!");
8850cbd3 331
dca0f651
VZ
332 if (!printerName.empty())
333 data.SetPrinterName( printerName );
8850cbd3 334 }
f31a4098 335
8850cbd3
RR
336 return true;
337}
338
fd64de59 339bool wxWindowsPrintNativeData::TransferFrom( const wxPrintData &data )
8850cbd3 340{
5c33522f 341 HGLOBAL hDevMode = static_cast<HGLOBAL>(m_devMode);
dca0f651 342 if ( !m_devMode )
8850cbd3
RR
343 {
344 // Use PRINTDLG as a way of creating a DEVMODE object
345 PRINTDLG pd;
346
8850cbd3
RR
347 memset(&pd, 0, sizeof(PRINTDLG));
348#ifdef __WXWINCE__
349 pd.cbStruct = sizeof(PRINTDLG);
350#else
351 pd.lStructSize = sizeof(PRINTDLG);
8850cbd3
RR
352#endif
353
bd84061d 354 pd.hwndOwner = NULL;
8850cbd3
RR
355 pd.hDevMode = NULL; // Will be created by PrintDlg
356 pd.hDevNames = NULL; // Ditto
8850cbd3
RR
357
358 pd.Flags = PD_RETURNDEFAULT;
359 pd.nCopies = 1;
360
361 // Fill out the DEVMODE structure
362 // so we can use it as input in the 'real' PrintDlg
363 if (!PrintDlg(&pd))
364 {
365 if ( pd.hDevMode )
366 GlobalFree(pd.hDevMode);
367 if ( pd.hDevNames )
368 GlobalFree(pd.hDevNames);
369 pd.hDevMode = NULL;
370 pd.hDevNames = NULL;
371
113f4def 372#if wxDEBUG_LEVEL
4b6a582b 373 wxLogDebug(wxT("Printing error: ") + wxGetPrintDlgError());
d021f94f 374#endif // wxDEBUG_LEVEL
8850cbd3
RR
375 }
376 else
377 {
378 hDevMode = pd.hDevMode;
dca0f651 379 m_devMode = hDevMode;
8850cbd3
RR
380 pd.hDevMode = NULL;
381
382 // We'll create a new DEVNAMEs structure below.
383 if ( pd.hDevNames )
384 GlobalFree(pd.hDevNames);
385 pd.hDevNames = NULL;
386
387 // hDevNames = pd->hDevNames;
388 // m_devNames = (void*)(long) hDevNames;
389 // pd->hDevnames = NULL;
390
391 }
392 }
393
394 if ( hDevMode )
395 {
dca0f651 396 GlobalPtrLock lockDevMode(hDevMode);
5c33522f 397 DEVMODE * const devMode = static_cast<DEVMODE *>(lockDevMode.Get());
8850cbd3
RR
398
399 //// Orientation
400 devMode->dmOrientation = (short)data.GetOrientation();
401
402 //// Collation
403 devMode->dmCollate = (data.GetCollate() ? DMCOLLATE_TRUE : DMCOLLATE_FALSE);
404 devMode->dmFields |= DM_COLLATE;
405
406 //// Number of copies
407 devMode->dmCopies = (short)data.GetNoCopies();
408 devMode->dmFields |= DM_COPIES;
409
410 //// Printer name
411 wxString name = data.GetPrinterName();
f31a4098 412 if (!name.empty())
8850cbd3 413 {
47af39fb
VZ
414 // NB: the cast is needed in the ANSI build, strangely enough
415 // dmDeviceName is BYTE[] and not char[] there
e408bf52 416 wxStrlcpy(reinterpret_cast<wxChar *>(devMode->dmDeviceName),
47af39fb 417 name.wx_str(),
e408bf52 418 WXSIZEOF(devMode->dmDeviceName));
8850cbd3
RR
419 }
420
421 //// Colour
422 if (data.GetColour())
423 devMode->dmColor = DMCOLOR_COLOR;
424 else
425 devMode->dmColor = DMCOLOR_MONOCHROME;
426 devMode->dmFields |= DM_COLOR;
427
428 //// Paper size
d5eaa19f
VZ
429
430 // Paper id has priority over paper size. If id is specified, then size
431 // is ignored (as it can be filled in even for standard paper sizes)
432
433 wxPrintPaperType *paperType = NULL;
434
435 const wxPaperSize paperId = data.GetPaperId();
436 if ( paperId != wxPAPER_NONE && wxThePrintPaperDatabase )
8850cbd3 437 {
d5eaa19f 438 paperType = wxThePrintPaperDatabase->FindPaperType(paperId);
8850cbd3 439 }
d5eaa19f
VZ
440
441 if ( paperType )
8850cbd3 442 {
d5eaa19f
VZ
443 devMode->dmPaperSize = (short)paperType->GetPlatformId();
444 devMode->dmFields |= DM_PAPERSIZE;
445 }
446 else // custom (or no) paper size
447 {
448 const wxSize paperSize = data.GetPaperSize();
449 if ( paperSize != wxDefaultSize )
8850cbd3 450 {
d5eaa19f
VZ
451 // Fall back on specifying the paper size explicitly
452 if(m_customWindowsPaperId != 0)
453 devMode->dmPaperSize = m_customWindowsPaperId;
21c358b2 454 else
21c358b2 455 devMode->dmPaperSize = DMPAPER_USER;
d5eaa19f
VZ
456 devMode->dmPaperWidth = (short)(paperSize.x * 10);
457 devMode->dmPaperLength = (short)(paperSize.y * 10);
458 devMode->dmFields |= DM_PAPERWIDTH;
459 devMode->dmFields |= DM_PAPERLENGTH;
3c46da42
JS
460
461 // A printer driver may or may not also want DM_PAPERSIZE to
462 // be specified. Also, if the printer driver doesn't implement the DMPAPER_USER
463 // size, then this won't work, and even if you found the correct id by
464 // enumerating the driver's paper sizes, it probably won't change the actual size,
465 // it'll just select that custom paper type with its own current setting.
466 // For a discussion on this, see http://www.codeguru.com/forum/showthread.php?threadid=458617
467 // Although m_customWindowsPaperId is intended to work around this, it's
468 // unclear how it can help you set the custom paper size programmatically.
8850cbd3 469 }
d5eaa19f
VZ
470 //else: neither paper type nor size specified, don't fill DEVMODE
471 // at all so that the system defaults are used
8850cbd3
RR
472 }
473
474 //// Duplex
475 short duplex;
476 switch (data.GetDuplex())
477 {
478 case wxDUPLEX_HORIZONTAL:
479 duplex = DMDUP_HORIZONTAL;
480 break;
481 case wxDUPLEX_VERTICAL:
482 duplex = DMDUP_VERTICAL;
483 break;
484 default:
485 // in fact case wxDUPLEX_SIMPLEX:
486 duplex = DMDUP_SIMPLEX;
487 break;
488 }
489 devMode->dmDuplex = duplex;
490 devMode->dmFields |= DM_DUPLEX;
491
492 //// Quality
493
494 short quality;
495 switch (data.GetQuality())
496 {
497 case wxPRINT_QUALITY_MEDIUM:
498 quality = DMRES_MEDIUM;
499 break;
500 case wxPRINT_QUALITY_LOW:
501 quality = DMRES_LOW;
502 break;
503 case wxPRINT_QUALITY_DRAFT:
504 quality = DMRES_DRAFT;
505 break;
506 case wxPRINT_QUALITY_HIGH:
507 quality = DMRES_HIGH;
508 break;
509 default:
510 quality = (short)data.GetQuality();
511 break;
512 }
513 devMode->dmPrintQuality = quality;
514 devMode->dmFields |= DM_PRINTQUALITY;
4e22a1f2 515
aa96f01c
RR
516 if (data.GetPrivDataLen() > 0)
517 {
518 memcpy( (char *)devMode+devMode->dmSize, data.GetPrivData(), data.GetPrivDataLen() );
4e22a1f2 519 devMode->dmDriverExtra = (WXWORD)data.GetPrivDataLen();
aa96f01c 520 }
8850cbd3
RR
521
522 if (data.GetBin() != wxPRINTBIN_DEFAULT)
523 {
524 switch (data.GetBin())
525 {
526 case wxPRINTBIN_ONLYONE: devMode->dmDefaultSource = DMBIN_ONLYONE; break;
527 case wxPRINTBIN_LOWER: devMode->dmDefaultSource = DMBIN_LOWER; break;
528 case wxPRINTBIN_MIDDLE: devMode->dmDefaultSource = DMBIN_MIDDLE; break;
529 case wxPRINTBIN_MANUAL: devMode->dmDefaultSource = DMBIN_MANUAL; break;
530 case wxPRINTBIN_ENVELOPE: devMode->dmDefaultSource = DMBIN_ENVELOPE; break;
531 case wxPRINTBIN_ENVMANUAL: devMode->dmDefaultSource = DMBIN_ENVMANUAL; break;
532 case wxPRINTBIN_AUTO: devMode->dmDefaultSource = DMBIN_AUTO; break;
533 case wxPRINTBIN_TRACTOR: devMode->dmDefaultSource = DMBIN_TRACTOR; break;
534 case wxPRINTBIN_SMALLFMT: devMode->dmDefaultSource = DMBIN_SMALLFMT; break;
535 case wxPRINTBIN_LARGEFMT: devMode->dmDefaultSource = DMBIN_LARGEFMT; break;
536 case wxPRINTBIN_LARGECAPACITY: devMode->dmDefaultSource = DMBIN_LARGECAPACITY; break;
537 case wxPRINTBIN_CASSETTE: devMode->dmDefaultSource = DMBIN_CASSETTE; break;
538 case wxPRINTBIN_FORMSOURCE: devMode->dmDefaultSource = DMBIN_FORMSOURCE; break;
539
540 default:
fde05480 541 devMode->dmDefaultSource = (short)(DMBIN_USER + data.GetBin() - wxPRINTBIN_USER); // 256 + data.GetBin() - 14 = 242 + data.GetBin()
8850cbd3
RR
542 break;
543 }
544
545 devMode->dmFields |= DM_DEFAULTSOURCE;
546 }
781609f2
JS
547 if (data.GetMedia() != wxPRINTMEDIA_DEFAULT)
548 {
549 devMode->dmMediaType = data.GetMedia();
550 devMode->dmFields |= DM_MEDIATYPE;
551 }
8850cbd3
RR
552 }
553
dca0f651 554 if ( m_devNames )
8850cbd3 555 {
5c33522f 556 ::GlobalFree(static_cast<HGLOBAL>(m_devNames));
8850cbd3
RR
557 }
558
559 // TODO: I hope it's OK to pass some empty strings to DEVNAMES.
dca0f651 560 m_devNames = wxCreateDevNames(wxEmptyString, data.GetPrinterName(), wxEmptyString);
f31a4098 561
8850cbd3
RR
562 return true;
563}
f31a4098 564
103aec29
VZ
565// ---------------------------------------------------------------------------
566// wxPrintDialog
567// ---------------------------------------------------------------------------
568
c061373d 569IMPLEMENT_CLASS(wxWindowsPrintDialog, wxPrintDialogBase)
2bda0e17 570
c061373d 571wxWindowsPrintDialog::wxWindowsPrintDialog(wxWindow *p, wxPrintDialogData* data)
2bda0e17 572{
7bcb11d3 573 Create(p, data);
2bda0e17
KB
574}
575
c061373d 576wxWindowsPrintDialog::wxWindowsPrintDialog(wxWindow *p, wxPrintData* data)
103aec29
VZ
577{
578 wxPrintDialogData data2;
579 if ( data )
580 data2 = *data;
581
582 Create(p, &data2);
583}
584
c061373d 585bool wxWindowsPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
2bda0e17 586{
7bcb11d3
JS
587 m_dialogParent = p;
588 m_printerDC = NULL;
078cf5cb 589 m_destroyDC = true;
7bcb11d3 590
93c2f401
RR
591 // MSW handle
592 m_printDlg = NULL;
f31a4098 593
7bcb11d3
JS
594 if ( data )
595 m_printDialogData = *data;
103aec29 596
078cf5cb 597 return true;
2bda0e17
KB
598}
599
c061373d 600wxWindowsPrintDialog::~wxWindowsPrintDialog()
2bda0e17 601{
93c2f401
RR
602 PRINTDLG *pd = (PRINTDLG *) m_printDlg;
603 if (pd && pd->hDevMode)
604 GlobalFree(pd->hDevMode);
605 if ( pd )
606 delete pd;
607
7bcb11d3
JS
608 if (m_destroyDC && m_printerDC)
609 delete m_printerDC;
2bda0e17
KB
610}
611
c061373d 612int wxWindowsPrintDialog::ShowModal()
2bda0e17 613{
93c2f401 614 ConvertToNative( m_printDialogData );
103aec29 615
93c2f401 616 PRINTDLG *pd = (PRINTDLG*) m_printDlg;
f31a4098 617
f6bcfd97 618 if (m_dialogParent)
93c2f401 619 pd->hwndOwner = (HWND) m_dialogParent->GetHWND();
f6bcfd97 620 else if (wxTheApp->GetTopWindow())
93c2f401 621 pd->hwndOwner = (HWND) wxTheApp->GetTopWindow()->GetHWND();
f6bcfd97 622 else
93c2f401 623 pd->hwndOwner = 0;
f6bcfd97 624
93c2f401 625 bool ret = (PrintDlg( pd ) != 0);
f6bcfd97 626
93c2f401 627 pd->hwndOwner = 0;
f6bcfd97 628
d0ee33f5 629 if ( ret && (pd->hDC) )
7bcb11d3 630 {
888dde65 631 wxPrinterDC *pdc = new wxPrinterDCFromHDC( (WXHDC) pd->hDC );
7bcb11d3 632 m_printerDC = pdc;
93c2f401 633 ConvertFromNative( m_printDialogData );
7bcb11d3
JS
634 return wxID_OK;
635 }
636 else
637 {
7bcb11d3
JS
638 return wxID_CANCEL;
639 }
2bda0e17
KB
640}
641
c061373d 642wxDC *wxWindowsPrintDialog::GetPrintDC()
2bda0e17 643{
7bcb11d3
JS
644 if (m_printerDC)
645 {
078cf5cb 646 m_destroyDC = false;
7bcb11d3
JS
647 return m_printerDC;
648 }
649 else
bd84061d 650 return NULL;
2bda0e17
KB
651}
652
93c2f401
RR
653bool wxWindowsPrintDialog::ConvertToNative( wxPrintDialogData &data )
654{
655 wxWindowsPrintNativeData *native_data =
656 (wxWindowsPrintNativeData *) data.GetPrintData().GetNativeData();
657 data.GetPrintData().ConvertToNative();
f31a4098 658
93c2f401
RR
659 PRINTDLG *pd = (PRINTDLG*) m_printDlg;
660
661 // Shouldn't have been defined anywhere
662 if (pd)
663 return false;
f31a4098 664
93c2f401
RR
665 pd = new PRINTDLG;
666 memset( pd, 0, sizeof(PRINTDLG) );
667 m_printDlg = (void*) pd;
668
93c2f401 669 pd->lStructSize = sizeof(PRINTDLG);
bd84061d 670 pd->hwndOwner = NULL;
93c2f401
RR
671 pd->hDevMode = NULL; // Will be created by PrintDlg
672 pd->hDevNames = NULL; // Ditto
673
674 pd->Flags = PD_RETURNDEFAULT;
675 pd->nCopies = 1;
f31a4098 676
93c2f401
RR
677 // Pass the devmode data to the PRINTDLG structure, since it'll
678 // be needed when PrintDlg is called.
679 if (pd->hDevMode)
680 GlobalFree(pd->hDevMode);
681
682 // Pass the devnames data to the PRINTDLG structure, since it'll
683 // be needed when PrintDlg is called.
684 if (pd->hDevNames)
685 GlobalFree(pd->hDevNames);
686
5c33522f 687 pd->hDevMode = static_cast<HGLOBAL>(native_data->GetDevMode());
dca0f651 688 native_data->SetDevMode(NULL);
93c2f401
RR
689
690 // Shouldn't assert; we should be able to test Ok-ness at a higher level
691 //wxASSERT_MSG( (pd->hDevMode), wxT("hDevMode must be non-NULL in ConvertToNative!"));
692
5c33522f 693 pd->hDevNames = static_cast<HGLOBAL>(native_data->GetDevNames());
dca0f651 694 native_data->SetDevNames(NULL);
93c2f401
RR
695
696
bd84061d 697 pd->hDC = NULL;
93c2f401
RR
698 pd->nFromPage = (WORD)data.GetFromPage();
699 pd->nToPage = (WORD)data.GetToPage();
700 pd->nMinPage = (WORD)data.GetMinPage();
701 pd->nMaxPage = (WORD)data.GetMaxPage();
702 pd->nCopies = (WORD)data.GetNoCopies();
703
704 pd->Flags = PD_RETURNDC;
93c2f401 705 pd->lStructSize = sizeof( PRINTDLG );
93c2f401 706
bd84061d
VZ
707 pd->hwndOwner = NULL;
708 pd->hInstance = NULL;
312242ea 709 pd->lCustData = 0;
93c2f401
RR
710 pd->lpfnPrintHook = NULL;
711 pd->lpfnSetupHook = NULL;
712 pd->lpPrintTemplateName = NULL;
713 pd->lpSetupTemplateName = NULL;
bd84061d
VZ
714 pd->hPrintTemplate = NULL;
715 pd->hSetupTemplate = NULL;
93c2f401
RR
716
717 if ( data.GetAllPages() )
718 pd->Flags |= PD_ALLPAGES;
719 if ( data.GetSelection() )
720 pd->Flags |= PD_SELECTION;
721 if ( data.GetCollate() )
722 pd->Flags |= PD_COLLATE;
723 if ( data.GetPrintToFile() )
724 pd->Flags |= PD_PRINTTOFILE;
725 if ( !data.GetEnablePrintToFile() )
726 pd->Flags |= PD_DISABLEPRINTTOFILE;
727 if ( !data.GetEnableSelection() )
728 pd->Flags |= PD_NOSELECTION;
729 if ( !data.GetEnablePageNumbers() )
730 pd->Flags |= PD_NOPAGENUMS;
731 else if ( (!data.GetAllPages()) && (!data.GetSelection()) && (data.GetFromPage() != 0) && (data.GetToPage() != 0))
732 pd->Flags |= PD_PAGENUMS;
733 if ( data.GetEnableHelp() )
734 pd->Flags |= PD_SHOWHELP;
f31a4098 735
93c2f401
RR
736 return true;
737}
738
739bool wxWindowsPrintDialog::ConvertFromNative( wxPrintDialogData &data )
740{
741 PRINTDLG *pd = (PRINTDLG*) m_printDlg;
742 if ( pd == NULL )
743 return false;
744
745 wxWindowsPrintNativeData *native_data =
746 (wxWindowsPrintNativeData *) data.GetPrintData().GetNativeData();
f31a4098 747
93c2f401
RR
748 // Pass the devmode data back to the wxPrintData structure where it really belongs.
749 if (pd->hDevMode)
750 {
751 if (native_data->GetDevMode())
752 {
5c33522f 753 ::GlobalFree(static_cast<HGLOBAL>(native_data->GetDevMode()));
93c2f401 754 }
dca0f651 755 native_data->SetDevMode(pd->hDevMode);
93c2f401
RR
756 pd->hDevMode = NULL;
757 }
758
759 // Pass the devnames data back to the wxPrintData structure where it really belongs.
760 if (pd->hDevNames)
761 {
762 if (native_data->GetDevNames())
763 {
5c33522f 764 ::GlobalFree(static_cast<HGLOBAL>(native_data->GetDevNames()));
93c2f401 765 }
dca0f651 766 native_data->SetDevNames(pd->hDevNames);
93c2f401
RR
767 pd->hDevNames = NULL;
768 }
769
770 // Now convert the DEVMODE object, passed down from the PRINTDLG object,
771 // into wxWidgets form.
772 native_data->TransferTo( data.GetPrintData() );
773
774 data.SetFromPage( pd->nFromPage );
775 data.SetToPage( pd->nToPage );
776 data.SetMinPage( pd->nMinPage );
777 data.SetMaxPage( pd->nMaxPage );
778 data.SetNoCopies( pd->nCopies );
779
780 data.SetAllPages( (((pd->Flags & PD_PAGENUMS) != PD_PAGENUMS) && ((pd->Flags & PD_SELECTION) != PD_SELECTION)) );
781 data.SetSelection( ((pd->Flags & PD_SELECTION) == PD_SELECTION) );
782 data.SetCollate( ((pd->Flags & PD_COLLATE) == PD_COLLATE) );
783 data.SetPrintToFile( ((pd->Flags & PD_PRINTTOFILE) == PD_PRINTTOFILE) );
784 data.EnablePrintToFile( ((pd->Flags & PD_DISABLEPRINTTOFILE) != PD_DISABLEPRINTTOFILE) );
785 data.EnableSelection( ((pd->Flags & PD_NOSELECTION) != PD_NOSELECTION) );
786 data.EnablePageNumbers( ((pd->Flags & PD_NOPAGENUMS) != PD_NOPAGENUMS) );
787 data.EnableHelp( ((pd->Flags & PD_SHOWHELP) == PD_SHOWHELP) );
c1dc9f83 788
93c2f401
RR
789 return true;
790}
791
103aec29 792// ---------------------------------------------------------------------------
08680429 793// wxWidnowsPageSetupDialog
103aec29 794// ---------------------------------------------------------------------------
2bda0e17 795
08680429 796IMPLEMENT_CLASS(wxWindowsPageSetupDialog, wxPageSetupDialogBase)
c061373d 797
08680429 798wxWindowsPageSetupDialog::wxWindowsPageSetupDialog()
2bda0e17 799{
7bcb11d3 800 m_dialogParent = NULL;
b45dfd0a 801 m_pageDlg = NULL;
2bda0e17
KB
802}
803
08680429 804wxWindowsPageSetupDialog::wxWindowsPageSetupDialog(wxWindow *p, wxPageSetupDialogData *data)
2bda0e17 805{
7bcb11d3 806 Create(p, data);
2bda0e17
KB
807}
808
08680429 809bool wxWindowsPageSetupDialog::Create(wxWindow *p, wxPageSetupDialogData *data)
2bda0e17 810{
7bcb11d3 811 m_dialogParent = p;
b45dfd0a 812 m_pageDlg = NULL;
103aec29 813
7bcb11d3
JS
814 if (data)
815 m_pageSetupData = (*data);
103aec29 816
078cf5cb 817 return true;
2bda0e17
KB
818}
819
08680429 820wxWindowsPageSetupDialog::~wxWindowsPageSetupDialog()
2bda0e17 821{
b45dfd0a
RR
822 PAGESETUPDLG *pd = (PAGESETUPDLG *)m_pageDlg;
823 if ( pd && pd->hDevMode )
824 GlobalFree(pd->hDevMode);
825 if ( pd && pd->hDevNames )
826 GlobalFree(pd->hDevNames);
827 if ( pd )
828 delete pd;
2bda0e17
KB
829}
830
08680429 831int wxWindowsPageSetupDialog::ShowModal()
2bda0e17 832{
b45dfd0a 833 ConvertToNative( m_pageSetupData );
f31a4098 834
b45dfd0a 835 PAGESETUPDLG *pd = (PAGESETUPDLG *) m_pageDlg;
f6bcfd97 836 if (m_dialogParent)
b45dfd0a 837 pd->hwndOwner = (HWND) m_dialogParent->GetHWND();
f6bcfd97 838 else if (wxTheApp->GetTopWindow())
b45dfd0a 839 pd->hwndOwner = (HWND) wxTheApp->GetTopWindow()->GetHWND();
f6bcfd97 840 else
b45dfd0a
RR
841 pd->hwndOwner = 0;
842 BOOL retVal = PageSetupDlg( pd ) ;
843 pd->hwndOwner = 0;
f6bcfd97 844 if (retVal)
2bda0e17 845 {
b45dfd0a 846 ConvertFromNative( m_pageSetupData );
7bcb11d3 847 return wxID_OK;
2bda0e17
KB
848 }
849 else
7bcb11d3 850 return wxID_CANCEL;
b45dfd0a
RR
851}
852
08680429 853bool wxWindowsPageSetupDialog::ConvertToNative( wxPageSetupDialogData &data )
b45dfd0a
RR
854{
855 wxWindowsPrintNativeData *native_data =
856 (wxWindowsPrintNativeData *) data.GetPrintData().GetNativeData();
857 data.GetPrintData().ConvertToNative();
858
859 PAGESETUPDLG *pd = (PAGESETUPDLG*) m_pageDlg;
860
861 // Shouldn't have been defined anywhere
862 if (pd)
863 return false;
f31a4098 864
b45dfd0a
RR
865 pd = new PAGESETUPDLG;
866 pd->hDevMode = NULL;
867 pd->hDevNames = NULL;
868 m_pageDlg = (void *)pd;
869
870 // Pass the devmode data (created in m_printData.ConvertToNative)
871 // to the PRINTDLG structure, since it'll
872 // be needed when PrintDlg is called.
873
874 if (pd->hDevMode)
875 {
876 GlobalFree(pd->hDevMode);
877 pd->hDevMode = NULL;
878 }
879 pd->hDevMode = (HGLOBAL) native_data->GetDevMode();
bd84061d 880 native_data->SetDevMode(NULL);
b45dfd0a
RR
881
882 // Shouldn't assert; we should be able to test Ok-ness at a higher level
883 //wxASSERT_MSG( (pd->hDevMode), wxT("hDevMode must be non-NULL in ConvertToNative!"));
884
885 // Pass the devnames data (created in m_printData.ConvertToNative)
886 // to the PRINTDLG structure, since it'll
887 // be needed when PrintDlg is called.
888
889 if (pd->hDevNames)
890 {
891 GlobalFree(pd->hDevNames);
892 pd->hDevNames = NULL;
893 }
894 pd->hDevNames = (HGLOBAL) native_data->GetDevNames();
bd84061d 895 native_data->SetDevNames(NULL);
b45dfd0a
RR
896
897// pd->hDevMode = GlobalAlloc(GMEM_MOVEABLE, sizeof(DEVMODE));
898
899 pd->Flags = PSD_MARGINS|PSD_MINMARGINS;
900
901 if ( data.GetDefaultMinMargins() )
902 pd->Flags |= PSD_DEFAULTMINMARGINS;
903 if ( !data.GetEnableMargins() )
904 pd->Flags |= PSD_DISABLEMARGINS;
905 if ( !data.GetEnableOrientation() )
906 pd->Flags |= PSD_DISABLEORIENTATION;
907 if ( !data.GetEnablePaper() )
908 pd->Flags |= PSD_DISABLEPAPER;
909 if ( !data.GetEnablePrinter() )
910 pd->Flags |= PSD_DISABLEPRINTER;
911 if ( data.GetDefaultInfo() )
912 pd->Flags |= PSD_RETURNDEFAULT;
913 if ( data.GetEnableHelp() )
914 pd->Flags |= PSD_SHOWHELP;
915
916 // We want the units to be in hundredths of a millimetre
917 pd->Flags |= PSD_INHUNDREDTHSOFMILLIMETERS;
918
919 pd->lStructSize = sizeof( PAGESETUPDLG );
bd84061d
VZ
920 pd->hwndOwner = NULL;
921 pd->hInstance = NULL;
b45dfd0a
RR
922 // PAGESETUPDLG is in hundreds of a mm
923 pd->ptPaperSize.x = data.GetPaperSize().x * 100;
924 pd->ptPaperSize.y = data.GetPaperSize().y * 100;
925
926 pd->rtMinMargin.left = data.GetMinMarginTopLeft().x * 100;
927 pd->rtMinMargin.top = data.GetMinMarginTopLeft().y * 100;
928 pd->rtMinMargin.right = data.GetMinMarginBottomRight().x * 100;
929 pd->rtMinMargin.bottom = data.GetMinMarginBottomRight().y * 100;
930
931 pd->rtMargin.left = data.GetMarginTopLeft().x * 100;
932 pd->rtMargin.top = data.GetMarginTopLeft().y * 100;
933 pd->rtMargin.right = data.GetMarginBottomRight().x * 100;
934 pd->rtMargin.bottom = data.GetMarginBottomRight().y * 100;
935
936 pd->lCustData = 0;
937 pd->lpfnPageSetupHook = NULL;
938 pd->lpfnPagePaintHook = NULL;
939 pd->hPageSetupTemplate = NULL;
940 pd->lpPageSetupTemplateName = NULL;
941
942/*
943 if ( pd->hDevMode )
944 {
945 DEVMODE *devMode = (DEVMODE*) GlobalLock(pd->hDevMode);
946 memset(devMode, 0, sizeof(DEVMODE));
947 devMode->dmSize = sizeof(DEVMODE);
948 devMode->dmOrientation = m_orientation;
949 devMode->dmFields = DM_ORIENTATION;
950 GlobalUnlock(pd->hDevMode);
951 }
952*/
953 return true;
954}
955
08680429 956bool wxWindowsPageSetupDialog::ConvertFromNative( wxPageSetupDialogData &data )
b45dfd0a
RR
957{
958 PAGESETUPDLG *pd = (PAGESETUPDLG *) m_pageDlg;
959 if ( !pd )
960 return false;
961
962 wxWindowsPrintNativeData *native_data =
963 (wxWindowsPrintNativeData *) data.GetPrintData().GetNativeData();
f31a4098 964
b45dfd0a
RR
965 // Pass the devmode data back to the wxPrintData structure where it really belongs.
966 if (pd->hDevMode)
967 {
968 if (native_data->GetDevMode())
969 {
970 // Make sure we don't leak memory
971 GlobalFree((HGLOBAL) native_data->GetDevMode());
972 }
973 native_data->SetDevMode( (void*) pd->hDevMode );
974 pd->hDevMode = NULL;
975 }
f31a4098 976
b45dfd0a
RR
977 // Isn't this superfluous? It's called again below.
978 // data.GetPrintData().ConvertFromNative();
979
980 // Pass the devnames data back to the wxPrintData structure where it really belongs.
981 if (pd->hDevNames)
982 {
983 if (native_data->GetDevNames())
984 {
985 // Make sure we don't leak memory
986 GlobalFree((HGLOBAL) native_data->GetDevNames());
987 }
988 native_data->SetDevNames((void*) pd->hDevNames);
989 pd->hDevNames = NULL;
990 }
991
992 data.GetPrintData().ConvertFromNative();
993
994 pd->Flags = PSD_MARGINS|PSD_MINMARGINS;
995
996 data.SetDefaultMinMargins( ((pd->Flags & PSD_DEFAULTMINMARGINS) == PSD_DEFAULTMINMARGINS) );
997 data.EnableMargins( ((pd->Flags & PSD_DISABLEMARGINS) != PSD_DISABLEMARGINS) );
998 data.EnableOrientation( ((pd->Flags & PSD_DISABLEORIENTATION) != PSD_DISABLEORIENTATION) );
999 data.EnablePaper( ((pd->Flags & PSD_DISABLEPAPER) != PSD_DISABLEPAPER) );
1000 data.EnablePrinter( ((pd->Flags & PSD_DISABLEPRINTER) != PSD_DISABLEPRINTER) );
1001 data.SetDefaultInfo( ((pd->Flags & PSD_RETURNDEFAULT) == PSD_RETURNDEFAULT) );
1002 data.EnableHelp( ((pd->Flags & PSD_SHOWHELP) == PSD_SHOWHELP) );
1003
1004 // PAGESETUPDLG is in hundreds of a mm
fa4f4c58
RR
1005 if (data.GetPrintData().GetOrientation() == wxLANDSCAPE)
1006 data.SetPaperSize( wxSize(pd->ptPaperSize.y / 100, pd->ptPaperSize.x / 100) );
1007 else
1008 data.SetPaperSize( wxSize(pd->ptPaperSize.x / 100, pd->ptPaperSize.y / 100) );
b45dfd0a
RR
1009
1010 data.SetMinMarginTopLeft( wxPoint(pd->rtMinMargin.left / 100, pd->rtMinMargin.top / 100) );
1011 data.SetMinMarginBottomRight( wxPoint(pd->rtMinMargin.right / 100, pd->rtMinMargin.bottom / 100) );
1012
1013 data.SetMarginTopLeft( wxPoint(pd->rtMargin.left / 100, pd->rtMargin.top / 100) );
1014 data.SetMarginBottomRight( wxPoint(pd->rtMargin.right / 100, pd->rtMargin.bottom / 100) );
f31a4098 1015
b45dfd0a 1016 return true;
2bda0e17
KB
1017}
1018
f6bcfd97
BP
1019#endif
1020 // wxUSE_PRINTING_ARCHITECTURE