diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2018-10-31 09:21:17 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2018-10-31 12:39:50 +0100 |
commit | 1c712a4447f560b8dc63a3e1e775ab04ef54f988 (patch) | |
tree | 2a77fc9a7f99eba0e7520eba0bf5bbdbd5454167 /vcl | |
parent | d72c915794eb4453dc580fc0dcdfbe3503a4879b (diff) |
qt5 a11y: Implement QAccessibleEditableTextInterface
Change-Id: I21106ac31484c4bf47363e3805315c5fb698e172
Reviewed-on: https://gerrit.libreoffice.org/62682
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/qt5/Qt5AccessibleWidget.hxx | 6 | ||||
-rw-r--r-- | vcl/qt5/Qt5AccessibleWidget.cxx | 32 |
2 files changed, 38 insertions, 0 deletions
diff --git a/vcl/inc/qt5/Qt5AccessibleWidget.hxx b/vcl/inc/qt5/Qt5AccessibleWidget.hxx index af4b3c858983..ff4dab306a58 100644 --- a/vcl/inc/qt5/Qt5AccessibleWidget.hxx +++ b/vcl/inc/qt5/Qt5AccessibleWidget.hxx @@ -34,6 +34,7 @@ class VCLPLUG_QT5_PUBLIC Qt5AccessibleWidget : public QObject, public QAccessibleInterface, public QAccessibleActionInterface, public QAccessibleTextInterface, + public QAccessibleEditableTextInterface, public QAccessibleTableInterface, public QAccessibleValueInterface { @@ -96,6 +97,11 @@ public: QString textBeforeOffset(int offset, QAccessible::TextBoundaryType boundaryType, int* startOffset, int* endOffset) const override; + // QAccessibleEditableTextInterface + virtual void deleteText(int startOffset, int endOffset) override; + virtual void insertText(int offset, const QString& text) override; + virtual void replaceText(int startOffset, int endOffset, const QString& text) override; + // QAccessibleValueInterface QVariant currentValue() const override; QVariant maximumValue() const override; diff --git a/vcl/qt5/Qt5AccessibleWidget.cxx b/vcl/qt5/Qt5AccessibleWidget.cxx index 4eb1f7022664..dd50a3ef57ab 100644 --- a/vcl/qt5/Qt5AccessibleWidget.cxx +++ b/vcl/qt5/Qt5AccessibleWidget.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/XAccessibleAction.hpp> #include <com/sun/star/accessibility/XAccessibleComponent.hpp> +#include <com/sun/star/accessibility/XAccessibleEditableText.hpp> #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> #include <com/sun/star/accessibility/XAccessibleEventListener.hpp> #include <com/sun/star/accessibility/XAccessibleKeyBinding.hpp> @@ -624,6 +625,8 @@ void* Qt5AccessibleWidget::interface_cast(QAccessible::InterfaceType t) return static_cast<QAccessibleActionInterface*>(this); if (t == QAccessible::TextInterface) return static_cast<QAccessibleTextInterface*>(this); + if (t == QAccessible::EditableTextInterface) + return static_cast<QAccessibleEditableTextInterface*>(this); if (t == QAccessible::ValueInterface) return static_cast<QAccessibleValueInterface*>(this); if (t == QAccessible::TableInterface) @@ -893,6 +896,35 @@ QString Qt5AccessibleWidget::textBeforeOffset(int /* offset */, return QString(); } +// QAccessibleEditableTextInterface + +void Qt5AccessibleWidget::deleteText(int startOffset, int endOffset) +{ + Reference<XAccessibleEditableText> xEditableText(m_xAccessible->getAccessibleContext(), + UNO_QUERY); + if (!xEditableText.is()) + return; + xEditableText->deleteText(startOffset, endOffset); +} + +void Qt5AccessibleWidget::insertText(int offset, const QString& text) +{ + Reference<XAccessibleEditableText> xEditableText(m_xAccessible->getAccessibleContext(), + UNO_QUERY); + if (!xEditableText.is()) + return; + xEditableText->insertText(toOUString(text), offset); +} + +void Qt5AccessibleWidget::replaceText(int startOffset, int endOffset, const QString& text) +{ + Reference<XAccessibleEditableText> xEditableText(m_xAccessible->getAccessibleContext(), + UNO_QUERY); + if (!xEditableText.is()) + return; + xEditableText->replaceText(startOffset, endOffset, toOUString(text)); +} + // QAccessibleValueInterface QVariant Qt5AccessibleWidget::currentValue() const { |