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
44 = static_cast<QAccessibleInterface
*>(m_pAccessibleWidget
);
46 Reference
<XAccessible
> xChild
;
47 switch (aEvent
.EventId
)
49 case AccessibleEventId::NAME_CHANGED
:
50 QAccessible::updateAccessibility(
51 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::NameChanged
));
53 case AccessibleEventId::DESCRIPTION_CHANGED
:
54 QAccessible::updateAccessibility(
55 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::DescriptionChanged
));
57 case AccessibleEventId::ACTION_CHANGED
:
58 QAccessible::updateAccessibility(
59 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::ActionChanged
));
61 case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED
:
62 QAccessible::updateAccessibility(
63 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::ActiveDescendantChanged
));
65 case AccessibleEventId::CHILD
:
67 QAccessible::Event event
= QAccessible::InvalidEvent
;
68 if (aEvent
.OldValue
>>= xChild
)
69 event
= QAccessible::ObjectDestroyed
;
70 if (aEvent
.NewValue
>>= xChild
)
71 event
= QAccessible::ObjectCreated
;
72 if (event
!= QAccessible::InvalidEvent
)
73 QAccessible::updateAccessibility(
74 new QAccessibleEvent(pQAccessibleInterface
, event
));
77 case AccessibleEventId::SELECTION_CHANGED
:
78 QAccessible::updateAccessibility(
79 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::Selection
));
81 case AccessibleEventId::VISIBLE_DATA_CHANGED
:
82 QAccessible::updateAccessibility(
83 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::VisibleDataChanged
));
85 case AccessibleEventId::TEXT_SELECTION_CHANGED
:
86 QAccessible::updateAccessibility(
87 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::Selection
));
89 case AccessibleEventId::TEXT_ATTRIBUTE_CHANGED
:
90 QAccessible::updateAccessibility(
91 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::AttributeChanged
));
93 case AccessibleEventId::TABLE_CAPTION_CHANGED
:
94 QAccessible::updateAccessibility(
95 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::TableCaptionChanged
));
97 case AccessibleEventId::TABLE_COLUMN_DESCRIPTION_CHANGED
:
98 QAccessible::updateAccessibility(new QAccessibleEvent(
99 pQAccessibleInterface
, QAccessible::TableColumnDescriptionChanged
));
101 case AccessibleEventId::TABLE_COLUMN_HEADER_CHANGED
:
102 QAccessible::updateAccessibility(
103 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::TableColumnHeaderChanged
));
105 case AccessibleEventId::TABLE_ROW_DESCRIPTION_CHANGED
:
106 QAccessible::updateAccessibility(new QAccessibleEvent(
107 pQAccessibleInterface
, QAccessible::TableRowDescriptionChanged
));
109 case AccessibleEventId::TABLE_ROW_HEADER_CHANGED
:
110 QAccessible::updateAccessibility(
111 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::TableRowHeaderChanged
));
113 case AccessibleEventId::TABLE_SUMMARY_CHANGED
:
114 case AccessibleEventId::CARET_CHANGED
:
115 QAccessible::updateAccessibility(
116 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::TableSummaryChanged
));
118 case AccessibleEventId::SELECTION_CHANGED_ADD
:
119 QAccessible::updateAccessibility(
120 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::SelectionAdd
));
122 case AccessibleEventId::SELECTION_CHANGED_REMOVE
:
123 QAccessible::updateAccessibility(
124 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::SelectionRemove
));
126 case AccessibleEventId::SELECTION_CHANGED_WITHIN
:
127 QAccessible::updateAccessibility(
128 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::SelectionWithin
));
130 case AccessibleEventId::PAGE_CHANGED
:
131 QAccessible::updateAccessibility(
132 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::PageChanged
));
134 case AccessibleEventId::SECTION_CHANGED
:
135 QAccessible::updateAccessibility(
136 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::SectionChanged
));
138 case AccessibleEventId::TEXT_CHANGED
:
139 case AccessibleEventId::COLUMN_CHANGED
:
140 QAccessible::updateAccessibility(
141 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::TextColumnChanged
));
143 case AccessibleEventId::BOUNDRECT_CHANGED
:
144 QAccessible::updateAccessibility(
145 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::LocationChanged
));
147 case AccessibleEventId::STATE_CHANGED
:
148 QAccessible::updateAccessibility(
149 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::ForegroundChanged
));
151 case AccessibleEventId::ROLE_CHANGED
:
152 case AccessibleEventId::INVALIDATE_ALL_CHILDREN
:
153 case AccessibleEventId::VALUE_CHANGED
:
154 case AccessibleEventId::CONTENT_FLOWS_FROM_RELATION_CHANGED
:
155 case AccessibleEventId::CONTENT_FLOWS_TO_RELATION_CHANGED
:
156 case AccessibleEventId::CONTROLLED_BY_RELATION_CHANGED
:
157 case AccessibleEventId::CONTROLLER_FOR_RELATION_CHANGED
:
158 case AccessibleEventId::LABEL_FOR_RELATION_CHANGED
:
159 case AccessibleEventId::LABELED_BY_RELATION_CHANGED
:
160 case AccessibleEventId::MEMBER_OF_RELATION_CHANGED
:
161 case AccessibleEventId::SUB_WINDOW_OF_RELATION_CHANGED
:
162 case AccessibleEventId::HYPERTEXT_CHANGED
:
163 case AccessibleEventId::TABLE_MODEL_CHANGED
:
164 case AccessibleEventId::LISTBOX_ENTRY_EXPANDED
:
165 case AccessibleEventId::LISTBOX_ENTRY_COLLAPSED
:
166 case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS
:
168 SAL_WARN("vcl.qt5", "Unmapped AccessibleEventId: " << aEvent
.EventId
);
173 void Qt5AccessibleEventListener::disposing(const EventObject
& /* Source */) {}
175 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */