]> git.saurik.com Git - wxWidgets.git/blob - src/common/cmndata.cpp
wxUSE_XXX related fixes
[wxWidgets.git] / src / common / cmndata.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: cmndata.cpp
3 // Purpose: Common GDI data
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "cmndata.h"
22 #endif
23
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
26
27 #ifdef __BORLANDC__
28 #pragma hdrstop
29 #endif
30
31 #ifndef WX_PRECOMP
32 #include <stdio.h>
33 #include "wx/string.h"
34 #include "wx/utils.h"
35 #include "wx/app.h"
36 #endif
37
38 #include "wx/gdicmn.h"
39 #include "wx/cmndata.h"
40 #include "wx/log.h"
41 #include "wx/prntbase.h"
42 #include "wx/printdlg.h"
43
44 #if wxUSE_FONTDLG
45 #include "wx/fontdlg.h"
46 #endif // wxUSE_FONTDLG
47
48 #if wxUSE_PRINTING_ARCHITECTURE
49 #include "wx/paper.h"
50 #endif // wxUSE_PRINTING_ARCHITECTURE
51
52 #if defined(__WXMSW__)
53 #include <windowsx.h>
54 #include "wx/msw/private.h"
55
56 #ifndef __SMARTPHONE__ /* of WinCE */
57 #include <commdlg.h>
58 #endif
59
60 #if defined(__WATCOMC__) || defined(__SYMANTEC__) || defined(__SALFORDC__)
61 #include <windowsx.h>
62 #include <commdlg.h>
63 #endif
64 #endif // MSW
65
66 #if wxUSE_PRINTING_ARCHITECTURE
67
68 #if defined(__WXMAC__)
69 #include "wx/mac/private/print.h"
70 #endif
71
72 IMPLEMENT_DYNAMIC_CLASS(wxPrintData, wxObject)
73 IMPLEMENT_DYNAMIC_CLASS(wxPrintDialogData, wxObject)
74 IMPLEMENT_DYNAMIC_CLASS(wxPageSetupDialogData, wxObject)
75 #endif // wxUSE_PRINTING_ARCHITECTURE
76
77 IMPLEMENT_DYNAMIC_CLASS(wxFontData, wxObject)
78 IMPLEMENT_DYNAMIC_CLASS(wxColourData, wxObject)
79
80 #ifndef DMPAPER_USER
81 #define DMPAPER_USER 256
82 #endif
83
84 // ============================================================================
85 // implementation
86 // ============================================================================
87
88 // ----------------------------------------------------------------------------
89 // wxColourData
90 // ----------------------------------------------------------------------------
91
92 wxColourData::wxColourData()
93 {
94 m_chooseFull = false;
95 m_dataColour.Set(0,0,0);
96 // m_custColours are wxNullColours initially
97 }
98
99 wxColourData::wxColourData(const wxColourData& data)
100 : wxObject()
101 {
102 (*this) = data;
103 }
104
105 wxColourData::~wxColourData()
106 {
107 }
108
109 void wxColourData::SetCustomColour(int i, const wxColour& colour)
110 {
111 wxCHECK_RET( (i >= 0 && i < 16), _T("custom colour index out of range") );
112
113 m_custColours[i] = colour;
114 }
115
116 wxColour wxColourData::GetCustomColour(int i)
117 {
118 wxCHECK_MSG( (i >= 0 && i < 16), wxColour(0,0,0),
119 _T("custom colour index out of range") );
120
121 return m_custColours[i];
122 }
123
124 void wxColourData::operator=(const wxColourData& data)
125 {
126 int i;
127 for (i = 0; i < 16; i++)
128 m_custColours[i] = data.m_custColours[i];
129
130 m_dataColour = (wxColour&)data.m_dataColour;
131 m_chooseFull = data.m_chooseFull;
132 }
133
134 // ----------------------------------------------------------------------------
135 // Font data
136 // ----------------------------------------------------------------------------
137
138 wxFontData::wxFontData()
139 {
140 // Intialize colour to black.
141 m_fontColour = wxNullColour;
142
143 m_showHelp = false;
144 m_allowSymbols = true;
145 m_enableEffects = true;
146 m_minSize = 0;
147 m_maxSize = 0;
148
149 m_encoding = wxFONTENCODING_SYSTEM;
150 }
151
152 wxFontData::~wxFontData()
153 {
154 }
155
156 #if wxUSE_FONTDLG
157
158 wxFontDialogBase::~wxFontDialogBase()
159 {
160 }
161
162 #endif // wxUSE_FONTDLG
163
164 #if wxUSE_PRINTING_ARCHITECTURE
165 // ----------------------------------------------------------------------------
166 // Print data
167 // ----------------------------------------------------------------------------
168
169 wxPrintData::wxPrintData()
170 {
171 #ifdef __WXMAC__
172 m_nativePrintData = wxNativePrintData::Create() ;
173 #endif
174 m_bin = wxPRINTBIN_DEFAULT;
175 m_printMode = wxPRINT_MODE_PRINTER;
176 m_printOrientation = wxPORTRAIT;
177 m_printNoCopies = 1;
178 m_printCollate = false;
179
180 // New, 24/3/99
181 m_printerName = wxEmptyString;
182 m_colour = true;
183 m_duplexMode = wxDUPLEX_SIMPLEX;
184 m_printQuality = wxPRINT_QUALITY_HIGH;
185 m_paperId = wxPAPER_A4;
186 m_paperSize = wxSize(210, 297);
187
188 m_nativeData = wxPrintFactory::GetFactory()->CreatePrintNativeData();
189 }
190
191 wxPrintData::wxPrintData(const wxPrintData& printData)
192 : wxObject()
193 {
194 m_nativeData = NULL;
195 (*this) = printData;
196 }
197
198 wxPrintData::~wxPrintData()
199 {
200 m_nativeData->m_ref--;
201 if (m_nativeData->m_ref == 0)
202 delete m_nativeData;
203
204 #ifdef __WXMAC__
205 delete m_nativePrintData ;
206 #endif
207 }
208
209 void wxPrintData::ConvertToNative()
210 {
211 #ifdef __WXMAC__
212 m_nativePrintData->TransferFrom( this ) ;
213 #else
214 m_nativeData->TransferFrom( *this ) ;
215 #endif
216 }
217
218 void wxPrintData::ConvertFromNative()
219 {
220 #ifdef __WXMAC__
221 m_nativePrintData->TransferTo( this ) ;
222 #else
223 m_nativeData->TransferTo( *this ) ;
224 #endif
225 }
226
227 void wxPrintData::operator=(const wxPrintData& data)
228 {
229 m_printNoCopies = data.m_printNoCopies;
230 m_printCollate = data.m_printCollate;
231 m_printOrientation = data.m_printOrientation;
232 m_printerName = data.m_printerName;
233 m_colour = data.m_colour;
234 m_duplexMode = data.m_duplexMode;
235 m_printQuality = data.m_printQuality;
236 m_paperId = data.m_paperId;
237 m_paperSize = data.m_paperSize;
238 m_bin = data.m_bin;
239 m_printMode = data.m_printMode;
240 m_filename = data.m_filename;
241
242 // UnRef old m_nativeData
243 if (m_nativeData)
244 {
245 m_nativeData->m_ref--;
246 if (m_nativeData->m_ref == 0)
247 delete m_nativeData;
248 }
249 // Set Ref new one
250 m_nativeData = data.GetNativeData();
251 m_nativeData->m_ref++;
252
253 #ifdef __WXMAC__
254 m_nativePrintData->CopyFrom( data.m_nativePrintData ) ;
255 #endif
256 }
257
258 // Is this data OK for showing the print dialog?
259 bool wxPrintData::Ok() const
260 {
261 m_nativeData->TransferFrom( *this );
262
263 return m_nativeData->Ok();
264 }
265
266 // What should happen here? wxPostScriptPrintNativeData is not
267 // defined unless all this is true on MSW.
268 #if WXWIN_COMPATIBILITY_2_4 && wxUSE_PRINTING_ARCHITECTURE && (!defined(__WXMSW__) || wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW)
269
270 #include "wx/generic/prntdlgg.h"
271
272 #if wxUSE_POSTSCRIPT
273 #define WXUNUSED_WITHOUT_PS(name) name
274 #else
275 #define WXUNUSED_WITHOUT_PS(name) WXUNUSED(name)
276 #endif
277
278 wxString wxPrintData::GetPrinterCommand() const
279 {
280 #if wxUSE_POSTSCRIPT
281 if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
282 return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterCommand();
283 #endif
284 return wxEmptyString;
285 }
286
287 wxString wxPrintData::GetPrinterOptions() const
288 {
289 #if wxUSE_POSTSCRIPT
290 if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
291 return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterOptions();
292 #endif
293 return wxEmptyString;
294 }
295
296 wxString wxPrintData::GetPreviewCommand() const
297 {
298 #if wxUSE_POSTSCRIPT
299 if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
300 return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPreviewCommand();
301 #endif
302 return wxEmptyString;
303 }
304
305 wxString wxPrintData::GetFontMetricPath() const
306 {
307 #if wxUSE_POSTSCRIPT
308 if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
309 return ((wxPostScriptPrintNativeData*)m_nativeData)->GetFontMetricPath();
310 #endif
311 return wxEmptyString;
312 }
313
314 double wxPrintData::GetPrinterScaleX() const
315 {
316 #if wxUSE_POSTSCRIPT
317 if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
318 return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterScaleX();
319 #endif
320 return 1.0;
321 }
322
323 double wxPrintData::GetPrinterScaleY() const
324 {
325 #if wxUSE_POSTSCRIPT
326 if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
327 return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterScaleY();
328 #endif
329 return 1.0;
330 }
331
332 long wxPrintData::GetPrinterTranslateX() const
333 {
334 #if wxUSE_POSTSCRIPT
335 if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
336 return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterTranslateX();
337 #endif
338 return 0;
339 }
340
341 long wxPrintData::GetPrinterTranslateY() const
342 {
343 #if wxUSE_POSTSCRIPT
344 if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
345 return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterTranslateY();
346 #endif
347 return 0;
348 }
349
350 void wxPrintData::SetPrinterCommand(const wxString& WXUNUSED_WITHOUT_PS(command))
351 {
352 #if wxUSE_POSTSCRIPT
353 if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
354 ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterCommand( command );
355 #endif
356 }
357
358 void wxPrintData::SetPrinterOptions(const wxString& WXUNUSED_WITHOUT_PS(options))
359 {
360 #if wxUSE_POSTSCRIPT
361 if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
362 ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterOptions( options );
363 #endif
364 }
365
366 void wxPrintData::SetPreviewCommand(const wxString& WXUNUSED_WITHOUT_PS(command))
367 {
368 #if wxUSE_POSTSCRIPT
369 if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
370 ((wxPostScriptPrintNativeData*)m_nativeData)->SetPreviewCommand( command );
371 #endif
372 }
373
374 void wxPrintData::SetFontMetricPath(const wxString& WXUNUSED_WITHOUT_PS(path))
375 {
376 #if wxUSE_POSTSCRIPT
377 if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
378 ((wxPostScriptPrintNativeData*)m_nativeData)->SetFontMetricPath( path );
379 #endif
380 }
381
382 void wxPrintData::SetPrinterScaleX(double WXUNUSED_WITHOUT_PS(x))
383 {
384 #if wxUSE_POSTSCRIPT
385 if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
386 ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterScaleX( x );
387 #endif
388 }
389
390 void wxPrintData::SetPrinterScaleY(double WXUNUSED_WITHOUT_PS(y))
391 {
392 #if wxUSE_POSTSCRIPT
393 if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
394 ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterScaleY( y );
395 #endif
396 }
397
398 void wxPrintData::SetPrinterScaling(double WXUNUSED_WITHOUT_PS(x), double WXUNUSED_WITHOUT_PS(y))
399 {
400 #if wxUSE_POSTSCRIPT
401 if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
402 ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterScaling( x, y );
403 #endif
404 }
405
406 void wxPrintData::SetPrinterTranslateX(long WXUNUSED_WITHOUT_PS(x))
407 {
408 #if wxUSE_POSTSCRIPT
409 if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
410 ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterTranslateX( x );
411 #endif
412 }
413
414 void wxPrintData::SetPrinterTranslateY(long WXUNUSED_WITHOUT_PS(y))
415 {
416 #if wxUSE_POSTSCRIPT
417 if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
418 ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterTranslateY( y );
419 #endif
420 }
421
422 void wxPrintData::SetPrinterTranslation(long WXUNUSED_WITHOUT_PS(x), long WXUNUSED_WITHOUT_PS(y))
423 {
424 #if wxUSE_POSTSCRIPT
425 if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
426 ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterTranslation( x, y );
427 #endif
428 }
429 #endif
430
431 // ----------------------------------------------------------------------------
432 // Print dialog data
433 // ----------------------------------------------------------------------------
434
435 wxPrintDialogData::wxPrintDialogData()
436 {
437 m_printFromPage = 0;
438 m_printToPage = 0;
439 m_printMinPage = 0;
440 m_printMaxPage = 0;
441 m_printNoCopies = 1;
442 m_printAllPages = false;
443 m_printCollate = false;
444 m_printToFile = false;
445 m_printSelection = false;
446 m_printEnableSelection = false;
447 m_printEnablePageNumbers = true;
448
449 wxPrintFactory* factory = wxPrintFactory::GetFactory();
450 m_printEnablePrintToFile = ! factory->HasOwnPrintToFile();
451
452 m_printEnableHelp = false;
453 #if WXWIN_COMPATIBILITY_2_4
454 m_printSetupDialog = false;
455 #endif
456 }
457
458 wxPrintDialogData::wxPrintDialogData(const wxPrintDialogData& dialogData)
459 : wxObject()
460 {
461 (*this) = dialogData;
462 }
463
464 wxPrintDialogData::wxPrintDialogData(const wxPrintData& printData)
465 {
466 m_printFromPage = 1;
467 m_printToPage = 0;
468 m_printMinPage = 1;
469 m_printMaxPage = 9999;
470 m_printNoCopies = 1;
471 m_printAllPages = false;
472 m_printCollate = false;
473 m_printToFile = false;
474 m_printSelection = false;
475 m_printEnableSelection = false;
476 m_printEnablePageNumbers = true;
477 m_printEnablePrintToFile = true;
478 m_printEnableHelp = false;
479 #if WXWIN_COMPATIBILITY_2_4
480 m_printSetupDialog = false;
481 #endif
482 m_printData = printData;
483 }
484
485 wxPrintDialogData::~wxPrintDialogData()
486 {
487 }
488
489 #ifdef __WXMAC__
490
491 void wxPrintDialogData::ConvertToNative()
492 {
493 m_printData.ConvertToNative();
494 m_printData.m_nativePrintData->TransferFrom( this ) ;
495 }
496
497 void wxPrintDialogData::ConvertFromNative()
498 {
499 m_printData.ConvertFromNative();
500 m_printData.m_nativePrintData->TransferTo( this ) ;
501 }
502
503 #endif
504
505
506 void wxPrintDialogData::operator=(const wxPrintDialogData& data)
507 {
508 m_printFromPage = data.m_printFromPage;
509 m_printToPage = data.m_printToPage;
510 m_printMinPage = data.m_printMinPage;
511 m_printMaxPage = data.m_printMaxPage;
512 m_printNoCopies = data.m_printNoCopies;
513 m_printAllPages = data.m_printAllPages;
514 m_printCollate = data.m_printCollate;
515 m_printToFile = data.m_printToFile;
516 m_printSelection = data.m_printSelection;
517 m_printEnableSelection = data.m_printEnableSelection;
518 m_printEnablePageNumbers = data.m_printEnablePageNumbers;
519 m_printEnableHelp = data.m_printEnableHelp;
520 m_printEnablePrintToFile = data.m_printEnablePrintToFile;
521 #if WXWIN_COMPATIBILITY_2_4
522 m_printSetupDialog = data.m_printSetupDialog;
523 #endif
524 m_printData = data.m_printData;
525 }
526
527 void wxPrintDialogData::operator=(const wxPrintData& data)
528 {
529 m_printData = data;
530 }
531
532 // ----------------------------------------------------------------------------
533 // wxPageSetupDialogData
534 // ----------------------------------------------------------------------------
535
536 wxPageSetupDialogData::wxPageSetupDialogData()
537 {
538 m_paperSize = wxSize(0,0);
539
540 CalculatePaperSizeFromId();
541
542 m_minMarginTopLeft =
543 m_minMarginBottomRight =
544 m_marginTopLeft =
545 m_marginBottomRight = wxPoint(0,0);
546
547 // Flags
548 m_defaultMinMargins = false;
549 m_enableMargins = true;
550 m_enableOrientation = true;
551 m_enablePaper = true;
552 m_enablePrinter = true;
553 m_enableHelp = false;
554 m_getDefaultInfo = false;
555 }
556
557 wxPageSetupDialogData::wxPageSetupDialogData(const wxPageSetupDialogData& dialogData)
558 : wxObject()
559 {
560 (*this) = dialogData;
561 }
562
563 wxPageSetupDialogData::wxPageSetupDialogData(const wxPrintData& printData)
564 {
565 m_paperSize = wxSize(0,0);
566 m_minMarginTopLeft =
567 m_minMarginBottomRight =
568 m_marginTopLeft =
569 m_marginBottomRight = wxPoint(0,0);
570
571 // Flags
572 m_defaultMinMargins = false;
573 m_enableMargins = true;
574 m_enableOrientation = true;
575 m_enablePaper = true;
576 m_enablePrinter = true;
577 m_enableHelp = false;
578 m_getDefaultInfo = false;
579
580 m_printData = printData;
581
582 // The wxPrintData paper size overrides these values, unless the size cannot
583 // be found.
584 CalculatePaperSizeFromId();
585 }
586
587 wxPageSetupDialogData::~wxPageSetupDialogData()
588 {
589 }
590
591 wxPageSetupDialogData& wxPageSetupDialogData::operator=(const wxPageSetupDialogData& data)
592 {
593 m_paperSize = data.m_paperSize;
594 m_minMarginTopLeft = data.m_minMarginTopLeft;
595 m_minMarginBottomRight = data.m_minMarginBottomRight;
596 m_marginTopLeft = data.m_marginTopLeft;
597 m_marginBottomRight = data.m_marginBottomRight;
598 m_defaultMinMargins = data.m_defaultMinMargins;
599 m_enableMargins = data.m_enableMargins;
600 m_enableOrientation = data.m_enableOrientation;
601 m_enablePaper = data.m_enablePaper;
602 m_enablePrinter = data.m_enablePrinter;
603 m_getDefaultInfo = data.m_getDefaultInfo;;
604 m_enableHelp = data.m_enableHelp;
605
606 m_printData = data.m_printData;
607
608 return *this;
609 }
610
611 wxPageSetupDialogData& wxPageSetupDialogData::operator=(const wxPrintData& data)
612 {
613 m_printData = data;
614 CalculatePaperSizeFromId();
615
616 return *this;
617 }
618
619 #ifdef __WXMAC__
620 void wxPageSetupDialogData::ConvertToNative()
621 {
622 m_printData.ConvertToNative();
623 m_printData.m_nativePrintData->TransferFrom( this ) ;
624 }
625
626 void wxPageSetupDialogData::ConvertFromNative()
627 {
628 m_printData.ConvertFromNative ();
629 m_paperSize = m_printData.GetPaperSize() ;
630 CalculateIdFromPaperSize();
631 m_printData.m_nativePrintData->TransferTo( this ) ;
632 // adjust minimal values
633
634 if ( m_marginTopLeft.x < m_minMarginTopLeft.x )
635 m_marginTopLeft.x = m_minMarginTopLeft.x;
636
637 if ( m_marginBottomRight.x < m_minMarginBottomRight.x )
638 m_marginBottomRight.x = m_minMarginBottomRight.x;
639
640 if ( m_marginTopLeft.y < m_minMarginTopLeft.y )
641 m_marginTopLeft.y = m_minMarginTopLeft.y;
642
643 if ( m_marginBottomRight.y < m_minMarginBottomRight.y )
644 m_marginBottomRight.y = m_minMarginBottomRight.y;
645 }
646 #endif
647
648
649 // If a corresponding paper type is found in the paper database, will set the m_printData
650 // paper size id member as well.
651 void wxPageSetupDialogData::SetPaperSize(const wxSize& sz)
652 {
653 m_paperSize = sz;
654
655 CalculateIdFromPaperSize();
656 }
657
658 // Sets the wxPrintData id, plus the paper width/height if found in the paper database.
659 void wxPageSetupDialogData::SetPaperSize(wxPaperSize id)
660 {
661 m_printData.SetPaperId(id);
662
663 CalculatePaperSizeFromId();
664 }
665
666 void wxPageSetupDialogData::SetPrintData(const wxPrintData& printData)
667 {
668 m_printData = printData;
669 CalculatePaperSizeFromId();
670 }
671
672 // Use paper size defined in this object to set the wxPrintData
673 // paper id
674 void wxPageSetupDialogData::CalculateIdFromPaperSize()
675 {
676 wxASSERT_MSG( (wxThePrintPaperDatabase != (wxPrintPaperDatabase*) NULL),
677 wxT("wxThePrintPaperDatabase should not be NULL. Do not create global print dialog data objects.") );
678
679 wxSize sz = GetPaperSize();
680
681 wxPaperSize id = wxThePrintPaperDatabase->GetSize(wxSize(sz.x* 10, sz.y * 10));
682 if (id != wxPAPER_NONE)
683 {
684 m_printData.SetPaperId(id);
685 }
686 }
687
688 // Use paper id in wxPrintData to set this object's paper size
689 void wxPageSetupDialogData::CalculatePaperSizeFromId()
690 {
691 wxASSERT_MSG( (wxThePrintPaperDatabase != (wxPrintPaperDatabase*) NULL),
692 wxT("wxThePrintPaperDatabase should not be NULL. Do not create global print dialog data objects.") );
693
694 wxSize sz = wxThePrintPaperDatabase->GetSize(m_printData.GetPaperId());
695
696 // sz is in 10ths of a mm, while paper size is in mm
697 m_paperSize.x = sz.x / 10;
698 m_paperSize.y = sz.y / 10;
699 }
700
701 #endif // wxUSE_PRINTING_ARCHITECTURE