summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2021-07-28 09:39:07 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2021-07-28 15:44:58 +0200
commit349a8801b9ee98f4f9ee1d35f7d28e17baedf7cc (patch)
tree2bd6dd20f7618a812f550867515f4bfa9a2cc553 /include
parent9ceb47ce712157019ca06ee11c66515ea7cc16ec (diff)
a11y: Expose FormattedField as spinbox
This adds a new accessibility class 'SVTXAccessibleNumericField' that implements 'XAccessibleValue' and reports having an a11y role of 'AccessibleRole::SPIN_BOX'. An object of that class is returned by 'SVTXNumericField::CreateAccessibleContext'. Create an 'SVTXNumericField' XWindow peer for windows of type 'WindowType::FORMATTEDFIELD' (instead of a 'VCLXNumericField' one), so the newly introduced accessibility class gets used for 'FormattedField'. This way, FormattedFields are now exposed to a11y tools as spinboxes. Previously, since no specific accessibility class had been implemented for VCLXNumericField (then used as XWindow peer class for FormattedField), the one for VCLXEdit, i.e. VCLXAccessibleEdit, was used. While VCLXNumericField implements XNumericField and thus in general offers the relevant methods to implement an accessible class that implements XAccessibleValue as well, it uses the Formatter from the VCLXFormattedSpinField base class to get/set values. However, that doesn't work for the FormattedField case, since FormattedField has its own formatter of a different type and the 'mpFormatter' member in the VCLXFormattedSpinField base class is a nullptr, resulting in the corresponding getter methods always returning 0 and the setters doing nothing. With this commit in place, Accerciser now reports role "spin box" instead of just "text" for FormattedFields and displays the current value as well as allows to change it via the "Value" interface when using the qt5/kf5 VCL plugin. Note: For non-integer values, Accerciser doesn't show the actual decimal value, but an integer, e.g. when the value for "Height" spinbox in Writer's "Page Style" -> "Page" dialog (section "Paper format") is set to "29.70cm", Accerciser shows "30" instead of "29.70", despite 'Qt5AccessibleWidget::currentValue' returning the exact value. This is because Accerciser appears to rely on the value for the minimum increment being reported (as a corresponding decimal value) by a call to 'atspi_value_get_minimum_increment', s.[1]. However, there is currently no corresponding method in the 'XAccesibleValue' interface for that at-spi method which 'Qt5AccessibleWidget::currentValue' could call to retrieve the value. The NVDA screen reader on Windows now also says e.g. "Width: (Type = 344) spin button editable Alt+W selected 8.50″" instead of "Width: (Type = 344) edit Alt+W selected 8.50″". [1] https://developer.gnome.org/libatspi/stable/libatspi-atspi-value.html#atspi-value-get-minimum-increment Change-Id: I8af326c2d24c1801147a56ea2e2a886ab42ac634 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119590 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'include')
-rw-r--r--include/toolkit/awt/vclxwindows.hxx4
-rw-r--r--include/toolkit/helper/accessiblefactory.hxx6
2 files changed, 9 insertions, 1 deletions
diff --git a/include/toolkit/awt/vclxwindows.hxx b/include/toolkit/awt/vclxwindows.hxx
index 99f8fea450fa..9e365eeb6d3f 100644
--- a/include/toolkit/awt/vclxwindows.hxx
+++ b/include/toolkit/awt/vclxwindows.hxx
@@ -542,7 +542,7 @@ protected:
virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
};
-class SVTXNumericField final : public css::awt::XNumericField, public SVTXFormattedField
+class TOOLKIT_DLLPUBLIC SVTXNumericField final : public css::awt::XNumericField, public SVTXFormattedField
{
public:
SVTXNumericField();
@@ -576,6 +576,8 @@ public:
sal_Bool SAL_CALL isStrictFormat( ) override;
virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override;
+
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override;
};
// class VCLXListBox
diff --git a/include/toolkit/helper/accessiblefactory.hxx b/include/toolkit/helper/accessiblefactory.hxx
index 109e1cbea038..bd7ae90976d4 100644
--- a/include/toolkit/helper/accessiblefactory.hxx
+++ b/include/toolkit/helper/accessiblefactory.hxx
@@ -27,6 +27,7 @@ namespace com::sun::star::accessibility {
class XAccessible;
class XAccessibleContext;
}
+class SVTXNumericField;
class VCLXButton;
class VCLXCheckBox;
class VCLXRadioButton;
@@ -116,6 +117,11 @@ namespace toolkit
virtual css::uno::Reference< css::accessibility::XAccessibleContext >
createAccessibleContext( VCLXHeaderBar* _pXWindow ) = 0;
+ /** creates an accessible context for a numeric field
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ createAccessibleContext( SVTXNumericField* _pXWindow ) = 0;
+
/** creates an accessible context for a generic window
*/
virtual css::uno::Reference< css::accessibility::XAccessibleContext >