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 #ifndef INCLUDED_VCL_OSX_DOCUMENTFOCUSLISTENER_HXX
21 #define INCLUDED_VCL_OSX_DOCUMENTFOCUSLISTENER_HXX
22 
23 #include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
24 
25 #include <cppuhelper/implbase.hxx>
26 
27 #include <osx/a11yfocustracker.hxx>
28 
29 #include <set>
30 
31 
32 class DocumentFocusListener :
33     public ::cppu::WeakImplHelper< css::accessibility::XAccessibleEventListener >
34 {
35 
36 public:
37 
38     explicit DocumentFocusListener(AquaA11yFocusTracker& rTracker);
39 
40     /// @throws css::lang::IndexOutOfBoundsException
41     /// @throws css::uno::RuntimeException
42     void attachRecursive(
43         const css::uno::Reference< css::accessibility::XAccessible >& xAccessible
44     );
45 
46     /// @throws css::lang::IndexOutOfBoundsException
47     /// @throws css::uno::RuntimeException
48     void attachRecursive(
49         const css::uno::Reference< css::accessibility::XAccessible >& xAccessible,
50         const css::uno::Reference< css::accessibility::XAccessibleContext >& xContext
51     );
52 
53     /// @throws css::lang::IndexOutOfBoundsException
54     /// @throws css::uno::RuntimeException
55     void attachRecursive(
56         const css::uno::Reference< css::accessibility::XAccessible >& xAccessible,
57         const css::uno::Reference< css::accessibility::XAccessibleContext >& xContext,
58         const css::uno::Reference< css::accessibility::XAccessibleStateSet >& xStateSet
59     );
60 
61     /// @throws css::lang::IndexOutOfBoundsException
62     /// @throws css::uno::RuntimeException
63     void detachRecursive(
64         const css::uno::Reference< css::accessibility::XAccessible >& xAccessible
65     );
66 
67     /// @throws css::lang::IndexOutOfBoundsException
68     /// @throws css::uno::RuntimeException
69     void detachRecursive(
70         const css::uno::Reference< css::accessibility::XAccessible >& xAccessible,
71         const css::uno::Reference< css::accessibility::XAccessibleContext >& xContext
72     );
73 
74     /// @throws css::lang::IndexOutOfBoundsException
75     /// @throws css::uno::RuntimeException
76     void detachRecursive(
77         const css::uno::Reference< css::accessibility::XAccessible >& xAccessible,
78         const css::uno::Reference< css::accessibility::XAccessibleContext >& xContext,
79         const css::uno::Reference< css::accessibility::XAccessibleStateSet >& xStateSet
80     );
81 
82     /// @throws css::lang::IndexOutOfBoundsException
83     /// @throws css::uno::RuntimeException
84     static css::uno::Reference< css::accessibility::XAccessible > getAccessible(const css::lang::EventObject& aEvent );
85 
86     // XEventListener
87     virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
88 
89     // XAccessibleEventListener
90     virtual void SAL_CALL notifyEvent( const css::accessibility::AccessibleEventObject& aEvent ) override;
91 
92 private:
93     std::set< css::uno::Reference< css::uno::XInterface > > m_aRefList;
94 
95     AquaA11yFocusTracker& m_aFocusTracker;
96 };
97 
98 #endif // INCLUDED_VCL_OSX_DOCUMENTFOCUSLISTENER_HXX
99 
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
101