a11y: Directly use vcl ScrollBar in VCLXAccessibleScrollBar

... instead of using the toolkit/UNO wrapper class
VCLXScrollBar.

WIP: simplify

Change-Id: I9df8efb514d2bcf555bd163a7fe418c5c8d9e903
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178241
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn
2024-12-10 16:24:52 +01:00
parent 6f6e920a29
commit 85e17c7ff9

View File

@@ -165,9 +165,9 @@ Any VCLXAccessibleScrollBar::getCurrentValue( )
Any aValue; Any aValue;
VCLXScrollBar* pVCLXScrollBar = static_cast< VCLXScrollBar* >( GetVCLXWindow() ); VclPtr<ScrollBar> pScrollBar = GetAs<ScrollBar>();
if ( pVCLXScrollBar ) if (pScrollBar)
aValue <<= pVCLXScrollBar->getValue(); aValue <<= sal_Int32(pScrollBar->GetThumbPos());
return aValue; return aValue;
} }
@@ -179,20 +179,19 @@ sal_Bool VCLXAccessibleScrollBar::setCurrentValue( const Any& aNumber )
bool bReturn = false; bool bReturn = false;
VCLXScrollBar* pVCLXScrollBar = static_cast< VCLXScrollBar* >( GetVCLXWindow() ); VclPtr<ScrollBar> pScrollBar = GetAs<ScrollBar>();
if ( pVCLXScrollBar ) if (pScrollBar)
{ {
sal_Int32 nValue = 0, nValueMin = 0, nValueMax = 0; sal_Int32 nValue = 0;
OSL_VERIFY( aNumber >>= nValue ); OSL_VERIFY( aNumber >>= nValue );
OSL_VERIFY( getMinimumValue() >>= nValueMin ); sal_Int32 nValueMax = pScrollBar->GetRangeMax();
OSL_VERIFY( getMaximumValue() >>= nValueMax );
if ( nValue < nValueMin ) if (nValue < 0)
nValue = nValueMin; nValue = 0;
else if ( nValue > nValueMax ) else if ( nValue > nValueMax )
nValue = nValueMax; nValue = nValueMax;
pVCLXScrollBar->setValue( nValue ); pScrollBar->DoScroll(nValue);
bReturn = true; bReturn = true;
} }
@@ -206,9 +205,9 @@ Any VCLXAccessibleScrollBar::getMaximumValue( )
Any aValue; Any aValue;
VCLXScrollBar* pVCLXScrollBar = static_cast< VCLXScrollBar* >( GetVCLXWindow() ); VclPtr<ScrollBar> pScrollBar = GetAs<ScrollBar>();
if ( pVCLXScrollBar ) if (pScrollBar)
aValue <<= pVCLXScrollBar->getMaximum(); aValue <<= sal_Int32(pScrollBar->GetRangeMax());
return aValue; return aValue;
} }