1 ///////////////////////////////////////////////////////////////////////////// 
   3 // Purpose:     Printing framework base class implementation 
   4 // Author:      Julian Smart 
   8 // Copyright:   (c) Julian Smart 
   9 // Licence:     wxWindows licence 
  10 ///////////////////////////////////////////////////////////////////////////// 
  12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) 
  13   #pragma implementation "prntbase.h" 
  14   #pragma implementation "printdlg.h" 
  17 // For compilers that support precompilation, includes "wx.h". 
  18 #include "wx/wxprec.h" 
  26 #if wxUSE_PRINTING_ARCHITECTURE 
  32 #include "wx/msgdlg.h" 
  33 #include "wx/layout.h" 
  34 #include "wx/choice.h" 
  35 #include "wx/button.h" 
  36 #include "wx/settings.h" 
  37 #include "wx/dcmemory.h" 
  38 #include "wx/stattext.h" 
  40 #include "wx/textdlg.h" 
  44 #include "wx/prntbase.h" 
  45 #include "wx/dcprint.h" 
  46 #include "wx/printdlg.h" 
  48 #include "wx/module.h" 
  53 #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) 
  54 #include "wx/msw/printdlg.h" 
  55 #elif defined(__WXMAC__) 
  56 #include "wx/mac/printdlg.h" 
  58 #include "wx/generic/prntdlgg.h" 
  62     #include "wx/msw/private.h" 
  70 //---------------------------------------------------------------------------- 
  72 //---------------------------------------------------------------------------- 
  74 wxPrintFactory 
*wxPrintFactory::m_factory 
= NULL
; 
  76 void wxPrintFactory::SetPrintFactory( wxPrintFactory 
*factory 
) 
  78     if (wxPrintFactory::m_factory
) 
  79         delete wxPrintFactory::m_factory
; 
  81     wxPrintFactory::m_factory 
= factory
; 
  84 wxPrintFactory 
*wxPrintFactory::GetFactory() 
  86     if (!wxPrintFactory::m_factory
) 
  87         wxPrintFactory::m_factory 
= new wxNativePrintFactory
; 
  89     return wxPrintFactory::m_factory
; 
  92 //---------------------------------------------------------------------------- 
  93 // wxNativePrintFactory 
  94 //---------------------------------------------------------------------------- 
  96 wxPrinterBase 
*wxNativePrintFactory::CreatePrinter( wxPrintDialogData 
*data 
) 
  98 #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) 
  99     return new wxWindowsPrinter( data 
); 
 100 #elif defined(__WXMAC__) 
 101     return new wxMacPrinter( data 
); 
 102 #elif defined(__WXPM__) 
 103     return new wxOS2Printer( data 
); 
 105     return new wxPostScriptPrinter( data 
); 
 109 wxPrintPreviewBase 
*wxNativePrintFactory::CreatePrintPreview( wxPrintout 
*preview
, 
 110     wxPrintout 
*printout
, wxPrintDialogData 
*data 
) 
 112 #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) 
 113     return new wxWindowsPrintPreview( preview
, printout
, data 
); 
 114 #elif defined(__WXMAC__) 
 115     return new wxMacPrintPreview( preview
, printout
, data 
); 
 116 #elif defined(__WXPM__) 
 117     return new wxOS2PrintPreview( preview
, printout
, data 
); 
 119     return new wxPostScriptPrintPreview( preview
, printout
, data 
); 
 123 wxPrintPreviewBase 
*wxNativePrintFactory::CreatePrintPreview( wxPrintout 
*preview
, 
 124     wxPrintout 
*printout
, wxPrintData 
*data 
) 
 126 #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) 
 127     return new wxWindowsPrintPreview( preview
, printout
, data 
); 
 128 #elif defined(__WXMAC__) 
 129     return new wxMacPrintPreview( preview
, printout
, data 
); 
 130 #elif defined(__WXPM__) 
 131     return new wxOS2PrintPreview( preview
, printout
, data 
); 
 133     return new wxPostScriptPrintPreview( preview
, printout
, data 
); 
 137 wxPrintDialogBase 
*wxNativePrintFactory::CreatePrintDialog( wxWindow 
*parent
, 
 138                                                   wxPrintDialogData 
*data 
) 
 140 #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) 
 141     return new wxWindowsPrintDialog( parent
, data 
); 
 142 #elif defined(__WXMAC__) 
 143     return new wxMacPrintDialog( parent
, data 
); 
 145     return new wxGenericPrintDialog( parent
, data 
); 
 149 wxPrintDialogBase 
