summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-05-20 16:41:26 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-05-21 09:54:39 +0200
commitd4b2875752d06a4811598b1685afcb0485fe2755 (patch)
treef7e76cff054566a76c56954f95a8d59d23df4db8
parent60846212c7f5271a86fd43555d633f77d59f5a10 (diff)
center vertically the interactive cell widgets if they won't fit
Change-Id: Iae7cc83ece1707e9fd38708e4f0911e529565f23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94605 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--svtools/source/brwbox/editbrowsebox.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx
index 920f0e99faf3..0105082cea5c 100644
--- a/svtools/source/brwbox/editbrowsebox.cxx
+++ b/svtools/source/brwbox/editbrowsebox.cxx
@@ -1130,13 +1130,21 @@ namespace svt
return nullptr;
}
-
void EditBrowseBox::ResizeController(CellControllerRef const & rController, const tools::Rectangle& rRect)
{
- rController->GetWindow().SetPosSizePixel(rRect.TopLeft(), rRect.GetSize());
+ Point aPoint(rRect.TopLeft());
+ Size aSize(rRect.GetSize());
+ Control& rControl = rController->GetWindow();
+ auto nMinHeight = rControl.get_preferred_size().Height();
+ if (nMinHeight > aSize.Height())
+ {
+ auto nOffset = (nMinHeight - aSize.Height()) / 2;
+ aPoint.AdjustY(-nOffset);
+ aSize.setHeight(nMinHeight);
+ }
+ rControl.SetPosSizePixel(aPoint, aSize);
}
-
void EditBrowseBox::InitController(CellControllerRef&, long, sal_uInt16)
{
}