LibreOffice Module winaccessibility (master) 1
AccParagraphEventListener.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
36 :AccContainerEventListener(pAcc, Agent)
37{}
39{
40}
41
46void AccParagraphEventListener::notifyEvent( const css::accessibility::AccessibleEventObject& aEvent )
47{
49
50 switch (aEvent.EventId)
51 {
52 case AccessibleEventId::CARET_CHANGED:
53 HandleCaretChangedEvent(aEvent.OldValue, aEvent.NewValue);
54 break;
55 case AccessibleEventId::VISIBLE_DATA_CHANGED:
57 break;
58 case AccessibleEventId::BOUNDRECT_CHANGED:
60 break;
61 //Added for paragraph selected state.
62 case AccessibleEventId::STATE_CHANGED:
63 {
64 sal_Int64 State;
65 if( (aEvent.NewValue >>= State) && (State == AccessibleStateType::SELECTED) )
66 {
68 break;
69 }
70 else if( (aEvent.OldValue >>= State) && (State == AccessibleStateType::SELECTED) )
71 {
73 break;
74 }
75
77 break;
78 }
79
80 case AccessibleEventId::TEXT_SELECTION_CHANGED:
82 break;
83
84 default:
86 break;
87 }
88}
89
96{
98}
99
105void AccParagraphEventListener::SetComponentState(sal_Int64 state, bool enable )
106{
107 // only the following state can be fired state event.
108 switch (state)
109 {
110 case AccessibleStateType::EDITABLE:
111 // no msaa state
112 break;
113 case AccessibleStateType::MULTI_LINE:
114 // no msaa state mapping
115 break;
116 case AccessibleStateType::SINGLE_LINE:
117 // no msaa state mapping
118 break;
119 default:
121 break;
122 }
123}
124
126{
128}
129
130/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
AnyEventRef aEvent
AccContainerEventListener is inherited from AccEventListener.
virtual void SAL_CALL notifyEvent(const css::accessibility::AccessibleEventObject &aEvent) override
Uno's event notifier when event is captured.
virtual void SetComponentState(sal_Int64 state, bool enable) override
set the new state and fire the MSAA event
virtual void HandleVisibleDataChangedEvent()
handle the VISIBLE_DATA_CHANGED event
AccObjectManagerAgent * pAgent
virtual void HandleBoundrectChangedEvent()
handle the BOUNDRECT_CHANGED event
css::uno::Reference< css::accessibility::XAccessible > m_xAccessible
void DecreaseState(css::accessibility::XAccessible *pXAcc, sal_Int64 pState)
Interface of decreasing MSAA state when some UNO state is decreased.
void IncreaseState(css::accessibility::XAccessible *pXAcc, sal_Int64 pState)
Interface of increasing MSAA name when some UNO state is increased.
bool NotifyAccEvent(UnoMSAAEvent eEvent, css::accessibility::XAccessible *pXAcc=nullptr)
Interface of notify MSAA event when some UNO event occurred.
virtual ~AccParagraphEventListener() override
AccParagraphEventListener(css::accessibility::XAccessible *pAcc, AccObjectManagerAgent *Agent)
virtual void HandleCaretChangedEvent(css::uno::Any oldValue, css::uno::Any newValue)
handle the CARET_CHANGED event
virtual void SAL_CALL notifyEvent(const css::accessibility::AccessibleEventObject &aEvent) override
Uno's event notifier when event is captured.
virtual void SetComponentState(sal_Int64 state, bool enable) override
set the new state and fire the MSAA event
State
@ TEXT_SELECTION_CHANGED