Corretta la valutazione del columnwise per sottosezioni che non possiedono tutte le colonne
git-svn-id: svn://10.65.10.50/trunk@5606 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
3ce16e0620
commit
f9950b3fd1
@ -2349,44 +2349,61 @@ void TPrint_section::reset_tabs()
|
||||
int TPrint_section::tab(int col)
|
||||
{
|
||||
int ret = -1;
|
||||
int *tab=_tab;
|
||||
if (_columnwise)
|
||||
{
|
||||
if (tab[0] == -1 && _upsection )
|
||||
if (_tab[0] == -1 && fields())
|
||||
{
|
||||
// I'm the print section of a subsection: what my daddy says?
|
||||
return _upsection->section().tab(col);
|
||||
}
|
||||
if (tab[0] == -1)
|
||||
{
|
||||
// compute column offset
|
||||
_nfld = 0;
|
||||
tab[0] = 2;
|
||||
short maxcolreached = 0;
|
||||
for (word i = 0; i < fields(); i++)
|
||||
_tab[0] = 2;
|
||||
{
|
||||
if (field(i).shown())
|
||||
int extraoff=0;
|
||||
// compute column offset
|
||||
_nfld = 0;
|
||||
short maxcolreached = 0,mincolreached = MAXCOLUMNS+1;
|
||||
for (word i = 0; i < fields(); i++)
|
||||
{
|
||||
CHECKD (field(i)._x < MAXCOLUMNS, "Colonna ammessa e non concessa: ", field(i)._x);
|
||||
tab[field(i)._x] = field(i)._width + 1; // one is for separation
|
||||
if (field(i)._x > maxcolreached) maxcolreached = field(i)._x;
|
||||
_nfld++;
|
||||
if (!field(i).is_section() && field(i).shown())
|
||||
{
|
||||
const int curr_col=field(i)._x;
|
||||
CHECKD (curr_col >=0 && curr_col < MAXCOLUMNS, "Colonna ammessa e non concessa: ", field(i)._x);
|
||||
_tab[curr_col] = field(i)._width + 1; // one is for separation
|
||||
if (curr_col < mincolreached) mincolreached = curr_col;
|
||||
if (curr_col > maxcolreached) maxcolreached = curr_col;
|
||||
_nfld++;
|
||||
}
|
||||
}
|
||||
// cumulate offsets
|
||||
|
||||
if (_upsection)
|
||||
{
|
||||
if (mincolreached<=MAXCOLUMNS && mincolreached>0)
|
||||
{
|
||||
// print section of a subsection: extra offset
|
||||
extraoff=_upsection->section().tab(mincolreached-1);
|
||||
for (i = 1 ; i < (word)mincolreached; i++)
|
||||
{
|
||||
_tab[i]=_upsection->section()._tab[i];
|
||||
}
|
||||
if (extraoff== _tab[mincolreached-1])
|
||||
extraoff=0;
|
||||
else
|
||||
extraoff-=_upsection->section().tab(0);
|
||||
}
|
||||
}
|
||||
|
||||
int last = 0;
|
||||
for (i = mincolreached ; i <= (word)maxcolreached; i++)
|
||||
{
|
||||
if (_tab[i - 1] != -1)
|
||||
last = i - 1;
|
||||
if (_tab[i] != -1)
|
||||
_tab[i] += _tab[last]+extraoff;
|
||||
}
|
||||
}
|
||||
// cumulate offsets
|
||||
int last = 0;
|
||||
for (i = 1; i <= (word)maxcolreached; i++)
|
||||
{
|
||||
if (tab[i - 1] != -1)
|
||||
last = i - 1;
|
||||
if (tab[i] != -1)
|
||||
tab[i] += tab[last];
|
||||
}
|
||||
}
|
||||
// se manca la colonna, vai a prendere quella immediatamente prima
|
||||
while (tab[col] == -1 && col > 0)
|
||||
while (_tab[col] == -1 && col > 0)
|
||||
col--;
|
||||
ret = tab[col];
|
||||
ret = _tab[col];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user