diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-06-14 19:54:20 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-06-14 21:55:24 +0200 |
commit | 5cce65171b12cd652d6a9857a9c0bad1c608a65c (patch) | |
tree | d2cb842c5c579e28cc7318f71462e9c4946fc0e6 /svtools | |
parent | b31bcdd8322b57dc0cd5b093b8f3e8e59b32c37e (diff) |
Related: tdf#132966 scrollbar not tracking valueset cursor position
Change-Id: I408d872f89da67cd91f0282c1624fd33ddc6c538
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96298
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/control/valueset.cxx | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index d2d0acff4537..24ec4eaf7d53 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -696,6 +696,16 @@ void ValueSet::RecalculateItemSizes() } } +void ValueSet::SetFirstLine(sal_uInt16 nNewFirstLine) +{ + if (nNewFirstLine != mnFirstLine) + { + mnFirstLine = nNewFirstLine; + if (mxScrolledWindow) + mxScrolledWindow->vadjustment_set_value(mnFirstLine); + } +} + void ValueSet::SelectItem( sal_uInt16 nItemId ) { size_t nItemPos = 0; @@ -731,12 +741,12 @@ void ValueSet::SelectItem( sal_uInt16 nItemId ) sal_uInt16 nNewLine = static_cast<sal_uInt16>(nItemPos / mnCols); if ( nNewLine < mnFirstLine ) { - mnFirstLine = nNewLine; + SetFirstLine(nNewLine); bNewLine = true; } else if ( nNewLine > o3tl::make_unsigned(mnFirstLine+mnVisLines-1) ) { - mnFirstLine = static_cast<sal_uInt16>(nNewLine-mnVisLines+1); + SetFirstLine(static_cast<sal_uInt16>(nNewLine-mnVisLines+1)); bNewLine = true; } } @@ -924,12 +934,12 @@ void ValueSet::Format(vcl::RenderContext const & rRenderContext) if (mnLines <= mnVisLines) { - mnFirstLine = 0; + SetFirstLine(0); } else { if (mnFirstLine > o3tl::make_unsigned(mnLines - mnVisLines)) - mnFirstLine = static_cast<sal_uInt16>(mnLines - mnVisLines); + SetFirstLine(static_cast<sal_uInt16>(mnLines - mnVisLines)); } // calculate item size |