LCOV - code coverage report
Current view: top level - vcl/source/components - factory.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 21 26 80.8 %
Date: 2012-08-25 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 39 116 33.6 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <osl/mutex.hxx>
      30                 :            : #include <rtl/ustrbuf.hxx>
      31                 :            : #include <uno/dispatcher.h> // declaration of generic uno interface
      32                 :            : #include <uno/mapping.hxx> // mapping stuff
      33                 :            : #include <cppuhelper/factory.hxx>
      34                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      35                 :            : #include <vcl/dllapi.h>
      36                 :            : 
      37                 :            : using ::rtl::OUString;
      38                 :            : using ::rtl::OUStringBuffer;
      39                 :            : using namespace com::sun::star::uno;
      40                 :            : using namespace com::sun::star::lang;
      41                 :            : 
      42                 :            : // service implementation
      43                 :            : extern Sequence< OUString > SAL_CALL vcl_session_getSupportedServiceNames();
      44                 :            : extern OUString SAL_CALL vcl_session_getImplementationName();
      45                 :            : extern Reference< XInterface > SAL_CALL vcl_session_createInstance( const Reference< XMultiServiceFactory > & );
      46                 :            : 
      47                 :            : namespace vcl
      48                 :            : {
      49                 :            : extern Sequence< OUString > SAL_CALL DisplayAccess_getSupportedServiceNames();
      50                 :            : extern OUString SAL_CALL DisplayAccess_getImplementationName();
      51                 :            : extern Reference< XInterface > SAL_CALL DisplayAccess_createInstance( const Reference< XMultiServiceFactory > & );
      52                 :            : 
      53                 :            : extern Sequence< OUString > SAL_CALL FontIdentificator_getSupportedServiceNames();
      54                 :            : extern OUString SAL_CALL FontIdentificator_getImplementationName();
      55                 :            : extern Reference< XInterface > SAL_CALL FontIdentificator_createInstance( const Reference< XMultiServiceFactory > & );
      56                 :            : 
      57                 :            : extern Sequence< OUString > SAL_CALL StringMirror_getSupportedServiceNames();
      58                 :            : extern OUString SAL_CALL StringMirror_getImplementationName();
      59                 :            : extern Reference< XInterface > SAL_CALL StringMirror_createInstance( const Reference< XMultiServiceFactory > & );
      60                 :            : 
      61                 :            : extern OUString SAL_CALL Clipboard_getImplementationName();
      62                 :            : extern Reference< XSingleServiceFactory > SAL_CALL Clipboard_createFactory( const Reference< XMultiServiceFactory > & );
      63                 :            : 
      64                 :            : extern Sequence< OUString > SAL_CALL DragSource_getSupportedServiceNames();
      65                 :            : extern OUString SAL_CALL DragSource_getImplementationName();
      66                 :            : extern Reference< XInterface > SAL_CALL DragSource_createInstance( const Reference< XMultiServiceFactory > & );
      67                 :            : 
      68                 :            : extern Sequence< OUString > SAL_CALL DropTarget_getSupportedServiceNames();
      69                 :            : extern OUString SAL_CALL DropTarget_getImplementationName();
      70                 :            : extern Reference< XInterface > SAL_CALL DropTarget_createInstance( const Reference< XMultiServiceFactory > & );
      71                 :            : 
      72                 :            : namespace rsvg
      73                 :            : {
      74                 :            :     extern Sequence< OUString > SAL_CALL Rasterizer_getSupportedServiceNames();
      75                 :            :     extern OUString SAL_CALL Rasterizer_getImplementationName();
      76                 :            :     extern Reference< XInterface > SAL_CALL Rasterizer_createInstance( const Reference< XMultiServiceFactory > & );
      77                 :            : }
      78                 :            : }
      79                 :            : 
      80                 :            : extern "C" {
      81                 :            : 
      82                 :        248 :     VCL_DLLPUBLIC void* SAL_CALL vcl_component_getFactory(
      83                 :            :         const sal_Char* pImplementationName,
      84                 :            :         void* pXUnoSMgr,
      85                 :            :         void* /*pXUnoKey*/
      86                 :            :         )
      87                 :            :     {
      88                 :        248 :         void* pRet = 0;
      89                 :            : 
      90         [ +  - ]:        248 :         if( pXUnoSMgr )
      91                 :            :         {
      92                 :            :             Reference< ::com::sun::star::lang::XMultiServiceFactory > xMgr(
      93                 :            :                 reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pXUnoSMgr )
      94         [ +  - ]:        248 :                 );
      95                 :        248 :             Reference< ::com::sun::star::lang::XSingleServiceFactory > xFactory;
      96 [ -  + ][ +  - ]:        248 :             if( vcl_session_getImplementationName().equalsAscii( pImplementationName ) )
      97                 :            :             {
      98                 :            :                 xFactory = ::cppu::createOneInstanceFactory(
      99                 :            :                     xMgr, vcl_session_getImplementationName(), vcl_session_createInstance,
     100 [ #  # ][ #  # ]:          0 :                     vcl_session_getSupportedServiceNames() );
         [ #  # ][ #  # ]
                 [ #  # ]
     101                 :            :             }
     102 [ +  - ][ +  + ]:        248 :             else if( vcl::DisplayAccess_getImplementationName().equalsAscii( pImplementationName ) )
     103                 :            :             {
     104                 :            :                 xFactory = ::cppu::createSingleFactory(
     105                 :            :                     xMgr, vcl::DisplayAccess_getImplementationName(), vcl::DisplayAccess_createInstance,
     106 [ +  - ][ +  - ]:         62 :                     vcl::DisplayAccess_getSupportedServiceNames() );
         [ +  - ][ +  - ]
                 [ +  - ]
     107                 :            :             }
     108 [ +  - ][ -  + ]:        186 :             else if( vcl::FontIdentificator_getImplementationName().equalsAscii( pImplementationName ) )
     109                 :            :             {
     110                 :            :                 xFactory = ::cppu::createSingleFactory(
     111                 :            :                     xMgr, vcl::FontIdentificator_getImplementationName(), vcl::FontIdentificator_createInstance,
     112 [ #  # ][ #  # ]:          0 :                     vcl::FontIdentificator_getSupportedServiceNames() );
         [ #  # ][ #  # ]
                 [ #  # ]
     113                 :            :             }
     114 [ +  - ][ -  + ]:        186 :             else if( vcl::StringMirror_getImplementationName().equalsAscii( pImplementationName ) )
     115                 :            :             {
     116                 :            :                 xFactory = ::cppu::createSingleFactory(
     117                 :            :                     xMgr, vcl::StringMirror_getImplementationName(), vcl::StringMirror_createInstance,
     118 [ #  # ][ #  # ]:          0 :                     vcl::StringMirror_getSupportedServiceNames() );
         [ #  # ][ #  # ]
                 [ #  # ]
     119                 :            :             }
     120 [ +  - ][ +  + ]:        186 :             else if( vcl::Clipboard_getImplementationName().equalsAscii( pImplementationName ) )
     121                 :            :             {
     122 [ +  - ][ +  - ]:         62 :                 xFactory = vcl::Clipboard_createFactory( xMgr );
     123                 :            :             }
     124 [ +  - ][ +  + ]:        124 :             else if( vcl::DragSource_getImplementationName().equalsAscii( pImplementationName ) )
     125                 :            :             {
     126                 :            :                 xFactory = ::cppu::createSingleFactory(
     127                 :            :                     xMgr, vcl::DragSource_getImplementationName(), vcl::DragSource_createInstance,
     128 [ +  - ][ +  - ]:         62 :                     vcl::DragSource_getSupportedServiceNames() );
         [ +  - ][ +  - ]
                 [ +  - ]
     129                 :            :             }
     130 [ +  - ][ +  - ]:         62 :             else if( vcl::DropTarget_getImplementationName().equalsAscii( pImplementationName ) )
     131                 :            :             {
     132                 :            :                 xFactory = ::cppu::createSingleFactory(
     133                 :            :                     xMgr, vcl::DropTarget_getImplementationName(), vcl::DropTarget_createInstance,
     134 [ +  - ][ +  - ]:         62 :                     vcl::DropTarget_getSupportedServiceNames() );
         [ +  - ][ +  - ]
                 [ +  - ]
     135                 :            :             }
     136                 :            : #ifdef ENABLE_LIBRSVG
     137 [ #  # ][ #  # ]:          0 :             else if( vcl::rsvg::Rasterizer_getImplementationName().equalsAscii( pImplementationName ) )
     138                 :            :             {
     139                 :            :                 xFactory = ::cppu::createSingleFactory(
     140                 :            :                     xMgr, vcl::rsvg::Rasterizer_getImplementationName(), vcl::rsvg::Rasterizer_createInstance,
     141 [ #  # ][ #  # ]:          0 :                     vcl::rsvg::Rasterizer_getSupportedServiceNames() );
         [ #  # ][ #  # ]
                 [ #  # ]
     142                 :            :             }
     143                 :            : #endif
     144         [ +  - ]:        248 :             if( xFactory.is() )
     145                 :            :             {
     146         [ +  - ]:        248 :                 xFactory->acquire();
     147         [ +  - ]:        248 :                 pRet = xFactory.get();
     148                 :        248 :             }
     149                 :            :         }
     150                 :        248 :         return pRet;
     151                 :            :     }
     152                 :            : 
     153                 :            : } /* extern "C" */
     154                 :            : 
     155                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10