LCOV - code coverage report
Current view: top level - vcl/source/components - factory.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 20 24 83.3 %
Date: 2014-11-03 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             : #include <osl/mutex.hxx>
      21             : #include <rtl/ustrbuf.hxx>
      22             : #include <uno/dispatcher.h>
      23             : #include <uno/mapping.hxx>
      24             : #include <cppuhelper/factory.hxx>
      25             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      26             : #include <vcl/dllapi.h>
      27             : 
      28             : #include <factory.hxx>
      29             : 
      30             : using namespace com::sun::star::uno;
      31             : using namespace com::sun::star::lang;
      32             : 
      33             : extern "C" {
      34             : 
      35         234 :     VCL_DLLPUBLIC void* SAL_CALL vcl_component_getFactory(
      36             :         const sal_Char* pImplementationName,
      37             :         void* pXUnoSMgr,
      38             :         void* /*pXUnoKey*/
      39             :         )
      40             :     {
      41         234 :         void* pRet = 0;
      42             : 
      43         234 :         if( pXUnoSMgr )
      44             :         {
      45             :             Reference< ::com::sun::star::lang::XMultiServiceFactory > xMgr(
      46             :                 reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pXUnoSMgr )
      47         234 :                 );
      48         468 :             Reference< ::com::sun::star::lang::XSingleServiceFactory > xFactory;
      49         234 :             if( vcl_session_getImplementationName().equalsAscii( pImplementationName ) )
      50             :             {
      51           0 :                 xFactory = ::cppu::createOneInstanceFactory(
      52             :                     xMgr, vcl_session_getImplementationName(), vcl_session_createInstance,
      53           0 :                     vcl_session_getSupportedServiceNames() );
      54             :             }
      55         234 :             else if( vcl::FontIdentificator_getImplementationName().equalsAscii( pImplementationName ) )
      56             :             {
      57           0 :                 xFactory = ::cppu::createSingleFactory(
      58             :                     xMgr, vcl::FontIdentificator_getImplementationName(), vcl::FontIdentificator_createInstance,
      59           0 :                     vcl::FontIdentificator_getSupportedServiceNames() );
      60             :             }
      61         234 :             else if( vcl::Clipboard_getImplementationName().equalsAscii( pImplementationName ) )
      62             :             {
      63          78 :                 xFactory = vcl::Clipboard_createFactory( xMgr );
      64             :             }
      65         156 :             else if( vcl::DragSource_getImplementationName().equalsAscii( pImplementationName ) )
      66             :             {
      67         156 :                 xFactory = ::cppu::createSingleFactory(
      68             :                     xMgr, vcl::DragSource_getImplementationName(), vcl::DragSource_createInstance,
      69          78 :                     vcl::DragSource_getSupportedServiceNames() );
      70             :             }
      71          78 :             else if( vcl::DropTarget_getImplementationName().equalsAscii( pImplementationName ) )
      72             :             {
      73         156 :                 xFactory = ::cppu::createSingleFactory(
      74             :                     xMgr, vcl::DropTarget_getImplementationName(), vcl::DropTarget_createInstance,
      75          78 :                     vcl::DropTarget_getSupportedServiceNames() );
      76             :             }
      77         234 :             if( xFactory.is() )
      78             :             {
      79         234 :                 xFactory->acquire();
      80         234 :                 pRet = xFactory.get();
      81         234 :             }
      82             :         }
      83         234 :         return pRet;
      84             :     }
      85             : 
      86             : } /* extern "C" */
      87             : 
      88             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10