Patch level : 12.00 nopatch
Files correlati : Commento : Agiiunte righe verticali ad altezza automatica Aggiunto indirizza della ditta corrente L'esportazione in excel delle descrizioni lunghe le troncava alla prima riga
This commit is contained in:
parent
656929078c
commit
4b64ddeaa2
@ -221,7 +221,7 @@ TReport_font::TReport_font() : _win_mapped(NULL_WIN), _fontid(nullptr)
|
||||
create(DEFAULT_FONT_NAME, DEFAULT_FONT_SIZE, XVT_FS_NONE);
|
||||
}
|
||||
|
||||
TReport_font::TReport_font(const TReport_font& f) : _win_mapped(NULL_WIN), _fontid(NULL)
|
||||
TReport_font::TReport_font(const TReport_font& f) : _win_mapped(NULL_WIN), _fontid(nullptr)
|
||||
{ copy(f); }
|
||||
|
||||
TReport_font::~TReport_font()
|
||||
@ -234,7 +234,7 @@ TReport_font::~TReport_font()
|
||||
///////////////////////////////////////////////////////////
|
||||
static bool is_a_number(const char* str)
|
||||
{
|
||||
if (str == NULL || *str == '\0' || *str == '0')
|
||||
if (str == nullptr || *str == '\0' || *str == '0')
|
||||
return false; // Se comincia per zero va preservato!
|
||||
if (*str == '-')
|
||||
{
|
||||
@ -244,7 +244,7 @@ static bool is_a_number(const char* str)
|
||||
}
|
||||
while (*str)
|
||||
{
|
||||
if (strchr("0123456789.", *str) == NULL)
|
||||
if (strchr("0123456789.", *str) == nullptr)
|
||||
return false;
|
||||
str++;
|
||||
}
|
||||
@ -309,7 +309,7 @@ TReport_expr& TReport_expr_cache::operator[](const char* key)
|
||||
|
||||
TObject* TReport_image_cache::key2obj(const char* key)
|
||||
{
|
||||
TImage* img = NULL;
|
||||
TImage* img = nullptr;
|
||||
|
||||
TFilename pathname = key;
|
||||
if (pathname.custom_path())
|
||||
@ -386,16 +386,16 @@ TReport_section* TReport_section::father_section() const
|
||||
}
|
||||
else
|
||||
return _report.find_section('B', type() == 'B' ? 0 : 1);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const TReport_font& TReport_section::font() const
|
||||
{
|
||||
const TReport_font* f = _font;
|
||||
if (f == NULL)
|
||||
if (f == nullptr)
|
||||
{
|
||||
TReport_section* father = father_section();
|
||||
if (father == NULL)
|
||||
if (father == nullptr)
|
||||
f = &_report.font();
|
||||
else
|
||||
f = &father->font();
|
||||
@ -405,11 +405,7 @@ const TReport_font& TReport_section::font() const
|
||||
|
||||
void TReport_section::set_font(const TReport_font& f)
|
||||
{
|
||||
if (_font != NULL)
|
||||
{
|
||||
delete _font;
|
||||
_font = NULL;
|
||||
}
|
||||
safe_delete(_font);
|
||||
if (font() != f)
|
||||
_font = new TReport_font(f);
|
||||
}
|
||||
@ -418,7 +414,7 @@ void TReport_section::compute_print_font(const TReport_font& oldfont, const TRep
|
||||
{
|
||||
if (has_font())
|
||||
{
|
||||
if (_print_font == NULL)
|
||||
if (_print_font == nullptr)
|
||||
_print_font = new TReport_font;
|
||||
*_print_font = font();
|
||||
_print_font->adapt(oldfont, newfont);
|
||||
@ -432,14 +428,14 @@ void TReport_section::compute_print_font(const TReport_font& oldfont, const TRep
|
||||
|
||||
const TReport_font& TReport_section::print_font() const
|
||||
{
|
||||
if (_print_font != NULL && _report.use_printer_font())
|
||||
if (_print_font != nullptr && _report.use_printer_font())
|
||||
return *_print_font;
|
||||
|
||||
if (_font != NULL)
|
||||
if (_font != nullptr)
|
||||
return *_font;
|
||||
|
||||
TReport_section* father = father_section();
|
||||
if (father != NULL)
|
||||
if (father != nullptr)
|
||||
return father->print_font();
|
||||
|
||||
return _report.print_font();
|
||||
@ -467,7 +463,7 @@ void TReport_section::set_postscript(const char* src)
|
||||
|
||||
void TReport_section::unmap_font()
|
||||
{
|
||||
if (_font != NULL)
|
||||
if (_font != nullptr)
|
||||
_font->unmap();
|
||||
for (int i = last(); i >= 0; i--)
|
||||
field(i).unmap_font();
|
||||
@ -502,7 +498,7 @@ TReport_field* TReport_section::find_field(int id)
|
||||
const int pos = find_field_pos(id);
|
||||
if (pos >= 0)
|
||||
return &field(pos);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int TReport_section::code(TString& code) const
|
||||
@ -597,7 +593,7 @@ bool TReport_section::execute_prescript(const TBook& book)
|
||||
if (items() > 0)
|
||||
report().set_curr_field(&field(0));
|
||||
else
|
||||
report().set_curr_field(NULL);
|
||||
report().set_curr_field(nullptr);
|
||||
ok = _prescript.execute(report());
|
||||
}
|
||||
for (int i = 0; ok && i < items(); i++)
|
||||
@ -650,7 +646,8 @@ void TReport_section::print(TBook& book) const
|
||||
for (int i = 0; i < tot; i++)
|
||||
{
|
||||
const TReport_field& f = field(i);
|
||||
f.print(book);
|
||||
|
||||
f.print(book);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -682,7 +679,8 @@ bool TReport_section::execute_postscript()
|
||||
void TReport_section::save(TXmlItem& root) const
|
||||
{
|
||||
TXmlItem& item = root.AddChild("section");
|
||||
char* tipo = NULL;
|
||||
char* tipo = nullptr;
|
||||
|
||||
switch (type())
|
||||
{
|
||||
case 'H': tipo = "Head"; break;
|
||||
@ -723,7 +721,7 @@ void TReport_section::save(TXmlItem& root) const
|
||||
item.AddChild("condition") << condition();
|
||||
if (grouped_by().not_empty())
|
||||
item.AddChild("groupby") << grouped_by();
|
||||
if (recordset() != NULL)
|
||||
if (recordset() != nullptr)
|
||||
item.AddChild("sql") << recordset()->query_text();
|
||||
|
||||
if (has_font())
|
||||
@ -789,7 +787,7 @@ void TReport_section::load(const TXmlItem& sec)
|
||||
{
|
||||
TString str;
|
||||
const TXmlItem* cnd = sec.FindFirstChild("condition");
|
||||
if (cnd != NULL)
|
||||
if (cnd != nullptr)
|
||||
{
|
||||
cnd->GetEnclosedText(str);
|
||||
set_condition(str);
|
||||
@ -797,7 +795,7 @@ void TReport_section::load(const TXmlItem& sec)
|
||||
if (level() > 1)
|
||||
{
|
||||
const TXmlItem* gb = sec.FindFirstChild("groupby");
|
||||
if (gb != NULL)
|
||||
if (gb != nullptr)
|
||||
{
|
||||
gb->GetEnclosedText(str);
|
||||
group_by(str);
|
||||
@ -805,7 +803,7 @@ void TReport_section::load(const TXmlItem& sec)
|
||||
if (level() > 10 && type() == 'B') // Solo body dei pulcini hanno la query
|
||||
{
|
||||
const TXmlItem* sql = sec.FindFirstChild("sql");
|
||||
if (sql != NULL)
|
||||
if (sql != nullptr)
|
||||
{
|
||||
sql->GetEnclosedText(str);
|
||||
set_recordset(str);
|
||||
@ -836,7 +834,7 @@ void TReport_section::update_recordset_parent()
|
||||
if (type() == 'B' && level() > 0)
|
||||
{
|
||||
// Update my recordset
|
||||
if (_recordset != NULL)
|
||||
if (_recordset != nullptr)
|
||||
{
|
||||
if (level() > 100)
|
||||
{
|
||||
@ -851,7 +849,7 @@ void TReport_section::update_recordset_parent()
|
||||
{
|
||||
const int child = level()*10+i;
|
||||
TReport_section* rs = _report.find_section('B', child);
|
||||
if (rs != NULL)
|
||||
if (rs != nullptr)
|
||||
rs->update_recordset_parent();
|
||||
else
|
||||
break;
|
||||
@ -863,24 +861,23 @@ bool TReport_section::set_recordset(TRecordset* rs)
|
||||
{
|
||||
if (type() == 'B')
|
||||
{
|
||||
if (_recordset != NULL)
|
||||
delete _recordset;
|
||||
safe_delete(_recordset);
|
||||
_recordset = rs;
|
||||
update_recordset_parent();
|
||||
}
|
||||
return _recordset != NULL;
|
||||
return _recordset != nullptr;
|
||||
}
|
||||
|
||||
bool TReport_section::set_recordset(const TString& sql)
|
||||
{
|
||||
TRecordset* rex = create_recordset(sql);
|
||||
set_recordset(rex);
|
||||
return rex != NULL;
|
||||
return rex != nullptr;
|
||||
}
|
||||
|
||||
bool TReport_section::get_record_field(const char* name, TVariant& var) const
|
||||
{
|
||||
if (_recordset != NULL)
|
||||
if (_recordset != nullptr)
|
||||
{
|
||||
var = _recordset->get(name);
|
||||
if (!var.is_null())
|
||||
@ -888,7 +885,7 @@ bool TReport_section::get_record_field(const char* name, TVariant& var) const
|
||||
if (level() > 100)
|
||||
{
|
||||
const TReport_section* sec = _report.find_section('B', level()/10);
|
||||
if (sec != NULL) // Should ALWAYS exist
|
||||
if (sec != nullptr) // Should ALWAYS exist
|
||||
return sec->get_record_field(name, var);
|
||||
}
|
||||
}
|
||||
@ -900,7 +897,7 @@ TReport_section::TReport_section(TReport& r, char t, int l)
|
||||
_size(0,0), _page_break(false), _hidden_if_needed(false),
|
||||
_can_break(false), _keep_with_next(false),
|
||||
_repeat(false), _hidden(false), _deactivated(false),
|
||||
_font(NULL), _print_font(NULL), _recordset(NULL),
|
||||
_font(nullptr), _print_font(nullptr), _recordset(nullptr),
|
||||
_bgcolor(COLOR_WHITE), _fgcolor(COLOR_BLACK), _shcolor(COLOR_GRAY), _pattern(PAT_HOLLOW),
|
||||
_border(0), _radius(0), _shade_angle(0)
|
||||
{ }
|
||||
@ -1017,7 +1014,7 @@ void TReport_script::copy(const TReport_script& rs)
|
||||
|
||||
bool TReport_script::compile(TReport& rep)
|
||||
{
|
||||
if (_bc == NULL)
|
||||
if (_bc == nullptr)
|
||||
_bc = new TBytecode;
|
||||
|
||||
bool good = true;
|
||||
@ -1035,7 +1032,7 @@ bool TReport_script::execute(TReport& rep)
|
||||
bool good = true;
|
||||
if (ok())
|
||||
{
|
||||
if (_bc == NULL)
|
||||
if (_bc == nullptr)
|
||||
good = compile(rep);
|
||||
if (good)
|
||||
good = rep.execute(*_bc);
|
||||
@ -1057,11 +1054,7 @@ bool TReport_script::execute(TReport_field& rf)
|
||||
|
||||
void TReport_script::destroy()
|
||||
{
|
||||
if (_bc != NULL)
|
||||
{
|
||||
delete _bc;
|
||||
_bc = NULL;
|
||||
}
|
||||
safe_delete(_bc);
|
||||
_src.cut(0);
|
||||
}
|
||||
|
||||
@ -1089,7 +1082,7 @@ bool TReport_script::load(const TXmlItem& root, const char* tag)
|
||||
return ok();
|
||||
}
|
||||
|
||||
TReport_script::TReport_script() : _bc(NULL)
|
||||
TReport_script::TReport_script() : _bc(nullptr)
|
||||
{ }
|
||||
|
||||
TReport_script::~TReport_script()
|
||||
@ -1128,7 +1121,7 @@ TReport_field* TReport_field::next() const
|
||||
for (int i = sec.last()-1; i >= 0; i--)
|
||||
if (sec.objptr(i) == this)
|
||||
return (TReport_field*)sec.objptr(i+1);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TReport_field* TReport_field::prev() const
|
||||
@ -1137,7 +1130,7 @@ TReport_field* TReport_field::prev() const
|
||||
for (int i = sec.last(); i > 0; i--)
|
||||
if (sec.objptr(i) == this)
|
||||
return (TReport_field*)sec.objptr(i-1);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void TReport_field::set_pos(long x, long y)
|
||||
@ -1164,6 +1157,11 @@ void TReport_field::set_draw_pos(long x, long y)
|
||||
_draw_rct.y = y;
|
||||
}
|
||||
|
||||
void TReport_field::set_draw_height(long h)
|
||||
{
|
||||
_draw_rct.set_height(h);
|
||||
}
|
||||
|
||||
void TReport_field::set_draw_size(long w, long h)
|
||||
{
|
||||
_draw_rct.set_width(w);
|
||||
@ -1172,7 +1170,7 @@ void TReport_field::set_draw_size(long w, long h)
|
||||
|
||||
void TReport_field::set_dynamic_height(bool dh)
|
||||
{
|
||||
_dynamic_height = dh && _type == 'S' && _rct.height() > 0;
|
||||
_dynamic_height = dh && (_type == 'S' || _type == 'L') && _rct.height() > 0;
|
||||
}
|
||||
|
||||
bool TReport_field::dynamic_height() const
|
||||
@ -1186,14 +1184,14 @@ const TReport_rct& TReport_field::get_draw_rect() const
|
||||
|
||||
const TReport_font& TReport_field::font() const
|
||||
{
|
||||
return _font != NULL ? *_font : _section->font();
|
||||
return _font != nullptr ? *_font : _section->font();
|
||||
}
|
||||
|
||||
const TReport_font& TReport_field::print_font() const
|
||||
{
|
||||
if (_print_font != NULL)
|
||||
if (_print_font != nullptr)
|
||||
return *_print_font;
|
||||
if (_font != NULL)
|
||||
if (_font != nullptr)
|
||||
return *_font;
|
||||
return _section->print_font();
|
||||
}
|
||||
@ -1202,7 +1200,7 @@ void TReport_field::compute_print_font(const TReport_font& oldfont, const TRepor
|
||||
{
|
||||
if (has_font())
|
||||
{
|
||||
if (_print_font == NULL)
|
||||
if (_print_font == nullptr)
|
||||
_print_font = new TReport_font(font());
|
||||
else
|
||||
*_print_font = font();
|
||||
@ -1212,20 +1210,16 @@ void TReport_field::compute_print_font(const TReport_font& oldfont, const TRepor
|
||||
|
||||
void TReport_field::set_font(const TReport_font& f)
|
||||
{
|
||||
if (_font != NULL)
|
||||
{
|
||||
delete _font;
|
||||
_font = NULL;
|
||||
}
|
||||
if (_section == NULL || f != font())
|
||||
safe_delete(_font);
|
||||
if (_section == nullptr || f != font())
|
||||
_font = new TReport_font(f);
|
||||
}
|
||||
|
||||
void TReport_field::unmap_font()
|
||||
{
|
||||
if (_font != NULL)
|
||||
if (_font != nullptr)
|
||||
_font->unmap();
|
||||
if (_print_font != NULL)
|
||||
if (_print_font != nullptr)
|
||||
_print_font->unmap();
|
||||
}
|
||||
|
||||
@ -1278,7 +1272,7 @@ void TReport_field::copy(const TReport_field& rf)
|
||||
_groups = rf._groups;
|
||||
_modules = rf._modules;
|
||||
_list = rf._list;
|
||||
if (rf._font != NULL)
|
||||
if (rf._font != nullptr)
|
||||
set_font(*rf._font);
|
||||
_draw_hidden = _draw_deactivated = false;
|
||||
_selected = false;
|
||||
@ -1375,7 +1369,7 @@ bool TReport_field::execute_prescript()
|
||||
if (ok && type() == 'A')
|
||||
{
|
||||
TReport_array_item* item = get_array_item();
|
||||
if (item != NULL)
|
||||
if (item != nullptr)
|
||||
ok = item->_script.execute(*this);
|
||||
}
|
||||
}
|
||||
@ -1418,12 +1412,12 @@ TReport_array_item* TReport_field::get_array_item() const
|
||||
}
|
||||
return (TReport_array_item*)_list.objptr(i);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool TReport_field::zeroes_hidden() const
|
||||
{
|
||||
return _hide_zeroes && strchr("DNVP", _type) != NULL;
|
||||
return _hide_zeroes && strchr("DNVP", _type) != nullptr;
|
||||
}
|
||||
|
||||
const TString& TReport_field::formatted_text() const
|
||||
@ -1436,7 +1430,7 @@ const TString& TReport_field::formatted_text() const
|
||||
case 'A':
|
||||
{
|
||||
const TReport_array_item* item = get_array_item();
|
||||
if (item != NULL)
|
||||
if (item != nullptr)
|
||||
return item->_value;
|
||||
return EMPTY_STRING;
|
||||
}
|
||||
@ -2021,13 +2015,13 @@ TReport_field::TReport_field(TReport_section* sec)
|
||||
_shcolor(COLOR_GRAY), _pattern(PAT_HOLLOW),
|
||||
_radius(0), _shadow_offset(0), _shade_angle(0),
|
||||
_border(0), _halign('L'), _valign('T'), _dynamic_height(false),
|
||||
_font(NULL), _print_font(NULL),
|
||||
_font(nullptr), _print_font(nullptr),
|
||||
_hidden(false), _deactivated(false), _hide_zeroes(false), _selected(false),
|
||||
_hidden_default(false), _draw_hidden(false), _draw_deactivated(false)
|
||||
{ }
|
||||
|
||||
TReport_field::TReport_field(const TReport_field& rf)
|
||||
: _section(NULL), _font(NULL), _print_font(NULL), _draw_hidden(false),
|
||||
: _section(nullptr), _font(nullptr), _print_font(nullptr), _draw_hidden(false),
|
||||
_draw_deactivated(false)
|
||||
|
||||
{
|
||||
@ -2036,10 +2030,9 @@ TReport_field::TReport_field(const TReport_field& rf)
|
||||
|
||||
TReport_field::~TReport_field()
|
||||
{
|
||||
if (_font != NULL)
|
||||
delete _font;
|
||||
if (_print_font != NULL)
|
||||
delete _print_font;
|
||||
safe_delete(_font);
|
||||
|
||||
safe_delete(_print_font);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -2160,32 +2153,32 @@ void TReport::load_printer_font()
|
||||
|
||||
void TReport::update_recordset_parent()
|
||||
{
|
||||
if (recordset() != NULL)
|
||||
recordset()->set_parent(NULL);
|
||||
if (recordset() != nullptr)
|
||||
recordset()->set_parent(nullptr);
|
||||
for (int i = find_max_level('B'); i > 0; i--)
|
||||
section('B', i).update_recordset_parent();
|
||||
}
|
||||
|
||||
bool TReport::set_recordset(TRecordset* rs)
|
||||
{
|
||||
if (_recordset != NULL && _recordset != rs)
|
||||
delete _recordset;
|
||||
if (_recordset != rs)
|
||||
safe_delete(_recordset);
|
||||
_recordset = rs;
|
||||
update_recordset_parent();
|
||||
return _recordset != NULL;
|
||||
return _recordset != nullptr;
|
||||
}
|
||||
|
||||
bool TReport::set_recordset(const TString& sql)
|
||||
{
|
||||
TRecordset* rex = create_recordset(sql);
|
||||
set_recordset(rex);
|
||||
return rex != NULL;
|
||||
return rex != nullptr;
|
||||
}
|
||||
|
||||
TReport_section& TReport::section(char type, int level)
|
||||
{
|
||||
TReport_section* sec = find_section(type, level);
|
||||
if (sec == NULL)
|
||||
if (sec == nullptr)
|
||||
{
|
||||
sec = new TReport_section(*this, type, level);
|
||||
TString8 key; build_section_key(type, level, key);
|
||||
@ -2205,12 +2198,12 @@ int TReport::parse_field(const char* code, char& type, int& level, int& id) cons
|
||||
|
||||
if (isdigit(code[0]) || strncmp(code, "THIS", 4) == 0) // Niente sezione davanti
|
||||
{
|
||||
if (strchr(code, '.') != NULL)
|
||||
if (strchr(code, '.') != nullptr)
|
||||
return 0; // Mi sono confuso con un campo su file, es: 34.CODART
|
||||
|
||||
id = atoi(code);
|
||||
TReport_field* rf = curr_field();
|
||||
if (rf != NULL)
|
||||
if (rf != nullptr)
|
||||
{
|
||||
type = rf->section().type();
|
||||
level = rf->section().level();
|
||||
@ -2230,7 +2223,7 @@ int TReport::parse_field(const char* code, char& type, int& level, int& id) cons
|
||||
|
||||
TReport_section* sec = find_section(type, level);
|
||||
|
||||
if (sec == NULL)
|
||||
if (sec == nullptr)
|
||||
return 1;
|
||||
const char* pdot = strchr(code, '.');
|
||||
const int dot = pdot ? int(pdot-code) : -1;
|
||||
@ -2239,7 +2232,7 @@ int TReport::parse_field(const char* code, char& type, int& level, int& id) cons
|
||||
id = atoi((const char*)code + dot + 1);
|
||||
}
|
||||
|
||||
return strchr(code, '@') != NULL ? 4 : 3;
|
||||
return strchr(code, '@') != nullptr ? 4 : 3;
|
||||
}
|
||||
|
||||
TReport_field* TReport::field(const char* code)
|
||||
@ -2248,13 +2241,13 @@ TReport_field* TReport::field(const char* code)
|
||||
int level = -1, id = 0;
|
||||
const int k = parse_field(code, type, level, id);
|
||||
|
||||
TReport_field* rf = NULL;
|
||||
TReport_field* rf = nullptr;
|
||||
if (k == 3)
|
||||
{
|
||||
if (id > 0)
|
||||
{
|
||||
TReport_section* sec = find_section(type, level);
|
||||
if (sec != NULL)
|
||||
if (sec != nullptr)
|
||||
rf = sec->find_field(id);
|
||||
}
|
||||
else
|
||||
@ -2353,7 +2346,7 @@ bool TReport::load(const char* fname)
|
||||
_page_merge = xml.GetBoolAttr("page_merge");
|
||||
|
||||
const TXmlItem* desc = xml.FindFirstChild("description");
|
||||
if (desc != NULL)
|
||||
if (desc != nullptr)
|
||||
desc->GetEnclosedText(_description);
|
||||
|
||||
_class = xml.GetAttr("class");
|
||||
@ -2361,13 +2354,13 @@ bool TReport::load(const char* fname)
|
||||
|
||||
// Carico la query principale PRIMA delle sezioni che potrebbero collegarvicisi
|
||||
const TXmlItem* sql = xml.FindFirstChild("sql");
|
||||
if (sql != NULL)
|
||||
if (sql != nullptr)
|
||||
{
|
||||
TString str; sql->GetEnclosedText(str);
|
||||
set_recordset(str);
|
||||
}
|
||||
|
||||
if (xml.FindFirstChild("section") != NULL)
|
||||
if (xml.FindFirstChild("section") != nullptr)
|
||||
load_sections(xml);
|
||||
|
||||
_include = xml.GetAttr("libraries");
|
||||
@ -2378,7 +2371,7 @@ bool TReport::load(const char* fname)
|
||||
|
||||
_params.destroy();
|
||||
const TXmlItem* params = xml.FindFirstChild("parameters");
|
||||
if (params != NULL)
|
||||
if (params != nullptr)
|
||||
{
|
||||
TToken_string tok, str;
|
||||
for (int i = 0; i < params->GetChildren(); i++)
|
||||
@ -2396,7 +2389,7 @@ bool TReport::load(const char* fname)
|
||||
|
||||
_allegati.destroy();
|
||||
const TXmlItem* all = xml.FindFirstChild("allegates");
|
||||
if (all != NULL)
|
||||
if (all != nullptr)
|
||||
{
|
||||
for (int i = 0; i < all->GetChildren(); i++)
|
||||
{
|
||||
@ -2419,7 +2412,7 @@ bool TReport::load(const char* fname)
|
||||
bool TReport::save(const char* fname) const
|
||||
{
|
||||
char name[_MAX_FNAME];
|
||||
xvt_fsys_parse_pathname (fname, NULL, NULL, name, NULL, NULL);
|
||||
xvt_fsys_parse_pathname (fname, nullptr, nullptr, name, nullptr, nullptr);
|
||||
bool ok = *name > ' ';
|
||||
if (ok)
|
||||
{
|
||||
@ -2452,7 +2445,7 @@ bool TReport::save(const char* fname) const
|
||||
}
|
||||
}
|
||||
|
||||
if (recordset() != NULL)
|
||||
if (recordset() != nullptr)
|
||||
xml.AddChild("sql") << recordset()->query_text();
|
||||
|
||||
_prescript.save(xml, "prescript");
|
||||
@ -2511,7 +2504,7 @@ void TReport::set_postscript(const char* src)
|
||||
|
||||
bool TReport::execute_dot(const TVariant& var)
|
||||
{
|
||||
if (_curr_field != NULL)
|
||||
if (_curr_field != nullptr)
|
||||
{
|
||||
_curr_field->set(var);
|
||||
return true;
|
||||
@ -2556,7 +2549,7 @@ bool TReport::execute_prescript()
|
||||
if (bAsk)
|
||||
{
|
||||
// Script dei poverissimi: chiede le eventuali variabili
|
||||
if (recordset() != NULL)
|
||||
if (recordset() != nullptr)
|
||||
recordset()->ask_variables(false);
|
||||
}
|
||||
|
||||
@ -2623,9 +2616,16 @@ bool TReport::get_report_field(const TString& name, TVariant& var) const
|
||||
}
|
||||
|
||||
TReport_field* fld = ((TReport*)this)->field(str);
|
||||
if (fld != NULL)
|
||||
if (fld != nullptr)
|
||||
{
|
||||
var = fld->get();
|
||||
if (fld->type() == 'A')
|
||||
{
|
||||
TReport_array_item * i = fld->get_array_item();
|
||||
|
||||
var = i != nullptr ? i->_value : fld->get();
|
||||
}
|
||||
else
|
||||
var = fld->get();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2663,10 +2663,10 @@ bool TReport::get_report_field(const TString& name, TVariant& var) const
|
||||
bool TReport::get_record_field(const TString& name, TVariant& var) const
|
||||
{
|
||||
bool found = false;
|
||||
if (recordset() != NULL)
|
||||
if (recordset() != nullptr)
|
||||
{
|
||||
// Cerco il campo nel recordset della eventuale sottosezione di appartenenza
|
||||
if (_curr_field != NULL)
|
||||
if (_curr_field != nullptr)
|
||||
found = _curr_field->section().get_record_field(name, var);
|
||||
|
||||
// Se non lo trovo, allora lo cerco nel recordset principale
|
||||
@ -2731,7 +2731,7 @@ bool TReport::set_usr_val(const TString& name, const TVariant& var)
|
||||
case 3: // E' un campo singolo
|
||||
{
|
||||
TReport_field* rf = id <= 0 ? curr_field() : section(type, level).find_field(id);
|
||||
if (rf != NULL)
|
||||
if (rf != nullptr)
|
||||
{
|
||||
rf->set(var);
|
||||
ok = true;
|
||||
@ -2772,10 +2772,10 @@ size_t TReport::get_usr_words(TString_array& words) const
|
||||
"GET_POS", "GET_SIZE", "HIDE", "ISAM_READ",
|
||||
"RUN_FORM", "SET_BACK_COLOR", "SET_FORE_COLOR",
|
||||
"SET_POS", "SET_SIZE", "SET_TEXT_COLOR", "SHOW", "TABLE_READ", "GET_FIRM_DATA",
|
||||
"EVALUATE", "GOLEM", "LOGO", NULL
|
||||
"EVALUATE", "GOLEM", "LOGO", nullptr
|
||||
};
|
||||
size_t i;
|
||||
for (i = 0; name[i] != NULL; i++)
|
||||
for (i = 0; name[i] != nullptr; i++)
|
||||
words.add(name[i]);
|
||||
return i;
|
||||
}
|
||||
@ -2785,17 +2785,17 @@ size_t TReport::add_usr_words(TString_array& words, const char* const names[]) c
|
||||
TReport::get_usr_words(words);
|
||||
|
||||
const int first_msg = words.items(); // Calcola il primo numero disponibile
|
||||
for (size_t i = 0; names[i] != NULL; i++)
|
||||
for (size_t i = 0; names[i] != nullptr; i++)
|
||||
words.add(names[i]);
|
||||
|
||||
return first_msg;
|
||||
}
|
||||
|
||||
static void do_show(TReport_field& rf, void* jolly)
|
||||
{ rf.set_draw_hidden(jolly == NULL); }
|
||||
{ rf.set_draw_hidden(jolly == nullptr); }
|
||||
|
||||
static void do_enable(TReport_field& rf, void* jolly)
|
||||
{ rf.set_draw_deactivated(jolly == NULL); }
|
||||
{ rf.set_draw_deactivated(jolly == nullptr); }
|
||||
|
||||
static void do_set_pos(TReport_field& rf, void* jolly)
|
||||
{
|
||||
@ -2842,7 +2842,7 @@ bool TReport::do_message(const TVariant& var, FLDMSG_FUNC msg, void* jolly)
|
||||
case 3: // E' un campo singolo
|
||||
{
|
||||
TReport_field* rf = id <= 0 ? curr_field() : section(type, level).find_field(id);
|
||||
if (rf != NULL)
|
||||
if (rf != nullptr)
|
||||
msg(*rf, jolly);
|
||||
}
|
||||
break;
|
||||
@ -2873,7 +2873,7 @@ void TReport::report2mask(TMask & m) const
|
||||
{
|
||||
TMask_field& f = m.fld(i);
|
||||
const TFieldref* ref = f.field();
|
||||
if (ref != NULL)
|
||||
if (ref != nullptr)
|
||||
{
|
||||
const bool is_final = f.in_group(2);
|
||||
name = ref->name();
|
||||
@ -2957,7 +2957,7 @@ void TReport::mask2report(const TMask & m)
|
||||
TMask_field& f = m.fld(i);
|
||||
const TFieldref* ref = f.field();
|
||||
|
||||
if (ref != NULL)
|
||||
if (ref != nullptr)
|
||||
{
|
||||
const bool is_final = f.in_group(2);
|
||||
name = ref->name();
|
||||
@ -3408,6 +3408,17 @@ void TReport::msg_firm(TVariant_stack& stack)
|
||||
<< anag.get(is_fisc ? ANA_CIVRF : ANA_CIVRES) << " "
|
||||
<< comune.get(COM_DENCOM) << " (" << comune.get(COM_PROVCOM) << ")";
|
||||
cf.set(intest);
|
||||
return;
|
||||
}
|
||||
if (in == "INDIR")
|
||||
{
|
||||
TString indir;
|
||||
|
||||
indir << anag.get(is_fisc ? ANA_INDRF : ANA_INDRES) << " "
|
||||
<< anag.get(is_fisc ? ANA_CIVRF : ANA_CIVRES) << " "
|
||||
<< anag.get(is_fisc ? ANA_CAPRF : ANA_CAPRES) << " "
|
||||
<< comune.get(COM_DENCOM) << " (" << comune.get(COM_PROVCOM) << ")";
|
||||
cf.set(indir);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -383,9 +383,9 @@ protected:
|
||||
void copy(const TReport_field& rf);
|
||||
TFieldtypes var_type() const;
|
||||
void get_currency(TCurrency& cur) const;
|
||||
TReport_array_item* get_array_item() const;
|
||||
|
||||
public:
|
||||
TReport_array_item* get_array_item() const;
|
||||
virtual TObject* dup() const { return new TReport_field(*this); }
|
||||
TReport_field& operator=(const TReport_field& rf) { copy(rf); return *this; }
|
||||
|
||||
@ -470,6 +470,7 @@ public:
|
||||
void set_draw_deactivated(bool d) { _draw_deactivated = d; }
|
||||
|
||||
void set_draw_pos(long x, long y);
|
||||
void set_draw_height(long y);
|
||||
void set_draw_size(long x, long y);
|
||||
void set_image_resize_type(const char * image_resize_type) { _image_resize_type = image_resize_type; }
|
||||
|
||||
@ -730,7 +731,7 @@ public:
|
||||
bool export_text(const char * filename, int size = 0, bool signature = false);
|
||||
|
||||
TReport();
|
||||
TReport(const char * name) { load(name); }
|
||||
TReport(const char * name) : _recordset(nullptr), _curr_field(nullptr) { load(name); }
|
||||
virtual ~TReport();
|
||||
};
|
||||
|
||||
|
@ -2028,15 +2028,17 @@ bool TBook::export_excel(TFilename& fname, bool signature, bool goto_url, bool a
|
||||
|
||||
while (!ifs.eof())
|
||||
{
|
||||
ifs.getline(str.get_buffer(), str.size());
|
||||
if (str == "</text>")
|
||||
break;
|
||||
break;
|
||||
ifs.getline(str.get_buffer(), str.size());
|
||||
if (do_export && str.full())
|
||||
{
|
||||
int idx, pos;
|
||||
if (tab.find_column(col, wid, idx, pos))
|
||||
if (tab.find_column(col, wid, idx, pos, true))
|
||||
{
|
||||
TToken_string* line = (TToken_string*)page.objptr(row);
|
||||
TString field;
|
||||
|
||||
if (line == NULL)
|
||||
{
|
||||
line = new TToken_string(256,sep);
|
||||
@ -2049,7 +2051,24 @@ bool TBook::export_excel(TFilename& fname, bool signature, bool goto_url, bool a
|
||||
|
||||
str << '"' << s << '"';
|
||||
}
|
||||
line->add(str, idx);// come mai ?? pos);
|
||||
field << str;
|
||||
while (str != "</text>" && !ifs.eof())
|
||||
{
|
||||
ifs.getline(str.get_buffer(), str.size());
|
||||
if (str == "</text>")
|
||||
{
|
||||
line->add(field, idx);// come mai ?? pos);
|
||||
break;
|
||||
}
|
||||
reformat_excel(str);
|
||||
if (str.find(sep) >= 0)
|
||||
{
|
||||
const TString s = str;
|
||||
|
||||
str << '"' << s << '"';
|
||||
}
|
||||
field << str;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2678,7 +2697,7 @@ bool TReport_book::open_page()
|
||||
if (height > 0)
|
||||
{
|
||||
_delta.y += height;
|
||||
if (_delta.y >= _logical_foot_pos) // Copertina enorme?
|
||||
if (_delta.y > _logical_foot_pos) // Copertina enorme? perchè uguale ? >=
|
||||
{
|
||||
close_page();
|
||||
return open_page();
|
||||
@ -2687,7 +2706,7 @@ bool TReport_book::open_page()
|
||||
}
|
||||
|
||||
TReport_section* page_head = _report->find_section('H', 0);
|
||||
if (page_head != NULL && (_rep_page > 1 || !page_head->hidden_if_needed()))
|
||||
if (page_head != nullptr && (_rep_page > 1 || !page_head->hidden_if_needed()))
|
||||
{
|
||||
const TReport_pnt& pos = page_head->pos();
|
||||
_delta.x += pos.x; _delta.y += pos.y;
|
||||
@ -2797,8 +2816,19 @@ long TReport_book::print_section(TReport_section& rs)
|
||||
|
||||
const long height = rs.compute_size().y; // Compute size after the initilization script!
|
||||
|
||||
if (height > 0) // Has some visible fields
|
||||
if (height > 0) // Has some visible fields
|
||||
{
|
||||
for (int i = 0; i < rs.items(); i++)
|
||||
{
|
||||
TReport_field& f = rs.field(i);
|
||||
|
||||
if (f.type() == 'L' && f.dynamic_height())
|
||||
{
|
||||
f.set_height(height);
|
||||
f.set_draw_height(height);
|
||||
}
|
||||
}
|
||||
|
||||
long reprint_from = 0; // Posizione di stampa per sezione interrotte a meta'
|
||||
|
||||
bool page_break = false;
|
||||
@ -2833,7 +2863,7 @@ long TReport_book::print_section(TReport_section& rs)
|
||||
page_break = h > space_left; // Controlla se e' sufficiente
|
||||
|
||||
// Controllo se la sezione puo' essere stampata su due pagine
|
||||
if (page_break && space_left > 100 && rs.can_be_broken())
|
||||
if (page_break && space_left >= 100 && rs.can_be_broken()) // anche =
|
||||
{
|
||||
reprint_from = space_left;
|
||||
rs.print_clipped(*this, 0, reprint_from);
|
||||
@ -2912,19 +2942,23 @@ bool TReport_book::init(TReport& rep)
|
||||
const TSize res = page_res();
|
||||
|
||||
const double pollici_pagina_y = (double)siz.y / (double)res.y;
|
||||
const double righe_pagina = pollici_pagina_y * lpi();
|
||||
_logical_page_height = long(righe_pagina*100.0);
|
||||
const int righe_pagina = pollici_pagina_y * lpi();
|
||||
|
||||
_logical_page_height = long(righe_pagina*100);
|
||||
|
||||
const double pollici_pagina_x = (double)siz.x / (double)res.x;
|
||||
const double colonne_pagina = pollici_pagina_x * cpi();
|
||||
_logical_page_width = long(colonne_pagina*100.0);
|
||||
|
||||
_logical_page_width = long(colonne_pagina*100);
|
||||
|
||||
const TReport_section& footer = _report->section('F', 0);
|
||||
|
||||
_logical_foot_pos = footer.pos().y;
|
||||
if (_logical_foot_pos <= 0)
|
||||
{
|
||||
const long logical_footer_height = footer.compute_size().y;
|
||||
_logical_foot_pos = _logical_page_height - logical_footer_height;
|
||||
|
||||
_logical_foot_pos = _logical_page_height - logical_footer_height;
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -3030,12 +3064,13 @@ bool TReport_book::add(TReport& rep, export_type type, bool progind)
|
||||
if (!init(rep))
|
||||
return false;
|
||||
|
||||
_report->reset_export_sections();
|
||||
_report->set_export_sections(type);
|
||||
if (!_report->execute_prescript())
|
||||
return false;
|
||||
|
||||
TRecordset* rex = _report->recordset();
|
||||
if (rex == NULL)
|
||||
if (rex == nullptr)
|
||||
return true;
|
||||
|
||||
rex->requery();
|
||||
@ -3165,7 +3200,7 @@ bool TReport_book::add(TReport& rep, export_type type, bool progind)
|
||||
const int fy = fl->pos().y;
|
||||
if (fy > 0) // Ha una coordinata y imposta
|
||||
{
|
||||
if (fy < _delta.y) // Sono gia' andato oltre quindi salto pagina
|
||||
if (fy < _delta.y) // Sono gia' andato oltre quindi salto pagina sec
|
||||
{
|
||||
close_page();
|
||||
open_page();
|
||||
|
Loading…
x
Reference in New Issue
Block a user