sc/source/ui/cctrl/dpcontrol.cxx |    7 +++++++
 sc/source/ui/view/output2.cxx    |   14 +++++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)

New commits:
commit 68892230ddcde135e9951047a3621438eb7987d0
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Mon Feb 1 16:48:28 2021 +0100
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Feb 9 13:27:09 2021 +0100

    autofilter: scale dropdown button according to zoom level
    
    Change-Id: I4f8a16e196bc33ea5b29fda0edc1f773a24e28db
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110259
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>

diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx
index 2ca413055000..f178074ae577 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
     long nW = std::min(maSize.getWidth() / 2, nMaxSize);
     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 41a9760cc450..9e301615a107 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1336,8 +1336,10 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE 
nArrY, long nPosX, long nPosY
              ( 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 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 long nFilter = fZoom * DROPDOWN_BITMAP_SIZE;
             bool bFit = ( nNeeded + nFilter <= nMergeSizeX );
             if ( bFit || bCellIsValue )
             {
@@ -4906,11 +4908,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;
                                         long nComp = nEngineWidth;
                                         if (nAvailWidth<nComp) 
nAvailWidth=nComp;
                                     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to