LCOV - code coverage report
Current view: top level - libreoffice/vcl/source/components - factory.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 22 0.0 %
Date: 2012-12-27 Functions: 0 1 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 <osl/mutex.hxx>
      21             : #include <rtl/ustrbuf.hxx>
      22             : #include <uno/dispatcher.h> // declaration of generic uno interface
      23             : #include <uno/mapping.hxx> // mapping stuff
      24             : #include <cppuhelper/factory.hxx>
      25             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      26             : #include <vcl/dllapi.h>
      27             : 
      28             : using ::rtl::OUString;
      29             : using ::rtl::OUStringBuffer;
      30             : using namespace com::sun::star::uno;
      31             : using namespace com::sun::star::lang;
      32             : 
      33             : // service implementation
      34             : extern Sequence< OUString > SAL_CALL vcl_session_getSupportedServiceNames();
      35             : extern OUString SAL_CALL vcl_session_getImplementationName();
      36             : extern Reference< XInterface > SAL_CALL vcl_session_createInstance( const Reference< XMultiServiceFactory > & );
      37             : 
      38             : namespace vcl
      39             : {
      40             : extern Sequence< OUString > SAL_CALL FontIdentificator_getSupportedServiceNames();
      41             : extern OUString SAL_CALL FontIdentificator_getImplementationName();
      42             : extern Reference< XInterface > SAL_CALL FontIdentificator_createInstance( const Reference< XMultiServiceFactory > & );
      43             : 
      44             : extern Sequence< OUString > SAL_CALL StringMirror_getSupportedServiceNames();
      45             : extern OUString SAL_CALL StringMirror_getImplementationName();
      46             : extern Reference< XInterface > SAL_CALL StringMirror_createInstance( const Reference< XMultiServiceFactory > & );
      47             : 
      48             : extern OUString SAL_CALL Clipboard_getImplementationName();
      49             : extern Reference< XSingleServiceFactory > SAL_CALL Clipboard_createFactory( const Reference< XMultiServiceFactory > & );
      50             : 
      51             : extern Sequence< OUString > SAL_CALL DragSource_getSupportedServiceNames();
      52             : extern OUString SAL_CALL DragSource_getImplementationName();
      53             : extern Reference< XInterface > SAL_CALL DragSource_createInstance( const Reference< XMultiServiceFactory > & );
      54             : 
      55             : extern Sequence< OUString > SAL_CALL DropTarget_getSupportedServiceNames();
      56             : extern OUString SAL_CALL DropTarget_getImplementationName();
      57             : extern Reference< XInterface > SAL_CALL DropTarget_createInstance( const Reference< XMultiServiceFactory > & );
      58             : 
      59             : }
      60             : 
      61             : extern "C" {
      62             : 
      63           0 :     VCL_DLLPUBLIC void* SAL_CALL vcl_component_getFactory(
      64             :         const sal_Char* pImplementationName,
      65             :         void* pXUnoSMgr,
      66             :         void* /*pXUnoKey*/
      67             :         )
      68             :     {
      69           0 :         void* pRet = 0;
      70             : 
      71           0 :         if( pXUnoSMgr )
      72             :         {
      73             :             Reference< ::com::sun::star::lang::XMultiServiceFactory > xMgr(
      74             :                 reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pXUnoSMgr )
      75           0 :                 );
      76           0 :             Reference< ::com::sun::star::lang::XSingleServiceFactory > xFactory;
      77           0 :             if( vcl_session_getImplementationName().equalsAscii( pImplementationName ) )
      78             :             {
      79             :                 xFactory = ::cppu::createOneInstanceFactory(
      80             :                     xMgr, vcl_session_getImplementationName(), vcl_session_createInstance,
      81           0 :                     vcl_session_getSupportedServiceNames() );
      82             :             }
      83           0 :             else if( vcl::FontIdentificator_getImplementationName().equalsAscii( pImplementationName ) )
      84             :             {
      85             :                 xFactory = ::cppu::createSingleFactory(
      86             :                     xMgr, vcl::FontIdentificator_getImplementationName(), vcl::FontIdentificator_createInstance,
      87           0 :                     vcl::FontIdentificator_getSupportedServiceNames() );
      88             :             }
      89           0 :             else if( vcl::StringMirror_getImplementationName().equalsAscii( pImplementationName ) )
      90             :             {
      91             :                 xFactory = ::cppu::createSingleFactory(
      92             :                     xMgr, vcl::StringMirror_getImplementationName(), vcl::StringMirror_createInstance,
      93           0 :                     vcl::StringMirror_getSupportedServiceNames() );
      94             :             }
      95           0 :             else if( vcl::Clipboard_getImplementationName().equalsAscii( pImplementationName ) )
      96             :             {
      97           0 :                 xFactory = vcl::Clipboard_createFactory( xMgr );
      98             :             }
      99           0 :             else if( vcl::DragSource_getImplementationName().equalsAscii( pImplementationName ) )
     100             :             {
     101             :                 xFactory = ::cppu::createSingleFactory(
     102             :                     xMgr, vcl::DragSource_getImplementationName(), vcl::DragSource_createInstance,
     103           0 :                     vcl::DragSource_getSupportedServiceNames() );
     104             :             }
     105           0 :             else if( vcl::DropTarget_getImplementationName().equalsAscii( pImplementationName ) )
     106             :             {
     107             :                 xFactory = ::cppu::createSingleFactory(
     108             :                     xMgr, vcl::DropTarget_getImplementationName(), vcl::DropTarget_createInstance,
     109           0 :                     vcl::DropTarget_getSupportedServiceNames() );
     110             :             }
     111           0 :             if( xFactory.is() )
     112             :             {
     113           0 :                 xFactory->acquire();
     114           0 :                 pRet = xFactory.get();
     115           0 :             }
     116             :         }
     117           0 :         return pRet;
     118             :     }
     119             : 
     120             : } /* extern "C" */
     121             : 
     122             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10