[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - include/svtools svtools/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jun 15 11:16:35 UTC 2020
include/svtools/valueset.hxx | 1 +
svtools/source/control/valueset.cxx | 18 ++++++++++++++----
2 files changed, 15 insertions(+), 4 deletions(-)
New commits:
commit 3a3ab9c95c37bdd84fdceac82349621368e1bee1
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Jun 14 19:54:20 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Jun 15 13:16:05 2020 +0200
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 at redhat.com>
(cherry picked from commit 5cce65171b12cd652d6a9857a9c0bad1c608a65c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96333
diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx
index 29a17f530483..6c6055d0d982 100644
--- a/include/svtools/valueset.hxx
+++ b/include/svtools/valueset.hxx
@@ -254,6 +254,7 @@ private:
SVT_DLLPRIVATE bool ImplHasAccessibleListeners();
SVT_DLLPRIVATE void ImplTracking(const Point& rPos);
SVT_DLLPRIVATE void QueueReformat();
+ SVT_DLLPRIVATE void SetFirstLine(sal_uInt16 nNewFirstLine); // set mnFirstLine and update scrollbar to match
SVT_DLLPRIVATE void RecalcScrollBar();
DECL_DLLPRIVATE_LINK(ImplScrollHdl, weld::ScrolledWindow&, void);
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index 40f2280cda5d..4329d415f9a1 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
More information about the Libreoffice-commits
mailing list