diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2018-09-21 10:20:09 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2018-09-27 17:05:02 +0200 |
commit | 4d382636b0b1c555af2b98f2f41b4776fd7b5ffb (patch) | |
tree | 3b08b4ba73c16a230508eef6e2ed90cfaa4c5000 /vcl/inc | |
parent | c9343988204ee3e9889f3cc833adbbaca83e53e6 (diff) |
qt5: Add basic a11y support
Widget tree is displayed and basic role mapping is available.
Still needs quite some work (positions, actions, texts, etc.)
Change-Id: I9d26a762f1d9684f33bbb80a384cf2a0b8a905c0
Reviewed-on: https://gerrit.libreoffice.org/60853
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'vcl/inc')
-rw-r--r-- | vcl/inc/qt5/Qt5AccessibleWidget.hxx | 77 | ||||
-rw-r--r-- | vcl/inc/qt5/Qt5VclWindow.hxx | 31 | ||||
-rw-r--r-- | vcl/inc/qt5/Qt5Widget.hxx | 3 |
3 files changed, 109 insertions, 2 deletions
diff --git a/vcl/inc/qt5/Qt5AccessibleWidget.hxx b/vcl/inc/qt5/Qt5AccessibleWidget.hxx new file mode 100644 index 000000000000..df6862567dd0 --- /dev/null +++ b/vcl/inc/qt5/Qt5AccessibleWidget.hxx @@ -0,0 +1,77 @@ +/* -*- 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 <QtCore/QObject> +#include <QtCore/QPair> +#include <QtCore/QString> +#include <QtCore/QStringList> +#include <QtCore/QVector> +#include <QtGui/QAccessible> +#include <QtGui/QAccessibleActionInterface> +#include <QtGui/QAccessibleInterface> +#include <QtGui/QColor> +#include <QtGui/QWindow> + +#include <vcl/window.hxx> + +class Qt5Frame; +class Qt5Widget; + +class VCLPLUG_QT5_PUBLIC Qt5AccessibleWidget : public QObject, public QAccessibleInterface +//public QAccessibleActionInterface +{ + Q_OBJECT + +public: + Qt5AccessibleWidget(Qt5Widget* pFrame, vcl::Window* pWindow); + Qt5AccessibleWidget(vcl::Window* pWindow); + QWindow* window() const override; + int childCount() const override; + int indexOfChild(const QAccessibleInterface* child) const override; + QVector<QPair<QAccessibleInterface*, QAccessible::Relation>> + relations(QAccessible::Relation match = QAccessible::AllRelations) const override; + QAccessibleInterface* focusChild() const override; + + QRect rect() const override; + + QAccessibleInterface* parent() const override; + QAccessibleInterface* child(int index) const override; + + QString text(QAccessible::Text t) const override; + QAccessible::Role role() const override; + QAccessible::State state() const override; + + QColor foregroundColor() const override; + QColor backgroundColor() const override; + + bool isValid() const override; + QObject* object() const override; + void setText(QAccessible::Text t, const QString& text) override; + QAccessibleInterface* childAt(int x, int y) const override; + + void* interface_cast(QAccessible::InterfaceType t) override; + + // QAccessibleActionInterface + /* QStringList actionNames() const override; + void doAction(const QString& actionName) override; + QStringList keyBindingsForAction(const QString& actionName) const override; */ + + // Factory + static QAccessibleInterface* customFactory(const QString& classname, QObject* object); + +private: + Qt5Widget* m_pFrame; + VclPtr<vcl::Window> m_pWindow; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5VclWindow.hxx b/vcl/inc/qt5/Qt5VclWindow.hxx new file mode 100644 index 000000000000..f7883aa67c4d --- /dev/null +++ b/vcl/inc/qt5/Qt5VclWindow.hxx @@ -0,0 +1,31 @@ +/* -*- 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 <QtCore/QObject> + +#include <vcl/window.hxx> + +class Qt5Frame; +class Qt5Widget; + +// Wrapper class to hold a vcl::Window while being able to pass it as a QObject +class VCLPLUG_QT5_PUBLIC Qt5VclWindow : public QObject +{ + Q_OBJECT + +public: + Qt5VclWindow(vcl::Window* pWindow); + VclPtr<vcl::Window> m_pWindow; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5Widget.hxx b/vcl/inc/qt5/Qt5Widget.hxx index ba558f82be38..101ae6d68f67 100644 --- a/vcl/inc/qt5/Qt5Widget.hxx +++ b/vcl/inc/qt5/Qt5Widget.hxx @@ -36,8 +36,6 @@ class Qt5Widget : public QWidget { Q_OBJECT - Qt5Frame* m_pFrame; - bool handleKeyEvent(QKeyEvent*, bool); void handleMouseButtonEvent(QMouseEvent*, bool); @@ -57,6 +55,7 @@ class Qt5Widget : public QWidget public: Qt5Widget(Qt5Frame& rFrame, Qt::WindowFlags f = Qt::WindowFlags()); + Qt5Frame* m_pFrame; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |