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 <QtAccessibleEventListener.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 QtAccessibleEventListener::QtAccessibleEventListener(const Reference
<XAccessible
> xAccessible
,
34 QtAccessibleWidget
* pAccessibleWidget
)
35 : m_xAccessible(xAccessible
)
36 , m_pAccessibleWidget(pAccessibleWidget
)
40 void QtAccessibleEventListener::notifyEvent(const css::accessibility::AccessibleEventObject
& aEvent
)
42 QAccessibleInterface
* pQAccessibleInterface
= m_pAccessibleWidget
;
44 Reference
<XAccessible
> xChild
;
45 switch (aEvent
.EventId
)
47 case AccessibleEventId::NAME_CHANGED
:
48 QAccessible::updateAccessibility(
49 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::NameChanged
));
51 case AccessibleEventId::DESCRIPTION_CHANGED
:
52 QAccessible::updateAccessibility(
53 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::DescriptionChanged
));
55 case AccessibleEventId::ACTION_CHANGED
:
56 QAccessible::updateAccessibility(
57 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::ActionChanged
));
59 case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED
:
60 QAccessible::updateAccessibility(
61 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::ActiveDescendantChanged
));
63 case AccessibleEventId::CHILD
:
65 QAccessible::Event event
= QAccessible::InvalidEvent
;
66 if (aEvent
.OldValue
>>= xChild
)
67 event
= QAccessible::ObjectDestroyed
;
68 if (aEvent
.NewValue
>>= xChild
)
69 event
= QAccessible::ObjectCreated
;
70 if (event
!= QAccessible::InvalidEvent
)
71 QAccessible::updateAccessibility(
72 new QAccessibleEvent(pQAccessibleInterface
, event
));
75 case AccessibleEventId::SELECTION_CHANGED
:
76 QAccessible::updateAccessibility(
77 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::Selection
));
79 case AccessibleEventId::VISIBLE_DATA_CHANGED
:
80 QAccessible::updateAccessibility(
81 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::VisibleDataChanged
));
83 case AccessibleEventId::TEXT_SELECTION_CHANGED
:
84 QAccessible::updateAccessibility(
85 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::Selection
));
87 case AccessibleEventId::TEXT_ATTRIBUTE_CHANGED
:
88 QAccessible::updateAccessibility(
89 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::AttributeChanged
));
91 case AccessibleEventId::TABLE_CAPTION_CHANGED
:
92 QAccessible::updateAccessibility(
93 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::TableCaptionChanged
));
95 case AccessibleEventId::TABLE_COLUMN_DESCRIPTION_CHANGED
:
96 QAccessible::updateAccessibility(new QAccessibleEvent(
97 pQAccessibleInterface
, QAccessible::TableColumnDescriptionChanged
));
99 case AccessibleEventId::TABLE_COLUMN_HEADER_CHANGED
:
100 QAccessible::updateAccessibility(
101 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::TableColumnHeaderChanged
));
103 case AccessibleEventId::TABLE_ROW_DESCRIPTION_CHANGED
:
104 QAccessible::updateAccessibility(new QAccessibleEvent(
105 pQAccessibleInterface
, QAccessible::TableRowDescriptionChanged
));
107 case AccessibleEventId::TABLE_ROW_HEADER_CHANGED
:
108 QAccessible::updateAccessibility(
109 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::TableRowHeaderChanged
));
111 case AccessibleEventId::TABLE_SUMMARY_CHANGED
:
112 case AccessibleEventId::CARET_CHANGED
:
113 QAccessible::updateAccessibility(
114 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::TableSummaryChanged
));
116 case AccessibleEventId::SELECTION_CHANGED_ADD
:
117 QAccessible::updateAccessibility(
118 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::SelectionAdd
));
120 case AccessibleEventId::SELECTION_CHANGED_REMOVE
:
121 QAccessible::updateAccessibility(
122 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::SelectionRemove
));
124 case AccessibleEventId::SELECTION_CHANGED_WITHIN
:
125 QAccessible::updateAccessibility(
126 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::SelectionWithin
));
128 case AccessibleEventId::PAGE_CHANGED
:
129 QAccessible::updateAccessibility(
130 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::PageChanged
));
132 case AccessibleEventId::SECTION_CHANGED
:
133 QAccessible::updateAccessibility(
134 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::SectionChanged
));
136 case AccessibleEventId::TEXT_CHANGED
:
137 case AccessibleEventId::COLUMN_CHANGED
:
138 QAccessible::updateAccessibility(
139 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::TextColumnChanged
));
141 case AccessibleEventId::BOUNDRECT_CHANGED
:
142 QAccessible::updateAccessibility(
143 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::LocationChanged
));
145 case AccessibleEventId::STATE_CHANGED
:
146 QAccessible::updateAccessibility(
147 new QAccessibleEvent(pQAccessibleInterface
, QAccessible::ForegroundChanged
));
149 case AccessibleEventId::ROLE_CHANGED
:
150 case AccessibleEventId::INVALIDATE_ALL_CHILDREN
:
151 case AccessibleEventId::VALUE_CHANGED
:
152 case AccessibleEventId::CONTENT_FLOWS_FROM_RELATION_CHANGED
:
153 case AccessibleEventId::CONTENT_FLOWS_TO_RELATION_CHANGED
:
154 case AccessibleEventId::CONTROLLED_BY_RELATION_CHANGED
:
155 case AccessibleEventId::CONTROLLER_FOR_RELATION_CHANGED
:
156 case AccessibleEventId::LABEL_FOR_RELATION_CHANGED
:
157 case AccessibleEventId::LABELED_BY_RELATION_CHANGED
:
158 case AccessibleEventId::MEMBER_OF_RELATION_CHANGED
:
159 case AccessibleEventId::SUB_WINDOW_OF_RELATION_CHANGED
:
160 case AccessibleEventId::HYPERTEXT_CHANGED
:
161 case AccessibleEventId::TABLE_MODEL_CHANGED
:
162 case AccessibleEventId::LISTBOX_ENTRY_EXPANDED
:
163 case AccessibleEventId::LISTBOX_ENTRY_COLLAPSED
:
164 case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS
:
166 SAL_WARN("vcl.qt", "Unmapped AccessibleEventId: " << aEvent
.EventId
);
171 void QtAccessibleEventListener::disposing(const EventObject
& /* Source */) {}
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */