[Libreoffice-commits] core.git: sc/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Thu Mar 4 14:43:05 UTC 2021


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

New commits:
commit 008c2354075e1b5b63000f6a2da802971a2902e6
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Feb 1 16:48:28 2021 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Thu Mar 4 15:42:21 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 <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111896
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

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;
                                     }


More information about the Libreoffice-commits mailing list