LCOV - code coverage report
Current view: top level - include/comphelper - propmultiplex.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 3 0.0 %
Date: 2014-04-14 Functions: 0 2 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_PROPMULTIPLEX_HXX
      21             : #define INCLUDED_COMPHELPER_PROPMULTIPLEX_HXX
      22             : 
      23             : #include <comphelper/propstate.hxx>
      24             : #include <cppuhelper/implbase1.hxx>
      25             : #include <comphelper/comphelperdllapi.h>
      26             : 
      27             : 
      28             : //= property helper classes
      29             : 
      30             : 
      31             : 
      32             : namespace comphelper
      33             : {
      34             : 
      35             : 
      36             :     class OPropertyChangeMultiplexer;
      37             : 
      38             : 
      39             :     //= OPropertyChangeListener
      40             : 
      41             :     /// simple listener adapter for property sets
      42             :     class COMPHELPER_DLLPUBLIC OPropertyChangeListener
      43             :     {
      44             :         friend class OPropertyChangeMultiplexer;
      45             : 
      46             :         OPropertyChangeMultiplexer* m_pAdapter;
      47             :         ::osl::Mutex&               m_rMutex;
      48             : 
      49             :     public:
      50           0 :         OPropertyChangeListener(::osl::Mutex& _rMutex)
      51           0 :             : m_pAdapter(NULL), m_rMutex(_rMutex) { }
      52             :         virtual ~OPropertyChangeListener();
      53             : 
      54             :         virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException) = 0;
      55             :         virtual void _disposing(const ::com::sun::star::lang::EventObject& _rSource)
      56             :             throw( ::com::sun::star::uno::RuntimeException, std::exception);
      57             : 
      58             :     protected:
      59             :         /** If the derivee also owns the mutex which we know as reference, then call this within your
      60             :             derivee's dtor.
      61             :         */
      62             :         void    disposeAdapter();
      63             : 
      64             :         // pseudo-private. Making it private now could break compatibility
      65             :         void    setAdapter( OPropertyChangeMultiplexer* _pAdapter );
      66             :     };
      67             : 
      68             : 
      69             :     //= OPropertyChangeMultiplexer
      70             : 
      71             :     /// multiplexer for property changes
      72             :     class COMPHELPER_DLLPUBLIC OPropertyChangeMultiplexer   :public cppu::WeakImplHelper1< ::com::sun::star::beans::XPropertyChangeListener>
      73             :     {
      74             :         friend class OPropertyChangeListener;
      75             :          ::com::sun::star::uno::Sequence< OUString >     m_aProperties;
      76             :          ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>   m_xSet;
      77             :         OPropertyChangeListener*                    m_pListener;
      78             :         sal_Int32                                   m_nLockCount;
      79             :         bool                                    m_bListening        : 1;
      80             :         bool                                    m_bAutoSetRelease   : 1;
      81             : 
      82             : 
      83             :         virtual ~OPropertyChangeMultiplexer();
      84             :     public:
      85             :         OPropertyChangeMultiplexer(OPropertyChangeListener* _pListener, const  ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxSet, bool _bAutoReleaseSet = true);
      86             : 
      87             :     // XEventListener
      88             :         virtual void SAL_CALL disposing( const  ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      89             : 
      90             :     // XPropertyChangeListener
      91             :         virtual void SAL_CALL propertyChange( const  ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      92             : 
      93             :         /// incremental lock
      94             :         void        lock();
      95             :         /// incremental unlock
      96             :         void        unlock();
      97             :         /// get the lock count
      98           0 :         sal_Int32   locked() const { return m_nLockCount; }
      99             : 
     100             :         void addProperty(const OUString& aPropertyName);
     101             :         void dispose();
     102             :     };
     103             : 
     104             : 
     105             : }   // namespace comphelper
     106             : 
     107             : 
     108             : #endif // INCLUDED_COMPHELPER_PROPMULTIPLEX_HXX
     109             : 
     110             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10