1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "sal/types.h"
21 #include "rtl/ustring.hxx"
22 #include <cppuhelper/factory.hxx>
23 #include <cppuhelper/weak.hxx>
24 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
25 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
26 #include <com/sun/star/registry/XRegistryKey.hpp>
27 #include <osl/diagnose.h>
28 #include <uno/mapping.hxx>
29 #include "provider.hxx"
30 #include "renderer.hxx"
31 #include "unowizard.hxx"
33 #include "comphelper/servicedecl.hxx"
35 #include "cppuhelper/implementationentry.hxx"
37 using namespace ::com::sun::star
;
38 using namespace ::com::sun::star::uno
;
39 using namespace ::com::sun::star::registry
;
40 using namespace ::com::sun::star::lang
;
41 using namespace unographic
;
44 namespace sdecl
= comphelper::service_decl
;
46 namespace unographic
{
47 extern sdecl::ServiceDecl
const serviceDecl
;
50 // -------------------------------------------------------------------------------------
52 // for CreateInstance functions implemented elsewhere
53 #define DECLARE_CREATEINSTANCE( ImplName ) \
54 Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& );
56 // for CreateInstance functions implemented elsewhere, while the function is within a namespace
57 #define DECLARE_CREATEINSTANCE_NAMESPACE( nmspe, ImplName ) \
59 Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& ); \
64 static struct ::cppu::ImplementationEntry s_aServiceEntries
[] =
67 ::svt::uno::Wizard::Create
,
68 ::svt::uno::Wizard::getImplementationName_static
,
69 ::svt::uno::Wizard::getSupportedServiceNames_static
,
70 ::cppu::createSingleComponentFactory
, NULL
, 0
76 // -------------------------------------------------------------------------------------
78 DECLARE_CREATEINSTANCE_NAMESPACE( svt
, OAddressBookSourceDialogUno
)
79 DECLARE_CREATEINSTANCE( SvFilterOptionsDialog
)
80 DECLARE_CREATEINSTANCE_NAMESPACE( unographic
, GraphicProvider
)
81 DECLARE_CREATEINSTANCE_NAMESPACE( unographic
, GraphicRendererVCL
)
83 // -------------------------------------------------------------------------------------
87 SAL_DLLPUBLIC_EXPORT
void * SAL_CALL
svt_component_getFactory (
88 const sal_Char
* pImplementationName
, void * _pServiceManager
, void * pRegistryKey
)
91 if ( _pServiceManager
)
93 Reference
< XSingleServiceFactory
> xFactory
;
95 pImplementationName
, "com.sun.star.comp.svtools.OAddressBookSourceDialogUno") == 0)
97 Sequence
< OUString
> aServiceNames(1);
98 aServiceNames
.getArray()[0] =
99 OUString( "com.sun.star.ui.AddressBookSourceDialog" );
101 xFactory
= ::cppu::createSingleFactory (
102 reinterpret_cast< XMultiServiceFactory
* >( _pServiceManager
),
103 OUString::createFromAscii( pImplementationName
),
104 svt::OAddressBookSourceDialogUno_CreateInstance
,
107 else if (rtl_str_compare (
108 pImplementationName
, "com.sun.star.svtools.SvFilterOptionsDialog") == 0)
110 Sequence
< OUString
> aServiceNames(1);
111 aServiceNames
.getArray()[0] =
112 OUString( "com.sun.star.ui.dialogs.FilterOptionsDialog" );
114 xFactory
= ::cppu::createSingleFactory (
115 reinterpret_cast< XMultiServiceFactory
* >( _pServiceManager
),
116 OUString::createFromAscii( pImplementationName
),
117 SvFilterOptionsDialog_CreateInstance
,
120 else if( 0 == GraphicProvider::getImplementationName_Static().compareToAscii( pImplementationName
) )
122 xFactory
= ::cppu::createOneInstanceFactory(
123 reinterpret_cast< lang::XMultiServiceFactory
* >( _pServiceManager
),
124 GraphicProvider::getImplementationName_Static(),
125 GraphicProvider_CreateInstance
,
126 GraphicProvider::getSupportedServiceNames_Static() );
128 else if( 0 == GraphicRendererVCL::getImplementationName_Static().compareToAscii( pImplementationName
) )
130 xFactory
= ::cppu::createOneInstanceFactory(
131 reinterpret_cast< lang::XMultiServiceFactory
* >( _pServiceManager
),
132 GraphicRendererVCL::getImplementationName_Static(),
133 GraphicRendererVCL_CreateInstance
,
134 GraphicRendererVCL::getSupportedServiceNames_Static() );
138 pResult
= component_getFactoryHelper( pImplementationName
, reinterpret_cast< lang::XMultiServiceFactory
* >( _pServiceManager
),reinterpret_cast< registry::XRegistryKey
* >( pRegistryKey
), serviceDecl
);
140 pResult
= ::cppu::component_getFactoryHelper( pImplementationName
, _pServiceManager
, pRegistryKey
, s_aServiceEntries
);
146 pResult
= xFactory
.get();
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */