LCOV - code coverage report
Current view: top level - xmloff/source/core - facreg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 58 62 93.5 %
Date: 2012-08-25 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 175 418 41.9 %

           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                 :            : 
      30                 :            : #include "sal/config.h"
      31                 :            : 
      32                 :            : #include "xmloff/dllapi.h"
      33                 :            : 
      34                 :            : #include <string.h>
      35                 :            : #include <com/sun/star/container/XSet.hpp>
      36                 :            : #include <com/sun/star/registry/XRegistryKey.hpp>
      37                 :            : #include <osl/diagnose.h>
      38                 :            : 
      39                 :            : #include <cppuhelper/factory.hxx>
      40                 :            : #include <uno/lbnames.h>
      41                 :            : #include "xmloff/xmlreg.hxx"
      42                 :            : 
      43                 :            : using namespace com::sun::star;
      44                 :            : 
      45                 :            : using ::rtl::OUString;
      46                 :            : 
      47                 :            : #define SERVICE( className )                                        \
      48                 :            : extern OUString SAL_CALL className##_getImplementationName() throw();   \
      49                 :            : extern uno::Sequence< OUString > SAL_CALL className##_getSupportedServiceNames() throw();\
      50                 :            : extern uno::Reference< uno::XInterface > SAL_CALL className##_createInstance(           \
      51                 :            :         const uno::Reference< lang::XMultiServiceFactory > & rSMgr )                \
      52                 :            :     throw( uno::Exception )
      53                 :            : 
      54                 :            : // impress oasis import
      55                 :            : SERVICE( XMLImpressImportOasis );
      56                 :            : SERVICE( XMLImpressStylesImportOasis );
      57                 :            : SERVICE( XMLImpressContentImportOasis );
      58                 :            : SERVICE( XMLImpressMetaImportOasis );
      59                 :            : SERVICE( XMLImpressSettingsImportOasis );
      60                 :            : 
      61                 :            : // impress oasis export
      62                 :            : SERVICE( XMLImpressExportOasis );
      63                 :            : SERVICE( XMLImpressStylesExportOasis );
      64                 :            : SERVICE( XMLImpressContentExportOasis );
      65                 :            : SERVICE( XMLImpressMetaExportOasis );
      66                 :            : SERVICE( XMLImpressSettingsExportOasis );
      67                 :            : 
      68                 :            : // impress OOo import
      69                 :            : 
      70                 :            : // impress OOo export
      71                 :            : SERVICE( XMLImpressExportOOO );
      72                 :            : SERVICE( XMLImpressStylesExportOOO );
      73                 :            : SERVICE( XMLImpressContentExportOOO );
      74                 :            : SERVICE( XMLImpressMetaExportOOO );
      75                 :            : SERVICE( XMLImpressSettingsExportOOO );
      76                 :            : 
      77                 :            : // draw oasis import
      78                 :            : SERVICE( XMLDrawImportOasis );
      79                 :            : SERVICE( XMLDrawStylesImportOasis );
      80                 :            : SERVICE( XMLDrawContentImportOasis );
      81                 :            : SERVICE( XMLDrawMetaImportOasis );
      82                 :            : SERVICE( XMLDrawSettingsImportOasis );
      83                 :            : 
      84                 :            : // draw oasis export
      85                 :            : SERVICE( XMLDrawExportOasis );
      86                 :            : SERVICE( XMLDrawStylesExportOasis );
      87                 :            : SERVICE( XMLDrawContentExportOasis );
      88                 :            : SERVICE( XMLDrawMetaExportOasis );
      89                 :            : SERVICE( XMLDrawSettingsExportOasis );
      90                 :            : 
      91                 :            : // draw OOo import
      92                 :            : 
      93                 :            : // draw OOo export
      94                 :            : SERVICE( XMLDrawExportOOO );
      95                 :            : SERVICE( XMLDrawStylesExportOOO );
      96                 :            : SERVICE( XMLDrawContentExportOOO );
      97                 :            : SERVICE( XMLDrawMetaExportOOO );
      98                 :            : SERVICE( XMLDrawSettingsExportOOO );
      99                 :            : 
     100                 :            : // impress animation import
     101                 :            : SERVICE( AnimationsImport );
     102                 :            : 
     103                 :            : // drawing layer export
     104                 :            : SERVICE( XMLDrawingLayerExport );
     105                 :            : 
     106                 :            : // impress xml clipboard export
     107                 :            : SERVICE( XMLImpressClipboardExport );
     108                 :            : 
     109                 :            : // chart oasis import
     110                 :            : SERVICE( SchXMLImport );
     111                 :            : SERVICE( SchXMLImport_Meta );
     112                 :            : SERVICE( SchXMLImport_Styles );
     113                 :            : SERVICE( SchXMLImport_Content );
     114                 :            : 
     115                 :            : // chart oasis export
     116                 :            : SERVICE( SchXMLExport_Oasis );
     117                 :            : SERVICE( SchXMLExport_Oasis_Meta );
     118                 :            : SERVICE( SchXMLExport_Oasis_Styles );
     119                 :            : SERVICE( SchXMLExport_Oasis_Content );
     120                 :            : 
     121                 :            : // chart OOo import
     122                 :            : 
     123                 :            : // chart OOo export
     124                 :            : SERVICE( SchXMLExport );
     125                 :            : SERVICE( SchXMLExport_Styles );
     126                 :            : SERVICE( SchXMLExport_Content );
     127                 :            : 
     128                 :            : // version list import/export
     129                 :            : SERVICE( XMLVersionListPersistence );
     130                 :            : 
     131                 :            : // meta export
     132                 :            : SERVICE( XMLMetaExportComponent );
     133                 :            : 
     134                 :            : // meta import
     135                 :            : SERVICE( XMLMetaImportComponent );
     136                 :            : 
     137                 :            : // meta export OOo
     138                 :            : SERVICE( XMLMetaExportOOO );
     139                 :            : 
     140                 :            : // writer autotext event export
     141                 :            : SERVICE( XMLAutoTextEventExport );
     142                 :            : 
     143                 :            : // writer autotext event import
     144                 :            : SERVICE( XMLAutoTextEventImport );
     145                 :            : 
     146                 :            : // writer autotext event export OOo
     147                 :            : SERVICE( XMLAutoTextEventExportOOO );
     148                 :            : 
     149                 :            : // writer autotext event import OOo
     150                 :            : SERVICE( XMLAutoTextEventImportOOO );
     151                 :            : 
     152                 :            : // Oasis2OOo transformer
     153                 :            : SERVICE( Oasis2OOoTransformer );
     154                 :            : 
     155                 :            : // OOo2Oasis transformer
     156                 :            : SERVICE( OOo2OasisTransformer );
     157                 :            : 
     158                 :            : //
     159                 :            : #ifdef __cplusplus
     160                 :            : extern "C"
     161                 :            : {
     162                 :            : #endif
     163                 :            : 
     164                 :            : #define SINGLEFACTORY(classname)\
     165                 :            :         if( classname##_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )\
     166                 :            :         {\
     167                 :            :             xFactory = ::cppu::createSingleFactory( xMSF,\
     168                 :            :                 classname##_getImplementationName(),\
     169                 :            :                 classname##_createInstance,\
     170                 :            :                 classname##_getSupportedServiceNames() );\
     171                 :            :         }
     172                 :            : 
     173                 :        125 : XMLOFF_DLLPUBLIC void * SAL_CALL xo_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
     174                 :            : {
     175                 :        125 :     void * pRet = 0;
     176         [ +  - ]:        125 :     if( pServiceManager )
     177                 :            :     {
     178         [ +  - ]:        125 :         uno::Reference< lang::XMultiServiceFactory > xMSF( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ) );
     179                 :            : 
     180                 :        125 :         uno::Reference< lang::XSingleServiceFactory > xFactory;
     181                 :            : 
     182                 :        125 :         const sal_Int32 nImplNameLen = strlen( pImplName );
     183                 :            : 
     184                 :            :         // impress oasis import
     185 [ #  # ][ #  # ]:        125 :         SINGLEFACTORY( XMLImpressImportOasis )
         [ #  # ][ -  + ]
     186 [ +  + ][ +  - ]:        125 :         else SINGLEFACTORY( XMLImpressStylesImportOasis )
         [ +  - ][ +  - ]
     187 [ +  + ][ +  - ]:        118 :         else SINGLEFACTORY( XMLImpressContentImportOasis )
         [ +  - ][ +  - ]
     188 [ +  + ][ +  - ]:        111 :         else SINGLEFACTORY( XMLImpressMetaImportOasis )
         [ +  - ][ +  - ]
     189 [ +  + ][ +  - ]:        104 :         else SINGLEFACTORY( XMLImpressSettingsImportOasis )
         [ +  - ][ +  - ]
     190                 :            : 
     191                 :            :         // impress oasis export
     192 [ -  + ][ #  # ]:         99 :         else SINGLEFACTORY( XMLImpressExportOasis )
         [ #  # ][ #  # ]
     193 [ +  + ][ +  - ]:         99 :         else SINGLEFACTORY( XMLImpressStylesExportOasis )
         [ +  - ][ +  - ]
     194 [ +  + ][ +  - ]:         97 :         else SINGLEFACTORY( XMLImpressContentExportOasis )
         [ +  - ][ +  - ]
     195 [ +  + ][ +  - ]:         95 :         else SINGLEFACTORY( XMLImpressMetaExportOasis )
         [ +  - ][ +  - ]
     196 [ +  + ][ +  - ]:         93 :         else SINGLEFACTORY( XMLImpressSettingsExportOasis )
         [ +  - ][ +  - ]
     197                 :            : 
     198 [ +  + ][ +  - ]:         91 :         else SINGLEFACTORY( AnimationsImport )
         [ +  - ][ +  - ]
     199                 :            : 
     200                 :            :         // impress OOo export
     201 [ -  + ][ #  # ]:         89 :         else SINGLEFACTORY( XMLImpressExportOOO )
         [ #  # ][ #  # ]
     202 [ +  + ][ +  - ]:         89 :         else SINGLEFACTORY( XMLImpressStylesExportOOO )
         [ +  - ][ +  - ]
     203 [ +  + ][ +  - ]:         87 :         else SINGLEFACTORY( XMLImpressContentExportOOO )
         [ +  - ][ +  - ]
     204 [ +  + ][ +  - ]:         85 :         else SINGLEFACTORY( XMLImpressMetaExportOOO )
         [ +  - ][ +  - ]
     205 [ +  + ][ +  - ]:         81 :         else SINGLEFACTORY( XMLImpressSettingsExportOOO )
         [ +  - ][ +  - ]
     206                 :            : 
     207                 :            :         // draw oasis import
     208 [ +  + ][ +  - ]:         79 :         else SINGLEFACTORY( XMLDrawImportOasis )
         [ +  - ][ +  - ]
     209 [ -  + ][ #  # ]:         77 :         else SINGLEFACTORY( XMLDrawStylesImportOasis )
         [ #  # ][ #  # ]
     210 [ -  + ][ #  # ]:         77 :         else SINGLEFACTORY( XMLDrawContentImportOasis )
         [ #  # ][ #  # ]
     211 [ -  + ][ #  # ]:         77 :         else SINGLEFACTORY( XMLDrawMetaImportOasis )
         [ #  # ][ #  # ]
     212 [ -  + ][ #  # ]:         77 :         else SINGLEFACTORY( XMLDrawSettingsImportOasis )
         [ #  # ][ #  # ]
     213                 :            : 
     214                 :            :         // draw oasis export
     215 [ -  + ][ #  # ]:         77 :         else SINGLEFACTORY( XMLDrawExportOasis )
         [ #  # ][ #  # ]
     216 [ +  + ][ +  - ]:         77 :         else SINGLEFACTORY( XMLDrawStylesExportOasis )
         [ +  - ][ +  - ]
     217 [ +  + ][ +  - ]:         75 :         else SINGLEFACTORY( XMLDrawContentExportOasis )
         [ +  - ][ +  - ]
     218 [ +  + ][ +  - ]:         73 :         else SINGLEFACTORY( XMLDrawMetaExportOasis )
         [ +  - ][ +  - ]
     219 [ +  + ][ +  - ]:         71 :         else SINGLEFACTORY( XMLDrawSettingsExportOasis )
         [ +  - ][ +  - ]
     220                 :            : 
     221                 :            :         // draw OOo export
     222 [ +  + ][ +  - ]:         69 :         else SINGLEFACTORY( XMLDrawExportOOO )
         [ +  - ][ +  - ]
     223 [ +  + ][ +  - ]:         67 :         else SINGLEFACTORY( XMLDrawStylesExportOOO )
         [ +  - ][ +  - ]
     224 [ +  + ][ +  - ]:         65 :         else SINGLEFACTORY( XMLDrawContentExportOOO )
         [ +  - ][ +  - ]
     225 [ +  + ][ +  - ]:         61 :         else SINGLEFACTORY( XMLDrawMetaExportOOO )
         [ +  - ][ +  - ]
     226 [ +  + ][ +  - ]:         57 :         else SINGLEFACTORY( XMLDrawSettingsExportOOO )
         [ +  - ][ +  - ]
     227                 :            : 
     228                 :            :         // drawing layer export
     229 [ -  + ][ #  # ]:         55 :         else SINGLEFACTORY( XMLDrawingLayerExport )
         [ #  # ][ #  # ]
     230                 :            : 
     231                 :            :         // impress xml clipboard export
     232 [ -  + ][ #  # ]:         55 :         else SINGLEFACTORY( XMLImpressClipboardExport )
         [ #  # ][ #  # ]
     233                 :            : 
     234                 :            :         // chart oasis import
     235 [ -  + ][ #  # ]:         55 :         else SINGLEFACTORY( SchXMLImport )
         [ #  # ][ #  # ]
     236 [ -  + ][ #  # ]:         55 :         else SINGLEFACTORY( SchXMLImport_Meta )
         [ #  # ][ #  # ]
     237 [ +  + ][ +  - ]:         55 :         else SINGLEFACTORY( SchXMLImport_Styles )
         [ +  - ][ +  - ]
     238 [ +  + ][ +  - ]:         53 :         else SINGLEFACTORY( SchXMLImport_Content )
         [ +  - ][ +  - ]
     239                 :            : 
     240                 :            :         // chart oasis export
     241 [ -  + ][ #  # ]:         51 :         else SINGLEFACTORY( SchXMLExport_Oasis )
         [ #  # ][ #  # ]
     242 [ +  + ][ +  - ]:         51 :         else SINGLEFACTORY( SchXMLExport_Oasis_Meta )
         [ +  - ][ +  - ]
     243 [ +  + ][ +  - ]:         46 :         else SINGLEFACTORY( SchXMLExport_Oasis_Styles )
         [ +  - ][ +  - ]
     244 [ +  + ][ +  - ]:         41 :         else SINGLEFACTORY( SchXMLExport_Oasis_Content )
         [ +  - ][ +  - ]
     245                 :            : 
     246                 :            :         // chart OOo export
     247 [ -  + ][ #  # ]:         36 :         else SINGLEFACTORY( SchXMLExport )
         [ #  # ][ #  # ]
     248 [ -  + ][ #  # ]:         36 :         else SINGLEFACTORY( SchXMLExport_Styles )
         [ #  # ][ #  # ]
     249 [ -  + ][ #  # ]:         36 :         else SINGLEFACTORY( SchXMLExport_Content )
         [ #  # ][ #  # ]
     250                 :            : 
     251                 :            :         // meta import/export
     252 [ +  + ][ +  - ]:         36 :         else SINGLEFACTORY( XMLMetaExportComponent )
         [ +  - ][ +  - ]
     253 [ +  + ][ +  - ]:         34 :         else SINGLEFACTORY( XMLMetaImportComponent )
         [ +  - ][ +  - ]
     254                 :            : 
     255 [ +  - ][ +  - ]:         30 :         else SINGLEFACTORY( XMLVersionListPersistence )
         [ +  - ][ +  - ]
     256                 :            : 
     257                 :            :         // meta import/export OOo
     258 [ #  # ][ #  # ]:          0 :         else SINGLEFACTORY( XMLMetaExportOOO )
         [ #  # ][ #  # ]
     259                 :            : 
     260                 :            :         // auto text import/export
     261 [ #  # ][ #  # ]:          0 :         else SINGLEFACTORY( XMLAutoTextEventExport )
         [ #  # ][ #  # ]
     262 [ #  # ][ #  # ]:          0 :         else SINGLEFACTORY( XMLAutoTextEventImport )
         [ #  # ][ #  # ]
     263 [ #  # ][ #  # ]:          0 :         else SINGLEFACTORY( XMLAutoTextEventExportOOO )
         [ #  # ][ #  # ]
     264                 :            : 
     265         [ +  - ]:        125 :         if( xFactory.is())
     266                 :            :         {
     267         [ +  - ]:        125 :             xFactory->acquire();
     268         [ +  - ]:        125 :             pRet = xFactory.get();
     269                 :        125 :         }
     270                 :            :     }
     271                 :        125 :     return pRet;
     272                 :            : }
     273                 :            : 
     274                 :            : #ifdef __cplusplus
     275                 :            : }
     276                 :            : #endif
     277                 :            : 
     278                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10