User: obo Date: 2006/07/10 08:11:49 Modified: dba/dbaccess/source/core/inc/ContainerListener.hxx
Log: INTEGRATION: CWS qiq (1.3.124); FILE MERGED 2006/06/28 10:31:08 fs 1.3.124.3: #i10000# 2006/05/31 11:09:10 fs 1.3.124.2: #i51143# XContainerApproveListener return XVeto now, instead of throwing 2006/05/24 14:52:56 fs 1.3.124.1: #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.4 Delta lines: +50 -25 --------------------- --- ContainerListener.hxx 8 Sep 2005 13:32:23 -0000 1.3 +++ ContainerListener.hxx 10 Jul 2006 15:11:47 -0000 1.4 @@ -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_rMutex( _rMutex ) + ,m_rDestination( _rDestination ) + ,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 ::com::sun::star::uno::Reference< ::com::sun::star::util::XVeto > SAL_CALL approveInsertElement( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XVeto > SAL_CALL approveReplaceElement( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XVeto > 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]
