LCOV - code coverage report
Current view: top level - filter/source/config/cache - registration.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 24 25 96.0 %
Date: 2014-04-11 Functions: 1 1 100.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             : 
      21             : #include <cppuhelper/factory.hxx>
      22             : #include <rtl/instance.hxx>
      23             : 
      24             : #include "typedetection.hxx"
      25             : #include "filterfactory.hxx"
      26             : #include "contenthandlerfactory.hxx"
      27             : #include "frameloaderfactory.hxx"
      28             : #include "configflush.hxx"
      29             : 
      30             : 
      31             : namespace filter{
      32             :     namespace config{
      33             : 
      34             : 
      35             : extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL
      36         312 :     filterconfig1_component_getFactory( const sal_Char* pImplementationName,
      37             :                                         void* pServiceManager,
      38             :                                         void* /* pRegistryKey */ )
      39             : {
      40         312 :     if ((!pImplementationName) || (!pServiceManager ))
      41           0 :         return NULL;
      42             : 
      43             :     com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
      44         312 :         xSMGR = reinterpret_cast< com::sun::star::lang::XMultiServiceFactory* >(pServiceManager);
      45         624 :     com::sun::star::uno::Reference< com::sun::star::lang::XSingleServiceFactory > xFactory;
      46         624 :     OUString sImplName = OUString::createFromAscii(pImplementationName);
      47             : 
      48         312 :     if (TypeDetection::impl_getImplementationName() == sImplName)
      49         148 :         xFactory = cppu::createSingleFactory( xSMGR,
      50             :                                               TypeDetection::impl_getImplementationName(),
      51             :                                               TypeDetection::impl_createInstance,
      52          74 :                                               TypeDetection::impl_getSupportedServiceNames() );
      53             : 
      54         312 :     if (FilterFactory::impl_getImplementationName() == sImplName)
      55         148 :         xFactory = cppu::createSingleFactory( xSMGR,
      56             :                                               FilterFactory::impl_getImplementationName(),
      57             :                                               FilterFactory::impl_createInstance,
      58          74 :                                               FilterFactory::impl_getSupportedServiceNames() );
      59             : 
      60         312 :     if (ContentHandlerFactory::impl_getImplementationName() == sImplName)
      61          40 :         xFactory = cppu::createSingleFactory( xSMGR,
      62             :                                               ContentHandlerFactory::impl_getImplementationName(),
      63             :                                               ContentHandlerFactory::impl_createInstance,
      64          20 :                                               ContentHandlerFactory::impl_getSupportedServiceNames() );
      65             : 
      66         312 :     if (FrameLoaderFactory::impl_getImplementationName() == sImplName)
      67         138 :         xFactory = cppu::createSingleFactory( xSMGR,
      68             :                                               FrameLoaderFactory::impl_getImplementationName(),
      69             :                                               FrameLoaderFactory::impl_createInstance,
      70          69 :                                               FrameLoaderFactory::impl_getSupportedServiceNames() );
      71             : 
      72         312 :     if (ConfigFlush::impl_getImplementationName() == sImplName)
      73         150 :         xFactory = cppu::createOneInstanceFactory( xSMGR,
      74             :                                                    ConfigFlush::impl_getImplementationName(),
      75             :                                                    ConfigFlush::impl_createInstance,
      76          75 :                                                    ConfigFlush::impl_getSupportedServiceNames() );
      77             : 
      78             :     /* And if one of these checks was successful => xFactory was set! */
      79         312 :     if (xFactory.is())
      80             :     {
      81         312 :         xFactory->acquire();
      82         312 :         return xFactory.get();
      83             :     }
      84             : 
      85         312 :     return NULL;
      86             : }
      87             : 
      88             :     } // namespace config
      89             : } // namespace filter
      90             : 
      91             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10