LCOV - code coverage report
Current view: top level - framework/source/fwe/classes - actiontriggercontainer.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 53 0.0 %
Date: 2014-04-14 Functions: 0 14 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 <classes/actiontriggercontainer.hxx>
      21             : #include <classes/actiontriggerpropertyset.hxx>
      22             : #include <classes/actiontriggerseparatorpropertyset.hxx>
      23             : #include <cppuhelper/supportsservice.hxx>
      24             : #include <cppuhelper/typeprovider.hxx>
      25             : 
      26             : using namespace cppu;
      27             : using namespace com::sun::star::uno;
      28             : using namespace com::sun::star::lang;
      29             : using namespace com::sun::star::container;
      30             : 
      31             : namespace framework
      32             : {
      33             : 
      34           0 : ActionTriggerContainer::ActionTriggerContainer() :
      35           0 :     PropertySetContainer()
      36             : {
      37           0 : }
      38             : 
      39           0 : ActionTriggerContainer::~ActionTriggerContainer()
      40             : {
      41           0 : }
      42             : 
      43             : // XInterface
      44           0 : Any SAL_CALL ActionTriggerContainer::queryInterface( const Type& aType )
      45             : throw ( RuntimeException, std::exception )
      46             : {
      47             :     Any a = ::cppu::queryInterface(
      48             :                 aType ,
      49             :                 (static_cast< XMultiServiceFactory* >(this)),
      50             :                 (static_cast< XServiceInfo* >(this)),
      51           0 :                 (static_cast< XTypeProvider* >(this)));
      52             : 
      53           0 :     if( a.hasValue() )
      54             :     {
      55           0 :         return a;
      56             :     }
      57             : 
      58           0 :     return PropertySetContainer::queryInterface( aType );
      59             : }
      60             : 
      61           0 : void ActionTriggerContainer::acquire() throw()
      62             : {
      63           0 :     PropertySetContainer::acquire();
      64           0 : }
      65             : 
      66           0 : void ActionTriggerContainer::release() throw()
      67             : {
      68           0 :     PropertySetContainer::release();
      69           0 : }
      70             : 
      71             : // XMultiServiceFactory
      72           0 : Reference< XInterface > SAL_CALL ActionTriggerContainer::createInstance( const OUString& aServiceSpecifier )
      73             : throw ( ::com::sun::star::uno::Exception, RuntimeException, std::exception)
      74             : {
      75           0 :     if ( aServiceSpecifier.equalsAscii( SERVICENAME_ACTIONTRIGGER ))
      76           0 :         return (OWeakObject *)( new ActionTriggerPropertySet());
      77           0 :     else if ( aServiceSpecifier.equalsAscii( SERVICENAME_ACTIONTRIGGERCONTAINER ))
      78           0 :         return (OWeakObject *)( new ActionTriggerContainer());
      79           0 :     else if ( aServiceSpecifier.equalsAscii( SERVICENAME_ACTIONTRIGGERSEPARATOR ))
      80           0 :         return (OWeakObject *)( new ActionTriggerSeparatorPropertySet());
      81             :     else
      82           0 :         throw com::sun::star::uno::RuntimeException("Unknown service specifier!", (OWeakObject *)this );
      83             : }
      84             : 
      85           0 : Reference< XInterface > SAL_CALL ActionTriggerContainer::createInstanceWithArguments( const OUString& ServiceSpecifier, const Sequence< Any >& /*Arguments*/ )
      86             : throw ( Exception, RuntimeException, std::exception)
      87             : {
      88           0 :     return createInstance( ServiceSpecifier );
      89             : }
      90             : 
      91           0 : Sequence< OUString > SAL_CALL ActionTriggerContainer::getAvailableServiceNames()
      92             : throw ( RuntimeException, std::exception )
      93             : {
      94           0 :     Sequence< OUString > aSeq( 3 );
      95             : 
      96           0 :     aSeq[0] = OUString( SERVICENAME_ACTIONTRIGGER );
      97           0 :     aSeq[1] = OUString( SERVICENAME_ACTIONTRIGGERCONTAINER );
      98           0 :     aSeq[2] = OUString( SERVICENAME_ACTIONTRIGGERSEPARATOR );
      99             : 
     100           0 :     return aSeq;
     101             : }
     102             : 
     103             : // XServiceInfo
     104           0 : OUString SAL_CALL ActionTriggerContainer::getImplementationName()
     105             : throw ( RuntimeException, std::exception )
     106             : {
     107           0 :     return OUString( IMPLEMENTATIONNAME_ACTIONTRIGGERCONTAINER );
     108             : }
     109             : 
     110           0 : sal_Bool SAL_CALL ActionTriggerContainer::supportsService( const OUString& ServiceName )
     111             : throw ( RuntimeException, std::exception )
     112             : {
     113           0 :     return cppu::supportsService(this, ServiceName);
     114             : }
     115             : 
     116           0 : Sequence< OUString > SAL_CALL ActionTriggerContainer::getSupportedServiceNames()
     117             : throw ( RuntimeException, std::exception )
     118             : {
     119           0 :     Sequence< OUString > seqServiceNames( 1 );
     120             : 
     121           0 :     seqServiceNames[0] = OUString( SERVICENAME_ACTIONTRIGGERCONTAINER );
     122           0 :     return seqServiceNames;
     123             : }
     124             : 
     125             : // XTypeProvider
     126           0 : Sequence< Type > SAL_CALL ActionTriggerContainer::getTypes() throw ( RuntimeException, std::exception )
     127             : {
     128             :     // Optimize this method !
     129             :     // We initialize a static variable only one time. And we don't must use a mutex at every call!
     130             :     // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!
     131             :     static ::cppu::OTypeCollection* pTypeCollection = NULL;
     132             : 
     133           0 :     if ( pTypeCollection == NULL )
     134             :     {
     135             :         // Ready for multithreading; get global mutex for first call of this method only! see before
     136           0 :         osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
     137             : 
     138             :         // Control these pointer again ... it can be, that another instance will be faster then these!
     139           0 :         if ( pTypeCollection == NULL )
     140             :         {
     141             :             // Create a static typecollection ...
     142             :             static ::cppu::OTypeCollection aTypeCollection(
     143           0 :                         ::getCppuType(( const Reference< XMultiServiceFactory   >*)NULL ) ,
     144           0 :                         ::getCppuType(( const Reference< XIndexContainer        >*)NULL ) ,
     145           0 :                         ::getCppuType(( const Reference< XServiceInfo           >*)NULL ) ,
     146           0 :                         ::getCppuType(( const Reference< XTypeProvider          >*)NULL ) );
     147             : 
     148             :             // ... and set his address to static pointer!
     149           0 :             pTypeCollection = &aTypeCollection;
     150           0 :         }
     151             :     }
     152             : 
     153           0 :     return pTypeCollection->getTypes();
     154             : }
     155             : 
     156           0 : Sequence< sal_Int8 > SAL_CALL ActionTriggerContainer::getImplementationId() throw ( RuntimeException, std::exception )
     157             : {
     158           0 :     return css::uno::Sequence<sal_Int8>();
     159             : }
     160             : 
     161             : }
     162             : 
     163             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10