1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <Qt5AccessibleEventListener.hxx>
22 #include <sal/log.hxx>
24 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
26 #include <QtGui/QAccessible>
29 using namespace css::accessibility
;
30 using namespace css::lang
;
31 using namespace css::uno
;
33 Qt5AccessibleEventListener::Qt5AccessibleEventListener(const Reference
<XAccessible
> xAccessible
,
34 Qt5AccessibleWidget
* pAccessibleWidget
)
35 : m_xAccessible(xAccessible
)
36 , m_pAccessibleWidget(pAccessibleWidget
)
40 void Qt5AccessibleEventListener::notifyEvent(
41 const css::accessibility::AccessibleEventObject
& aEvent
)
43 QAccessibleInterface
* pQAccessibleInterface
= m_pAccessibleWidget
;
45 Reference
<XAccessible
> xChild
;
46 switch (aEvent
.EventId
)
48 case AccessibleEventId::NAME_CHANGED
:
49 QAccessible::updateAccessibility(
50 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::NameChanged
));
52 case AccessibleEventId::DESCRIPTION_CHANGED
:
53 QAccessible::updateAccessibility(
54 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::DescriptionChanged
));
56 case AccessibleEventId::ACTION_CHANGED
:
57 QAccessible::updateAccessibility(
58 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::ActionChanged
));
60 case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED
:
61 QAccessible::updateAccessibility(
62 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::ActiveDescendantChanged
));
64 case AccessibleEventId::CHILD
:
66 QAccessible::Event event
= QAccessible::InvalidEvent
;
67 if (aEvent
.OldValue
>>= xChild
)
68 event
= QAccessible::ObjectDestroyed
;
69 if (aEvent
.NewValue
>>= xChild
)
70 event
= QAccessible::ObjectCreated
;
71 if (event
!= QAccessible::InvalidEvent
)
72 QAccessible::updateAccessibility(
73 new QAccessibleEvent(pQAccessibleInterface
, event
));
76 case AccessibleEventId::SELECTION_CHANGED
:
77 QAccessible::updateAccessibility(
78 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::Selection
));
80 case AccessibleEventId::VISIBLE_DATA_CHANGED
:
81 QAccessible::updateAccessibility(
82 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::VisibleDataChanged
));
84 case AccessibleEventId::TEXT_SELECTION_CHANGED
:
85 QAccessible::updateAccessibility(
86 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::Selection
));
88 case AccessibleEventId::TEXT_ATTRIBUTE_CHANGED
:
89 QAccessible::updateAccessibility(
90 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::AttributeChanged
));
92 case AccessibleEventId::TABLE_CAPTION_CHANGED
:
93 QAccessible::updateAccessibility(
94 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::TableCaptionChanged
));
96 case AccessibleEventId::TABLE_COLUMN_DESCRIPTION_CHANGED
:
97 QAccessible::updateAccessibility(new QAccessibleEvent(
98 pQAccessibleInterface
, QAccessible::TableColumnDescriptionChanged
));
100 case AccessibleEventId::TABLE_COLUMN_HEADER_CHANGED
:
101 QAccessible::updateAccessibility(
102 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::TableColumnHeaderChanged
));
104 case AccessibleEventId::TABLE_ROW_DESCRIPTION_CHANGED
:
105 QAccessible::updateAccessibility(new QAccessibleEvent(
106 pQAccessibleInterface
, QAccessible::TableRowDescriptionChanged
));
108 case AccessibleEventId::TABLE_ROW_HEADER_CHANGED
:
109 QAccessible::updateAccessibility(
110 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::TableRowHeaderChanged
));
112 case AccessibleEventId::TABLE_SUMMARY_CHANGED
:
113 case AccessibleEventId::CARET_CHANGED
:
114 QAccessible::updateAccessibility(
115 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::TableSummaryChanged
));
117 case AccessibleEventId::SELECTION_CHANGED_ADD
:
118 QAccessible::updateAccessibility(
119 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::SelectionAdd
));
121 case AccessibleEventId::SELECTION_CHANGED_REMOVE
:
122 QAccessible::updateAccessibility(
123 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::SelectionRemove
));
125 case AccessibleEventId::SELECTION_CHANGED_WITHIN
:
126 QAccessible::updateAccessibility(
127 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::SelectionWithin
));
129 case AccessibleEventId::PAGE_CHANGED
:
130 QAccessible::updateAccessibility(
131 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::PageChanged
));
133 case AccessibleEventId::SECTION_CHANGED
:
134 QAccessible::updateAccessibility(
135 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::SectionChanged
));
137 case AccessibleEventId::TEXT_CHANGED
:
138 case AccessibleEventId::COLUMN_CHANGED
:
139 QAccessible::updateAccessibility(
140 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::TextColumnChanged
));
142 case AccessibleEventId::BOUNDRECT_CHANGED
:
143 QAccessible::updateAccessibility(
144 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::LocationChanged
));
146 case AccessibleEventId::STATE_CHANGED
:
147 QAccessible::updateAccessibility(
148 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::ForegroundChanged
));
150 case AccessibleEventId::ROLE_CHANGED
:
151 case AccessibleEventId::INVALIDATE_ALL_CHILDREN
:
152 case AccessibleEventId::VALUE_CHANGED
:
153 case AccessibleEventId::CONTENT_FLOWS_FROM_RELATION_CHANGED
:
154 case AccessibleEventId::CONTENT_FLOWS_TO_RELATION_CHANGED
:
155 case AccessibleEventId::CONTROLLED_BY_RELATION_CHANGED
:
156 case AccessibleEventId::CONTROLLER_FOR_RELATION_CHANGED
:
157 case AccessibleEventId::LABEL_FOR_RELATION_CHANGED
:
158 case AccessibleEventId::LABELED_BY_RELATION_CHANGED
:
159 case AccessibleEventId::MEMBER_OF_RELATION_CHANGED
:
160 case AccessibleEventId::SUB_WINDOW_OF_RELATION_CHANGED
:
161 case AccessibleEventId::HYPERTEXT_CHANGED
:
162 case AccessibleEventId::TABLE_MODEL_CHANGED
:
163 case AccessibleEventId::LISTBOX_ENTRY_EXPANDED
:
164 case AccessibleEventId::LISTBOX_ENTRY_COLLAPSED
:
165 case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS
:
167 SAL_WARN("vcl.qt5", "Unmapped AccessibleEventId: " << aEvent
.EventId
);
172 void Qt5AccessibleEventListener::disposing(const EventObject
& /* Source */) {}
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */