Kaydet (Commit) 03fdec57 authored tarafından Michael Stahl's avatar Michael Stahl

winaccessibility: use WeakImplHelper

Change-Id: I5872e520ca009a0f9277827d72e72befe3323a06
üst 76ff4c53
...@@ -22,7 +22,9 @@ ...@@ -22,7 +22,9 @@
#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> #include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/XAccessible.hpp>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase1.hxx>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
class AccObjectManagerAgent; class AccObjectManagerAgent;
...@@ -32,12 +34,10 @@ using namespace ::com::sun::star::uno; ...@@ -32,12 +34,10 @@ using namespace ::com::sun::star::uno;
* procedure of all the event handling and provides the basic support for some simple * procedure of all the event handling and provides the basic support for some simple
* methods. * methods.
*/ */
class AccEventListener: class AccEventListener
public com::sun::star::accessibility::XAccessibleEventListener, : public ::cppu::WeakImplHelper1<
public ::cppu::OWeakObject com::sun::star::accessibility::XAccessibleEventListener>
{ {
private:
oslInterlockedCount m_refcount;
protected: protected:
//accessible owner's pointer //accessible owner's pointer
com::sun::star::accessibility::XAccessible* pAccessible; com::sun::star::accessibility::XAccessible* pAccessible;
...@@ -74,9 +74,6 @@ public: ...@@ -74,9 +74,6 @@ public:
//for interface //for interface
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL acquire() throw ();
virtual void SAL_CALL release() throw ();
//get the accessible role of pAccessible //get the accessible role of pAccessible
virtual short SAL_CALL getRole(); virtual short SAL_CALL getRole();
//get the accessible parent's role //get the accessible parent's role
......
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
#include <com/sun/star/awt/XTopWindowListener.hpp> #include <com/sun/star/awt/XTopWindowListener.hpp>
#include <com/sun/star/awt/XExtendedToolkit.hpp> #include <com/sun/star/awt/XExtendedToolkit.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp> #include <com/sun/star/accessibility/XAccessibleContext.hpp>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase1.hxx>
#include "AccObjectManagerAgent.hxx" #include "AccObjectManagerAgent.hxx"
...@@ -34,14 +35,11 @@ ...@@ -34,14 +35,11 @@
* In this method, all the accessible objects (including COM object and Uno objects) are created and * In this method, all the accessible objects (including COM object and Uno objects) are created and
* cached into bridge managers, and they are monitored by listeners for later accessible evnet handling. * cached into bridge managers, and they are monitored by listeners for later accessible evnet handling.
*/ */
class AccTopWindowListener: class AccTopWindowListener
public com::sun::star::awt::XTopWindowListener, : public ::cppu::WeakImplHelper1<com::sun::star::awt::XTopWindowListener>
public ::cppu::OWeakObject
{ {
private: private:
AccObjectManagerAgent accManagerAgent; AccObjectManagerAgent accManagerAgent;
oslInterlockedCount m_refcount;
public: public:
AccTopWindowListener(); AccTopWindowListener();
virtual ~AccTopWindowListener(); virtual ~AccTopWindowListener();
...@@ -53,9 +51,6 @@ public: ...@@ -53,9 +51,6 @@ public:
virtual void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL acquire( ) throw ();
virtual void SAL_CALL release( ) throw ();
virtual void AddAllListeners(com::sun::star::accessibility::XAccessible* pAccessible,com::sun::star::accessibility::XAccessible* pParentXAcc,HWND pWND ); virtual void AddAllListeners(com::sun::star::accessibility::XAccessible* pAccessible,com::sun::star::accessibility::XAccessible* pParentXAcc,HWND pWND );
//for On-Demand load. //for On-Demand load.
virtual void handleWindowOpened( com::sun::star::accessibility::XAccessible* pAccessible ); virtual void handleWindowOpened( com::sun::star::accessibility::XAccessible* pAccessible );
......
...@@ -47,10 +47,9 @@ using namespace cppu; ...@@ -47,10 +47,9 @@ using namespace cppu;
AccEventListener::AccEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccEventListener::AccEventListener(com::sun::star::accessibility::XAccessible* pAcc,
AccObjectManagerAgent* Agent) AccObjectManagerAgent* Agent)
:pAccessible(pAcc), : pAccessible(pAcc)
pAgent(Agent), , pAgent(Agent)
m_isDisposed(false), , m_isDisposed(false)
m_refcount(0)
{} {}
AccEventListener::~AccEventListener() AccEventListener::~AccEventListener()
...@@ -280,30 +279,4 @@ throw (::com::sun::star::uno::RuntimeException) ...@@ -280,30 +279,4 @@ throw (::com::sun::star::uno::RuntimeException)
removeMeFromBroadcaster(); removeMeFromBroadcaster();
} }
//need to investigate further
::com::sun::star::uno::Any SAL_CALL AccEventListener::queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException)
{
if(aType.equals(::getCppuType( (Reference< com::sun::star::accessibility::XAccessibleEventListener> const *)0 ) ))
{
Reference< com::sun::star::accessibility::XAccessibleEventListener> xEventListener( static_cast< com::sun::star::accessibility::XAccessibleEventListener* >(this));
return makeAny(xEventListener);
}
return Any();
}
void AccEventListener::acquire( ) throw ()
{
::osl_incrementInterlockedCount( &m_refcount );
}
void AccEventListener::release() throw ()
{
// thread-safe decrementation of reference count
if (0 == ::osl_decrementInterlockedCount( &m_refcount ))
{
delete this; // shutdown this object
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -117,9 +117,8 @@ void AccTopWindowListener::handleWindowOpened( com::sun::star::accessibility::XA ...@@ -117,9 +117,8 @@ void AccTopWindowListener::handleWindowOpened( com::sun::star::accessibility::XA
} }
} }
AccTopWindowListener::AccTopWindowListener(): AccTopWindowListener::AccTopWindowListener()
accManagerAgent(), : accManagerAgent()
m_refcount(1)
{ {
} }
...@@ -272,29 +271,4 @@ void AccTopWindowListener::disposing( const ::com::sun::star::lang::EventObject& ...@@ -272,29 +271,4 @@ void AccTopWindowListener::disposing( const ::com::sun::star::lang::EventObject&
{ {
} }
//need to investigate further
::com::sun::star::uno::Any SAL_CALL AccTopWindowListener::queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException)
{
if (aType.equals( ::getCppuType( (Reference< com::sun::star::awt::XTopWindowListener> const *)0 ) ))
{
Reference< com::sun::star::awt::XTopWindowListener> xTopListener( static_cast< com::sun::star::awt::XTopWindowListener* >(this));
return makeAny(xTopListener);
}
return Any();
}
void AccTopWindowListener::acquire( ) throw ()
{
::osl_incrementInterlockedCount( &m_refcount );
}
void AccTopWindowListener::release() throw ()
{
// thread-safe decrementation of reference count
if (0 == ::osl_decrementInterlockedCount( &m_refcount ))
{
delete this; // shutdown this object
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment