syncing uppdev

git-svn-id: svn://ultimatepp.org/upp/trunk@1657 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2009-10-25 20:12:22 +00:00
commit d5c7c159f1
8 changed files with 156 additions and 0 deletions

View file

@ -0,0 +1,13 @@
description "Demonstrates using RichTextLayoutTracer to count number of table rows per report page\377";
uses
CtrlLib,
Report,
Painter;
file
main.cpp;
mainconfig
"" = "GUI";

View file

@ -0,0 +1,6 @@
#ifndef _RichTextLayoutTracer_icpp_init_stub
#define _RichTextLayoutTracer_icpp_init_stub
#include "CtrlLib/init"
#include "Report/init"
#include "Painter/init"
#endif

View file

@ -0,0 +1,34 @@
#include <Report/Report.h>
using namespace Upp;
struct TableRowTracer : RichTextLayoutTracer {
VectorMap<int, int> pgr;
virtual void TableCell(const Rect& page, PageY py, int i, int j, const RichTable& table, PageY npy)
{
if(j == 0)
for(int i = py.page; i <= npy.page; i++)
pgr.GetAdd(i, 0)++;
}
};
GUI_APP_MAIN
{
Report r;
r.Footer("[R1 ");
TableRowTracer t;
r.SetRichTextLayoutTracer(t);
String qtf = LoadFile("D:\\log.qtf");
r.Put(qtf);
Report rr;
for(int i = 0; i < r.GetCount(); i++) {
if(i)
rr.NewPage();
rr.Footer("[R1 There is " + AsString(t.pgr.Get(i, 0)) + " table rows on this page");
rr.DrawDrawing(r.GetPageSize(), r[i]);
}
Perform(rr);
}