X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9749497156909657d17ef972857caaca4bd09da2..6d9022fe3bb50a75b9b5eaf5cf32558e518ba310:/include/wx/html/htmprint.h?ds=inline diff --git a/include/wx/html/htmprint.h b/include/wx/html/htmprint.h index e3d527d1f4..a68eb03f2f 100644 --- a/include/wx/html/htmprint.h +++ b/include/wx/html/htmprint.h @@ -15,7 +15,7 @@ #pragma interface "htmprint.h" #endif -#include +#include "wx/defs.h" #if wxUSE_HTML & wxUSE_PRINTING_ARCHITECTURE @@ -97,64 +97,64 @@ enum { class WXDLLEXPORT wxHtmlPrintout : public wxPrintout { - public: - wxHtmlPrintout(const wxString& title = "Printout"); - ~wxHtmlPrintout(); - - void SetHtmlText(const wxString& html, const wxString &basepath = wxEmptyString, bool isdir = TRUE); - // prepares the class for printing this html document. - // 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 - // 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 - // (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, - float spaces = 5); - // sets margins in milimeters. Defaults to 1 inch for margins and 0.5cm for space - // between text and header and/or footer - - // wxPrintout stuff: - bool OnPrintPage(int page); - bool HasPage(int page); - void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo); - bool OnBeginDocument(int startPage, int endPage); - - private: - - 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; +public: + wxHtmlPrintout(const wxString& title = "Printout"); + ~wxHtmlPrintout(); + + void SetHtmlText(const wxString& html, const wxString &basepath = wxEmptyString, bool isdir = TRUE); + // prepares the class for printing this html document. + // 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 + // 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 + // (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, + float spaces = 5); + // sets margins in milimeters. Defaults to 1 inch for margins and 0.5cm for space + // between text and header and/or footer + + // wxPrintout stuff: + bool OnPrintPage(int page); + bool HasPage(int page); + void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo); + bool OnBeginDocument(int startPage, int endPage); + +private: + + 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 { - public: - - wxHtmlEasyPrinting(const wxString& name = "Printing", wxFrame *parent_frame = NULL); - ~wxHtmlEasyPrinting(); - - bool PreviewFile(const wxString &htmlfile); - bool PreviewText(const wxString &htmltext, const wxString& basepath = wxEmptyString); - // Preview file / html-text for printing - // (and offers printing) - // basepath is base directory for opening subsequent files (e.g. from 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); - 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 - - wxPrintData *GetPrintData() {return m_PrintData;} - wxPageSetupDialogData *GetPageSetupData() {return m_PageSetupData;} - // return page setting data objects. - // (You can set their parameters.) - - private: - - wxHtmlPrintout *CreatePrintout(); - bool DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *printout2); - bool DoPrint(wxHtmlPrintout *printout); - - wxPrintData *m_PrintData; - wxPageSetupDialogData *m_PageSetupData; - wxString m_Name; - wxString m_Headers[2], m_Footers[2]; - wxFrame *m_Frame; +public: + wxHtmlEasyPrinting(const wxString& name = "Printing", wxFrame *parent_frame = NULL); + ~wxHtmlEasyPrinting(); + + bool PreviewFile(const wxString &htmlfile); + bool PreviewText(const wxString &htmltext, const wxString& basepath = wxEmptyString); + // Preview file / html-text for printing + // (and offers printing) + // basepath is base directory for opening subsequent files (e.g. from 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); + 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 + + wxPrintData *GetPrintData() {return m_PrintData;} + wxPageSetupDialogData *GetPageSetupData() {return m_PageSetupData;} + // return page setting data objects. + // (You can set their parameters.) + +protected: + virtual wxHtmlPrintout *CreatePrintout(); + 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; };