LCOV - code coverage report
Current view: top level - UnoControls/source/controls - OConnectionPointContainerHelper.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 32 0.0 %
Date: 2014-11-03 Functions: 0 10 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             : #include "OConnectionPointContainerHelper.hxx"
      21             : 
      22             : #include "OConnectionPointHelper.hxx"
      23             : 
      24             : //  namespaces
      25             : 
      26             : using namespace ::osl;
      27             : using namespace ::cppu;
      28             : using namespace ::com::sun::star::uno;
      29             : using namespace ::com::sun::star::lang;
      30             : 
      31             : namespace unocontrols{
      32             : 
      33             : //  construct/destruct
      34             : 
      35           0 : OConnectionPointContainerHelper::OConnectionPointContainerHelper( Mutex& aMutex )
      36             :     : m_aSharedMutex        ( aMutex    )
      37           0 :     , m_aMultiTypeContainer ( aMutex    )
      38             : {
      39           0 : }
      40             : 
      41           0 : OConnectionPointContainerHelper::~OConnectionPointContainerHelper()
      42             : {
      43           0 : }
      44             : 
      45             : //  XInterface
      46             : 
      47           0 : Any SAL_CALL OConnectionPointContainerHelper::queryInterface( const Type& aType ) throw( RuntimeException, std::exception )
      48             : {
      49             :     // Attention:
      50             :     //  Don't use mutex or guard in this method!!! Is a method of XInterface.
      51             : 
      52             :     // Ask for my own supported interfaces ...
      53             :     Any aReturn ( ::cppu::queryInterface(   aType                                               ,
      54             :                                                static_cast< XConnectionPointContainer*  > ( this )
      55             :                                         )
      56           0 :                 );
      57             : 
      58             :     // If searched interface not supported by this class ...
      59           0 :     if ( !aReturn.hasValue() )
      60             :     {
      61             :         // ... ask baseclasses.
      62           0 :         aReturn = OWeakObject::queryInterface( aType );
      63             :     }
      64             : 
      65           0 :     return aReturn;
      66             : }
      67             : 
      68             : //  XInterface
      69             : 
      70           0 : void SAL_CALL OConnectionPointContainerHelper::acquire() throw()
      71             : {
      72             :     // Attention:
      73             :     //  Don't use mutex or guard in this method!!! Is a method of XInterface.
      74             : 
      75             :     // Forward to baseclass
      76           0 :     OWeakObject::acquire();
      77           0 : }
      78             : 
      79             : //  XInterface
      80             : 
      81           0 : void SAL_CALL OConnectionPointContainerHelper::release() throw()
      82             : {
      83             :     // Attention:
      84             :     //  Don't use mutex or guard in this method!!! Is a method of XInterface.
      85             : 
      86             :     // Forward to baseclass
      87           0 :     OWeakObject::release();
      88           0 : }
      89             : 
      90             : //  XConnectionPointContainer
      91             : 
      92           0 : Sequence< Type > SAL_CALL OConnectionPointContainerHelper::getConnectionPointTypes() throw( RuntimeException, std::exception )
      93             : {
      94             :     // Container is threadsafe himself !
      95           0 :     return m_aMultiTypeContainer.getContainedTypes();
      96             : }
      97             : 
      98             : //  XConnectionPointContainer
      99             : 
     100           0 : Reference< XConnectionPoint > SAL_CALL OConnectionPointContainerHelper::queryConnectionPoint( const Type& aType ) throw( RuntimeException, std::exception )
     101             : {
     102             :     // Set default return value, if method failed.
     103           0 :     Reference< XConnectionPoint > xConnectionPoint;
     104             : 
     105             :     // Get all elements of the container, which have the searched type.
     106           0 :     OInterfaceContainerHelper* pSpecialContainer = m_aMultiTypeContainer.getContainer( aType );
     107           0 :     if ( pSpecialContainer && pSpecialContainer->getLength() > 0 )
     108             :     {
     109             :         // Ready for multithreading
     110           0 :         MutexGuard aGuard( m_aSharedMutex );
     111             :         // If this container contains elements, build a connectionpoint-instance.
     112           0 :         OConnectionPointHelper* pNewConnectionPoint = new OConnectionPointHelper( m_aSharedMutex, this, aType );
     113           0 :         xConnectionPoint = Reference< XConnectionPoint >( (OWeakObject*)pNewConnectionPoint, UNO_QUERY );
     114             :     }
     115             : 
     116           0 :     return xConnectionPoint;
     117             : }
     118             : 
     119             : //  XConnectionPointContainer
     120             : 
     121           0 : void SAL_CALL OConnectionPointContainerHelper::advise(  const   Type&                       aType       ,
     122             :                                                         const   Reference< XInterface >&    xListener   ) throw( RuntimeException, std::exception )
     123             : {
     124             :     // Container is threadsafe himself !
     125           0 :     m_aMultiTypeContainer.addInterface( aType, xListener );
     126           0 : }
     127             : 
     128             : //  XConnectionPointContainer
     129             : 
     130           0 : void SAL_CALL OConnectionPointContainerHelper::unadvise(    const   Type&                       aType       ,
     131             :                                                             const   Reference< XInterface >&    xListener   ) throw( RuntimeException, std::exception )
     132             : {
     133             :     // Container is threadsafe himself !
     134           0 :     m_aMultiTypeContainer.removeInterface( aType, xListener );
     135           0 : }
     136             : 
     137             : }   // namespace unocontrols
     138             : 
     139             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10