Kaydet (Commit) 45cb9295 authored tarafından Caolán McNamara's avatar Caolán McNamara

keep empty spanned rows/cols for homogeneous grids

Change-Id: I5560ae291cd5bf9e5f57a5bad5ecdfe7a6cd0bb8
üst 22d1beb7
...@@ -774,64 +774,80 @@ VclGrid::array_type VclGrid::assembleGrid() const ...@@ -774,64 +774,80 @@ VclGrid::array_type VclGrid::assembleGrid() const
if (pChild && pChild->IsVisible()) if (pChild && pChild->IsVisible())
{ {
aNonEmptyCols[x] = true; aNonEmptyCols[x] = true;
if (get_column_homogeneous())
{
for (sal_Int32 nSpanX = 1; nSpanX < rEntry.nSpanWidth; ++nSpanX)
aNonEmptyCols[x+1] = true;
}
aNonEmptyRows[y] = true; aNonEmptyRows[y] = true;
if (get_row_homogeneous())
{
for (sal_Int32 nSpanY = 1; nSpanY < rEntry.nSpanHeight; ++nSpanY)
aNonEmptyRows[x+1] = true;
}
} }
} }
} }
//reduce the spans of elements that span empty columns if (!get_column_homogeneous())
for (sal_Int32 x = 0; x < nMaxX; ++x)
{ {
std::set<ExtendedGridEntry*> candidates; //reduce the spans of elements that span empty columns
for (sal_Int32 y = 0; y < nMaxY; ++y) for (sal_Int32 x = 0; x < nMaxX; ++x)
{ {
if (aNonEmptyCols[x]) std::set<ExtendedGridEntry*> candidates;
continue; for (sal_Int32 y = 0; y < nMaxY; ++y)
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 if (aNonEmptyCols[x])
//with no widget in it, or spanned by any other widget continue;
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->nSpanWidth;
} }
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->nSpanWidth;
} }
} }
//reduce the spans of elements that span empty rows if (!get_row_homogeneous())
for (sal_Int32 y = 0; y < nMaxY; ++y)
{ {
std::set<ExtendedGridEntry*> candidates; //reduce the spans of elements that span empty rows
for (sal_Int32 x = 0; x < nMaxX; ++x) for (sal_Int32 y = 0; y < nMaxY; ++y)
{ {
if (aNonEmptyRows[y]) std::set<ExtendedGridEntry*> candidates;
continue; for (sal_Int32 x = 0; x < nMaxX; ++x)
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 if (aNonEmptyRows[y])
//with no widget in it, or spanned by any other widget continue;
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;
} }
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;
} }
} }
......
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