mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-10-06 00:30:10 -06:00
syncing uppdev
git-svn-id: svn://ultimatepp.org/upp/trunk@1657 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
4de7a09eed
commit
d5c7c159f1
8 changed files with 156 additions and 0 deletions
13
uppdev/RichTextLayoutTracer/RichTextLayoutTracer.upp
Normal file
13
uppdev/RichTextLayoutTracer/RichTextLayoutTracer.upp
Normal 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";
|
||||
|
||||
6
uppdev/RichTextLayoutTracer/init
Normal file
6
uppdev/RichTextLayoutTracer/init
Normal 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
|
||||
34
uppdev/RichTextLayoutTracer/main.cpp
Normal file
34
uppdev/RichTextLayoutTracer/main.cpp
Normal 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);
|
||||
}
|
||||
Loading…
Reference in a new issue