[Libreoffice-commits] core.git: include/svtools svtools/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Jan 22 16:31:13 UTC 2020


 include/svtools/valueset.hxx        |    1 +
 svtools/source/control/valueset.cxx |   23 ++++++++++++++++++-----
 2 files changed, 19 insertions(+), 5 deletions(-)

New commits:
commit 3c8b6ba3995952602e1c223b7238fab0963aef4a
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jan 22 15:46:33 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jan 22 17:30:33 2020 +0100

    scroll to make selected entry visible
    
    even before first format
    
    Change-Id: Ic19e6dca0c112e8d8a7d570c01bf924d7d0d832d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87197
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx
index fed18733ec3c..5135afa0affa 100644
--- a/include/svtools/valueset.hxx
+++ b/include/svtools/valueset.hxx
@@ -454,6 +454,7 @@ private:
     SVT_DLLPRIVATE void         ImplFireAccessibleEvent( short nEventId, const css::uno::Any& rOldValue, const css::uno::Any& rNewValue );
     SVT_DLLPRIVATE bool         ImplHasAccessibleListeners();
     SVT_DLLPRIVATE void         ImplTracking(const Point& rPos);
+    SVT_DLLPRIVATE void         RecalcScrollBar();
     DECL_DLLPRIVATE_LINK(ImplScrollHdl, weld::ScrolledWindow&, void);
 
     Size           GetLargestItemSize();
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index 69d674be295d..b3dcd2adfa38 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -2676,6 +2676,15 @@ void SvtValueSet::RemoveItem( sal_uInt16 nItemId )
         Invalidate();
 }
 
+void SvtValueSet::RecalcScrollBar()
+{
+    // reset scrolled window state to initial value
+    // so it will get configured to the right adjustment
+    WinBits nStyle = GetStyle();
+    if (mxScrolledWindow && (nStyle & WB_VSCROLL))
+        mxScrolledWindow->set_vpolicy(VclPolicyType::NEVER);
+}
+
 void SvtValueSet::Clear()
 {
     ImplDeleteItems();
@@ -2687,11 +2696,7 @@ void SvtValueSet::Clear()
     mnSelItemId     = 0;
     mbNoSelection   = true;
 
-    // reset scrolled window state to initial value
-    // so it will get configured to the right adjustment
-    WinBits nStyle = GetStyle();
-    if (mxScrolledWindow && (nStyle & WB_VSCROLL))
-        mxScrolledWindow->set_vpolicy(VclPolicyType::NEVER);
+    RecalcScrollBar();
 
     mbFormat = true;
     if ( IsReallyVisible() && IsUpdateMode() )
@@ -2852,6 +2857,14 @@ void SvtValueSet::SelectItem( sal_uInt16 nItemId )
     bool bNewOut = !mbFormat && IsReallyVisible() && IsUpdateMode();
     bool bNewLine = false;
 
+    if (weld::DrawingArea* pNeedsFormatToScroll = !mnCols ? GetDrawingArea() : nullptr)
+    {
+        Format(pNeedsFormatToScroll->get_ref_device());
+        // reset scrollbar so its set to the later calculated mnFirstLine on
+        // the next Format
+        RecalcScrollBar(); // reset scrollbar so its set to the later calculated
+    }
+
     // if necessary scroll to the visible area
     if (mbScroll && nItemId && mnCols)
     {


More information about the Libreoffice-commits mailing list