[Libreoffice-commits] core.git: vcl/inc vcl/qt5

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Oct 31 11:40:14 UTC 2018


 vcl/inc/qt5/Qt5AccessibleWidget.hxx |    6 ++++++
 vcl/qt5/Qt5AccessibleWidget.cxx     |   32 ++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)

New commits:
commit 1c712a4447f560b8dc63a3e1e775ab04ef54f988
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Wed Oct 31 09:21:17 2018 +0100
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Wed Oct 31 12:39:50 2018 +0100

    qt5 a11y: Implement QAccessibleEditableTextInterface
    
    Change-Id: I21106ac31484c4bf47363e3805315c5fb698e172
    Reviewed-on: https://gerrit.libreoffice.org/62682
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

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
 {


More information about the Libreoffice-commits mailing list