summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-09-01 10:59:31 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2023-09-01 16:13:31 +0200
commita766f7555c55c73e2dfd167e66f1bf32c75de6df (patch)
tree3cc8c208bcc656d7e727f36438fb88f87ea63000
parent847df831b1c46a257fd371c6a193387cc9c06c4b (diff)
tdf#104833 a11y: Use VCLXAccessibleEdit for VCLXMultiLineEdit
Instead of the generic `VCLXAccessibleComponent`, use `VCLXAccessibleEdit` as a11y class for `VCLXMultiLineEdit` (the component interface class for MultiLineEdit) as well, not just for `VCLXEdit`. With the preparatory changes from Change-Id I8218db61feb07605f6ea5309f26eebd38312458a tdf#104833 a11y: Don't use VCLXEdit in VCLXAccessibleEdit in place, it behaves as expected when interacting with the multi line edit from the sample dialog in attachment 189287 in tdf#104833 using Accerciser and the qt6 or gtk3 VCL plugin (and the text can also be edited when removing the readonly flag from the control) or the update dialog (which uses UNO controls, `UnoControlEditModel` for the panes that were not announced, s. extensions/source/update/check/updatehdl.cxx ). In particular, the a11y text interface is supported by the multi line edit on the a11y layer, which makes Orca with the gtk3 VCL plugin announce the text content when the control gets focused. NVDA on Windows still announces "Checking..." instead of using the actual text that would be retrievable via the IAccessibleText interface now. This is probably because "Checking..." is the (outdated) accessible name, as can be seen by interacting with the object in NVDA's Python console: >>> focus.name 'Checking...' >>> txt = focus.IAccessibleTextObject >>> txt.text(0, txt.nCharacters) 'LibreOfficeDev 24.2 is up to date.' For both, gtk3 and qt6, the a11y object does have the new text as a11y name as well, as can be verified in Accerciser: In [10]: acc.name Out[10]: 'LibreOfficeDev 24.2 is up to date.' In [11]: txt = acc.queryText() In [12]: txt.getTextAtOffset(0,3) Out[12]: ('LibreOfficeDev 24.2 is up to date.', 0, 34) Change-Id: Id80e191cdd5342b3215fdb9d2ad3847470366337 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156402 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r--accessibility/source/helper/acc_factory.cxx7
-rw-r--r--include/toolkit/awt/vclxwindows.hxx3
-rw-r--r--include/toolkit/helper/accessiblefactory.hxx6
-rw-r--r--toolkit/source/awt/vclxwindows.cxx5
-rw-r--r--toolkit/source/helper/accessibilityclient.cxx5
5 files changed, 26 insertions, 0 deletions
diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx
index fb0468fe6d65..4dcc63e4ab12 100644
--- a/accessibility/source/helper/acc_factory.cxx
+++ b/accessibility/source/helper/acc_factory.cxx
@@ -103,6 +103,8 @@ public:
virtual css::uno::Reference< css::accessibility::XAccessibleContext >
createAccessibleContext( VCLXEdit* _pXWindow ) override;
virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXMultiLineEdit* _pXWindow ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
createAccessibleContext( VCLXComboBox* _pXWindow ) override;
virtual css::uno::Reference< css::accessibility::XAccessibleContext >
createAccessibleContext( VCLXToolBox* _pXWindow ) override;
@@ -280,6 +282,11 @@ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLX
return new VCLXAccessibleEdit( _pXWindow );
}
+Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXMultiLineEdit* _pXWindow )
+{
+ return new VCLXAccessibleEdit( _pXWindow );
+}
+
Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXComboBox* _pXWindow )
{
bool bIsDropDownBox = false;
diff --git a/include/toolkit/awt/vclxwindows.hxx b/include/toolkit/awt/vclxwindows.hxx
index 3a86cdecdfef..b6d333374a3f 100644
--- a/include/toolkit/awt/vclxwindows.hxx
+++ b/include/toolkit/awt/vclxwindows.hxx
@@ -461,6 +461,9 @@ public:
static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds );
virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
+
+protected:
+ virtual css::uno::Reference<css::accessibility::XAccessibleContext> CreateAccessibleContext() override;
};
// class VCLXSpinField
diff --git a/include/toolkit/helper/accessiblefactory.hxx b/include/toolkit/helper/accessiblefactory.hxx
index bd7ae90976d4..6c0532ce9edb 100644
--- a/include/toolkit/helper/accessiblefactory.hxx
+++ b/include/toolkit/helper/accessiblefactory.hxx
@@ -37,6 +37,7 @@ class VCLXFixedText;
class VCLXScrollBar;
class VCLXEdit;
class VCLXComboBox;
+class VCLXMultiLineEdit;
class VCLXToolBox;
class VCLXHeaderBar;
class VCLXWindow;
@@ -102,6 +103,11 @@ namespace toolkit
virtual css::uno::Reference< css::accessibility::XAccessibleContext >
createAccessibleContext( VCLXEdit* _pXWindow ) = 0;
+ /** creates an accessible context for a multiline edit window
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXMultiLineEdit* _pXWindow ) = 0;
+
/** creates an accessible context for a combo box window
*/
virtual css::uno::Reference< css::accessibility::XAccessibleContext >
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index ef378f228895..8c6652ca8548 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -7869,4 +7869,9 @@ void VCLXMultiLineEdit::ImplGetPropertyIds( std::vector< sal_uInt16 > &rIds )
VCLXWindow::ImplGetPropertyIds( rIds, true );
}
+css::uno::Reference<css::accessibility::XAccessibleContext> VCLXMultiLineEdit::CreateAccessibleContext()
+{
+ return getAccessibleFactory().createAccessibleContext(this);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/helper/accessibilityclient.cxx b/toolkit/source/helper/accessibilityclient.cxx
index 773bc9bfbd06..1926b004d15e 100644
--- a/toolkit/source/helper/accessibilityclient.cxx
+++ b/toolkit/source/helper/accessibilityclient.cxx
@@ -108,6 +108,11 @@ namespace toolkit
return nullptr;
}
css::uno::Reference< css::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXMultiLineEdit* /*_pXWindow*/ ) override
+ {
+ return nullptr;
+ }
+ css::uno::Reference< css::accessibility::XAccessibleContext >
createAccessibleContext( VCLXComboBox* /*_pXWindow*/ ) override
{
return nullptr;