Patch level : 2.1 nopatch

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :

Aggiunto nuovo codice modulo per Report di stampa personalizzati
Correzioni varie sull'editor dei report


git-svn-id: svn://10.65.10.50/trunk@12147 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2004-06-04 11:28:14 +00:00
parent 82496e7b61
commit 4e940e81c4
7 changed files with 78 additions and 32 deletions

View File

@ -8,7 +8,7 @@ se Contabilita' Semplificata
cg Contabilita' Generale
st Gestione studi
mi Modello IVA 11
ai Archiviazione Immagini
rs Report di stampa
ce Cespiti
ad Anagrafici Dichiarazioni
sc Saldaconto

View File

@ -13,7 +13,7 @@
#define MIAUT 9
#define AIAUT 10
#define CEAUT 11
#define ADAUT 12
#define RSAUT 12
#define SCAUT 13
#define SRAUT 14
#define CMAUT 15

View File

@ -844,7 +844,7 @@ bool TSocketClient::HttpSoap(CONNID id, const char* cmd)
if (cmd == NULL || *cmd == '\0')
return ok;
char hostname[64];
char hostname[256];
xvt_sys_get_host_name(hostname, sizeof(hostname));
TString content(256);

View File

@ -1251,7 +1251,7 @@ void TPrinter::read_configuration(
const TString& host = iniptr->get("Host");
if (host.not_empty())
{
char hostname[32];
char hostname[256];
xvt_sys_get_host_name(hostname, sizeof(hostname));
read_rcd = (host == hostname); // Safe to read
if (!read_rcd)
@ -1340,7 +1340,7 @@ void TPrinter::save_configuration()
prini.set("Lines", _lines_per_inch); // Linee per pollice
prini.set("Graphic", _isgraphics ? "X" : ""); // Grafica attiva
char hostname[80];
char hostname[256];
xvt_sys_get_host_name(hostname, sizeof(hostname));
prini.set("Host", hostname);
prini.set("User", user());

View File

@ -376,16 +376,17 @@ void advanced_draw_paragraph(TWindow& win, TString& para, const RCT& rct,
const bool acapo = para.find('\n') >= 0;
const bool parag = para.find(char(0xB6)) >= 0;
if (acapo || parag) // Devo scrivere piu' righe?
{
int leading, ascent, descent;
xvt_dwin_get_font_metrics(win.win(), &leading, &ascent, &descent);
const int kx = xvt_dwin_get_text_width(win.win(), "ABCDEFGH", 8) / 8;
const int ky = leading + ascent + descent;
int leading, ascent, descent;
xvt_dwin_get_font_metrics(win.win(), &leading, &ascent, &descent);
const int ky = leading + ascent + descent;
const int rct_height = rct.bottom - rct.top;
const int rct_height = rct.bottom - rct.top;
int rows = rct_height / ky;
if (acapo || parag || rows > 1) // Devo scrivere piu' righe?
{
const int kx = xvt_dwin_get_text_width(win.win(), "ABCDEFGH", 8) / 8;
const unsigned columns = (rct.right - rct.left) / kx;
int rows = rct_height / ky;
if (parag)
para.replace(char('0xB6'), '\n');
@ -1939,8 +1940,8 @@ bool TReport::execute_prescript()
else
{
// Script dei poveri: lancia la maschera associata al report
TFilename msk = _path; msk.ext("msk");
if (msk.exist())
TFilename msk = _path.name(); msk.ext("msk");
if (msk.custom_path())
{
const KEY key = run_form(msk.name());
ok = key != K_ESC && key != K_QUIT;
@ -2005,7 +2006,7 @@ bool TReport::get_record_field(const TString& name, TVariant& var) const
}
var = _recordset->get(str);
if (!var.is_null())
return true;
found = true;
}
return found;
@ -2400,12 +2401,31 @@ bool TReport::on_link(const TReport_link& lnk)
const int logicnum = table2logic(table);
if (logicnum >= LF_USER)
{
TRectype rec(logicnum);
TRectype rec(logicnum);;
if (logicnum == LF_TAB || logicnum == LF_TABCOM)
rec.settab(table.right(3));
TAssoc_array& fields = lnk.fields();
TAssoc_array delayed;
FOR_EACH_ASSOC_OBJECT(fields, h, k, o)
{
const TString* var = (const TString*)o;
rec.put(k, *var);
const TFieldref fld(k, logicnum);
if (fld.from() > 0)
delayed.add(k, *o);
else
{
const TString* var = (const TString*)o;
fld.write(*var, rec);
}
}
if (delayed.items() > 0)
{
FOR_EACH_ASSOC_OBJECT(delayed, h, k, o)
{
const TFieldref fld(k, logicnum);
const TString* var = (const TString*)o;
fld.write(*var, rec);
}
}
return rec.edit();
}

View File

@ -152,7 +152,7 @@ void TPrint_preview_window::update()
{
const TPoint res = _book->page_res();
const int lpi = _book->lpi();
for (int i = 1; ; i++)
for (int i = 1; lpi > 0; i++)
{
set_pen(i%lpi ? MAKE_COLOR(232,232,255) : MAKE_COLOR(255,192,255));
const short y = i * res.y / lpi;
@ -161,7 +161,7 @@ void TPrint_preview_window::update()
line(0, y, (short)size.x, y);
}
const int cpi = _book->cpi();
for (int j = 1; ; j++)
for (int j = 1; cpi > 0; j++)
{
set_pen(j%10 ? MAKE_COLOR(232,232,255) : MAKE_COLOR(255,192,255));
const short x = j * res.x / cpi;
@ -865,7 +865,7 @@ bool TBook::print_page(TWindow& win, size_t page)
if (img != NULL)
img->draw(win.win(), rct);
}
if (str.starts_with("<line/>"))
if (str == "<line/>")
{
PNT fr = { rct.top, rct.left };
PNT to = { rct.bottom, rct.right };
@ -904,7 +904,7 @@ bool TBook::print_page(TWindow& win, size_t page)
break;
stringona << str;
}
advanced_draw_text(win, stringona, rct, _horizontal_alignment, _vertical_alignment);
advanced_draw_paragraph(win, stringona, rct, _horizontal_alignment, _vertical_alignment);
continue;
}
if (str.starts_with("<text_align "))
@ -950,7 +950,7 @@ bool TBook::export_text(const TFilename& fname) const
ofstream ofs(fname);
TString_array page;
int row, col, wid;
int row, col, wid, hei;
const TPoint res = page_res();
@ -965,7 +965,19 @@ bool TBook::export_text(const TFilename& fname) const
row = y * lpi() / res.y;
col = x * cpi() / res.x;
wid = dx * cpi() / res.x;
hei = dy * cpi() / res.y;
} else
if (str == "<line/>")
{
if (hei == 0 && wid > 0)
{
if (page.objptr(row) == NULL)
page.add("", row);
TString& line = page.row(row++);
const TString stringona(wid, '-');
line.overwrite(stringona, col);
}
}
if (str.starts_with("<page "))
{
page.destroy();
@ -1323,7 +1335,7 @@ bool TReport_book::init(TReport& rep)
return true;
}
bool TReport_book::add(TReport& rep)
bool TReport_book::add(TReport& rep, bool progind)
{
if (!init(rep))
return false;
@ -1337,7 +1349,10 @@ bool TReport_book::add(TReport& rep)
TString msg = TR("Elaborazione report");
msg << ' ' << _report->filename();
TProgind pi(rex->items(), msg, true, true);
TProgind* pi = NULL;
if (progind)
pi = new TProgind(rex->items(), msg, true, true);
TString_array oldgroup, newgroup;
const int max_group = _report->find_max_level('H');
@ -1413,9 +1428,12 @@ bool TReport_book::add(TReport& rep)
}
}
pi.addstatus(1);
if (pi.iscancelled())
_print_aborted = true;
if (pi != NULL)
{
pi->addstatus(1);
if (pi->iscancelled())
_print_aborted = true;
}
}
if (!_print_aborted)
@ -1454,7 +1472,10 @@ bool TReport_book::add(TReport& rep)
_report->execute_postscript();
}
return true;
if (pi != NULL)
delete pi;
return !_print_aborted;
}
int TReport_book::lpi() const
@ -1512,6 +1533,11 @@ bool TReport_book::on_link(const TReport_link& lnk)
return ok;
}
TReport_book::TReport_book(const char* name)
: TBook(name), _report(NULL)
{
}
///////////////////////////////////////////////////////////
// Remote control interface
///////////////////////////////////////////////////////////

View File

@ -89,13 +89,13 @@ protected:
long print_section(char type, int level);
public:
bool add(TReport& report);
bool add(TReport& report, bool progind = true);
virtual int lpi() const;
virtual int cpi() const;
virtual bool print(size_t pagefrom = 0, size_t pageto = 0, size_t copies = 0);
TReport_book(const char* name = NULL) : TBook(name) { }
TReport_book(const char* name = NULL);
};
void abort_printing();