+wxPrintAbortDialog *wxPrinter::CreateAbortWindow(wxWindow *parent, wxPrintout *printout)
+{
+ return m_pimpl->CreateAbortWindow( parent, printout );
+}
+
+void wxPrinter::ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message)
+{
+ m_pimpl->ReportError( parent, printout, message );
+}
+
+bool wxPrinter::Setup(wxWindow *parent)
+{
+ return m_pimpl->Setup( parent );
+}
+
+bool wxPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
+{
+ if ( !prompt && m_printDialogData.GetToPage() == 0 )
+ {
+ // If the dialog is not shown, set the pages range to print everything
+ // by default (as otherwise we wouldn't print anything at all which is
+ // certainly not a reasonable default behaviour).
+ int minPage, maxPage, selFrom, selTo;
+ printout->GetPageInfo(&minPage, &maxPage, &selFrom, &selTo);
+
+ wxPrintDialogData& pdd = m_pimpl->GetPrintDialogData();
+ pdd.SetFromPage(minPage);
+ pdd.SetToPage(maxPage);
+ }
+
+ return m_pimpl->Print( parent, printout, prompt );
+}
+
+wxDC* wxPrinter::PrintDialog(wxWindow *parent)
+{
+ return m_pimpl->PrintDialog( parent );
+}
+
+wxPrintDialogData& wxPrinter::GetPrintDialogData() const
+{
+ return m_pimpl->GetPrintDialogData();
+}
+
+// ---------------------------------------------------------------------------
+// wxPrintDialogBase: the dialog for printing.
+// ---------------------------------------------------------------------------
+
+IMPLEMENT_ABSTRACT_CLASS(wxPrintDialogBase, wxDialog)
+
+wxPrintDialogBase::wxPrintDialogBase(wxWindow *parent,
+ wxWindowID id,
+ const wxString &title,
+ const wxPoint &pos,
+ const wxSize &size,
+ long style)
+ : wxDialog( parent, id, title.empty() ? wxString(_("Print")) : title,
+ pos, size, style )
+{
+}
+
+// ---------------------------------------------------------------------------
+// wxPrintDialog: the dialog for printing
+// ---------------------------------------------------------------------------
+
+IMPLEMENT_CLASS(wxPrintDialog, wxObject)
+
+wxPrintDialog::wxPrintDialog(wxWindow *parent, wxPrintDialogData* data)
+{
+ m_pimpl = wxPrintFactory::GetFactory()->CreatePrintDialog( parent, data );
+}
+
+wxPrintDialog::wxPrintDialog(wxWindow *parent, wxPrintData* data)
+{
+ m_pimpl = wxPrintFactory::GetFactory()->CreatePrintDialog( parent, data );
+}
+
+wxPrintDialog::~wxPrintDialog()
+{
+ delete m_pimpl;
+}
+
+int wxPrintDialog::ShowModal()
+{
+ return m_pimpl->ShowModal();
+}
+
+wxPrintDialogData& wxPrintDialog::GetPrintDialogData()
+{
+ return m_pimpl->GetPrintDialogData();
+}
+
+wxPrintData& wxPrintDialog::GetPrintData()
+{
+ return m_pimpl->GetPrintData();
+}
+
+wxDC *wxPrintDialog::GetPrintDC()
+{
+ return m_pimpl->GetPrintDC();
+}
+
+// ---------------------------------------------------------------------------
+// wxPageSetupDialogBase: the page setup dialog
+// ---------------------------------------------------------------------------
+
+IMPLEMENT_ABSTRACT_CLASS(wxPageSetupDialogBase, wxDialog)
+
+wxPageSetupDialogBase::wxPageSetupDialogBase(wxWindow *parent,
+ wxWindowID id,
+ const wxString &title,
+ const wxPoint &pos,
+ const wxSize &size,
+ long style)
+ : wxDialog( parent, id, title.empty() ? wxString(_("Page setup")) : title,
+ pos, size, style )
+{
+}
+
+// ---------------------------------------------------------------------------
+// wxPageSetupDialog: the page setup dialog
+// ---------------------------------------------------------------------------
+
+IMPLEMENT_CLASS(wxPageSetupDialog, wxObject)
+
+wxPageSetupDialog::wxPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data )
+{
+ m_pimpl = wxPrintFactory::GetFactory()->CreatePageSetupDialog( parent, data );
+}
+
+wxPageSetupDialog::~wxPageSetupDialog()
+{
+ delete m_pimpl;
+}
+
+int wxPageSetupDialog::ShowModal()
+{
+ return m_pimpl->ShowModal();
+}
+
+wxPageSetupDialogData& wxPageSetupDialog::GetPageSetupDialogData()
+{
+ return m_pimpl->GetPageSetupDialogData();
+}
+
+// old name
+wxPageSetupDialogData& wxPageSetupDialog::GetPageSetupData()
+{
+ return m_pimpl->GetPageSetupDialogData();
+}
+
+//----------------------------------------------------------------------------
+// wxPrintAbortDialog
+//----------------------------------------------------------------------------
+
+BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog)
+ EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel)
+END_EVENT_TABLE()
+
+wxPrintAbortDialog::wxPrintAbortDialog(wxWindow *parent,
+ const wxString& documentTitle,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxString& name)
+ : wxDialog(parent, wxID_ANY, _("Printing"), pos, size, style, name)
+{
+ wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
+ mainSizer->Add(new wxStaticText(this, wxID_ANY, _("Please wait while printing...")),
+ wxSizerFlags().Expand().DoubleBorder());
+
+ wxFlexGridSizer *gridSizer = new wxFlexGridSizer(2, wxSize(20, 0));
+ gridSizer->Add(new wxStaticText(this, wxID_ANY, _("Document:")));
+ gridSizer->AddGrowableCol(1);
+ gridSizer->Add(new wxStaticText(this, wxID_ANY, documentTitle));
+ gridSizer->Add(new wxStaticText(this, wxID_ANY, _("Progress:")));
+ m_progress = new wxStaticText(this, wxID_ANY, _("Preparing"));
+ m_progress->SetMinSize(wxSize(250, -1));
+ gridSizer->Add(m_progress);
+ mainSizer->Add(gridSizer, wxSizerFlags().Expand().DoubleBorder(wxLEFT | wxRIGHT));
+
+ mainSizer->Add(CreateStdDialogButtonSizer(wxCANCEL),
+ wxSizerFlags().Expand().DoubleBorder());
+
+ SetSizerAndFit(mainSizer);
+}
+
+void wxPrintAbortDialog::SetProgress(int currentPage, int totalPages,
+ int currentCopy, int totalCopies)
+{
+ wxString text;
+ text.Printf(_("Printing page %d of %d"), currentPage, totalPages);
+ if ( totalCopies > 1 )
+ text += wxString::Format(_(" (copy %d of %d)"), currentCopy, totalCopies);
+ m_progress->SetLabel(text);
+}
+
+void wxPrintAbortDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
+{
+ wxCHECK_RET( wxPrinterBase::sm_abortWindow != NULL, "OnCancel called twice" );
+
+ wxPrinterBase::sm_abortIt = true;
+ wxPrinterBase::sm_abortWindow->Destroy();
+ wxPrinterBase::sm_abortWindow = NULL;
+}
+
+//----------------------------------------------------------------------------
+// wxPrintout
+//----------------------------------------------------------------------------
+
+IMPLEMENT_ABSTRACT_CLASS(wxPrintout, wxObject)