From bdbc439ac6c6a0eb615d55dcaaf0722f3013b812 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 29 Oct 2019 14:52:37 +0000 Subject: tdf#49813 make autofilter popup at least the width of its column MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Idbcf3cdb62fb2886c3b05da721e8d326e0187588 Reviewed-on: https://gerrit.libreoffice.org/81690 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sc/source/ui/cctrl/checklistmenu.cxx | 5 +++-- sc/source/ui/inc/checklistmenu.hxx | 2 +- sc/source/ui/view/gridwin.cxx | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'sc') diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 6a8a51a0328e..b9b5acca11c8 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -878,7 +878,7 @@ void ScCheckListMenuWindow::CancelButton::Click() ::CancelButton::Click(); } -ScCheckListMenuWindow::ScCheckListMenuWindow(vcl::Window* pParent, ScDocument* pDoc) : +ScCheckListMenuWindow::ScCheckListMenuWindow(vcl::Window* pParent, ScDocument* pDoc, int nWidth) : ScMenuFloatingWindow(pParent, pDoc), maEdSearch(VclPtr::Create(this)), maChecks(VclPtr::Create(this)), @@ -893,7 +893,8 @@ ScCheckListMenuWindow::ScCheckListMenuWindow(vcl::Window* pParent, ScDocument* p { float fScaleFactor = GetDPIScaleFactor(); - maWndSize = Size(200 * fScaleFactor, 330 * fScaleFactor); + nWidth = std::max(nWidth, 200 * fScaleFactor); + maWndSize = Size(nWidth, 330 * fScaleFactor); maTabStops.AddTabStop( this ); maTabStops.AddTabStop( maEdSearch.get() ); diff --git a/sc/source/ui/inc/checklistmenu.hxx b/sc/source/ui/inc/checklistmenu.hxx index f62e8f6dc13c..2ff574a15252 100644 --- a/sc/source/ui/inc/checklistmenu.hxx +++ b/sc/source/ui/inc/checklistmenu.hxx @@ -335,7 +335,7 @@ public: Config(); }; - explicit ScCheckListMenuWindow(vcl::Window* pParent, ScDocument* pDoc); + explicit ScCheckListMenuWindow(vcl::Window* pParent, ScDocument* pDoc, int nWidth = -1); virtual ~ScCheckListMenuWindow() override; virtual void dispose() override; diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 777a9ed220f1..8f5324a7cd00 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -629,7 +629,8 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow) ScDocument* pDoc = pViewData->GetDocument(); mpAutoFilterPopup.disposeAndClear(); - mpAutoFilterPopup.reset(VclPtr::Create(this, pDoc)); + int nColWidth = ScViewData::ToPixel(pDoc->GetColWidth(nCol, nTab), pViewData->GetPPTX()); + mpAutoFilterPopup.reset(VclPtr::Create(this, pDoc, nColWidth)); // Avoid flicker when hovering over the menu items. if (!IsNativeControlSupported(ControlType::Pushbutton, ControlPart::Focus)) -- cgit