*wxNativePrintFactory::CreatePrintDialog( wxWindow 
*parent
, 
 152 #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) 
 153     return new wxWindowsPrintDialog( parent
, data 
); 
 154 #elif defined(__WXMAC__) 
 155     return new wxMacPrintDialog( parent
, data 
); 
 157     return new wxGenericPrintDialog( parent
, data 
); 
 161 wxPageSetupDialogBase 
*wxNativePrintFactory::CreatePageSetupDialog( wxWindow 
*parent
, 
 162                                                   wxPageSetupDialogData 
*data 
) 
 164 #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) 
 165     return new wxWindowsPageSetupDialog( parent
, data 
); 
 166 #elif defined(__WXMAC__) 
 167     return new wxMacPageSetupDialog( parent
, data 
); 
 169     return new wxGenericPageSetupDialog( parent
, data 
); 
 173 bool wxNativePrintFactory::HasPrintSetupDialog() 
 175 #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) 
 177 #elif defined(__WXMAC__) 
 180     // Only here do we need to provide the print setup 
 181     // dialog ourselves, the other platforms either have 
 182     // none, don't make it accessible or let you configure 
 183     // the printer from the wxPrintDialog anyway. 
 189 wxDialog 
*wxNativePrintFactory::CreatePrintSetupDialog( wxWindow 
*parent
, 
 192 #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) 
 196 #elif defined(__WXMAC__) 
 201     // Only here do we need to provide the print setup 
 202     // dialog ourselves, the other platforms either have 
 203     // none, don't make it accessible or let you configure 
 204     // the printer from the wxPrintDialog anyway. 
 205     return new wxGenericPrintSetupDialog( parent
, data 
); 
 209 bool wxNativePrintFactory::HasOwnPrintToFile() 
 211     // Only relevant for PostScript and here the 
 212     // setup dialog provides no "print to file" 
 213     // option. In the GNOME setup dialog, the 
 214     // setup dialog has its own print to file. 
 218 bool wxNativePrintFactory::HasPrinterLine() 
 220     // Only relevant for PostScript for now 
 224 wxString 
wxNativePrintFactory::CreatePrinterLine() 
 226     // Only relevant for PostScript for now 
 228     // We should query "lpstat -d" here 
 229     return _("Generic PostScript"); 
 232 bool wxNativePrintFactory::HasStatusLine() 
 234     // Only relevant for PostScript for now 
 238 wxString 
wxNativePrintFactory::CreateStatusLine() 
 240     // Only relevant for PostScript for now 
 242     // We should query "lpstat -r" or "lpstat -p" here 
 246 wxPrintNativeDataBase 
*wxNativePrintFactory::CreatePrintNativeData() 
 248 #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) 
 249     return new wxWindowsPrintNativeData
; 
 250 #elif defined(__WXMAC__) 
 251     return new wxMacPrintNativeData
; 
 253     return new wxPostScriptPrintNativeData
; 
 257 //---------------------------------------------------------------------------- 
 258 // wxPrintNativeDataBase 
 259 //---------------------------------------------------------------------------- 
 261 IMPLEMENT_ABSTRACT_CLASS(wxPrintNativeDataBase
, wxObject
) 
 263 wxPrintNativeDataBase::wxPrintNativeDataBase() 
 268 //---------------------------------------------------------------------------- 
 269 // wxPrintFactoryModule 
 270 //---------------------------------------------------------------------------- 
 272 class wxPrintFactoryModule
: public wxModule
 
 275     wxPrintFactoryModule() {} 
 276     bool OnInit() { return true; } 
 277     void OnExit() { wxPrintFactory::SetPrintFactory( NULL 
); } 
 280     DECLARE_DYNAMIC_CLASS(wxPrintFactoryModule
) 
 283 IMPLEMENT_DYNAMIC_CLASS(wxPrintFactoryModule
, wxModule
) 
 285 //---------------------------------------------------------------------------- 
 287 //---------------------------------------------------------------------------- 
 289 IMPLEMENT_CLASS(wxPrinterBase
, wxObject
) 
 291 wxPrinterBase::wxPrinterBase(wxPrintDialogData 
*data
) 
 293     m_currentPrintout 
= (wxPrintout 
*) NULL
; 
 294     sm_abortWindow 
= (wxWindow 
*) NULL
; 
 297         m_printDialogData 
= (*data
); 
 298     sm_lastError 
= wxPRINTER_NO_ERROR
; 
 301 wxWindow 
*wxPrinterBase::sm_abortWindow 
= (wxWindow 
*) NULL
; 
 302 bool wxPrinterBase::sm_abortIt 
= false; 
 303 wxPrinterError 
wxPrinterBase::sm_lastError 
= wxPRINTER_NO_ERROR
; 
 305 wxPrinterBase::~wxPrinterBase() 
 309 wxWindow 
*wxPrinterBase::CreateAbortWindow(wxWindow 
*parent
, wxPrintout 
* printout
) 
 311     wxPrintAbortDialog 
*dialog 
= new wxPrintAbortDialog(parent
, _("Printing ") , wxDefaultPosition
, wxDefaultSize
, wxDEFAULT_DIALOG_STYLE
); 
 313     wxBoxSizer 
*button_sizer 
= new wxBoxSizer( wxVERTICAL 
); 
 314     button_sizer
->Add( new wxStaticText(dialog
, wxID_ANY
, _("Please wait while printing\n") + printout
->GetTitle() ), 0, wxALL
, 10 ); 
 315     button_sizer
->Add( new wxButton( dialog
, wxID_CANCEL
, wxT("Cancel") ), 0, wxALL 
| wxALIGN_CENTER
, 10 ); 
 317     dialog
->SetAutoLayout( true ); 
 318     dialog
->SetSizer( button_sizer 
); 
 320     button_sizer
->Fit(dialog
); 
 321     button_sizer
->SetSizeHints (dialog
) ; 
 326 void wxPrinterBase::ReportError(wxWindow 
*parent
, wxPrintout 
*WXUNUSED(printout
), const wxString
& message
) 
 328     wxMessageBox(message
, _("Printing Error"), wxOK
, parent
); 
 331 wxPrintDialogData
& wxPrinterBase::GetPrintDialogData() const 
 333     return (wxPrintDialogData
&) m_printDialogData
; 
 336 //---------------------------------------------------------------------------- 
 338 //---------------------------------------------------------------------------- 
 340 IMPLEMENT_CLASS(wxPrinter
, wxPrinterBase
) 
 342 wxPrinter::wxPrinter(wxPrintDialogData 
*data
) 
 344     m_pimpl 
= wxPrintFactory::GetFactory()->CreatePrinter( data 
); 
 347 wxPrinter::~wxPrinter() 
 352 wxWindow 
*wxPrinter::CreateAbortWindow(wxWindow 
*parent
, wxPrintout 
*printout
) 
 354     return m_pimpl
->CreateAbortWindow( parent
, printout 
); 
 357 void wxPrinter::ReportError(wxWindow 
*parent
, wxPrintout 
*printout
, const wxString
& message
) 
 359     m_pimpl
->ReportError( parent
, printout
, message 
); 
 362 bool wxPrinter::Setup(wxWindow 
*parent
) 
 364     return m_pimpl
->Setup( parent 
); 
 367 bool wxPrinter::Print(wxWindow 
*parent
, wxPrintout 
*printout
, bool prompt
) 
 369     return m_pimpl
->Print( parent
, printout
, prompt 
); 
 372 wxDC
* wxPrinter::PrintDialog(wxWindow 
*parent
) 
 374     return m_pimpl
->PrintDialog( parent 
); 
 377 wxPrintDialogData
& wxPrinter::GetPrintDialogData() const 
 379     return m_pimpl
->GetPrintDialogData(); 
 382 // --------------------------------------------------------------------------- 
 383 // wxPrintDialogBase: the dialog for printing. 
 384 // --------------------------------------------------------------------------- 
 386 IMPLEMENT_ABSTRACT_CLASS(wxPrintDialogBase
, wxDialog
) 
 388 wxPrintDialogBase::wxPrintDialogBase(wxWindow 
*parent
, 
 390                                      const wxString 
&title
, 
 394     : wxDialog( parent
, id
, title
.empty() ? wxString(_("Print")) : title
, 
 399 // --------------------------------------------------------------------------- 
 400 // wxPrintDialog: the dialog for printing 
 401 // --------------------------------------------------------------------------- 
 403 IMPLEMENT_CLASS(wxPrintDialog
, wxObject
) 
 405 wxPrintDialog::wxPrintDialog(wxWindow 
*parent
, wxPrintDialogData
* data
) 
 407     m_pimpl 
= wxPrintFactory::GetFactory()->CreatePrintDialog( parent
, data 
); 
 410 wxPrintDialog::wxPrintDialog(wxWindow 
*parent
, wxPrintData
* data
) 
 412     m_pimpl 
= wxPrintFactory::GetFactory()->CreatePrintDialog( parent
, data 
); 
 415 wxPrintDialog::~wxPrintDialog() 
 420 int wxPrintDialog::ShowModal() 
 422     return m_pimpl
->ShowModal(); 
 425 wxPrintDialogData
& wxPrintDialog::GetPrintDialogData() 
 427     return m_pimpl
->GetPrintDialogData(); 
 430 wxPrintData
& wxPrintDialog::GetPrintData() 
 432     return m_pimpl
->GetPrintData(); 
 435 wxDC 
*wxPrintDialog::GetPrintDC() 
 437     return m_pimpl
->GetPrintDC(); 
 440 // --------------------------------------------------------------------------- 
 441 // wxPageSetupDialogBase: the page setup dialog 
 442 // --------------------------------------------------------------------------- 
 444 IMPLEMENT_ABSTRACT_CLASS(wxPageSetupDialogBase
, wxDialog
) 
 446 wxPageSetupDialogBase::wxPageSetupDialogBase(wxWindow 
*parent
, 
 448                                      const wxString 
&title
, 
 452     : wxDialog( parent
, id
, title
.empty() ? wxString(_("Page setup")) : title
, 
 457 // --------------------------------------------------------------------------- 
 458 // wxPageSetupDialog: the page setup dialog 
 459 // --------------------------------------------------------------------------- 
 461 IMPLEMENT_CLASS(wxPageSetupDialog
, wxObject
) 
 463 wxPageSetupDialog::wxPageSetupDialog(wxWindow 
*parent
, wxPageSetupDialogData 
*data 
) 
 465     m_pimpl 
= wxPrintFactory::GetFactory()->CreatePageSetupDialog( parent
, data 
); 
 468 wxPageSetupDialog::~wxPageSetupDialog() 
 473 int wxPageSetupDialog::ShowModal() 
 475     return m_pimpl
->ShowModal(); 
 478 wxPageSetupDialogData
& wxPageSetupDialog::GetPageSetupDialogData() 
 480     return m_pimpl
->GetPageSetupDialogData(); 
 484 wxPageSetupDialogData
& wxPageSetupDialog::GetPageSetupData() 
 486     return m_pimpl
->GetPageSetupDialogData(); 
 489 //---------------------------------------------------------------------------- 
 490 // wxPrintAbortDialog 
 491 //---------------------------------------------------------------------------- 
 493 BEGIN_EVENT_TABLE(wxPrintAbortDialog
, wxDialog
) 
 494     EVT_BUTTON(wxID_CANCEL
, wxPrintAbortDialog::OnCancel
) 
 497 void wxPrintAbortDialog::OnCancel(wxCommandEvent
& WXUNUSED(event
)) 
 499     wxPrinterBase::sm_abortIt 
= true; 
 500     wxPrinterBase::sm_abortWindow
->Show(false); 
 501     wxPrinterBase::sm_abortWindow
->Close(true); 
 502     wxPrinterBase::sm_abortWindow 
= (wxWindow 
*) NULL
; 
 505 //---------------------------------------------------------------------------- 
 507 //---------------------------------------------------------------------------- 
 509 IMPLEMENT_ABSTRACT_CLASS(wxPrintout
, wxObject
) 
 511 wxPrintout::wxPrintout(const wxString
& title
) 
 513     m_printoutTitle 
= title 
; 
 514     m_printoutDC 
= (wxDC 
*) NULL
; 
 517     m_pageWidthPixels 
= 0; 
 518     m_pageHeightPixels 
= 0; 
 526 wxPrintout::~wxPrintout() 
 530 bool wxPrintout::OnBeginDocument(int WXUNUSED(startPage
), int WXUNUSED(endPage
)) 
 532     return GetDC()->StartDoc(_("Printing ") + m_printoutTitle
); 
 535 void wxPrintout::OnEndDocument() 
 540 void wxPrintout::OnBeginPrinting() 
 544 void wxPrintout::OnEndPrinting() 
 548 bool wxPrintout::HasPage(int page
) 
 553 void wxPrintout::GetPageInfo(int *minPage
, int *maxPage
, int *fromPage
, int *toPage
) 
 561 //---------------------------------------------------------------------------- 
 563 //---------------------------------------------------------------------------- 
 565 IMPLEMENT_CLASS(wxPreviewCanvas
, wxWindow
) 
 567 BEGIN_EVENT_TABLE(wxPreviewCanvas
, wxScrolledWindow
) 
 568     EVT_PAINT(wxPreviewCanvas::OnPaint
) 
 569     EVT_CHAR(wxPreviewCanvas::OnChar
) 
 570     EVT_SYS_COLOUR_CHANGED(wxPreviewCanvas::OnSysColourChanged
) 
 573 // VZ: the current code doesn't refresh properly without 
 574 //     wxFULL_REPAINT_ON_RESIZE, this must be fixed as otherwise we have 
 575 //     really horrible flicker when resizing the preview frame, but without 
 576 //     this style it simply doesn't work correctly at all... 
 577 wxPreviewCanvas::wxPreviewCanvas(wxPrintPreviewBase 
*preview
, wxWindow 
*parent
, 
 578                                  const wxPoint
& pos
, const wxSize
& size
, long style
, const wxString
& name
): 
 579 wxScrolledWindow(parent
, wxID_ANY
, pos
, size
, style 
| wxFULL_REPAINT_ON_RESIZE
, name
) 
 581     m_printPreview 
= preview
; 
 583     // The app workspace colour is always white, but we should have 
 584     // a contrast with the page. 
 585     wxSystemColour colourIndex 
= wxSYS_COLOUR_3DDKSHADOW
; 
 587     wxSystemColour colourIndex 
= wxSYS_COLOUR_APPWORKSPACE
; 
 589     SetBackgroundColour(wxSystemSettings::GetColour(colourIndex
)); 
 591     SetScrollbars(10, 10, 100, 100); 
 594 wxPreviewCanvas::~wxPreviewCanvas() 
 598 void wxPreviewCanvas::OnPaint(wxPaintEvent
& WXUNUSED(event
)) 
 605     if (!GetUpdateRegion().IsEmpty()) 
 606         dc.SetClippingRegion( GetUpdateRegion() ); 
 612         m_printPreview
->PaintPage(this, dc
); 
 616 // Responds to colour changes, and passes event on to children. 
 617 void wxPreviewCanvas::OnSysColourChanged(wxSysColourChangedEvent
& event
) 
 620     // The app workspace colour is always white, but we should have 
 621     // a contrast with the page. 
 622     wxSystemColour colourIndex 
= wxSYS_COLOUR_3DDKSHADOW
; 
 624     wxSystemColour colourIndex 
= wxSYS_COLOUR_APPWORKSPACE
; 
 626     SetBackgroundColour(wxSystemSettings::GetColour(colourIndex
)); 
 629     // Propagate the event to the non-top-level children 
 630     wxWindow::OnSysColourChanged(event
); 
 633 void wxPreviewCanvas::OnChar(wxKeyEvent 
&event
) 
 635     wxPreviewControlBar
* controlBar 
= ((wxPreviewFrame
*) GetParent())->GetControlBar(); 
 636     if (event
.GetKeyCode() == WXK_ESCAPE
) 
 638         ((wxPreviewFrame
*) GetParent())->Close(true); 
 641     else if (event
.GetKeyCode() == WXK_TAB
) 
 643         controlBar
->OnGoto(); 
 646     else if (event
.GetKeyCode() == WXK_RETURN
) 
 648         controlBar
->OnPrint(); 
 652     if (!event
.ControlDown()) 
 658     switch(event
.GetKeyCode()) 
 661             controlBar
->OnNext(); break; 
 663             controlBar
->OnPrevious(); break; 
 665             controlBar
->OnFirst(); break; 
 667             controlBar
->OnLast(); break; 
 673 //---------------------------------------------------------------------------- 
 674 // wxPreviewControlBar 
 675 //---------------------------------------------------------------------------- 
 677 IMPLEMENT_CLASS(wxPreviewControlBar
, wxWindow
) 
 679 BEGIN_EVENT_TABLE(wxPreviewControlBar
, wxPanel
) 
 680     EVT_BUTTON(wxID_PREVIEW_CLOSE
,    wxPreviewControlBar::OnWindowClose
) 
 681     EVT_BUTTON(wxID_PREVIEW_PRINT
,    wxPreviewControlBar::OnPrintButton
) 
 682     EVT_BUTTON(wxID_PREVIEW_PREVIOUS
, wxPreviewControlBar::OnPreviousButton
) 
 683     EVT_BUTTON(wxID_PREVIEW_NEXT
,     wxPreviewControlBar::OnNextButton
) 
 684     EVT_BUTTON(wxID_PREVIEW_FIRST
,    wxPreviewControlBar::OnFirstButton
) 
 685     EVT_BUTTON(wxID_PREVIEW_LAST
,     wxPreviewControlBar::OnLastButton
) 
 686     EVT_BUTTON(wxID_PREVIEW_GOTO
,     wxPreviewControlBar::OnGotoButton
) 
 687     EVT_CHOICE(wxID_PREVIEW_ZOOM
,     wxPreviewControlBar::OnZoom
) 
 688     EVT_PAINT(wxPreviewControlBar::OnPaint
) 
 691 wxPreviewControlBar::wxPreviewControlBar(wxPrintPreviewBase 
*preview
, long buttons
, 
 692                                          wxWindow 
*parent
, const wxPoint
& pos
, const wxSize
& size
, 
 693                                          long style
, const wxString
& name
): 
 694 wxPanel(parent
, wxID_ANY
, pos
, size
, style
, name
) 
 696     m_printPreview 
= preview
; 
 697     m_closeButton 
= (wxButton 
*) NULL
; 
 698     m_nextPageButton 
= (wxButton 
*) NULL
; 
 699     m_previousPageButton 
= (wxButton 
*) NULL
; 
 700     m_printButton 
= (wxButton 
*) NULL
; 
 701     m_zoomControl 
= (wxChoice 
*) NULL
; 
 702     m_buttonFlags 
= buttons
; 
 705 wxPreviewControlBar::~wxPreviewControlBar() 
 709 void wxPreviewControlBar::OnPaint(wxPaintEvent
& WXUNUSED(event
)) 
 715     dc
.SetPen(*wxBLACK_PEN
); 
 716     dc
.SetBrush(*wxTRANSPARENT_BRUSH
); 
 717     dc
.DrawLine( 0, h
-1, w
, h
-1 ); 
 720 void wxPreviewControlBar::OnWindowClose(wxCommandEvent
& WXUNUSED(event
)) 
 722     wxPreviewFrame 
*frame 
= (wxPreviewFrame 
*)GetParent(); 
 726 void wxPreviewControlBar::OnPrint(void) 
 728     wxPrintPreviewBase 
*preview 
= GetPrintPreview(); 
 729     preview
->Print(true); 
 732 void wxPreviewControlBar::OnNext(void) 
 734     wxPrintPreviewBase 
*preview 
= GetPrintPreview(); 
 737         int currentPage 
= preview
->GetCurrentPage(); 
 738         if ((preview
->GetMaxPage() > 0) && 
 739             (currentPage 
< preview
->GetMaxPage()) && 
 740             preview
->GetPrintout()->HasPage(currentPage 
+ 1)) 
 742             preview
->SetCurrentPage(currentPage 
+ 1); 
 747 void wxPreviewControlBar::OnPrevious(void) 
 749     wxPrintPreviewBase 
*preview 
= GetPrintPreview(); 
 752         int currentPage 
= preview
->GetCurrentPage(); 
 753         if ((preview
->GetMinPage() > 0) && 
 754             (currentPage 
> preview
->GetMinPage()) && 
 755             preview
->GetPrintout()->HasPage(currentPage 
- 1)) 
 757             preview
->SetCurrentPage(currentPage 
- 1); 
 762 void wxPreviewControlBar::OnFirst(void) 
 764     wxPrintPreviewBase 
*preview 
= GetPrintPreview(); 
 767         int currentPage 
= preview
->GetMinPage(); 
 768         if (preview
->GetPrintout()->HasPage(currentPage
)) 
 770             preview
->SetCurrentPage(currentPage
); 
 775 void wxPreviewControlBar::OnLast(void) 
 777     wxPrintPreviewBase 
*preview 
= GetPrintPreview(); 
 780         int currentPage 
= preview
->GetMaxPage(); 
 781         if (preview
->GetPrintout()->HasPage(currentPage
)) 
 783             preview
->SetCurrentPage(currentPage
); 
 788 void wxPreviewControlBar::OnGoto(void) 
 790     wxPrintPreviewBase 
*preview 
= GetPrintPreview(); 
 795         if (preview
->GetMinPage() > 0) 
 800             strPrompt
.Printf( _("Enter a page number between %d and %d:"), 
 801                 preview
->GetMinPage(), preview
->GetMaxPage()); 
 802             strPage
.Printf( wxT("%d"), preview
->GetCurrentPage() ); 
 805                 wxGetTextFromUser( strPrompt
, _("Goto Page"), strPage
, GetParent()); 
 807             if ( strPage
.ToLong( ¤tPage 
) ) 
 808                 if (preview
->GetPrintout()->HasPage(currentPage
)) 
 810                     preview
->SetCurrentPage(currentPage
); 
 816 void wxPreviewControlBar::OnZoom(wxCommandEvent
& WXUNUSED(event
)) 
 818     int zoom 
= GetZoomControl(); 
 819     if (GetPrintPreview()) 
 820         GetPrintPreview()->SetZoom(zoom
); 
 823 void wxPreviewControlBar::CreateButtons() 
 825     SetSize(0, 0, 400, 40); 
 827     wxBoxSizer 
*item0 
= new wxBoxSizer( wxHORIZONTAL 
); 
 829     m_closeButton 
= new wxButton( this, wxID_PREVIEW_CLOSE
, _("&Close"), wxDefaultPosition
, wxDefaultSize
, 0 ); 
 830     item0
->Add( m_closeButton
, 0, wxALIGN_CENTRE
|wxALL
, 5 ); 
 832     if (m_buttonFlags 
& wxPREVIEW_PRINT
) 
 834         m_printButton 
= new wxButton( this, wxID_PREVIEW_PRINT
, _("&Print..."), wxDefaultPosition
, wxDefaultSize
, 0 ); 
 835         item0
->Add( m_printButton
, 0, wxALIGN_CENTRE
|wxALL
, 5 ); 
 838     if (m_buttonFlags 
& wxPREVIEW_FIRST
) 
 840         m_firstPageButton 
= new wxButton( this, wxID_PREVIEW_FIRST
, _("|<<"), wxDefaultPosition
, wxDefaultSize
, wxBU_EXACTFIT 
); 
 841         item0
->Add( m_firstPageButton
, 0, wxALIGN_CENTRE
|wxALL
, 5 ); 
 844     if (m_buttonFlags 
& wxPREVIEW_PREVIOUS
) 
 846         m_previousPageButton 
= new wxButton( this, wxID_PREVIEW_PREVIOUS
, _("<<"), wxDefaultPosition
, wxDefaultSize
, wxBU_EXACTFIT 
); 
 847         item0
->Add( m_previousPageButton
, 0, wxALIGN_CENTRE
|wxRIGHT
|wxTOP
|wxBOTTOM
, 5 ); 
 850     if (m_buttonFlags 
& wxPREVIEW_NEXT
) 
 852         m_nextPageButton 
= new wxButton( this, wxID_PREVIEW_NEXT
, _(">>"), wxDefaultPosition
, wxDefaultSize
, wxBU_EXACTFIT 
); 
 853         item0
->Add( m_nextPageButton
, 0, wxALIGN_CENTRE
|wxRIGHT
|wxTOP
|wxBOTTOM
, 5 ); 
 856     if (m_buttonFlags 
& wxPREVIEW_LAST
) 
 858         m_lastPageButton 
= new wxButton( this, wxID_PREVIEW_LAST
, _(">>|"), wxDefaultPosition
, wxDefaultSize
, wxBU_EXACTFIT 
); 
 859         item0
->Add( m_lastPageButton
, 0, wxALIGN_CENTRE
|wxRIGHT
|wxTOP
|wxBOTTOM
, 5 ); 
 862     if (m_buttonFlags 
& wxPREVIEW_GOTO
) 
 864         m_gotoPageButton 
= new wxButton( this, wxID_PREVIEW_GOTO
, _("&Goto..."), wxDefaultPosition
, wxDefaultSize
, 0 ); 
 865         item0
->Add( m_gotoPageButton
, 0, wxALIGN_CENTRE
|wxALL
, 5 ); 
 868     if (m_buttonFlags 
& wxPREVIEW_ZOOM
) 
 872             wxT("10%"), wxT("15%"), wxT("20%"), wxT("25%"), wxT("30%"), wxT("35%"), wxT("40%"), wxT("45%"), wxT("50%"), wxT("55%"), 
 873                 wxT("60%"), wxT("65%"), wxT("70%"), wxT("75%"), wxT("80%"), wxT("85%"), wxT("90%"), wxT("95%"), wxT("100%"), wxT("110%"), 
 874                 wxT("120%"), wxT("150%"), wxT("200%") 
 876         int n 
= WXSIZEOF(choices
); 
 878         m_zoomControl 
= new wxChoice( this, wxID_PREVIEW_ZOOM
, wxDefaultPosition
, wxSize(70,wxDefaultCoord
), n
, choices
, 0 ); 
 879         item0
->Add( m_zoomControl
, 0, wxALIGN_CENTRE
|wxALL
, 5 ); 
 880         SetZoomControl(m_printPreview
->GetZoom()); 
 887 void wxPreviewControlBar::SetZoomControl(int zoom
) 
 891         int n
, count 
= m_zoomControl
->GetCount(); 
 893         for (n
=0; n
<count
; n
++) 
 895             if (m_zoomControl
->GetString(n
).BeforeFirst(wxT('%')).ToLong(&val
) && 
 898                 m_zoomControl
->SetSelection(n
); 
 903         m_zoomControl
->SetSelection(count
-1); 
 907 int wxPreviewControlBar::GetZoomControl() 
 909     if (m_zoomControl 
&& (m_zoomControl
->GetStringSelection() != wxEmptyString
)) 
 912         if (m_zoomControl
->GetStringSelection().BeforeFirst(wxT('%')).ToLong(&val
)) 
 924 IMPLEMENT_CLASS(wxPreviewFrame
, wxFrame
) 
 926 BEGIN_EVENT_TABLE(wxPreviewFrame
, wxFrame
) 
 927     EVT_CLOSE(wxPreviewFrame::OnCloseWindow
) 
 930 wxPreviewFrame::wxPreviewFrame(wxPrintPreviewBase 
*preview
, wxWindow 
*parent
, const wxString
& title
, 
 931                                const wxPoint
& pos
, const wxSize
& size
, long style
, const wxString
& name
): 
 932 wxFrame(parent
, wxID_ANY
, title
, pos
, size
, style
, name
) 
 934     m_printPreview 
= preview
; 
 936     m_previewCanvas 
= NULL
; 
 937     m_windowDisabler 
= NULL
; 
 939     // Give the application icon 
 941     wxFrame
* topFrame 
= wxDynamicCast(wxTheApp
->GetTopWindow(), wxFrame
); 
 943         SetIcon(topFrame
->GetIcon()); 
 947 wxPreviewFrame::~wxPreviewFrame() 
 951 void wxPreviewFrame::OnCloseWindow(wxCloseEvent
& WXUNUSED(event
)) 
 953     if (m_windowDisabler
) 
 954         delete m_windowDisabler
; 
 956     // Need to delete the printout and the print preview 
 957     wxPrintout 
*printout 
= m_printPreview
->GetPrintout(); 
 961         m_printPreview
->SetPrintout(NULL
); 
 962         m_printPreview
->SetCanvas(NULL
); 
 963         m_printPreview
->SetFrame(NULL
); 
 965     delete m_printPreview
; 
 970 void wxPreviewFrame::Initialize() 
 978     m_printPreview
->SetCanvas(m_previewCanvas
); 
 979     m_printPreview
->SetFrame(this); 
 981     wxBoxSizer 
*item0 
= new wxBoxSizer( wxVERTICAL 
); 
 983     item0
->Add( m_controlBar
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
, 5 ); 
 984     item0
->Add( m_previewCanvas
, 1, wxGROW
|wxALIGN_CENTER_VERTICAL
, 5 ); 
 986     SetAutoLayout( true ); 
 989     m_windowDisabler 
= new wxWindowDisabler(this); 
 993     m_printPreview
->AdjustScrollbars(m_previewCanvas
); 
 994     m_previewCanvas
->SetFocus(); 
 995     m_controlBar
->SetFocus(); 
 998 void wxPreviewFrame::CreateCanvas() 
1000     m_previewCanvas 
= new wxPreviewCanvas(m_printPreview
, this); 
1003 void wxPreviewFrame::CreateControlBar() 
1005     long buttons 
= wxPREVIEW_DEFAULT
; 
1006     if (m_printPreview
->GetPrintoutForPrinting()) 
1007         buttons 
|= wxPREVIEW_PRINT
; 
1009     m_controlBar 
= new wxPreviewControlBar(m_printPreview
, buttons
, this, wxPoint(0,0), wxSize(400, 40)); 
1010     m_controlBar
->CreateButtons(); 
1017 IMPLEMENT_CLASS(wxPrintPreviewBase
, wxObject
) 
1019 wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout 
*printout
, 
1020                                        wxPrintout 
*printoutForPrinting
, 
1024         m_printDialogData 
= (*data
); 
1026     Init(printout
, printoutForPrinting
); 
1029 wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout 
*printout
, 
1030                                        wxPrintout 
*printoutForPrinting
, 
1031                                        wxPrintDialogData 
*data
) 
1034         m_printDialogData 
= (*data
); 
1036     Init(printout
, printoutForPrinting
); 
1039 void wxPrintPreviewBase::Init(wxPrintout 
*printout
, 
1040                               wxPrintout 
*printoutForPrinting
) 
1043     m_previewPrintout 
= printout
; 
1044     if (m_previewPrintout
) 
1045         m_previewPrintout
->SetIsPreview(true); 
1047     m_printPrintout 
= printoutForPrinting
; 
1049     m_previewCanvas 
= NULL
; 
1050     m_previewFrame 
= NULL
; 
1051     m_previewBitmap 
= NULL
; 
1058     m_printingPrepared 
= false; 
1063 wxPrintPreviewBase::~wxPrintPreviewBase() 
1065     if (m_previewPrintout
) 
1066         delete m_previewPrintout
; 
1067     if (m_previewBitmap
) 
1068         delete m_previewBitmap
; 
1069     if (m_printPrintout
) 
1070         delete m_printPrintout
; 
1073 bool wxPrintPreviewBase::SetCurrentPage(int pageNum
) 
1075     if (m_currentPage 
== pageNum
) 
1078     m_currentPage 
= pageNum
; 
1079     if (m_previewBitmap
) 
1081         delete m_previewBitmap
; 
1082         m_previewBitmap 
= NULL
; 
1085     if (m_previewCanvas
) 
1087         AdjustScrollbars(m_previewCanvas
); 
1089         if (!RenderPage(pageNum
)) 
1091         m_previewCanvas
->Refresh(); 
1092         m_previewCanvas
->SetFocus(); 
1097 int wxPrintPreviewBase::GetCurrentPage() const 
1098     { return m_currentPage
; }; 
1099 void wxPrintPreviewBase::SetPrintout(wxPrintout 
*printout
) 
1100     { m_previewPrintout 
= printout
; }; 
1101 wxPrintout 
*wxPrintPreviewBase::GetPrintout() const 
1102     { return m_previewPrintout
; }; 
1103 wxPrintout 
*wxPrintPreviewBase::GetPrintoutForPrinting() const 
1104     { return m_printPrintout
; }; 
1105 void wxPrintPreviewBase::SetFrame(wxFrame 
*frame
) 
1106     { m_previewFrame 
= frame
; }; 
1107 void wxPrintPreviewBase::SetCanvas(wxPreviewCanvas 
*canvas
) 
1108     { m_previewCanvas 
= canvas
; }; 
1109 wxFrame 
*wxPrintPreviewBase::GetFrame() const 
1110     { return m_previewFrame
; } 
1111 wxPreviewCanvas 
*wxPrintPreviewBase::GetCanvas() const 
1112     { return m_previewCanvas
; } 
1114 bool wxPrintPreviewBase::PaintPage(wxPreviewCanvas 
*canvas
, wxDC
& dc
) 
1116     DrawBlankPage(canvas
, dc
); 
1118     if (!m_previewBitmap
) 
1119         if (!RenderPage(m_currentPage
)) 
1122     if (!m_previewBitmap
) 
1128     int canvasWidth
, canvasHeight
; 
1129     canvas
->GetSize(&canvasWidth
, &canvasHeight
); 
1131     double zoomScale 
= ((float)m_currentZoom
/(float)100); 
1132     double actualWidth 
= (zoomScale
*m_pageWidth
*m_previewScale
); 
1133     //  float actualHeight = (float)(zoomScale*m_pageHeight*m_previewScale); 
1135     int x 
= (int) ((canvasWidth 
- actualWidth
)/2.0); 
1136     if (x 
< m_leftMargin
) 
1138     int y 
= m_topMargin
; 
1141     temp_dc
.SelectObject(*m_previewBitmap
); 
1143     dc
.Blit(x
, y
, m_previewBitmap
->GetWidth(), m_previewBitmap
->GetHeight(), &temp_dc
, 0, 0); 
1145     temp_dc
.SelectObject(wxNullBitmap
); 
1150 // Adjusts the scrollbars for the current scale 
1151 void wxPrintPreviewBase::AdjustScrollbars(wxPreviewCanvas 
*canvas
) 
1156     int canvasWidth
, canvasHeight
; 
1157     canvas
->GetSize(&canvasWidth
, &canvasHeight
); 
1159     double zoomScale 
= ((float)m_currentZoom
/(float)100); 
1160     double actualWidth 
= (zoomScale
*m_pageWidth
*m_previewScale
); 
1161     double actualHeight 
= (zoomScale
*m_pageHeight
*m_previewScale
); 
1163     // Set the scrollbars appropriately 
1164     int totalWidth 
= (int)(actualWidth 
+ 2*m_leftMargin
); 
1165     int totalHeight 
= (int)(actualHeight 
+ 2*m_topMargin
); 
1166     int scrollUnitsX 
= totalWidth
/10; 
1167     int scrollUnitsY 
= totalHeight
/10; 
1168     wxSize virtualSize 
= canvas
->GetVirtualSize(); 
1169     if (virtualSize
.GetWidth() != totalWidth 
|| virtualSize
.GetHeight() != totalHeight
) 
1170         canvas
->SetScrollbars(10, 10, scrollUnitsX
, scrollUnitsY
, 0, 0, true); 
1173 bool wxPrintPreviewBase::RenderPage(int pageNum
) 
1177     int canvasWidth
, canvasHeight
; 
1179     if (!m_previewCanvas
) 
1181         wxFAIL_MSG(_T("wxPrintPreviewBase::RenderPage: must use wxPrintPreviewBase::SetCanvas to let me know about the canvas!")); 
1185     m_previewCanvas
->GetSize(&canvasWidth
, &canvasHeight
); 
1187     double zoomScale 
= (m_currentZoom
/100.0); 
1188     int actualWidth 
= (int)(zoomScale
*m_pageWidth
*m_previewScale
); 
1189     int actualHeight 
= (int)(zoomScale
*m_pageHeight
*m_previewScale
); 
1191     if (!m_previewBitmap
) 
1193         m_previewBitmap 
= new wxBitmap((int)actualWidth
, (int)actualHeight
); 
1194         if (!m_previewBitmap 
|| !m_previewBitmap
->Ok()) 
1196             if (m_previewBitmap
) { 
1197                 delete m_previewBitmap
; 
1198                 m_previewBitmap 
= NULL
; 
1200             wxMessageBox(_("Sorry, not enough memory to create a preview."), _("Print Preview Failure"), wxOK
); 
1205     wxMemoryDC memoryDC
; 
1206     memoryDC
.SelectObject(*m_previewBitmap
); 
1210     m_previewPrintout
->SetDC(&memoryDC
); 
1211     m_previewPrintout
->SetPageSizePixels(m_pageWidth
, m_pageHeight
); 
1213     // Need to delay OnPreparePrinting until here, so we have enough information. 
1214     if (!m_printingPrepared
) 
1216         m_previewPrintout
->OnPreparePrinting(); 
1218         m_previewPrintout
->GetPageInfo(&m_minPage
, &m_maxPage
, &selFrom
, &selTo
); 
1219         m_printingPrepared 
= true; 
1222     m_previewPrintout
->OnBeginPrinting(); 
1224     if (!m_previewPrintout
->OnBeginDocument(m_printDialogData
.GetFromPage(), m_printDialogData
.GetToPage())) 
1226         wxMessageBox(_("Could not start document preview."), _("Print Preview Failure"), wxOK
); 
1228         memoryDC
.SelectObject(wxNullBitmap
); 
1230         delete m_previewBitmap
; 
1231         m_previewBitmap 
= NULL
; 
1235     m_previewPrintout
->OnPrintPage(pageNum
); 
1236     m_previewPrintout
->OnEndDocument(); 
1237     m_previewPrintout
->OnEndPrinting(); 
1239     m_previewPrintout
->SetDC(NULL
); 
1241     memoryDC
.SelectObject(wxNullBitmap
); 
1246         status 
= wxString::Format(_("Page %d of %d"), pageNum
, m_maxPage
); 
1248         status 
= wxString::Format(_("Page %d"), pageNum
); 
1251         m_previewFrame
->SetStatusText(status
); 
1258 bool wxPrintPreviewBase::DrawBlankPage(wxPreviewCanvas 
*canvas
, wxDC
& dc
) 
1260     int canvasWidth
, canvasHeight
; 
1261     canvas
->GetSize(&canvasWidth
, &canvasHeight
); 
1263     float zoomScale 
= (float)((float)m_currentZoom
/(float)100); 
1264     float actualWidth 
= zoomScale
*m_pageWidth
*m_previewScale
; 
1265     float actualHeight 
= zoomScale
*m_pageHeight
*m_previewScale
; 
1267     float x 
= (float)((canvasWidth 
- actualWidth
)/2.0); 
1268     if (x 
< m_leftMargin
) 
1269         x 
= (float)m_leftMargin
; 
1270     float y 
= (float)m_topMargin
; 
1272     // Draw shadow, allowing for 1-pixel border AROUND the actual page 
1273     int shadowOffset 
= 4; 
1274     dc
.SetPen(*wxBLACK_PEN
); 
1275     dc
.SetBrush(*wxBLACK_BRUSH
); 
1277     dc.DrawRectangle((int)(x-1 + shadowOffset), (int)(y-1 + shadowOffset), (int)(actualWidth+2), (int)(actualHeight+2)); 
1279     dc
.DrawRectangle((int)(x 
+ shadowOffset
), (int)(y 
+ actualHeight
+1), (int)(actualWidth
), shadowOffset
); 
1280     dc
.DrawRectangle((int)(x 
+ actualWidth
), (int)(y 
+ shadowOffset
), shadowOffset
, (int)(actualHeight
)); 
1282     // Draw blank page allowing for 1-pixel border AROUND the actual page 
1283     dc
.SetPen(*wxBLACK_PEN
); 
1284     dc
.SetBrush(*wxWHITE_BRUSH
); 
1287     wxRegion update_region = canvas->GetUpdateRegion(); 
1288     wxRect r = update_region.GetBox(); 
1290       printf( "x: %d y: %d w: %d h: %d.\n", (int)r.x, (int)r.y, (int)r.width, (int)r.height ); 
1293     dc
.DrawRectangle((int)(x
-2), (int)(y
-1), (int)(actualWidth
+3), (int)(actualHeight
+2)); 
1298 void wxPrintPreviewBase::SetZoom(int percent
) 
1300     if (m_currentZoom 
== percent
) 
1303     m_currentZoom 
= percent
; 
1304     if (m_previewBitmap
) 
1306         delete m_previewBitmap
; 
1307         m_previewBitmap 
= NULL
; 
1310     if (m_previewCanvas
) 
1312         AdjustScrollbars(m_previewCanvas
); 
1313         RenderPage(m_currentPage
); 
1314         ((wxScrolledWindow 
*) m_previewCanvas
)->Scroll(0, 0); 
1315         m_previewCanvas
->ClearBackground(); 
1316         m_previewCanvas
->Refresh(); 
1317         m_previewCanvas
->SetFocus(); 
1321 wxPrintDialogData
& wxPrintPreviewBase::GetPrintDialogData() 
1323     return m_printDialogData
; 
1326 int wxPrintPreviewBase::GetZoom() const 
1327 { return m_currentZoom
; } 
1328 int wxPrintPreviewBase::GetMaxPage() const 
1329 { return m_maxPage
; } 
1330 int wxPrintPreviewBase::GetMinPage() const 
1331 { return m_minPage
; } 
1332 bool wxPrintPreviewBase::Ok() const 
1334 void wxPrintPreviewBase::SetOk(bool ok
) 
1336 //---------------------------------------------------------------------------- 
1338 //---------------------------------------------------------------------------- 
1340 IMPLEMENT_CLASS(wxPrintPreview
, wxPrintPreviewBase
) 
1342 wxPrintPreview::wxPrintPreview(wxPrintout 
*printout
, 
1343                    wxPrintout 
*printoutForPrinting
, 
1344                    wxPrintDialogData 
*data
) : 
1345     wxPrintPreviewBase( printout
, printoutForPrinting
, data 
) 
1347     m_pimpl 
= wxPrintFactory::GetFactory()-> 
1348         CreatePrintPreview( printout
, printoutForPrinting
, data 
); 
1351 wxPrintPreview::wxPrintPreview(wxPrintout 
*printout
, 
1352                    wxPrintout 
*printoutForPrinting
, 
1353                    wxPrintData 
*data 
) : 
1354     wxPrintPreviewBase( printout
, printoutForPrinting
, data 
) 
1356     m_pimpl 
= wxPrintFactory::GetFactory()-> 
1357         CreatePrintPreview( printout
, printoutForPrinting
, data 
); 
1360 wxPrintPreview::~wxPrintPreview() 
1364     // don't delete twice 
1365     m_printPrintout 
= NULL
; 
1366     m_previewPrintout 
= NULL
; 
1367     m_previewBitmap 
= NULL
; 
1370 bool wxPrintPreview::SetCurrentPage(int pageNum
) 
1372     return m_pimpl
->SetCurrentPage( pageNum 
); 
1375 int wxPrintPreview::GetCurrentPage() const 
1377     return m_pimpl
->GetCurrentPage(); 
1380 void wxPrintPreview::SetPrintout(wxPrintout 
*printout
) 
1382     m_pimpl
->SetPrintout( printout 
); 
1385 wxPrintout 
*wxPrintPreview::GetPrintout() const 
1387     return m_pimpl
->GetPrintout(); 
1390 wxPrintout 
*wxPrintPreview::GetPrintoutForPrinting() const 
1392     return m_pimpl
->GetPrintoutForPrinting(); 
1395 void wxPrintPreview::SetFrame(wxFrame 
*frame
) 
1397     m_pimpl
->SetFrame( frame 
); 
1400 void wxPrintPreview::SetCanvas(wxPreviewCanvas 
*canvas
) 
1402     m_pimpl
->SetCanvas( canvas 
); 
1405 wxFrame 
*wxPrintPreview::GetFrame() const 
1407     return m_pimpl
->GetFrame(); 
1410 wxPreviewCanvas 
*wxPrintPreview::GetCanvas() const 
1412     return m_pimpl
->GetCanvas(); 
1415 bool wxPrintPreview::PaintPage(wxPreviewCanvas 
*canvas
, wxDC
& dc
) 
1417     return m_pimpl
->PaintPage( canvas
, dc 
); 
1420 bool wxPrintPreview::DrawBlankPage(wxPreviewCanvas 
*canvas
, wxDC
& dc
) 
1422     return m_pimpl
->DrawBlankPage( canvas
, dc 
); 
1425 void wxPrintPreview::AdjustScrollbars(wxPreviewCanvas 
*canvas
) 
1427     m_pimpl
->AdjustScrollbars( canvas 
); 
1430 bool wxPrintPreview::RenderPage(int pageNum
) 
1432     return m_pimpl
->RenderPage( pageNum 
); 
1435 void wxPrintPreview::SetZoom(int percent
) 
1437     m_pimpl
->SetZoom( percent 
); 
1440 wxPrintDialogData
& wxPrintPreview::GetPrintDialogData() 
1442     return m_pimpl
->GetPrintDialogData(); 
1445 int wxPrintPreview::GetMaxPage() const 
1447     return m_pimpl
->GetMaxPage(); 
1450 int wxPrintPreview::GetMinPage() const 
1452     return m_pimpl
->GetMinPage(); 
1455 bool wxPrintPreview::Ok() const 
1457     return m_pimpl
->Ok(); 
1460 void wxPrintPreview::SetOk(bool ok
) 
1462     m_pimpl
->SetOk( ok 
); 
1465 bool wxPrintPreview::Print(bool interactive
) 
1467     return m_pimpl
->Print( interactive 
); 
1470 void wxPrintPreview::DetermineScaling() 
1472     m_pimpl
->DetermineScaling(); 
1476 #endif // wxUSE_PRINTING_ARCHITECTURE