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 #ifndef __ACCTOPWINDOWLISTENER_HXX
23 #define __ACCTOPWINDOWLISTENER_HXX
24 
25 #include <com/sun/star/awt/XTopWindowListener.hpp>
26 #include <com/sun/star/awt/XExtendedToolkit.hpp>
27 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
28 #include <cppuhelper/weak.hxx>
29 
30 #include  "AccObjectManagerAgent.hxx"
31 
32 /**
33  * AccEventListener is the general event listener for all top windows. The top windows defined
34  * in UNO are: FRAME, WINDOW, DIALOG, MENU, TOOLTIP.
35  * It implements the methods of XTopWindowListener and the most important method is windowOpened().
36  * In this method, all the accessible objects (including COM object and Uno objects) are created and
37  * cached into bridge managers, and they are monitored by listeners for later accessible evnet handling.
38  */
39 class AccTopWindowListener:
40             public com::sun::star::awt::XTopWindowListener,
41             public ::cppu::OWeakObject
42 
43 {
44 private:
45     AccObjectManagerAgent accManagerAgent;
46     oslInterlockedCount m_refcount;
47 public:
48     AccTopWindowListener();
49     virtual ~AccTopWindowListener();
50     virtual void SAL_CALL windowOpened( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
51     virtual void SAL_CALL windowClosing( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
52     virtual void SAL_CALL windowClosed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
53     virtual void SAL_CALL windowMinimized( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
54     virtual void SAL_CALL windowNormalized( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
55     virtual void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
56     virtual void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
57     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
58     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
59     virtual void SAL_CALL acquire(  ) throw ();
60     virtual void SAL_CALL release(  ) throw ();
61     virtual void AddAllListeners(com::sun::star::accessibility::XAccessible* pAccessible,com::sun::star::accessibility::XAccessible* pParentXAcc,HWND pWND );
62     //for On-Demand load.
63     virtual void handleWindowOpened( com::sun::star::accessibility::XAccessible* pAccessible );
64 };
65 
66 #endif
67