bool PreviewBuffer(const wxRichTextBuffer& buffer);
/// Print the file or buffer
- bool PrintFile(const wxString& richTextFile);
- bool PrintBuffer(const wxRichTextBuffer& buffer);
+ bool PrintFile(const wxString& richTextFile, bool showPrintDialog = true);
+ bool PrintBuffer(const wxRichTextBuffer& buffer, bool showPrintDialog = true);
/// Shows page setup dialog
void PageSetup();
protected:
virtual wxRichTextPrintout *CreatePrintout();
virtual bool DoPreview(wxRichTextPrintout *printout1, wxRichTextPrintout *printout2);
- virtual bool DoPrint(wxRichTextPrintout *printout);
+ virtual bool DoPrint(wxRichTextPrintout *printout, bool showPrintDialog);
private:
wxPrintData* m_printData;
/**
Prints the given buffer. The function takes its own copy of @a buffer.
+ @showPrintDialog can be @true to show the print dialog, or @false to print quietly.
*/
- bool PrintBuffer(const wxRichTextBuffer& buffer);
+ bool PrintBuffer(const wxRichTextBuffer& buffer, bool showPrintDialog = true);
/**
Prints the given file. @a richTextFile can be a text file or XML file,
- or other file depending on the available file handlers.
+ or other file depending on the available file handlers. @showPrintDialog
+ can be @true to show the print dialog, or @false to print quietly.
*/
- bool PrintFile(const wxString& richTextFile);
+ bool PrintFile(const wxString& richTextFile, bool showPrintDialog = true);
/**
A convenience function to set the footer text.
return DoPreview(p1, p2);
}
-bool wxRichTextPrinting::PrintFile(const wxString& richTextFile)
+bool wxRichTextPrinting::PrintFile(const wxString& richTextFile, bool showPrintDialog)
{
SetRichTextBufferPrinting(new wxRichTextBuffer);
wxRichTextPrintout *p = CreatePrintout();
p->SetRichTextBuffer(m_richTextBufferPrinting);
- bool ret = DoPrint(p);
+ bool ret = DoPrint(p, showPrintDialog);
delete p;
return ret;
}
-bool wxRichTextPrinting::PrintBuffer(const wxRichTextBuffer& buffer)
+bool wxRichTextPrinting::PrintBuffer(const wxRichTextBuffer& buffer, bool showPrintDialog)
{
SetRichTextBufferPrinting(new wxRichTextBuffer(buffer));
wxRichTextPrintout *p = CreatePrintout();
p->SetRichTextBuffer(m_richTextBufferPrinting);
- bool ret = DoPrint(p);
+ bool ret = DoPrint(p, showPrintDialog);
delete p;
return ret;
}
return true;
}
-bool wxRichTextPrinting::DoPrint(wxRichTextPrintout *printout)
+bool wxRichTextPrinting::DoPrint(wxRichTextPrintout *printout, bool showPrintDialog)
{
wxPrintDialogData printDialogData(*GetPrintData());
wxPrinter printer(&printDialogData);
- if (!printer.Print(m_parentWindow, printout, true))
+ if (!printer.Print(m_parentWindow, printout, showPrintDialog))
{
return false;
}