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

Generated by: LCOV version 1.10