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 __ACCEVENTLISTENER_HXX
23 #define __ACCEVENTLISTENER_HXX
24 
25 #include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
26 #include <com/sun/star/accessibility/XAccessible.hpp>
27 #include <cppuhelper/weak.hxx>
28 #include <vos/mutex.hxx>
29 
30 class AccObjectManagerAgent;
31 using namespace ::com::sun::star::uno;
32 /**
33  * AccEventListener is the general event listener for all controls. It defines the
34  * procedure of all the event handling and provides the basic support for some simple
35  * methods.
36  */
37 class AccEventListener:
38             public com::sun::star::accessibility::XAccessibleEventListener,
39             public ::cppu::OWeakObject
40 {
41 private:
42     oslInterlockedCount m_refcount;
43 protected:
44     //accessible owner's pointer
45     com::sun::star::accessibility::XAccessible* pAccessible;
46     //agent pointer for objects' manager
47     AccObjectManagerAgent* pAgent;
48     //disposed state indicator
49     bool  m_isDisposed;
50     mutable ::vos::OMutex aRemoveMutex;
51 public:
52     AccEventListener( com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
53     virtual ~AccEventListener();
54 
55     //AccessibleEventListener
56     virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
57 
58     //for name changed event
59     virtual void SAL_CALL handleNameChangedEvent(Any name);
60 
61     //for description changed event
62     virtual void SAL_CALL handleDescriptionChangedEvent(Any desc);
63 
64     //for state changed event
65     virtual void SAL_CALL handleStateChangedEvent (Any oldValue, Any newValue);
66     virtual void SAL_CALL setComponentState(short state, bool enable);
67     virtual void SAL_CALL fireStatePropertyChange(short state, bool set
68                                                      );
69     virtual void SAL_CALL fireStateFocusdChange(bool enable);
70 
71     //for bound rect changed event
72     virtual void SAL_CALL handleBoundrectChangedEvent();
73 
74     //for visible data changed event
75     virtual void SAL_CALL handleVisibleDataChangedEvent();
76 
77     //for interface
78     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
79     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
80     virtual void SAL_CALL acquire() throw ();
81     virtual void SAL_CALL release() throw ();
82     //get the accessible role of pAccessible
83     virtual short SAL_CALL getRole();
84     //get the accessible parent's role
85     virtual short SAL_CALL getParentRole();
86 public:
87     void removeMeFromBroadcaster();
88 };
89 
90 #endif
91