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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Oct 5 06:46:01 UTC 2018


 vcl/Library_vclplug_qt5.mk          |    1 
 vcl/inc/qt5/Qt5AccessibleValue.hxx  |   38 ++++++++++++++++++++++
 vcl/inc/qt5/Qt5AccessibleWidget.hxx |    3 +
 vcl/qt5/Qt5AccessibleValue.cxx      |   61 ++++++++++++++++++++++++++++++++++++
 vcl/qt5/Qt5AccessibleWidget.cxx     |    6 +++
 5 files changed, 109 insertions(+)

New commits:
commit 7b0d9a053c13f7e772e7ef3e1fce4a2803b42d72
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Thu Oct 4 10:46:15 2018 +0200
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Fri Oct 5 08:45:33 2018 +0200

    Qt5AccessibleWidget: Implement QAccessibleValueInterface
    
    Change-Id: Ia431650586ec26f5dc321cb162afa632ddb53ab3
    Reviewed-on: https://gerrit.libreoffice.org/61361
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index c7fa015442b0..be237f37f232 100644
--- a/vcl/Library_vclplug_qt5.mk
+++ b/vcl/Library_vclplug_qt5.mk
@@ -80,6 +80,7 @@ $(eval $(call gb_Library_add_libs,vclplug_qt5,\
 endif
 
 $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
+    vcl/qt5/Qt5AccessibleValue \
     vcl/qt5/Qt5AccessibleWidget \
     vcl/qt5/Qt5Bitmap \
     vcl/qt5/Qt5Clipboard \
diff --git a/vcl/inc/qt5/Qt5AccessibleValue.hxx b/vcl/inc/qt5/Qt5AccessibleValue.hxx
new file mode 100644
index 000000000000..4805a4d38073
--- /dev/null
+++ b/vcl/inc/qt5/Qt5AccessibleValue.hxx
@@ -0,0 +1,38 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include <vclpluginapi.h>
+
+#include <QtGui/QAccessibleValueInterface>
+
+#include <QtCore/QVariant>
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+class Qt5Frame;
+class Qt5Widget;
+
+class VCLPLUG_QT5_PUBLIC Qt5AccessibleValue : public QAccessibleValueInterface
+{
+public:
+    Qt5AccessibleValue(const css::uno::Reference<css::accessibility::XAccessible> xAccessible);
+
+    QVariant currentValue() const override;
+    QVariant maximumValue() const override;
+    QVariant minimumStepSize() const override;
+    QVariant minimumValue() const override;
+    void setCurrentValue(const QVariant& value) override;
+
+private:
+    css::uno::Reference<css::accessibility::XAccessible> m_xAccessible;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/Qt5AccessibleWidget.hxx b/vcl/inc/qt5/Qt5AccessibleWidget.hxx
index d1008f992ab9..980c464b9658 100644
--- a/vcl/inc/qt5/Qt5AccessibleWidget.hxx
+++ b/vcl/inc/qt5/Qt5AccessibleWidget.hxx
@@ -19,6 +19,7 @@
 #include <QtGui/QAccessible>
 #include <QtGui/QAccessibleActionInterface>
 #include <QtGui/QAccessibleInterface>
+#include <QtGui/QAccessibleValueInterface>
 #include <QtGui/QColor>
 #include <QtGui/QWindow>
 
@@ -66,6 +67,8 @@ public:
     void doAction(const QString& actionName) override;
     QStringList keyBindingsForAction(const QString& actionName) const override;
 
+    QAccessibleValueInterface* valueInterface();
+
     // Factory
     static QAccessibleInterface* customFactory(const QString& classname, QObject* object);
 
diff --git a/vcl/qt5/Qt5AccessibleValue.cxx b/vcl/qt5/Qt5AccessibleValue.cxx
new file mode 100644
index 000000000000..ab95127aca12
--- /dev/null
+++ b/vcl/qt5/Qt5AccessibleValue.cxx
@@ -0,0 +1,61 @@
+/* -*- 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/.
+ */
+
+#include <Qt5AccessibleValue.hxx>
+
+#include <QtGui/QAccessibleInterface>
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+
+using namespace css;
+using namespace css::accessibility;
+using namespace css::uno;
+
+Qt5AccessibleValue::Qt5AccessibleValue(const Reference<XAccessible> xAccessible)
+    : m_xAccessible(xAccessible)
+{
+}
+
+QVariant Qt5AccessibleValue::currentValue() const
+{
+    Reference<XAccessibleValue> xValue(m_xAccessible->getAccessibleContext(), UNO_QUERY);
+    if (!xValue.is())
+        return QVariant();
+    double aDouble = 0;
+    xValue->getCurrentValue() >>= aDouble;
+    return QVariant(aDouble);
+}
+QVariant Qt5AccessibleValue::maximumValue() const
+{
+    Reference<XAccessibleValue> xValue(m_xAccessible->getAccessibleContext(), UNO_QUERY);
+    if (!xValue.is())
+        return QVariant();
+    double aDouble = 0;
+    xValue->getMaximumValue() >>= aDouble;
+    return QVariant(aDouble);
+}
+QVariant Qt5AccessibleValue::minimumStepSize() const { return QVariant(); }
+QVariant Qt5AccessibleValue::minimumValue() const
+{
+    Reference<XAccessibleValue> xValue(m_xAccessible->getAccessibleContext(), UNO_QUERY);
+    if (!xValue.is())
+        return QVariant();
+    double aDouble = 0;
+    xValue->getMinimumValue() >>= aDouble;
+    return QVariant(aDouble);
+}
+void Qt5AccessibleValue::setCurrentValue(const QVariant& value)
+{
+    Reference<XAccessibleValue> xValue(m_xAccessible->getAccessibleContext(), UNO_QUERY);
+    if (!xValue.is())
+        return;
+    xValue->setCurrentValue(Any(value.toDouble()));
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5AccessibleWidget.cxx b/vcl/qt5/Qt5AccessibleWidget.cxx
index f85823a7e168..75b7bb7fcecd 100644
--- a/vcl/qt5/Qt5AccessibleWidget.cxx
+++ b/vcl/qt5/Qt5AccessibleWidget.cxx
@@ -26,6 +26,7 @@
 #include <Qt5Tools.hxx>
 #include <Qt5Widget.hxx>
 #include <Qt5XAccessible.hxx>
+#include <Qt5AccessibleValue.hxx>
 
 #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
@@ -696,4 +697,9 @@ QStringList Qt5AccessibleWidget::keyBindingsForAction(const QString& actionName)
     return keyBindings;
 }
 
+QAccessibleValueInterface* Qt5AccessibleWidget::valueInterface()
+{
+    return new Qt5AccessibleValue(m_xAccessible);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list