LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/comphelper - containermultiplexer.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1 0.0 %
Date: 2013-07-09 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 _COMPHELPER_CONTAINERMULTIPLEXER_HXX_
      21             : #define _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 ) throw(::com::sun::star::uno::RuntimeException);
      54             :         virtual void _elementRemoved( const ::com::sun::star::container::ContainerEvent& _Event ) throw(::com::sun::star::uno::RuntimeException);
      55             :         virtual void _elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
      56             :         virtual void _disposing(const ::com::sun::star::lang::EventObject& _rSource) throw( ::com::sun::star::uno::RuntimeException);
      57             : 
      58             :     protected:
      59             :         void setAdapter(OContainerListenerAdapter* _pAdapter);
      60             :     };
      61             : 
      62             :     //=====================================================================
      63             :     //= OContainerListenerAdapter
      64             :     //=====================================================================
      65             :     class COMPHELPER_DLLPUBLIC OContainerListenerAdapter
      66             :             :public cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener >
      67             :     {
      68             :         friend class OContainerListener;
      69             : 
      70             :     protected:
      71             :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >
      72             :                                 m_xContainer;
      73             :         OContainerListener*     m_pListener;
      74             :         sal_Int32               m_nLockCount;
      75             : 
      76             :         virtual ~OContainerListenerAdapter();
      77             : 
      78             :     public:
      79             :         OContainerListenerAdapter(OContainerListener* _pListener,
      80             :             const  ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >& _rxContainer);
      81             : 
      82             :         // XEventListener
      83             :         virtual void SAL_CALL disposing( const  ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException);
      84             : 
      85             :         // XContainerListener
      86             :         virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
      87             :         virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
      88             :         virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
      89             : 
      90             :         // locking the multiplexer
      91           0 :         sal_Int32   locked() const { return m_nLockCount; }
      92             : 
      93             :         /// dispose the object. No multiplexing anymore
      94             :         void        dispose();
      95             : 
      96             :         const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >&
      97             :                     getContainer() const { return m_xContainer; }
      98             :     };
      99             : 
     100             : //.........................................................................
     101             : }   // namespace dbaui
     102             : //.........................................................................
     103             : 
     104             : #endif // _COMPHELPER_CONTAINERMULTIPLEXER_HXX_
     105             : 
     106             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10