summaryrefslogtreecommitdiff
path: root/vcl/source/window
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-12-29 16:58:31 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-12-29 18:02:26 +0000
commit7d48d41d9e7bee273628ed55a4bac720751ba328 (patch)
treea74d1940b583259094365b9c4ba53803a6af5421 /vcl/source/window
parentfd38d60c54cf59eb533089fb478bd7d686893ac7 (diff)
don't remove blank rows/cols more than once
Change-Id: I7b46ac1f9fcca5a3ae9dbb6b6c4f92917f522295
Diffstat (limited to 'vcl/source/window')
-rw-r--r--vcl/source/window/layout.cxx48
1 files changed, 41 insertions, 7 deletions
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 91017d5cb9ca..f8a75053255a 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -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;