sc/source/ui/condformat/condformatdlg.cxx |    9 +++++++++
 sc/source/ui/inc/condformatdlgentry.hxx   |    1 +
 2 files changed, 10 insertions(+)

New commits:
commit 426a38ea955742c471c22b4c20f0149ec423f653
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Mar 18 14:21:22 2021 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Fri Mar 19 12:59:21 2021 +0100

    tdf#118482 set a scroll step of the height of a collapsed entry
    
    Change-Id: I09ea056f6c2284afda5b387b6fdff3160bb7adc2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112677
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/source/ui/condformat/condformatdlg.cxx 
b/sc/source/ui/condformat/condformatdlg.cxx
index 7a4631289f01..b4759bb3940e 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -174,6 +174,8 @@ void ScCondFormatList::RecalcAll()
     if (mbFrozen)
         return;
 
+    int nWheelScroll = SAL_MAX_INT32;
+
     sal_Int32 nIndex = 1;
     for (const auto& item : maEntries)
     {
@@ -181,8 +183,15 @@ void ScCondFormatList::RecalcAll()
             continue;
         item->SetIndex(nIndex);
         item->set_grid_top_attach(nIndex - 1);
+        nWheelScroll = std::min(nWheelScroll, item->get_preferred_height());
         ++nIndex;
     }
+
+    if (nWheelScroll != SAL_MAX_INT32)
+    {
+        // tdf#118482 set a scroll step of the height of a collapsed entry
+        mxScrollWindow->vadjustment_set_step_increment(nWheelScroll);
+    }
 }
 
 IMPL_LINK(ScCondFormatList, ColFormatTypeHdl, weld::ComboBox&, rBox, void)
diff --git a/sc/source/ui/inc/condformatdlgentry.hxx 
b/sc/source/ui/inc/condformatdlgentry.hxx
index bf2d80fba2e0..aed63be47729 100644
--- a/sc/source/ui/inc/condformatdlgentry.hxx
+++ b/sc/source/ui/inc/condformatdlgentry.hxx
@@ -77,6 +77,7 @@ public:
     void Show() { mxGrid->show(); }
 
     void set_grid_top_attach(int nAttach) { 
mxBorder->set_grid_top_attach(nAttach); }
+    int get_preferred_height() const { return 
mxBorder->get_preferred_size().Height(); }
 
     void SetPos(const ScAddress& rPos) { maPos = rPos; };
     bool IsSelected() const { return mbActive;}
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to