summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2021-02-01 16:48:28 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2021-03-04 15:42:21 +0100
commit008c2354075e1b5b63000f6a2da802971a2902e6 (patch)
tree38357899643ba2790dda8b958851a212f60a7dc8
parent0e6e10cd3dd5a6bf06000750a74982a9824ec853 (diff)
autofilter: scale dropdown button according to zoom level
Change-Id: I4f8a16e196bc33ea5b29fda0edc1f773a24e28db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110259 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Jan Holesovsky <kendy@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111896 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
-rw-r--r--sc/source/ui/cctrl/dpcontrol.cxx7
-rw-r--r--sc/source/ui/view/output2.cxx14
2 files changed, 16 insertions, 5 deletions
diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx
index 24620cdbd661..d7dd13dd5c4e 100644
--- a/sc/source/ui/cctrl/dpcontrol.cxx
+++ b/sc/source/ui/cctrl/dpcontrol.cxx
@@ -146,6 +146,13 @@ void ScDPFieldButton::getPopupBoundingBox(Point& rPos, Size& rSize) const
tools::Long nW = std::min(maSize.getWidth() / 2, nMaxSize);
tools::Long nH = std::min(maSize.getHeight(), nMaxSize);
+ double fZoom = static_cast<double>(maZoomY) > 1.0 ? static_cast<double>(maZoomY) : 1.0;
+ if (fZoom > 1.0)
+ {
+ nW = fZoom * (nW - 1);
+ nH = fZoom * (nH - 1);
+ }
+
// #i114944# AutoFilter button is left-aligned in RTL.
// DataPilot button is always right-aligned for now, so text output isn't affected.
if (mbPopupLeft)
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index e7083ed2c45c..b3da99ca3d35 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1384,8 +1384,10 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, tools::Long nPosX, too
( rPattern.GetItem(ATTR_MERGE_FLAG).GetValue() & (ScMF::Auto|ScMF::Button|ScMF::ButtonPopup) ) &&
( !bBreak || mpRefDevice == pFmtDevice ) )
{
- // filter drop-down width is now independent from row height
- const tools::Long nFilter = DROPDOWN_BITMAP_SIZE;
+ // filter drop-down width depends on row height
+ double fZoom = mpRefDevice ? static_cast<double>(mpRefDevice->GetMapMode().GetScaleY()) : 1.0;
+ fZoom = fZoom > 1.0 ? fZoom : 1.0;
+ const tools::Long nFilter = fZoom * DROPDOWN_BITMAP_SIZE;
bool bFit = ( nNeeded + nFilter <= nMergeSizeX );
if ( bFit )
{
@@ -4949,11 +4951,13 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
eOrient!=SvxCellOrientation::Stacked &&
pInfo->bAutoFilter)
{
- // filter drop-down width is now independent from row height
+ // filter drop-down width depends on row height
+ double fZoom = mpRefDevice ? static_cast<double>(mpRefDevice->GetMapMode().GetScaleY()) : 1.0;
+ fZoom = fZoom > 1.0 ? fZoom : 1.0;
if (bPixelToLogic)
- nAvailWidth -= mpRefDevice->PixelToLogic(Size(0,DROPDOWN_BITMAP_SIZE)).Height();
+ nAvailWidth -= mpRefDevice->PixelToLogic(Size(0,fZoom * DROPDOWN_BITMAP_SIZE)).Height();
else
- nAvailWidth -= DROPDOWN_BITMAP_SIZE;
+ nAvailWidth -= fZoom * DROPDOWN_BITMAP_SIZE;
tools::Long nComp = nEngineWidth;
if (nAvailWidth<nComp) nAvailWidth=nComp;
}