summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-01-22 15:46:33 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-01-22 17:30:33 +0100
commit3c8b6ba3995952602e1c223b7238fab0963aef4a (patch)
tree1f94f8dbab95cabd9ef94eafbb2281268c0b045f /svtools
parent197aa7911d5be5464efd19feaf3370eea1c15ab1 (diff)
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@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/control/valueset.cxx23
1 files changed, 18 insertions, 5 deletions
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)
{