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 .
21 #include <config_vclplug.h>
22 #include "KDriver.hxx"
23 #include <cppuhelper/factory.hxx>
27 #define kab_component_getFactory tdeab_component_getFactory
31 using namespace connectivity::kab
;
32 using ::com::sun::star::uno::Reference
;
33 using ::com::sun::star::uno::Sequence
;
34 using ::com::sun::star::lang::XSingleServiceFactory
;
35 using ::com::sun::star::lang::XMultiServiceFactory
;
37 typedef Reference
< XSingleServiceFactory
> (SAL_CALL
*createFactoryFunc
)
39 const Reference
< XMultiServiceFactory
> & rServiceManager
,
40 const OUString
& rComponentName
,
41 ::cppu::ComponentInstantiation pCreateFunction
,
42 const Sequence
< OUString
> & rServiceNames
,
47 struct ProviderRequest
49 Reference
< XSingleServiceFactory
> xRet
;
50 Reference
< XMultiServiceFactory
> const xServiceManager
;
51 OUString
const sImplementationName
;
54 void* pServiceManager
,
55 sal_Char
const* pImplementationName
57 : xServiceManager(static_cast<XMultiServiceFactory
*>(pServiceManager
))
58 , sImplementationName(OUString::createFromAscii(pImplementationName
))
64 const OUString
& Implname
,
65 const Sequence
< OUString
> & Services
,
66 ::cppu::ComponentInstantiation Factory
,
67 createFactoryFunc creator
70 if (!xRet
.is() && (Implname
== sImplementationName
))
74 xRet
= creator( xServiceManager
, sImplementationName
,Factory
, Services
,0);
83 void* getProvider() const { return xRet
.get(); }
87 extern "C" SAL_DLLPUBLIC_EXPORT
void* SAL_CALL
kab_component_getFactory(
88 const sal_Char
* pImplementationName
,
89 void* pServiceManager
,
95 ProviderRequest
aReq(pServiceManager
,pImplementationName
);
98 KabDriver::getImplementationName_Static(),
99 KabDriver::getSupportedServiceNames_Static(),
101 ::cppu::createSingleFactory
)
105 aReq
.xRet
->acquire();
107 pRet
= aReq
.getProvider();
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */