Patch level : 12.0 nopatch

Files correlati     :

Commento        :
Aggiunti Reportprogram 0> eport che non lanciano in autmatico la maschera con lo stesso nome.
This commit is contained in:
Alessandro Bonazzi 2021-05-22 21:47:32 +02:00
parent 3631a0c132
commit 7a4f105218
2 changed files with 26 additions and 7 deletions

View File

@ -197,7 +197,7 @@ void TReport_font::save(TXmlItem& item) const
bool TReport_font::load(const TXmlItem& item)
{
const TXmlItem* font = item.FindFirstChild("font");
if (font != NULL)
if (font != nullptr)
{
const TString& name = font->GetAttr("face");
const int size = font->GetIntAttr("size", 10);
@ -210,10 +210,10 @@ bool TReport_font::load(const TXmlItem& item)
style |= XVT_FS_UNDERLINE;
create(name, size, style);
}
return font != NULL;
return font != nullptr;
}
TReport_font::TReport_font() : _win_mapped(NULL_WIN), _fontid(NULL)
TReport_font::TReport_font() : _win_mapped(NULL_WIN), _fontid(nullptr)
{
create(DEFAULT_FONT_NAME, DEFAULT_FONT_SIZE, XVT_FS_NONE);
}
@ -600,6 +600,7 @@ bool TReport_section::execute_prescript(const TBook& book)
for (int i = 0; ok && i < items(); i++)
{
TReport_field& f = field(i);
ok = f.execute_prescript();
if (ok && f.dynamic_height())
f.compute_draw_rect(book); // Serve fondamentalmente per MESSAGE _DESCRIGA
@ -1074,8 +1075,10 @@ void TReport_script::save(TXmlItem& root, const char* tag) const
bool TReport_script::load(const TXmlItem& root, const char* tag)
{
destroy();
TXmlItem* script = root.FindFirstChild(tag);
if (script != NULL)
if (script != nullptr)
{
_desc = script->GetAttr("description");
script->GetEnclosedText(_src);
@ -1681,15 +1684,18 @@ void TReport_field::print(TBook& book) const
default :
{
const TString& str = formatted_text();
if (str.full())
{
const TReport_font& pf = print_font();
book.set_font(pf);
book.set_text_align(horizontal_alignment(), vertical_alignment());
book.set_text_color(text_color(), back_color());
TString8 sec_code; section().code(sec_code);
TString8 sec_code; section().code(sec_code);
bool multiline = dynamic_height();
if (!multiline && (pf.lpi() > 6 || get_rect().height() > 100))
{
const int font_height = 720 / pf.lpi();
@ -1700,6 +1706,7 @@ void TReport_field::print(TBook& book) const
{
TString_array para;
TReport_rct rect = get_draw_rect();
book.compute_text_frame(str, pf, rect, para);
print_rect(_draw_rct, book); // Stampa eventuale cornice
if (para.empty())
@ -2160,7 +2167,9 @@ int TReport::parse_field(const char* code, char& type, int& level, int& id) cons
return 0;
level = atoi((const char*)code + 1);
TReport_section* sec = find_section(type, level);
if (sec == NULL)
return 1;
const char* pdot = strchr(code, '.');
@ -2232,8 +2241,8 @@ bool TReport::evaluate(const char* expr, TVariant& var, TFieldtypes force_type)
}
const TFieldtypes ft = force_type != _nullfld ? force_type : var.type();
var = e.as_variant(ft);
var = e.as_variant(ft);
return true;
}
@ -2241,7 +2250,7 @@ void TReport::destroy()
{
_sections.destroy();
_description.cut(0);
set_recordset(NULL);
set_recordset(nullptr);
}
void TReport::load_sections(const TXmlItem& xml)
@ -2249,12 +2258,14 @@ void TReport::load_sections(const TXmlItem& xml)
for (int i = 0; i < xml.GetChildren(); i++)
{
const TXmlItem& sec = *xml.GetChild(i);
if (sec.GetTag() != "section")
continue;
const char type = sec.GetAttr("type")[0];
const int level = sec.GetIntAttr("level");
TReport_section& rs = section(type, level);
rs.load(sec);
}
}

View File

@ -678,4 +678,12 @@ public:
virtual ~TReport();
};
class TProgramReport : public TReport
{
public:
virtual bool use_mask() { return false; }
TProgramReport() {}
virtual ~TProgramReport() {}
};
#endif