- 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 = wxT("Printout"));
+ virtual ~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
+
+ // Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
+ void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = NULL);
+
+ // Sets font sizes to be relative to the given size or the system
+ // default size; use either specified or default font
+ void SetStandardFonts(int size = -1,
+ const wxString& normal_face = wxEmptyString,
+ const wxString& fixed_face = wxEmptyString);
+
+ 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);
+ void OnPreparePrinting();
+
+ // Adds input filter
+ static void AddFilter(wxHtmlFilter *filter);
+
+ // Cleanup
+ static void CleanUpStatics();
+
+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];
+ wxArrayInt m_PageBreaks;
+
+ 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;
+
+ // list of HTML filters
+ static wxList m_Filters;
+
+ DECLARE_NO_COPY_CLASS(wxHtmlPrintout)