backported HTML pagebreak code

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20690 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2003-05-21 23:05:46 +00:00
parent cc715ad02b
commit 5009d37d51
7 changed files with 261 additions and 34 deletions

View File

@@ -25,6 +25,8 @@
#include "wx/print.h"
#include "wx/printdlg.h"
#include <limits.h> // INT_MAX
//--------------------------------------------------------------------------------
// wxHtmlDCRenderer
// This class is capable of rendering HTML into specified
@@ -39,7 +41,7 @@ public:
// Following 3 methods *must* be called before any call to Render:
// Asign DC to this render
// Assign DC to this render
void SetDC(wxDC *dc, double pixel_scale = 1.0);
// Sets size of output rectangle, in pixels. Note that you *can't* change
@@ -57,15 +59,32 @@ public:
void SetFonts(wxString normal_face, wxString fixed_face, const int *sizes = NULL);
// [x,y] is position of upper-left corner of printing rectangle (see SetSize)
// from is y-coordinate of the very first visible cell
// from is y-coordinate of the very first visible cell
// to is y-coordinate of the next following page break, if any
// Returned value is y coordinate of first cell than didn't fit onto page.
// Use this value as 'from' in next call to Render in order to print multiple pages
// document
// If dont_render is TRUE then nothing is rendered into DC and it only counts
// pixels and return y coord of the next page
//
// CAUTION! Render() changes DC's user scale and does NOT restore it!
// known_pagebreaks and number_of_pages are used only when counting pages;
// otherwise, their default values should be used. Their purpose is to
// support pagebreaks using a subset of CSS2's <DIV>. The <DIV> handler
// needs to know what pagebreaks have already been set so that it doesn't
// set the same pagebreak twice.
//
// CAUTION! Render() changes DC's user scale and does NOT restore it!
int Render(int x, int y, int from = 0, int dont_render = FALSE);
// wx 2.5 will use this signature instead of the preceding:
// int Render(int x, int y, int from = 0, int dont_render = FALSE, int to = INT_MAX,
// int *known_pagebreaks = NULL, int number_of_pages = 0);
// but for this backport we have to get rid of the default arguments
// so that the following signature is distinct from the original. This is
// OK because the implementation never uses those defaults, and user code
// wouldn't know about the extra arguments anyway. The default argument
// on the original signature above still works.
int Render(int x, int y, int from /* = 0 */, int dont_render /* = FALSE */, int to /* = INT_MAX */,
int *known_pagebreaks /* = NULL */, int number_of_pages /* = 0 */);
// returns total height of the html document
// (compare Render's return value with this)
@@ -214,7 +233,7 @@ public:
// return page setting data objects.
// (You can set their parameters.)
protected:
protected:
virtual wxHtmlPrintout *CreatePrintout();
virtual bool DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *printout2);
virtual bool DoPrint(wxHtmlPrintout *printout);