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