Kaydet (Commit) 7b0d9a05 authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt

Qt5AccessibleWidget: Implement QAccessibleValueInterface

Change-Id: Ia431650586ec26f5dc321cb162afa632ddb53ab3
Reviewed-on: https://gerrit.libreoffice.org/61361
Tested-by: Jenkins
Reviewed-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
üst dbe85d66
......@@ -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 \
......
/* -*- 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: */
......@@ -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);
......
/* -*- 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: */
......@@ -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: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment