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

Generated by: LCOV version 1.10