diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2018-10-01 15:44:07 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2018-10-02 15:05:36 +0200 |
commit | 754f3614837ecd7348b241c9000d5f1d15d16947 (patch) | |
tree | 484f1e230e6d4b397bd98561df163c45ef752313 /vcl | |
parent | 570d99b7776ccbee031737a9c32c5c9af11649ed (diff) |
Qt5AccessibleWidget: Implement keyBindingsForAction
Change-Id: I53d6d36374fc35eb8370ad6d83723aafb01fb8b4
Reviewed-on: https://gerrit.libreoffice.org/61199
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qt5/Qt5AccessibleWidget.cxx | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/vcl/qt5/Qt5AccessibleWidget.cxx b/vcl/qt5/Qt5AccessibleWidget.cxx index 2d691a2d112c..898123af0711 100644 --- a/vcl/qt5/Qt5AccessibleWidget.cxx +++ b/vcl/qt5/Qt5AccessibleWidget.cxx @@ -34,9 +34,11 @@ #include <com/sun/star/accessibility/XAccessibleComponent.hpp> #include <com/sun/star/accessibility/XAccessibleKeyBinding.hpp> #include <com/sun/star/accessibility/XAccessibleStateSet.hpp> +#include <com/sun/star/uno/Sequence.hxx> #include <sal/log.hxx> #include <vcl/popupmenuwindow.hxx> +#include <comphelper/AccessibleImplementationHelper.hxx> using namespace css; using namespace css::accessibility; @@ -584,9 +586,27 @@ void Qt5AccessibleWidget::doAction(const QString& actionName) xAccessibleAction->doAccessibleAction(index); } -QStringList Qt5AccessibleWidget::keyBindingsForAction(const QString& /* actionName */) const +QStringList Qt5AccessibleWidget::keyBindingsForAction(const QString& actionName) const { - return QStringList(); + QStringList keyBindings; + Reference<XAccessibleAction> xAccessibleAction(m_xAccessible, UNO_QUERY); + if (!xAccessibleAction.is()) + return keyBindings; + + int index = actionNames().indexOf(actionName); + if (index == -1) + return keyBindings; + + Reference<XAccessibleKeyBinding> xKeyBinding + = xAccessibleAction->getAccessibleActionKeyBinding(index); + + int count = xKeyBinding->getAccessibleKeyBindingCount(); + for (int i = 0; i < count; i++) + { + Sequence<awt::KeyStroke> keyStroke = xKeyBinding->getAccessibleKeyBinding(i); + keyBindings.append(toQString(comphelper::GetkeyBindingStrByXkeyBinding(keyStroke))); + } + return keyBindings; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |