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>
2021-07-28 02:39:07 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2023-01-26 05:15:18 -06:00
|
|
|
#include <cppuhelper/implbase.hxx>
|
2023-04-14 10:25:34 -05:00
|
|
|
#include <vcl/vclevent.hxx>
|
|
|
|
|
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>
2021-07-28 02:39:07 -05:00
|
|
|
#include <standard/vclxaccessibleedit.hxx>
|
|
|
|
|
|
|
|
#include <com/sun/star/accessibility/XAccessibleValue.hpp>
|
|
|
|
|
2023-01-26 05:15:18 -06:00
|
|
|
class SVTXAccessibleNumericField final
|
|
|
|
: public cppu::ImplInheritanceHelper<VCLXAccessibleEdit, css::accessibility::XAccessibleValue>
|
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>
2021-07-28 02:39:07 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
SVTXAccessibleNumericField(VCLXWindow* pVCLXindow);
|
|
|
|
|
2023-04-14 10:25:34 -05:00
|
|
|
virtual void ProcessWindowEvent(const VclWindowEvent& rVclWindowEvent) override;
|
|
|
|
|
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>
2021-07-28 02:39:07 -05:00
|
|
|
// XAccessibleContext
|
|
|
|
virtual sal_Int16 SAL_CALL getAccessibleRole() override;
|
|
|
|
|
|
|
|
// XAccessibleValue
|
|
|
|
virtual ::css::uno::Any SAL_CALL getCurrentValue() override;
|
|
|
|
virtual ::sal_Bool SAL_CALL setCurrentValue(const css::uno::Any& aNumber) override;
|
|
|
|
virtual ::css::uno::Any SAL_CALL getMaximumValue() override;
|
|
|
|
virtual ::css::uno::Any SAL_CALL getMinimumValue() override;
|
2021-07-28 04:26:16 -05:00
|
|
|
virtual ::css::uno::Any SAL_CALL getMinimumIncrement() override;
|
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>
2021-07-28 02:39:07 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|