1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _DOCUMENTFOCUSLISTENER_HXX_
25 #define _DOCUMENTFOCUSLISTENER_HXX_
26 
27 #include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
28 
29 #include <cppuhelper/implbase1.hxx>
30 
31 #include "aqua/aqua11yfocustracker.hxx"
32 
33 #include <set>
34 
35 // -------------------------
36 // - DocumentFocusListener -
37 // -------------------------
38 
39 class DocumentFocusListener :
40     public ::cppu::WeakImplHelper1< ::com::sun::star::accessibility::XAccessibleEventListener >
41 {
42 
43 public:
44 
45     DocumentFocusListener(AquaA11yFocusTracker& rTracker);
46 
47     void attachRecursive(
48         const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& xAccessible
49     ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
50 
51     void attachRecursive(
52         const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& xAccessible,
53         const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& xContext
54     ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
55 
56     void attachRecursive(
57         const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& xAccessible,
58         const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& xContext,
59         const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet >& xStateSet
60     ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
61 
62     void detachRecursive(
63         const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& xAccessible
64     ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
65 
66     void detachRecursive(
67         const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& xAccessible,
68         const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& xContext
69     ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
70 
71     void detachRecursive(
72         const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& xAccessible,
73         const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& xContext,
74         const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet >& xStateSet
75     ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
76 
77     static ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > getAccessible(const ::com::sun::star::lang::EventObject& aEvent )
78         throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
79 
80     // XEventListener
81     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
82 		throw (::com::sun::star::uno::RuntimeException);
83 
84     // XAccessibleEventListener
85     virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
86 		throw( ::com::sun::star::uno::RuntimeException );
87 
88 private:
89     std::set< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > m_aRefList;
90 
91     AquaA11yFocusTracker& m_aFocusTracker;
92 };
93 
94 #endif // _DOCUMENTFOCUSLISTENER_HXX_