Tag: cws_src680_qiq User: fs Date: 06/05/24 07:52:59 Modified: /dba/dbaccess/source/core/inc/ ContainerListener.hxx
Log: #i51143# also implementing XContainerApproveListener File Changes: Directory: /dba/dbaccess/source/core/inc/ ========================================= File [changed]: ContainerListener.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/inc/ContainerListener.hxx?r1=1.3&r2=1.3.124.1 Delta lines: +53 -28 --------------------- --- ContainerListener.hxx 8 Sep 2005 13:32:23 -0000 1.3 +++ ContainerListener.hxx 24 May 2006 14:52:56 -0000 1.3.124.1 @@ -4,9 +4,9 @@ * * $RCSfile: ContainerListener.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.3.124.1 $ * - * last change: $Author: rt $ $Date: 2005/09/08 13:32:23 $ + * last change: $Author: fs $ $Date: 2006/05/24 14:52:56 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -35,43 +35,68 @@ #ifndef DBA_CONTAINERLISTENER_HXX #define DBA_CONTAINERLISTENER_HXX -#ifndef _CPPUHELPER_IMPLBASE1_HXX_ -#include <cppuhelper/implbase1.hxx> +#ifndef _CPPUHELPER_IMPLBASE2_HXX_ +#include <cppuhelper/implbase2.hxx> #endif #ifndef _COM_SUN_STAR_CONTAINER_XCONTAINERLISTENER_HPP_ #include <com/sun/star/container/XContainerListener.hpp> #endif +#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINERAPPROVELISTENER_HPP_ +#include <com/sun/star/container/XContainerApproveListener.hpp> +#endif + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + //........................................................................ namespace dbaccess { //........................................................................ + //========================================================================== //= OContainerListener - // is helper class to avoid a cycle in refcount //========================================================================== - typedef ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener > OContainerListener_BASE; - template <class T> class OContainerListener : public OContainerListener_BASE - { - T* m_pDestination; - public: - OContainerListener(T* _pDestination) : m_pDestination(_pDestination){} + typedef ::cppu::WeakImplHelper2 < ::com::sun::star::container::XContainerListener + , ::com::sun::star::container::XContainerApproveListener + > OContainerListener_BASE; - virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException) - { - m_pDestination->elementInserted(Event); - } - virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException) + /** is helper class to avoid a cycle in refcount + */ + class OContainerListener : public OContainerListener_BASE { - m_pDestination->elementRemoved(Event); - } - virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException) + ::osl::Mutex& m_rMutex; + OWeakObject& m_rDestination; + bool m_bDisposed; + + public: + OContainerListener( OWeakObject& _rDestination, ::osl::Mutex& _rMutex ) + :m_rDestination( _rDestination ) + ,m_rMutex( _rMutex ) + ,m_bDisposed( false ) { - m_pDestination->elementReplaced(Event); } - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) + + // XContainerApproveListener + virtual void SAL_CALL approveInsertElement( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL approveReplaceElement( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL approveRemoveElement( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XContainerListener + virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); + + void SAL_CALL dispose() { - m_pDestination->disposing(Source); + m_bDisposed = true; } + + protected: + virtual ~OContainerListener(); }; //........................................................................ } // namespace dbaccess --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
