LCOV - code coverage report
Current view: top level - include/comphelper - containermultiplexer.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 1 0.0 %
Date: 2014-04-14 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_COMPHELPER_CONTAINERMULTIPLEXER_HXX
      21             : #define INCLUDED_COMPHELPER_CONTAINERMULTIPLEXER_HXX
      22             : 
      23             : #include <com/sun/star/container/XContainer.hpp>
      24             : #include <cppuhelper/implbase1.hxx>
      25             : #include <osl/mutex.hxx>
      26             : #include <comphelper/comphelperdllapi.h>
      27             : 
      28             : 
      29             : namespace comphelper
      30             : {
      31             : 
      32             : 
      33             :     class OContainerListenerAdapter;
      34             : 
      35             :     //= OContainerListener
      36             : 
      37             :     /** a non-UNO container listener
      38             :         <p>Useful if you have a non-refcountable class which should act as container listener.<br/>
      39             :         In this case, derive this class from OContainerListener, and create an adapter
      40             :         OContainerListenerAdapter which multiplexes the changes.</p>
      41             :     */
      42             :     class COMPHELPER_DLLPUBLIC OContainerListener
      43             :     {
      44             :         friend class OContainerListenerAdapter;
      45             :     protected:
      46             :         OContainerListenerAdapter*  m_pAdapter;
      47             :         ::osl::Mutex&               m_rMutex;
      48             : 
      49             :     public:
      50             :         OContainerListener(::osl::Mutex& _rMutex);
      51             :         virtual ~OContainerListener();
      52             : 
      53             :         virtual void _elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent )
      54             :             throw (::com::sun::star::uno::RuntimeException,
      55             :                    std::exception);
      56             :         virtual void _elementRemoved( const ::com::sun::star::container::ContainerEvent& _Event )
      57             :             throw (::com::sun::star::uno::RuntimeException,
      58             :                    std::exception);
      59             :         virtual void _elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent )
      60             :             throw (::com::sun::star::uno::RuntimeException,
      61             :                    std::exception);
      62             :         virtual void _disposing(const ::com::sun::star::lang::EventObject& _rSource)
      63             :             throw (::com::sun::star::uno::RuntimeException,
      64             :                    std::exception);
      65             : 
      66             :     protected:
      67             :         void setAdapter(OContainerListenerAdapter* _pAdapter);
      68             :     };
      69             : 
      70             : 
      71             :     //= OContainerListenerAdapter
      72             : 
      73             :     class COMPHELPER_DLLPUBLIC OContainerListenerAdapter
      74             :             :public cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener >
      75             :     {
      76             :         friend class OContainerListener;
      77             : 
      78             :     protected:
      79             :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >
      80             :                                 m_xContainer;
      81             :         OContainerListener*     m_pListener;
      82             :         sal_Int32               m_nLockCount;
      83             : 
      84             :         virtual ~OContainerListenerAdapter();
      85             : 
      86             :     public:
      87             :         OContainerListenerAdapter(OContainerListener* _pListener,
      88             :             const  ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >& _rxContainer);
      89             : 
      90             :         // XEventListener
      91             :         virtual void SAL_CALL disposing( const  ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      92             : 
      93             :         // XContainerListener
      94             :         virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      95             :         virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      96             :         virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      97             : 
      98             :         // locking the multiplexer
      99           0 :         sal_Int32   locked() const { return m_nLockCount; }
     100             : 
     101             :         /// dispose the object. No multiplexing anymore
     102             :         void        dispose();
     103             : 
     104             :         const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >&
     105             :                     getContainer() const { return m_xContainer; }
     106             :     };
     107             : 
     108             : 
     109             : }   // namespace dbaui
     110             : 
     111             : 
     112             : #endif // INCLUDED_COMPHELPER_CONTAINERMULTIPLEXER_HXX
     113             : 
     114             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10