Kaydet (Commit) 4d382636 authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt

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: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
üst c9343988
......@@ -10,12 +10,14 @@
$(eval $(call gb_CustomTarget_CustomTarget,vcl/qt5))
$(call gb_CustomTarget_get_target,vcl/qt5) : \
$(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5AccessibleWidget.moc \
$(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5FilePicker.moc \
$(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5Frame.moc \
$(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5Instance.moc \
$(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5MainWindow.moc \
$(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5Menu.moc \
$(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5Timer.moc \
$(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5VclWindow.moc \
$(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5Widget.moc \
$(call gb_CustomTarget_get_workdir,vcl/qt5)/%.moc : \
......
......@@ -80,6 +80,7 @@ $(eval $(call gb_Library_add_libs,vclplug_qt5,\
endif
$(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
vcl/qt5/Qt5AccessibleWidget \
vcl/qt5/Qt5Bitmap \
vcl/qt5/Qt5Data \
vcl/qt5/Qt5FilePicker \
......@@ -101,6 +102,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
vcl/qt5/Qt5Timer \
vcl/qt5/Qt5Tools \
vcl/qt5/Qt5VirtualDevice \
vcl/qt5/Qt5VclWindow \
vcl/qt5/Qt5Widget \
))
......
/* -*- 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: */
/* -*- 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: */
......@@ -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: */
This diff is collapsed.
......@@ -10,13 +10,16 @@
#include <Qt5MainWindow.hxx>
#include <Qt5MainWindow.moc>
#include <Qt5AccessibleWidget.hxx>
#include <QtGui/QAccessible>
#include <QtGui/QCloseEvent>
Qt5MainWindow::Qt5MainWindow(Qt5Frame& rFrame, QWidget* parent, Qt::WindowFlags f)
: QMainWindow(parent, f)
, m_pFrame(&rFrame)
{
QAccessible::installFactory(Qt5AccessibleWidget::customFactory);
}
void Qt5MainWindow::closeEvent(QCloseEvent* pEvent)
......
/* -*- 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 <Qt5VclWindow.hxx>
#include <Qt5VclWindow.moc>
#include <Qt5Frame.hxx>
#include <Qt5Tools.hxx>
#include <Qt5Widget.hxx>
#include <sal/log.hxx>
using namespace css::accessibility;
Qt5VclWindow::Qt5VclWindow(vcl::Window* pWindow)
: m_pWindow(pWindow)
{
}
/* 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