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 "fpicker.hxx"
30 #include "provider.hxx"
31 #include "renderer.hxx"
32 #include "unowizard.hxx"
34 #include "comphelper/servicedecl.hxx"
36 #include "cppuhelper/implementationentry.hxx"
38 using namespace ::com::sun::star
;
39 using namespace ::com::sun::star::uno
;
40 using namespace ::com::sun::star::registry
;
41 using namespace ::com::sun::star::lang
;
42 using namespace unographic
;
45 namespace sdecl
= comphelper::service_decl
;
47 namespace unographic
{
48 extern sdecl::ServiceDecl
const serviceDecl
;
51 // -------------------------------------------------------------------------------------
53 // for CreateInstance functions implemented elsewhere
54 #define DECLARE_CREATEINSTANCE( ImplName ) \
55 Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& );
57 // for CreateInstance functions implemented elsewhere, while the function is within a namespace
58 #define DECLARE_CREATEINSTANCE_NAMESPACE( nmspe, ImplName ) \
60 Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& ); \
65 static const struct ::cppu::ImplementationEntry s_aServiceEntries
[] =
68 ::svt::uno::Wizard::Create
,
69 ::svt::uno::Wizard::getImplementationName_static
,
70 ::svt::uno::Wizard::getSupportedServiceNames_static
,
71 ::cppu::createSingleComponentFactory
, NULL
, 0
74 FilePicker_CreateInstance
,
75 FilePicker_getImplementationName
,
76 FilePicker_getSupportedServiceNames
,
77 ::cppu::createSingleComponentFactory
, 0, 0
80 FolderPicker_CreateInstance
,
81 FolderPicker_getImplementationName
,
82 FolderPicker_getSupportedServiceNames
,
83 ::cppu::createSingleComponentFactory
, 0, 0
89 // -------------------------------------------------------------------------------------
91 DECLARE_CREATEINSTANCE_NAMESPACE( svt
, OAddressBookSourceDialogUno
)
92 DECLARE_CREATEINSTANCE( SvFilterOptionsDialog
)
93 DECLARE_CREATEINSTANCE_NAMESPACE( unographic
, GraphicProvider
)
94 DECLARE_CREATEINSTANCE_NAMESPACE( unographic
, GraphicRendererVCL
)
96 // -------------------------------------------------------------------------------------
100 SAL_DLLPUBLIC_EXPORT
void * SAL_CALL
svt_component_getFactory (
101 const sal_Char
* pImplementationName
, void * _pServiceManager
, void * pRegistryKey
)
104 if ( _pServiceManager
)
106 Reference
< XMultiServiceFactory
> xSMgr(reinterpret_cast< XMultiServiceFactory
* >( _pServiceManager
) );
108 Reference
< XSingleServiceFactory
> xFactory
;
109 if (rtl_str_compare (
110 pImplementationName
, "com.sun.star.comp.svtools.OAddressBookSourceDialogUno") == 0)
112 Sequence
< OUString
> aServiceNames(1);
113 aServiceNames
.getArray()[0] =
114 OUString( "com.sun.star.ui.AddressBookSourceDialog" );
116 xFactory
= ::cppu::createSingleFactory (xSMgr
,
117 OUString::createFromAscii( pImplementationName
),
118 svt::OAddressBookSourceDialogUno_CreateInstance
,
121 else if (rtl_str_compare (
122 pImplementationName
, "com.sun.star.svtools.SvFilterOptionsDialog") == 0)
124 Sequence
< OUString
> aServiceNames(1);
125 aServiceNames
.getArray()[0] =
126 OUString( "com.sun.star.ui.dialogs.FilterOptionsDialog" );
128 xFactory
= ::cppu::createSingleFactory (xSMgr
,
129 OUString::createFromAscii( pImplementationName
),
130 SvFilterOptionsDialog_CreateInstance
,
133 else if( GraphicProvider::getImplementationName_Static().equalsAscii( pImplementationName
) )
135 xFactory
= ::cppu::createOneInstanceFactory(xSMgr
,
136 GraphicProvider::getImplementationName_Static(),
137 GraphicProvider_CreateInstance
,
138 GraphicProvider::getSupportedServiceNames_Static() );
140 else if( GraphicRendererVCL::getImplementationName_Static().equalsAscii( pImplementationName
) )
142 xFactory
= ::cppu::createOneInstanceFactory(xSMgr
,
143 GraphicRendererVCL::getImplementationName_Static(),
144 GraphicRendererVCL_CreateInstance
,
145 GraphicRendererVCL::getSupportedServiceNames_Static() );
149 pResult
= comphelper::service_decl::component_getFactoryHelper(
151 static_cast<css::lang::XMultiServiceFactory
*>(
153 static_cast<css::registry::XRegistryKey
*>(pRegistryKey
),
156 pResult
= cppu::component_getFactoryHelper(
157 pImplementationName
, _pServiceManager
, pRegistryKey
,
164 pResult
= xFactory
.get();
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */