diff --git a/uppsrc/Report/Report.cpp b/uppsrc/Report/Report.cpp index 054db37ce..6dc599193 100644 --- a/uppsrc/Report/Report.cpp +++ b/uppsrc/Report/Report.cpp @@ -51,15 +51,23 @@ void Report::PaintHF(Draw& w, int y, const char *qtf, int i) txt.Paint(w, 0, y, GetSize().cx); } +void Report::Flush() +{ + if(pagei >= 0) { + Drawing dw = GetResult(); + page.At(pagei).Append(dw); + Create(GetSize()); + } +} + void Report::StartPage(int i) { - DrawingDraw dw; - PaintHF(dw, 0, header, i); - PaintHF(dw, GetSize().cy - footercy, footer, i); - Drawing& g = page.At(i); - g = dw; - g.SetSize(GetSize()); + DrawingDraw dw(GetSize()); + page.At(i) = dw; Create(GetSize()); + WhenPage(); + PaintHF(*this, 0, header, i); + PaintHF(*this, GetSize().cy - footercy, footer, i); y = GetPageRect().top; } @@ -72,7 +80,6 @@ Draw& Report::Page(int i) while(page.GetCount() <= pagei) StartPage(page.GetCount()); y = GetPageRect().top; - Create(GetSize()); } return *this; } @@ -127,15 +134,6 @@ void Report::RestartPage() StartPage(pagei); } -void Report::Flush() -{ - if(pagei >= 0) { - Drawing dw = GetResult(); - page.At(pagei).Append(dw); - Create(GetSize()); - } -} - Report& Report::Landscape() { Size sz = GetSize(); diff --git a/uppsrc/Report/Report.h b/uppsrc/Report/Report.h index 12fa30aa5..1d4df6ebc 100644 --- a/uppsrc/Report/Report.h +++ b/uppsrc/Report/Report.h @@ -30,6 +30,8 @@ private: void RestartPage(); public: + Callback WhenPage; + int GetCount() { Flush(); return page.GetCount(); } Drawing GetPage(int i) { Flush(); return page[i]; } Drawing operator[](int i) { return GetPage(i); }