Correzioni su get_realpp delle tabelle di modulo ed esportazione in Excel degli Spreadsheet
git-svn-id: svn://10.65.10.50/branches/R_10_00@22684 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
49adc1b3f4
commit
3e64641a51
@ -621,7 +621,7 @@ bool TApplication::set_firm(long newfirm)
|
||||
if (interactive)
|
||||
{
|
||||
if (newfirm <= 0)
|
||||
return newfirm > 0;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -339,23 +339,9 @@ HIDDEN XI_BITMAP* get_background_bitmap(bool reload)
|
||||
XVT_IMAGE img = (XVT_IMAGE)bmp->xin_bitmap->x;
|
||||
short w, h; xvt_image_get_dimensions(img, &w, &h);
|
||||
|
||||
unsigned long r=0, g=0, b=0, k=0;
|
||||
|
||||
/*
|
||||
for (short y = 0; y < h; y++)
|
||||
{
|
||||
for (short x = 0; x < w; x++)
|
||||
{
|
||||
const COLOR col = xvt_image_get_pixel(img, x, y);
|
||||
r += XVT_COLOR_GET_RED(col);
|
||||
g += XVT_COLOR_GET_GREEN(col);
|
||||
b += XVT_COLOR_GET_BLUE(col);
|
||||
k++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
k = min(w,h);
|
||||
for (short xy = 0; xy < short(k); xy++)
|
||||
unsigned long r=0, g=0, b=0;
|
||||
const short k = min(w,h);
|
||||
for (short xy = 0; xy < k; xy++)
|
||||
{
|
||||
const COLOR col = xvt_image_get_pixel(img, xy, xy);
|
||||
r += XVT_COLOR_GET_RED(col);
|
||||
|
@ -795,6 +795,32 @@ const char* TBaseisamfile::name() const
|
||||
return tmp;
|
||||
}
|
||||
|
||||
const char* TBaseisamfile::module() const
|
||||
{
|
||||
TFilename app;
|
||||
curr().get_relapp(app);
|
||||
if (app.full())
|
||||
return app.left(2);
|
||||
|
||||
switch (num())
|
||||
{
|
||||
case LF_CLIFO:
|
||||
case LF_CAUSALI:
|
||||
case LF_RCAUSALI:
|
||||
case LF_MOV:
|
||||
case LF_RMOV:
|
||||
case LF_RMOVIVA:
|
||||
return "cg";
|
||||
case LF_ANAMAG:
|
||||
case LF_DOC:
|
||||
case LF_RIGHEDOC:
|
||||
return "ve";
|
||||
default: break;
|
||||
}
|
||||
|
||||
return "ba";
|
||||
}
|
||||
|
||||
const char* TBaseisamfile::filename() const
|
||||
{
|
||||
const int n = _isam_handle > 0 ? _isam_handle : num();
|
||||
@ -856,7 +882,6 @@ int TBaseisamfile::prev(word lockop)
|
||||
}
|
||||
|
||||
int TBaseisamfile::reread(word lockop)
|
||||
|
||||
{
|
||||
return TBaseisamfile::reread(curr(), lockop);
|
||||
}
|
||||
@ -1028,7 +1053,7 @@ int TBaseisamfile::rewrite_write(const TRectype& rec)
|
||||
|
||||
int TBaseisamfile::rewrite_write()
|
||||
{
|
||||
return TBaseisamfile::rewrite_write(curr());
|
||||
return TBaseisamfile::rewrite_write(curr());
|
||||
}
|
||||
|
||||
int TBaseisamfile::_rewrite(const TRectype& rec)
|
||||
@ -3839,7 +3864,9 @@ int TRectype::rewrite(TBaseisamfile& f) const
|
||||
int TRectype::write_rewrite(TBaseisamfile& f) const
|
||||
{
|
||||
int err = write(f);
|
||||
if (err != NOERR)
|
||||
if (err == NOERR)
|
||||
f._read((TRectype&)*this, _iscurr, _unlock); // Sblocca record 19-09-2012 (andrebbe nella _write)
|
||||
else
|
||||
err = rewrite(f);
|
||||
return err;
|
||||
}
|
||||
@ -3847,9 +3874,13 @@ int TRectype::write_rewrite(TBaseisamfile& f) const
|
||||
int TRectype::rewrite_write(TBaseisamfile& f) const
|
||||
{
|
||||
int err = rewrite(f);
|
||||
if (err != NOERR)
|
||||
if (err != NOERR)
|
||||
{
|
||||
err = write(f);
|
||||
return err;
|
||||
if (err == NOERR)
|
||||
f._read((TRectype&)*this, _iscurr, _unlock); // Sblocca record 19-09-2012 (andrebbe nella _write)
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
// Certified ??%
|
||||
|
@ -400,6 +400,8 @@ public:
|
||||
virtual int remove(const TRectype& rec);
|
||||
// @cmember Ritorna il numero logico del file sotto forma di stringa
|
||||
virtual const char* name() const;
|
||||
// @cmember Ritorna il modulo al quale appartiene la tabella
|
||||
virtual const char* module() const;
|
||||
|
||||
// @cmember Ritorna il numero del record corrente
|
||||
virtual TRecnotype recno() const
|
||||
@ -650,7 +652,7 @@ public:
|
||||
// @base public | TBaseisamfile
|
||||
class TLocalisamfile : public TBaseisamfile
|
||||
|
||||
// @author:(INTERNAL) Sandro
|
||||
// @author:(INTERNAL) Alex
|
||||
{
|
||||
// @access Protected Member
|
||||
protected:
|
||||
|
@ -1266,7 +1266,7 @@ void TMask::read_page(
|
||||
#ifdef DBG
|
||||
const int pf = fields();
|
||||
TString e;
|
||||
e << "Campo non riconosciuto alla posizione " << pf;
|
||||
e << "Campo non riconosciuto alla posizione " << pf << ": " << scanner.key();
|
||||
if (pf > 0)
|
||||
e << "\nL'ultimo riconosciuto e' " << fld(pf-1).dlg() << ": " << fld(pf-1).prompt();
|
||||
error_box(e);
|
||||
|
@ -257,13 +257,12 @@ protected:
|
||||
// <p _needs_update>)
|
||||
void on_idle();
|
||||
|
||||
// @cmember Cerca la colonna col
|
||||
XI_OBJ* find_column(int col) const;
|
||||
|
||||
// @cmember Cerca le proprieta' della riga r e volendo le crea pure
|
||||
TRow_property* get_property(int r, bool create = false);
|
||||
|
||||
TSheet_field& owner() const { return (TSheet_field&)*_fld; }
|
||||
// @cmember Cerca la colonna col
|
||||
XI_OBJ* find_column(int col) const;
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
@ -3633,10 +3632,14 @@ static TString& clean_white_space(TString& str)
|
||||
class TSheet_recordset : public TRecordset
|
||||
{
|
||||
const TSpreadsheet* _sheet;
|
||||
int _cols;
|
||||
TRecnotype _curr;
|
||||
|
||||
protected:
|
||||
virtual bool get_attr(int column, TAttributes& attr, bool header) const;
|
||||
|
||||
public:
|
||||
virtual unsigned int columns() const { return _sheet->columns(); }
|
||||
virtual unsigned int columns() const { return _cols; }
|
||||
virtual const TRecordset_column_info& column_info(unsigned int i) const;
|
||||
virtual TRecnotype items() const { return _sheet->items(); }
|
||||
virtual bool move_to(TRecnotype pos);
|
||||
@ -3646,7 +3649,8 @@ public:
|
||||
|
||||
public:
|
||||
virtual const TString& query_text() const { return EMPTY_STRING; }
|
||||
TSheet_recordset(const TSpreadsheet* s) : _sheet(s), _curr(-1) {}
|
||||
TSheet_recordset(const TSpreadsheet* s) : _sheet(s), _curr(-1)
|
||||
{ xi_get_member_list(((TSpreadsheet*)s)->xi_object(), &_cols); _cols--; }
|
||||
};
|
||||
|
||||
bool TSheet_recordset::move_to(TRecnotype pos)
|
||||
@ -3661,16 +3665,17 @@ const TRecordset_column_info& TSheet_recordset::column_info(unsigned int i) cons
|
||||
{
|
||||
static TRecordset_column_info _info;
|
||||
|
||||
_info._pos = i;
|
||||
|
||||
if (i >= 0 && i < columns())
|
||||
int num;
|
||||
XI_OBJ** columns = xi_get_member_list(((TSpreadsheet*)_sheet)->xi_object(), &num);
|
||||
XI_OBJ* column = int(i+1) < num ? columns[i+1] : NULL;
|
||||
if (column)
|
||||
{
|
||||
int columns = 0;
|
||||
XI_OBJ** pcols = xi_get_member_list(((TSpreadsheet*)_sheet)->xi_object(), &columns);
|
||||
xi_get_text(pcols[i+1], _info._name.get_buffer(), _info._name.size());
|
||||
_info._pos = (column->cid % 100) - 1;
|
||||
|
||||
xi_get_text(column, _info._name.get_buffer(), _info._name.size());
|
||||
_info._name.trim();
|
||||
|
||||
const TMask_field& fld = _sheet->sheet_mask().field(short(101+i));
|
||||
const TMask_field& fld = _sheet->sheet_mask().field(column->cid);
|
||||
switch (fld.class_id())
|
||||
{
|
||||
case CLASS_BOOLEAN_FIELD : _info._type = _boolfld; break;
|
||||
@ -3683,6 +3688,7 @@ const TRecordset_column_info& TSheet_recordset::column_info(unsigned int i) cons
|
||||
}
|
||||
else
|
||||
{
|
||||
_info._pos = -1;
|
||||
_info._name.cut(0);
|
||||
_info._type = _nullfld;
|
||||
_info._width = 0;
|
||||
@ -3691,15 +3697,42 @@ const TRecordset_column_info& TSheet_recordset::column_info(unsigned int i) cons
|
||||
return _info;
|
||||
}
|
||||
|
||||
const TVariant& TSheet_recordset::get(unsigned int column) const
|
||||
const TVariant& TSheet_recordset::get(unsigned int i) const
|
||||
{
|
||||
TVariant& var = get_tmp_var();
|
||||
if (_curr >= 0 && _curr < items() && column < columns())
|
||||
if (_curr >= 0 && _curr < items() && i < columns())
|
||||
{
|
||||
TToken_string& row = ((TSpreadsheet*)_sheet)->row(_curr);
|
||||
var = row.get(column);
|
||||
const TRecordset_column_info& ci = column_info(i);
|
||||
if (ci._pos >= 0)
|
||||
{
|
||||
TToken_string& row = ((TSpreadsheet*)_sheet)->row(_curr);
|
||||
TVariant& tmp = get_tmp_var();
|
||||
tmp = row.get(ci._pos);
|
||||
tmp.convert_to(ci._type);
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
return var;
|
||||
return NULL_VARIANT;
|
||||
}
|
||||
|
||||
bool TSheet_recordset::get_attr(int i, TAttributes& attr, bool header) const
|
||||
{
|
||||
const TRecordset_column_info& ci = column_info(i);
|
||||
bool is_valid = false;
|
||||
if (ci._pos >= 0)
|
||||
{
|
||||
COLOR back, fore;
|
||||
if (header)
|
||||
{
|
||||
back = BTN_BACK_COLOR;
|
||||
fore = PROMPT_COLOR;
|
||||
// is_valid = true; // Per ora non funziona
|
||||
}
|
||||
else
|
||||
{
|
||||
is_valid = ((TSpreadsheet*)_sheet)->get_back_and_fore_color(back, fore, _curr, ci._pos);
|
||||
}
|
||||
}
|
||||
return is_valid;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
@ -1140,7 +1140,7 @@ bool TRelation_application::save(bool check_dirty)
|
||||
mask2mail(*_mask);
|
||||
break;
|
||||
case _isreinsert:
|
||||
warning_box(TR("Esiste gia' un elemento con la stessa chiave"));
|
||||
warning_box(TR("Esiste già un elemento con la stessa chiave"));
|
||||
break;
|
||||
default:
|
||||
error_box(FR("Impossibile registrare i dati: errore %d"), err);
|
||||
@ -1186,20 +1186,7 @@ int TRelation_application::write(const TMask& m)
|
||||
r.curr().set_creation_info();
|
||||
|
||||
// write relation and all independent sheets
|
||||
int err=r.write();
|
||||
|
||||
/*
|
||||
const int max = m.fields();
|
||||
for (int i = 0; i < max; i++)
|
||||
{
|
||||
if (m.fld(i).is_sheet())
|
||||
{
|
||||
TSheet_field& f = (TSheet_field& )m.fld(i);
|
||||
if (f.record() && !f.external_record())
|
||||
err|=f.record()->write(FALSE);
|
||||
}
|
||||
}
|
||||
*/
|
||||
int err = r.write();
|
||||
FOR_EACH_MASK_SHEET(m, i, s)
|
||||
{
|
||||
if (s->record() && !s->external_record())
|
||||
@ -1219,18 +1206,6 @@ int TRelation_application::rewrite(const TMask& m)
|
||||
r.rewrite();
|
||||
int err=r.status();
|
||||
|
||||
/*
|
||||
const int max = m.fields();
|
||||
for (int i = 0; i < max; i++)
|
||||
{
|
||||
if (m.fld(i).is_sheet())
|
||||
{
|
||||
TSheet_field& f = (TSheet_field&)m.fld(i);
|
||||
if (f.record()&& !f.external_record())
|
||||
err|=f.record()->write(TRUE);
|
||||
}
|
||||
}
|
||||
*/
|
||||
FOR_EACH_MASK_SHEET(m, i, s)
|
||||
{
|
||||
if (s->record() && !s->external_record())
|
||||
@ -1378,7 +1353,10 @@ void TRelation_application::main_loop()
|
||||
if (save_and_quit())
|
||||
k = K_QUIT;
|
||||
else
|
||||
{
|
||||
edit_cancel(); // Novità 19-06-2012
|
||||
query_mode();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case K_QUIT:
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <execp.h>
|
||||
#include <tabapp.h>
|
||||
#include <tabmod.h>
|
||||
#include <tabutil.h>
|
||||
|
||||
// @cmember Costruttore
|
||||
@ -14,7 +15,7 @@ TTable_application::~TTable_application()
|
||||
// @cmember Indica se la futura <mf TTable_application::get_mask> ritornera' una maschera diversa
|
||||
// dalla corrente.
|
||||
bool TTable_application::changing_mask(int mode)
|
||||
{ return FALSE; }
|
||||
{ return false; }
|
||||
|
||||
// @cmember Richiede la maschera da usare
|
||||
TMask* TTable_application::get_mask(int mode)
|
||||
@ -47,7 +48,7 @@ void TTable_application::init_query_mode(TMask& m)
|
||||
void TTable_application::init_modify_mode(TMask& m)
|
||||
{
|
||||
m.disable(-GR_MODIFY_PROTECTED);
|
||||
const bool enable = !(_rel->curr().get_bool(FPC));
|
||||
const bool enable = !_rel->curr().get_bool(FPC);
|
||||
m.enable(-GR_RECORD_PROTECTED,enable);
|
||||
}
|
||||
|
||||
@ -59,12 +60,14 @@ bool TTable_application::protected_record(TRectype& rec)
|
||||
TString& TTable_application::get_mask_name(TString& t) const
|
||||
{
|
||||
CHECK(_rel,"Can't use a NULL relation to retrieve table module");
|
||||
TTable& tab = (TTable&) _rel->lfile();
|
||||
|
||||
TString16 m = _tabname;
|
||||
if (m[0] == '%' || m[0] == '&') m.ltrim(1);
|
||||
|
||||
t = tab.module();
|
||||
TString8 m = _tabname;
|
||||
if (m[0] == '%' || m[0] == '$')
|
||||
m.ltrim(1); else
|
||||
if (m[0] == '&')
|
||||
m = _tabname.right(3);
|
||||
|
||||
t = _rel->lfile().module();
|
||||
t << "tb" << m;
|
||||
t.lower();
|
||||
|
||||
@ -94,7 +97,7 @@ TMask* TTable_application::set_mask(TMask* m)
|
||||
if (name.custom_path())
|
||||
_msk = new TMask(name);
|
||||
else
|
||||
error_box(FR("Impossibile trovare la maschera %s"), (const char*)name);
|
||||
cantread_box(name);
|
||||
}
|
||||
return _msk;
|
||||
}
|
||||
@ -111,23 +114,25 @@ bool TTable_application::user_create()
|
||||
if (set_mask() == NULL)
|
||||
return false;
|
||||
|
||||
const int campi = _msk->fields();
|
||||
for (int i = 0; i < campi; i++)
|
||||
FOR_EACH_MASK_FIELD(*_msk, i, f)
|
||||
{
|
||||
const TMask_field& f = _msk->fld(i);
|
||||
if (f.in_group(GR_SEARCH))
|
||||
if (f->in_group(GR_SEARCH))
|
||||
{
|
||||
set_search_field(f.dlg());
|
||||
set_search_field(f->dlg());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TFilename rpt; get_mask_name(rpt); rpt.ext("rpt");
|
||||
if (rpt.custom_path())
|
||||
TFilename rpt;
|
||||
get_mask_name(rpt); rpt.ext("rpt");
|
||||
bool can_print = rpt.custom_path();
|
||||
if (!can_print)
|
||||
{
|
||||
enable_menu_item(M_FILE_PREVIEW);
|
||||
enable_menu_item(M_FILE_PRINT);
|
||||
get_mask_name(rpt); rpt.ext("rep");
|
||||
can_print = rpt.custom_path();
|
||||
}
|
||||
enable_menu_item(M_FILE_PREVIEW, can_print);
|
||||
enable_menu_item(M_FILE_PRINT, can_print);
|
||||
|
||||
TString title;
|
||||
_msk->get_caption(title);
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
// @cmember Ritorna il nome della tabella
|
||||
virtual const char* name() const { return _tabname;}
|
||||
// @cmember Ritorna il modulo al quale appartiene la tabella
|
||||
const char* module() const;
|
||||
virtual const char* module() const;
|
||||
// @cmember Ritorna il cliente al quale appartiene la tabella
|
||||
long customer() const;
|
||||
|
||||
|
@ -216,10 +216,10 @@ void TTable::load_module_description()
|
||||
_module = "ba";
|
||||
}
|
||||
|
||||
const char* TTable::module()
|
||||
const char* TTable::module() const
|
||||
{
|
||||
if (!_des_mod_loaded)
|
||||
load_module_description();
|
||||
((TTable*)this)->load_module_description();
|
||||
return _module;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
// @cmember Ritorna il nome della tabella
|
||||
virtual const char* name() const { return _tabname;}
|
||||
// @cmember Ritorna il modulo al quale appartiene la tabella
|
||||
const char* module();
|
||||
virtual const char* module() const;
|
||||
// @cmember Ritorna la descrizione della tabella
|
||||
virtual const char* description();
|
||||
// @controlla se la tabella e' vuota
|
||||
|
Loading…
x
Reference in New Issue
Block a user