LibreOffice Module winaccessibility (master) 1
AccListEventListener.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <com/sun/star/accessibility/XAccessible.hpp>
21#include <com/sun/star/accessibility/AccessibleStateType.hpp>
22#include <com/sun/star/accessibility/AccessibleEventId.hpp>
23#include <com/sun/star/accessibility/AccessibleRole.hpp>
24#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
25
26#include <vcl/svapp.hxx>
27
30#include <unomsaaevent.hxx>
31
32using namespace com::sun::star::uno;
33using namespace com::sun::star::accessibility;
34
35AccListEventListener::AccListEventListener(css::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
37{
38}
39
41{
42}
43
48void AccListEventListener::notifyEvent( const css::accessibility::AccessibleEventObject& aEvent )
49{
51
52 switch (aEvent.EventId)
53 {
54 case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED:
56 break;
57 case AccessibleEventId::INVALIDATE_ALL_CHILDREN:
58 // Since List items a transient a child events are mostly used
59 // to attach/detach listeners, it is safe to ignore it here
60 //TODO: investigate again
61 break;
62 case AccessibleEventId::VALUE_CHANGED:
63 HandleValueChangedEvent(aEvent.OldValue, aEvent.NewValue);
64 break;
65 default:
67 break;
68 }
69}
70
77{
79
80 if(newValue >>= xChild )
81 {
82 if(xChild.is())
83 {
84 XAccessible* pAcc = xChild.get();
85
86 // Valueset has cache the child item xacc,Update state if no insert obj
87 bool bHasCache = pAgent->InsertAccObj(pAcc, m_xAccessible.get());
88 if (!bHasCache)
89 {
90 pAgent->UpdateState(pAcc);
91 }
92
93 pAgent->IncreaseState( pAcc, AccessibleStateType::FOCUSED);
94
96 }
97 }
98 if (oldValue >>= xChild)
99 {
100 if(xChild.is())
101 {
102 XAccessible* pAcc = xChild.get();
103 pAgent->DeleteAccObj( pAcc );
104 }
105 }
106}
107
115{
116 //to enable value changed event
117 if (GetParentRole() == AccessibleRole::COMBO_BOX)
118 {
119 XAccessible* pParentAcc =
121 pAgent->UpdateValue(pParentAcc);
123 }
124}
125
126/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
AnyEventRef aEvent
AccDescendantManagerEventListener is inherited from AccComponentEventListener.
virtual void SAL_CALL notifyEvent(const css::accessibility::AccessibleEventObject &aEvent) override
Uno's event notifier when event is captured.
virtual short GetParentRole()
get the role of accessible parent object which is observed
AccObjectManagerAgent * pAgent
css::uno::Reference< css::accessibility::XAccessible > m_xAccessible
virtual void HandleActiveDescendantChangedEvent(css::uno::Any oldValue, css::uno::Any newValue)
handle the ACTIVE_DESCENDANT_CHANGED event
virtual void SAL_CALL notifyEvent(const css::accessibility::AccessibleEventObject &aEvent) override
Uno's event notifier when event is captured.
AccListEventListener(css::accessibility::XAccessible *pAcc, AccObjectManagerAgent *Agent)
virtual void HandleValueChangedEvent(css::uno::Any oldValue, css::uno::Any newValue) override
handle the VALUE_CHANGED event
virtual ~AccListEventListener() override
virtual void DeleteAccObj(css::accessibility::XAccessible *pXAcc)
When a new UNO XAccessible object is destroyed, we delete its corresponding com object and remove it ...
void UpdateValue(css::accessibility::XAccessible *pXAcc)
void IncreaseState(css::accessibility::XAccessible *pXAcc, sal_Int64 pState)
Interface of increasing MSAA name when some UNO state is increased.
virtual bool InsertAccObj(css::accessibility::XAccessible *pXAcc, css::accessibility::XAccessible *pParentXAcc, HWND hWnd=nullptr)
When a new UNO XAccessible object is found by listener, we create a corresponding com object and inse...
css::accessibility::XAccessible * GetParentXAccessible(css::accessibility::XAccessible *pXAcc)
bool NotifyAccEvent(UnoMSAAEvent eEvent, css::accessibility::XAccessible *pXAcc=nullptr)
Interface of notify MSAA event when some UNO event occurred.
void UpdateState(css::accessibility::XAccessible *pXAcc)
@ ACTIVE_DESCENDANT_CHANGED