diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-08-21 10:12:23 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-08-21 10:35:18 +0100 |
commit | 45cb92953bde8df8369101637225469bd1883758 (patch) | |
tree | 252ce0c9b9cba347e2796364a30499098f81355d /vcl/source/window | |
parent | 22d1beb78a475e4846af945afde1c4d6c263b5d6 (diff) |
keep empty spanned rows/cols for homogeneous grids
Change-Id: I5560ae291cd5bf9e5f57a5bad5ecdfe7a6cd0bb8
Diffstat (limited to 'vcl/source/window')
-rw-r--r-- | vcl/source/window/layout.cxx | 100 |
1 files changed, 58 insertions, 42 deletions
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 118298b4e103..622862e3cbb1 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -774,64 +774,80 @@ VclGrid::array_type VclGrid::assembleGrid() const if (pChild && pChild->IsVisible()) { aNonEmptyCols[x] = true; + if (get_column_homogeneous()) + { + for (sal_Int32 nSpanX = 1; nSpanX < rEntry.nSpanWidth; ++nSpanX) + aNonEmptyCols[x+1] = 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 - for (sal_Int32 x = 0; x < nMaxX; ++x) + if (!get_column_homogeneous()) { - std::set<ExtendedGridEntry*> candidates; - for (sal_Int32 y = 0; y < nMaxY; ++y) + //reduce the spans of elements that span empty columns + for (sal_Int32 x = 0; x < nMaxX; ++x) { - 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 - if ((rSpan.x == -1) || (rSpan.y == -1)) + std::set<ExtendedGridEntry*> candidates; + for (sal_Int32 y = 0; y < nMaxY; ++y) { - //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; + 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 + 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 - for (sal_Int32 y = 0; y < nMaxY; ++y) + if (!get_row_homogeneous()) { - std::set<ExtendedGridEntry*> candidates; - for (sal_Int32 x = 0; x < nMaxX; ++x) + //reduce the spans of elements that span empty rows + for (sal_Int32 y = 0; y < nMaxY; ++y) { - 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)) + std::set<ExtendedGridEntry*> candidates; + for (sal_Int32 x = 0; x < nMaxX; ++x) { - //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; + 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; } - 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; } } |