summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2018-10-04 10:46:15 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2018-10-05 08:45:33 +0200
commit7b0d9a053c13f7e772e7ef3e1fce4a2803b42d72 (patch)
treedeff2f9262707aebe5d164574f447ab37e5ff070 /vcl
parentdbe85d6613f96192417059acb3274e981a57819d (diff)
Qt5AccessibleWidget: Implement QAccessibleValueInterface
Change-Id: Ia431650586ec26f5dc321cb162afa632ddb53ab3 Reviewed-on: https://gerrit.libreoffice.org/61361 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/Library_vclplug_qt5.mk1
-rw-r--r--vcl/inc/qt5/Qt5AccessibleValue.hxx38
-rw-r--r--vcl/inc/qt5/Qt5AccessibleWidget.hxx3
-rw-r--r--vcl/qt5/Qt5AccessibleValue.cxx61
-rw-r--r--vcl/qt5/Qt5AccessibleWidget.cxx6
5 files changed, 109 insertions, 0 deletions
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: */