accessibility/source/standard/svtaccessiblenumericfield.cxx | 22 +++--- accessibility/source/standard/vclxaccessiblecheckbox.cxx | 40 ++++-------- accessibility/source/standard/vclxaccessibleedit.cxx | 6 - include/vcl/toolkit/fmtfield.hxx | 2 4 files changed, 29 insertions(+), 41 deletions(-)
New commits: commit 02d173ab19252bd09cdf4e39151aadb94758e70f Author: Michael Weghorn <[email protected]> AuthorDate: Wed Dec 4 16:39:30 2024 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Dec 6 16:06:23 2024 +0100 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 <[email protected]> Tested-by: Jenkins (cherry picked from commit e3c9a06b7056e2b99628aef8005329c328bcab91) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177940 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; } commit 0ae49fe15da3e3336cd8fbec596ee4a9c019465d Author: Michael Weghorn <[email protected]> AuthorDate: Wed Dec 4 16:17:03 2024 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Dec 6 16:06:15 2024 +0100 a11y: Use FormattedField directly in SVTXAccessibleNumericField ... instead of using the toolkit/UNO wrapper SVTXNumericField. Change-Id: I86e274a06f210e2076e287087a1d4b979abe7c35 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177814 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins (cherry picked from commit 1d2f37a93cb6746dfb08731579d269478943d2a0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177939 diff --git a/accessibility/source/standard/svtaccessiblenumericfield.cxx b/accessibility/source/standard/svtaccessiblenumericfield.cxx index f3192d4212f0..50a17a1373ec 100644 --- a/accessibility/source/standard/svtaccessiblenumericfield.cxx +++ b/accessibility/source/standard/svtaccessiblenumericfield.cxx @@ -19,7 +19,7 @@ #include <standard/svtaccessiblenumericfield.hxx> #include <comphelper/accessiblecontexthelper.hxx> -#include <toolkit/awt/vclxwindows.hxx> +#include <vcl/toolkit/fmtfield.hxx> #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> @@ -50,9 +50,9 @@ css::uno::Any SAL_CALL SVTXAccessibleNumericField::getCurrentValue() OExternalLockGuard aGuard(this); double dValue = 0; - SVTXNumericField* pField = static_cast<SVTXNumericField*>(GetVCLXWindow()); + VclPtr<FormattedField> pField = GetAs<FormattedField>(); if (pField) - dValue = pField->getValue(); + dValue = pField->GetFormatter().GetValue(); return css::uno::Any(dValue); } @@ -61,13 +61,13 @@ sal_Bool SVTXAccessibleNumericField::setCurrentValue(const css::uno::Any& aNumbe { OExternalLockGuard aGuard(this); - SVTXNumericField* pField = static_cast<SVTXNumericField*>(GetVCLXWindow()); + VclPtr<FormattedField> pField = GetAs<FormattedField>(); if (!pField) return false; double dValue = 0; aNumber >>= dValue; - pField->setValue(dValue); + pField->GetFormatter().SetValue(dValue); return true; } @@ -76,9 +76,9 @@ css::uno::Any SAL_CALL SVTXAccessibleNumericField::getMaximumValue() OExternalLockGuard aGuard(this); double dValue = 0; - SVTXNumericField* pField = static_cast<SVTXNumericField*>(GetVCLXWindow()); + VclPtr<FormattedField> pField = GetAs<FormattedField>(); if (pField) - dValue = pField->getMax(); + dValue = pField->GetFormatter().GetMaxValue(); return css::uno::Any(dValue); } @@ -88,9 +88,9 @@ css::uno::Any SAL_CALL SVTXAccessibleNumericField::getMinimumValue() OExternalLockGuard aGuard(this); double dValue = 0; - SVTXNumericField* pField = static_cast<SVTXNumericField*>(GetVCLXWindow()); + VclPtr<FormattedField> pField = GetAs<FormattedField>(); if (pField) - dValue = pField->getMin(); + dValue = pField->GetFormatter().GetMinValue(); return css::uno::Any(dValue); } @@ -100,9 +100,9 @@ css::uno::Any SAL_CALL SVTXAccessibleNumericField::getMinimumIncrement() OExternalLockGuard aGuard(this); double dValue = 0; - SVTXNumericField* pField = static_cast<SVTXNumericField*>(GetVCLXWindow()); + VclPtr<FormattedField> pField = GetAs<FormattedField>(); if (pField) - dValue = pField->getSpinSize(); + dValue = pField->GetFormatter().GetSpinSize(); return css::uno::Any(dValue); } diff --git a/include/vcl/toolkit/fmtfield.hxx b/include/vcl/toolkit/fmtfield.hxx index f62c5a3a2517..34b7ea755707 100644 --- a/include/vcl/toolkit/fmtfield.hxx +++ b/include/vcl/toolkit/fmtfield.hxx @@ -26,7 +26,7 @@ #include <vcl/formatter.hxx> #include <vcl/toolkit/spinfld.hxx> -class UNLESS_MERGELIBS(VCL_DLLPUBLIC) FormattedField : public SpinField +class VCL_DLLPUBLIC FormattedField : public SpinField { public: FormattedField(vcl::Window* pParent, WinBits nStyle); commit 4a49ea70c5f99af7cf21ee5e79737db1a2a53e27 Author: Michael Weghorn <[email protected]> AuthorDate: Wed Dec 4 16:02:29 2024 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Dec 6 16:06:08 2024 +0100 a11y: Use vcl::Window instead of VCLXWindow right away Use the vcl::Window for the null check instead of the corresponding VCLXWindow. There's no need to use a toolkit class here, in particular since the vcl::Window is used later anyway. Change-Id: Ia2c80f9634eadf33601af8c9ea1f628e7ea3e96b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177813 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> (cherry picked from commit def785ee31bc71fc8edb4f717280265fa9f80b0a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177938 diff --git a/accessibility/source/standard/vclxaccessibleedit.cxx b/accessibility/source/standard/vclxaccessibleedit.cxx index 5cb259dddc08..e87ed8960503 100644 --- a/accessibility/source/standard/vclxaccessibleedit.cxx +++ b/accessibility/source/standard/vclxaccessibleedit.cxx @@ -108,12 +108,12 @@ void VCLXAccessibleEdit::FillAccessibleStateSet( sal_Int64& rStateSet ) { VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet ); - VCLXWindow* pVCLXWindow = GetVCLXWindow(); - if (pVCLXWindow) + vcl::Window* pWindow = GetWindow(); + if (pWindow) { rStateSet |= AccessibleStateType::FOCUSABLE; - if (GetWindow() && GetWindow()->GetType() == WindowType::MULTILINEEDIT) + if (pWindow->GetType() == WindowType::MULTILINEEDIT) rStateSet |= AccessibleStateType::MULTI_LINE; else rStateSet |= AccessibleStateType::SINGLE_LINE;
