From b45629418d91c7452245ae4c6894fa3c1becf237 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 21 Apr 2021 16:57:32 +0100 Subject: Related: tdf#140659 off by one indexes because scrollbar is now outside and not inside the control so it doesn't need to be accounted for as a child Change-Id: I77b55ec8d9b515850817417664df8944b4e44204 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114451 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- starmath/source/ElementsDockingWindow.cxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'starmath') diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index 0ee85b49eab8..e8365df87f01 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -288,7 +288,7 @@ SmElementsControl::SmElementsControl(std::unique_ptr xScro : mpDocShell(new SmDocShell(SfxModelFlags::EMBEDDED_OBJECT)) , m_nCurrentElement(SAL_MAX_UINT16) , m_nCurrentRolloverElement(SAL_MAX_UINT16) - , m_nCurrentOffset(1) // Default offset of 1 due to the ScrollBar child + , m_nCurrentOffset(0) , mbVerticalMode(true) , mxScroll(std::move(xScrolledWindow)) , m_bFirstPaintAfterLayout(false) @@ -1018,7 +1018,7 @@ void SmElementsControl::addElements(const SmElementDescr aElementsArray[], sal_u void SmElementsControl::build() { // The order is important! - // 1. Ensure there are no items left, including the default scrollbar! + // 1. Ensure there are no items left // 2. Release all the current accessible items. // This will check for new items after releasing them! // 3. Set the cursor element @@ -1033,9 +1033,7 @@ void SmElementsControl::build() setCurrentElement(SAL_MAX_UINT16); - // The first element is the scrollbar. We can't change its indexInParent - // value, as this is set by being a child of the SmElementsControl. - m_nCurrentOffset = 1; + m_nCurrentOffset = 0; for (sal_uInt16 n = 0; n < SAL_N_ELEMENTS(m_aCategories); ++n) { if (msCurrentSetId == std::get<0>(m_aCategories[n])) -- cgit