summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-12-04 16:39:30 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2024-12-06 16:06:23 +0100
commit02d173ab19252bd09cdf4e39151aadb94758e70f (patch)
tree8b9dcbad15f1c0575e734c7ccb1c6ac66a87e602
parent0ae49fe15da3e3336cd8fbec596ee4a9c019465d (diff)
a11y: Use vcl CheckBox directly in VCLXAccessibleCheckBox
... instead of using the toolkit/UNO wrapper class VCLXCheckBox. Change-Id: I271535f3e2e46202e2ca3d2e3f9a1d05ac380c41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177815 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins (cherry picked from commit e3c9a06b7056e2b99628aef8005329c328bcab91) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177940
-rw-r--r--accessibility/source/standard/vclxaccessiblecheckbox.cxx40
1 files changed, 14 insertions, 26 deletions
diff --git a/accessibility/source/standard/vclxaccessiblecheckbox.cxx b/accessibility/source/standard/vclxaccessiblecheckbox.cxx
index 46c3e8749e92..debdb086df1e 100644
--- a/accessibility/source/standard/vclxaccessiblecheckbox.cxx
+++ b/accessibility/source/standard/vclxaccessiblecheckbox.cxx
@@ -19,7 +19,6 @@
#include <standard/vclxaccessiblecheckbox.hxx>
-#include <toolkit/awt/vclxwindows.hxx>
#include <helper/accresmgr.hxx>
#include <strings.hrc>
@@ -54,25 +53,15 @@ VCLXAccessibleCheckBox::VCLXAccessibleCheckBox( VCLXWindow* pVCLWindow )
bool VCLXAccessibleCheckBox::IsChecked() const
{
- bool bChecked = false;
-
- VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() );
- if ( pVCLXCheckBox && pVCLXCheckBox->getState() == sal_Int16(1) )
- bChecked = true;
-
- return bChecked;
+ VclPtr<CheckBox> pCheckBox = GetAs<CheckBox>();
+ return pCheckBox && pCheckBox->IsChecked();
}
bool VCLXAccessibleCheckBox::IsIndeterminate() const
{
- bool bIndeterminate = false;
-
- VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() );
- if ( pVCLXCheckBox && pVCLXCheckBox->getState() == sal_Int16(2) )
- bIndeterminate = true;
-
- return bIndeterminate;
+ VclPtr<CheckBox> pCheckBox = GetAs<CheckBox>();
+ return pCheckBox && pCheckBox->GetState() == TRISTATE_INDET;
}
@@ -176,23 +165,22 @@ sal_Bool VCLXAccessibleCheckBox::doAccessibleAction ( sal_Int32 nIndex )
if ( nIndex != 0 )
throw IndexOutOfBoundsException();
- VclPtr< CheckBox > pCheckBox = GetAs< CheckBox >();
- VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() );
- if ( pCheckBox && pVCLXCheckBox )
+ VclPtr<CheckBox> pCheckBox = GetAs<CheckBox>();
+ if (pCheckBox)
{
sal_Int32 nValueMax = sal_Int32(1);
if ( pCheckBox->IsTriStateEnabled() )
nValueMax = sal_Int32(2);
- sal_Int32 nValue = static_cast<sal_Int32>(pVCLXCheckBox->getState());
+ sal_Int32 nValue = static_cast<sal_Int32>(pCheckBox->GetState());
++nValue;
if ( nValue > nValueMax )
nValue = 0;
- pVCLXCheckBox->setState( static_cast<sal_Int16>(nValue) );
+ pCheckBox->SetState(static_cast<TriState>(nValue));
}
return true;
@@ -259,9 +247,9 @@ Any VCLXAccessibleCheckBox::getCurrentValue( )
Any aValue;
- VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() );
- if ( pVCLXCheckBox )
- aValue <<= static_cast<sal_Int32>(pVCLXCheckBox->getState());
+ VclPtr<CheckBox> pCheckBox = GetAs<CheckBox>();
+ if (pCheckBox)
+ aValue <<= static_cast<sal_Int32>(pCheckBox->GetState());
return aValue;
}
@@ -273,8 +261,8 @@ sal_Bool VCLXAccessibleCheckBox::setCurrentValue( const Any& aNumber )
bool bReturn = false;
- VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() );
- if ( pVCLXCheckBox )
+ VclPtr<CheckBox> pCheckBox = GetAs<CheckBox>();
+ if (pCheckBox)
{
sal_Int32 nValue = 0, nValueMin = 0, nValueMax = 0;
OSL_VERIFY( aNumber >>= nValue );
@@ -285,7 +273,7 @@ sal_Bool VCLXAccessibleCheckBox::setCurrentValue( const Any& aNumber )
else if ( nValue > nValueMax )
nValue = nValueMax;
- pVCLXCheckBox->setState( static_cast<sal_Int16>(nValue) );
+ pCheckBox->SetState(static_cast<TriState>(nValue));
bReturn = true;
}