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 TPrint_section::tab(int col)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int *tab=_tab;
|
|
||||||
if (_columnwise)
|
if (_columnwise)
|
||||||
{
|
{
|
||||||
if (tab[0] == -1 && _upsection )
|
if (_tab[0] == -1 && fields())
|
||||||
{
|
{
|
||||||
// I'm the print section of a subsection: what my daddy says?
|
_tab[0] = 2;
|
||||||
return _upsection->section().tab(col);
|
|
||||||
}
|
|
||||||
if (tab[0] == -1)
|
|
||||||
{
|
{
|
||||||
|
int extraoff=0;
|
||||||
// compute column offset
|
// compute column offset
|
||||||
_nfld = 0;
|
_nfld = 0;
|
||||||
tab[0] = 2;
|
short maxcolreached = 0,mincolreached = MAXCOLUMNS+1;
|
||||||
short maxcolreached = 0;
|
|
||||||
for (word i = 0; i < fields(); i++)
|
for (word i = 0; i < fields(); i++)
|
||||||
{
|
{
|
||||||
if (field(i).shown())
|
if (!field(i).is_section() && field(i).shown())
|
||||||
{
|
{
|
||||||
CHECKD (field(i)._x < MAXCOLUMNS, "Colonna ammessa e non concessa: ", field(i)._x);
|
const int curr_col=field(i)._x;
|
||||||
tab[field(i)._x] = field(i)._width + 1; // one is for separation
|
CHECKD (curr_col >=0 && curr_col < MAXCOLUMNS, "Colonna ammessa e non concessa: ", field(i)._x);
|
||||||
if (field(i)._x > maxcolreached) maxcolreached = 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++;
|
_nfld++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// cumulate offsets
|
// cumulate offsets
|
||||||
int last = 0;
|
|
||||||
for (i = 1; i <= (word)maxcolreached; i++)
|
if (_upsection)
|
||||||
{
|
{
|
||||||
if (tab[i - 1] != -1)
|
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;
|
last = i - 1;
|
||||||
if (tab[i] != -1)
|
if (_tab[i] != -1)
|
||||||
tab[i] += tab[last];
|
_tab[i] += _tab[last]+extraoff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// se manca la colonna, vai a prendere quella immediatamente prima
|
// se manca la colonna, vai a prendere quella immediatamente prima
|
||||||
while (tab[col] == -1 && col > 0)
|
while (_tab[col] == -1 && col > 0)
|
||||||
col--;
|
col--;
|
||||||
ret = tab[col];
|
ret = _tab[col];
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user