wxHtmlEasyPrinting indentation changes + CreatePrintout,DoPrint and DoPreview virtual and protected
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11443 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -97,64 +97,64 @@ enum {
|
|||||||
|
|
||||||
class WXDLLEXPORT wxHtmlPrintout : public wxPrintout
|
class WXDLLEXPORT wxHtmlPrintout : public wxPrintout
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxHtmlPrintout(const wxString& title = "Printout");
|
wxHtmlPrintout(const wxString& title = "Printout");
|
||||||
~wxHtmlPrintout();
|
~wxHtmlPrintout();
|
||||||
|
|
||||||
void SetHtmlText(const wxString& html, const wxString &basepath = wxEmptyString, bool isdir = TRUE);
|
void SetHtmlText(const wxString& html, const wxString &basepath = wxEmptyString, bool isdir = TRUE);
|
||||||
// prepares the class for printing this html document.
|
// prepares the class for printing this html document.
|
||||||
// Must be called before using the class, in fact just after constructor
|
// Must be called before using the class, in fact just after constructor
|
||||||
//
|
//
|
||||||
// basepath is base directory (html string would be stored there if it was in
|
// basepath is base directory (html string would be stored there if it was in
|
||||||
// file). It is used to determine path for loading images, for example.
|
// file). It is used to determine path for loading images, for example.
|
||||||
// isdir is FALSE if basepath is filename, TRUE if it is directory name
|
// isdir is FALSE if basepath is filename, TRUE if it is directory name
|
||||||
// (see wxFileSystem for detailed explanation)
|
// (see wxFileSystem for detailed explanation)
|
||||||
|
|
||||||
void SetHtmlFile(const wxString &htmlfile);
|
|
||||||
// same as SetHtmlText except that it takes regular file as the parameter
|
|
||||||
|
|
||||||
void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
|
|
||||||
void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
|
|
||||||
// sets header/footer for the document. The argument is interpreted as HTML document.
|
|
||||||
// You can use macros in it:
|
|
||||||
// @PAGENUM@ is replaced by page number
|
|
||||||
// @PAGESCNT@ is replaced by total number of pages
|
|
||||||
//
|
|
||||||
// pg is one of wxPAGE_ODD, wxPAGE_EVEN and wx_PAGE_ALL constants.
|
|
||||||
// You can set different header/footer for odd and even pages
|
|
||||||
|
|
||||||
void SetMargins(float top = 25.2, float bottom = 25.2, float left = 25.2, float right = 25.2,
|
void SetHtmlFile(const wxString &htmlfile);
|
||||||
float spaces = 5);
|
// same as SetHtmlText except that it takes regular file as the parameter
|
||||||
// sets margins in milimeters. Defaults to 1 inch for margins and 0.5cm for space
|
|
||||||
// between text and header and/or footer
|
|
||||||
|
|
||||||
// wxPrintout stuff:
|
void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
|
||||||
bool OnPrintPage(int page);
|
void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
|
||||||
bool HasPage(int page);
|
// sets header/footer for the document. The argument is interpreted as HTML document.
|
||||||
void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo);
|
// You can use macros in it:
|
||||||
bool OnBeginDocument(int startPage, int endPage);
|
// @PAGENUM@ is replaced by page number
|
||||||
|
// @PAGESCNT@ is replaced by total number of pages
|
||||||
private:
|
//
|
||||||
|
// pg is one of wxPAGE_ODD, wxPAGE_EVEN and wx_PAGE_ALL constants.
|
||||||
|
// You can set different header/footer for odd and even pages
|
||||||
|
|
||||||
void RenderPage(wxDC *dc, int page);
|
void SetMargins(float top = 25.2, float bottom = 25.2, float left = 25.2, float right = 25.2,
|
||||||
// renders one page into dc
|
float spaces = 5);
|
||||||
wxString TranslateHeader(const wxString& instr, int page);
|
// sets margins in milimeters. Defaults to 1 inch for margins and 0.5cm for space
|
||||||
// substitute @PAGENUM@ and @PAGESCNT@ by real values
|
// between text and header and/or footer
|
||||||
void CountPages();
|
|
||||||
// counts pages and fills m_NumPages and m_PageBreaks
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
int m_NumPages;
|
|
||||||
int m_PageBreaks[wxHTML_PRINT_MAX_PAGES];
|
|
||||||
|
|
||||||
wxString m_Document, m_BasePath;
|
// wxPrintout stuff:
|
||||||
bool m_BasePathIsDir;
|
bool OnPrintPage(int page);
|
||||||
wxString m_Headers[2], m_Footers[2];
|
bool HasPage(int page);
|
||||||
|
void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo);
|
||||||
|
bool OnBeginDocument(int startPage, int endPage);
|
||||||
|
|
||||||
int m_HeaderHeight, m_FooterHeight;
|
private:
|
||||||
wxHtmlDCRenderer *m_Renderer, *m_RendererHdr;
|
|
||||||
float m_MarginTop, m_MarginBottom, m_MarginLeft, m_MarginRight, m_MarginSpace;
|
void RenderPage(wxDC *dc, int page);
|
||||||
|
// renders one page into dc
|
||||||
|
wxString TranslateHeader(const wxString& instr, int page);
|
||||||
|
// substitute @PAGENUM@ and @PAGESCNT@ by real values
|
||||||
|
void CountPages();
|
||||||
|
// counts pages and fills m_NumPages and m_PageBreaks
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
int m_NumPages;
|
||||||
|
int m_PageBreaks[wxHTML_PRINT_MAX_PAGES];
|
||||||
|
|
||||||
|
wxString m_Document, m_BasePath;
|
||||||
|
bool m_BasePathIsDir;
|
||||||
|
wxString m_Headers[2], m_Footers[2];
|
||||||
|
|
||||||
|
int m_HeaderHeight, m_FooterHeight;
|
||||||
|
wxHtmlDCRenderer *m_Renderer, *m_RendererHdr;
|
||||||
|
float m_MarginTop, m_MarginBottom, m_MarginLeft, m_MarginRight, m_MarginSpace;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -175,51 +175,50 @@ class WXDLLEXPORT wxHtmlPrintout : public wxPrintout
|
|||||||
|
|
||||||
class WXDLLEXPORT wxHtmlEasyPrinting : public wxObject
|
class WXDLLEXPORT wxHtmlEasyPrinting : public wxObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
wxHtmlEasyPrinting(const wxString& name = "Printing", wxFrame *parent_frame = NULL);
|
||||||
|
~wxHtmlEasyPrinting();
|
||||||
|
|
||||||
wxHtmlEasyPrinting(const wxString& name = "Printing", wxFrame *parent_frame = NULL);
|
bool PreviewFile(const wxString &htmlfile);
|
||||||
~wxHtmlEasyPrinting();
|
bool PreviewText(const wxString &htmltext, const wxString& basepath = wxEmptyString);
|
||||||
|
// Preview file / html-text for printing
|
||||||
bool PreviewFile(const wxString &htmlfile);
|
// (and offers printing)
|
||||||
bool PreviewText(const wxString &htmltext, const wxString& basepath = wxEmptyString);
|
// basepath is base directory for opening subsequent files (e.g. from <img> tag)
|
||||||
// Preview file / html-text for printing
|
|
||||||
// (and offers printing)
|
|
||||||
// basepath is base directory for opening subsequent files (e.g. from <img> tag)
|
|
||||||
|
|
||||||
bool PrintFile(const wxString &htmlfile);
|
|
||||||
bool PrintText(const wxString &htmltext, const wxString& basepath = wxEmptyString);
|
|
||||||
// Print file / html-text w/o preview
|
|
||||||
|
|
||||||
void PrinterSetup();
|
|
||||||
void PageSetup();
|
|
||||||
// pop up printer or page setup dialog
|
|
||||||
|
|
||||||
void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
|
bool PrintFile(const wxString &htmlfile);
|
||||||
void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
|
bool PrintText(const wxString &htmltext, const wxString& basepath = wxEmptyString);
|
||||||
// sets header/footer for the document. The argument is interpreted as HTML document.
|
// Print file / html-text w/o preview
|
||||||
// You can use macros in it:
|
|
||||||
// @PAGENUM@ is replaced by page number
|
void PrinterSetup();
|
||||||
// @PAGESCNT@ is replaced by total number of pages
|
void PageSetup();
|
||||||
//
|
// pop up printer or page setup dialog
|
||||||
// pg is one of wxPAGE_ODD, wxPAGE_EVEN and wx_PAGE_ALL constants.
|
|
||||||
// You can set different header/footer for odd and even pages
|
void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
|
||||||
|
void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
|
||||||
wxPrintData *GetPrintData() {return m_PrintData;}
|
// sets header/footer for the document. The argument is interpreted as HTML document.
|
||||||
wxPageSetupDialogData *GetPageSetupData() {return m_PageSetupData;}
|
// You can use macros in it:
|
||||||
// return page setting data objects.
|
// @PAGENUM@ is replaced by page number
|
||||||
// (You can set their parameters.)
|
// @PAGESCNT@ is replaced by total number of pages
|
||||||
|
//
|
||||||
private:
|
// pg is one of wxPAGE_ODD, wxPAGE_EVEN and wx_PAGE_ALL constants.
|
||||||
|
// You can set different header/footer for odd and even pages
|
||||||
wxHtmlPrintout *CreatePrintout();
|
|
||||||
bool DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *printout2);
|
wxPrintData *GetPrintData() {return m_PrintData;}
|
||||||
bool DoPrint(wxHtmlPrintout *printout);
|
wxPageSetupDialogData *GetPageSetupData() {return m_PageSetupData;}
|
||||||
|
// return page setting data objects.
|
||||||
wxPrintData *m_PrintData;
|
// (You can set their parameters.)
|
||||||
wxPageSetupDialogData *m_PageSetupData;
|
|
||||||
wxString m_Name;
|
protected:
|
||||||
wxString m_Headers[2], m_Footers[2];
|
virtual wxHtmlPrintout *CreatePrintout();
|
||||||
wxFrame *m_Frame;
|
virtual bool DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *printout2);
|
||||||
|
virtual bool DoPrint(wxHtmlPrintout *printout);
|
||||||
|
|
||||||
|
private:
|
||||||
|
wxPrintData *m_PrintData;
|
||||||
|
wxPageSetupDialogData *m_PageSetupData;
|
||||||
|
wxString m_Name;
|
||||||
|
wxString m_Headers[2], m_Footers[2];
|
||||||
|
wxFrame *m_Frame;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user