Kaydet (Commit) 7d48d41d authored tarafından Caolán McNamara's avatar Caolán McNamara

don't remove blank rows/cols more than once

Change-Id: I7b46ac1f9fcca5a3ae9dbb6b6c4f92917f522295
üst fd38d60c
......@@ -543,11 +543,14 @@ VclGrid::array_type VclGrid::assembleGrid() const
}
}
//reduce the spans of elements that span empty rows or columns
//reduce the spans of elements that span empty columns
for (sal_Int32 x = 0; x < nMaxX; ++x)
{
std::set<ExtendedGridEntry*> candidates;
for (sal_Int32 y = 0; y < nMaxY; ++y)
{
if (aNonEmptyCols[x])
continue;
ExtendedGridEntry &rSpan = A[x][y];
//cell x/y is spanned by the widget at cell rSpan.x/rSpan.y,
//just points back to itself if there's no cell spanning
......@@ -558,10 +561,41 @@ VclGrid::array_type VclGrid::assembleGrid() const
continue;
}
ExtendedGridEntry &rEntry = A[rSpan.x][rSpan.y];
if (aNonEmptyCols[x] == false)
--rEntry.nSpanWidth;
if (aNonEmptyRows[y] == false)
--rEntry.nSpanHeight;
candidates.insert(&rEntry);
}
for (std::set<ExtendedGridEntry*>::iterator aI = candidates.begin(), aEnd = candidates.end();
aI != aEnd; ++aI)
{
ExtendedGridEntry *pEntry = *aI;
--pEntry->nSpanWidth;
}
}
//reduce the spans of elements that span empty rows
for (sal_Int32 y = 0; y < nMaxY; ++y)
{
std::set<ExtendedGridEntry*> candidates;
for (sal_Int32 x = 0; x < nMaxX; ++x)
{
if (aNonEmptyRows[y])
continue;
ExtendedGridEntry &rSpan = A[x][y];
//cell x/y is spanned by the widget at cell rSpan.x/rSpan.y,
//just points back to itself if there's no cell spanning
if ((rSpan.x == -1) || (rSpan.y == -1))
{
//there is no entry for this cell, i.e. this is a cell
//with no widget in it, or spanned by any other widget
continue;
}
ExtendedGridEntry &rEntry = A[rSpan.x][rSpan.y];
candidates.insert(&rEntry);
}
for (std::set<ExtendedGridEntry*>::iterator aI = candidates.begin(), aEnd = candidates.end();
aI != aEnd; ++aI)
{
ExtendedGridEntry *pEntry = *aI;
--pEntry->nSpanHeight;
}
}
......@@ -612,7 +646,7 @@ void VclGrid::calcMaxs(const array_type &A, std::vector<Value> &rWidths, std::ve
{
const GridEntry &rEntry = A[x][y];
const Window *pChild = rEntry.pChild;
if (!pChild)
if (!pChild || !pChild->IsVisible())
continue;
sal_Int32 nWidth = rEntry.nSpanWidth;
......@@ -643,7 +677,7 @@ void VclGrid::calcMaxs(const array_type &A, std::vector<Value> &rWidths, std::ve
{
const GridEntry &rEntry = A[x][y];
const Window *pChild = rEntry.pChild;
if (!pChild)
if (!pChild || !pChild->IsVisible())
continue;
sal_Int32 nWidth = rEntry.nSpanWidth;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment