xref: /AOO41X/main/winaccessibility/inc/AccEventListener.hxx (revision 0deba7fbda3d9908785c25a443701a293b6f4e71)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright IBM Corporation 2010.
6  * Copyright 2000, 2010 Oracle and/or its affiliates.
7  *
8  * OpenOffice.org - a multi-platform office productivity suite
9  *
10  * This file is part of OpenOffice.org.
11  *
12  * OpenOffice.org is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License version 3
14  * only, as published by the Free Software Foundation.
15  *
16  * OpenOffice.org is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU Lesser General Public License version 3 for more details
20  * (a copy is included in the LICENSE file that accompanied this code).
21  *
22  * You should have received a copy of the GNU Lesser General Public License
23  * version 3 along with OpenOffice.org.  If not, see
24  * <http://www.openoffice.org/license.html>
25  * for a copy of the LGPLv3 License.
26  *
27  ************************************************************************/
28 
29 #ifndef __ACCEVENTLISTENER_HXX
30 #define __ACCEVENTLISTENER_HXX
31 
32 #include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
33 #include <com/sun/star/accessibility/XAccessible.hpp>
34 #include <cppuhelper/weak.hxx>
35 #include <vos/mutex.hxx>
36 
37 class AccObjectManagerAgent;
38 using namespace ::com::sun::star::uno;
39 /**
40  * AccEventListener is the general event listener for all controls. It defines the
41  * procedure of all the event handling and provides the basic support for some simple
42  * methods.
43  */
44 class AccEventListener:
45             public com::sun::star::accessibility::XAccessibleEventListener,
46             public ::cppu::OWeakObject
47 {
48 private:
49     oslInterlockedCount m_refcount;
50 protected:
51     //accessible owner's pointer
52     com::sun::star::accessibility::XAccessible* pAccessible;
53     //agent pointer for objects' manager
54     AccObjectManagerAgent* pAgent;
55     //disposed state indicator
56     bool  m_isDisposed;
57     mutable ::vos::OMutex aRemoveMutex;
58 public:
59     AccEventListener( com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
60     virtual ~AccEventListener();
61 
62     //AccessibleEventListener
63     virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
64 
65     //for name changed event
66     virtual void SAL_CALL handleNameChangedEvent(Any name);
67 
68     //for description changed event
69     virtual void SAL_CALL handleDescriptionChangedEvent(Any desc);
70 
71     //for state changed event
72     virtual void SAL_CALL handleStateChangedEvent (Any oldValue, Any newValue);
73     virtual void SAL_CALL setComponentState(short state, bool enable);
74     virtual void SAL_CALL fireStatePropertyChange(short state, bool set
75                                                      );
76     virtual void SAL_CALL fireStateFocusdChange(bool enable);
77 
78     //for bound rect changed event
79     virtual void SAL_CALL handleBoundrectChangedEvent();
80 
81     //for visible data changed event
82     virtual void SAL_CALL handleVisibleDataChangedEvent();
83 
84     //for interface
85     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
86     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
87     virtual void SAL_CALL acquire() throw ();
88     virtual void SAL_CALL release() throw ();
89     //get the accessible role of pAccessible
90     virtual short SAL_CALL getRole();
91     //get the accessible parent's role
92     virtual short SAL_CALL getParentRole();
93 public:
94     void removeMeFromBroadcaster();
95 };
96 
97 #endif
98