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 "ole2uno.hxx"
22 #include "servprov.hxx"
23 #include <rtl/ustring.hxx>
24 #include <cppuhelper/factory.hxx>
28 Reference
<XInterface
> ConverterProvider_CreateInstance2( const Reference
<XMultiServiceFactory
> & xSMgr
)
30 Reference
<XInterface
> xService
= *new OleConverter( xSMgr
);
34 Reference
<XInterface
> ConverterProvider_CreateInstanceVar1( const Reference
<XMultiServiceFactory
> & xSMgr
)
36 Reference
<XInterface
> xService
= *new OleConverter( xSMgr
, UNO_OBJECT_WRAPPER_REMOTE_OPT
, IUNKNOWN_WRAPPER_IMPL
);
40 Reference
<XInterface
> OleClient_CreateInstance( const Reference
<XMultiServiceFactory
> & xSMgr
)
42 Reference
<XInterface
> xService
= *new OleClient( xSMgr
);
46 Reference
<XInterface
> OleServer_CreateInstance( const Reference
<XMultiServiceFactory
> & xSMgr
)
48 Reference
<XInterface
> xService
= *new OleServer(xSMgr
);
52 extern "C" SAL_DLLPUBLIC_EXPORT
void * oleautobridge_component_getFactory(
53 const sal_Char
* pImplName
, void * pServiceManager
, void * /*pRegistryKey*/ )
55 void * pRet
= nullptr;
57 OUString
aImplName( OUString::createFromAscii( pImplName
) );
58 Reference
< XSingleServiceFactory
> xFactory
;
59 Sequence
<OUString
> seqServiceNames
;
60 if (pServiceManager
&& aImplName
== "com.sun.star.comp.ole.OleConverter2")
62 xFactory
= createSingleFactory( static_cast< XMultiServiceFactory
*>(pServiceManager
),
64 ConverterProvider_CreateInstance2
, seqServiceNames
);
66 else if (pServiceManager
&& aImplName
== "com.sun.star.comp.ole.OleConverterVar1")
68 xFactory
= createSingleFactory( static_cast<XMultiServiceFactory
*>(pServiceManager
),
70 ConverterProvider_CreateInstanceVar1
, seqServiceNames
);
72 else if(pServiceManager
&& aImplName
== "com.sun.star.comp.ole.OleClient")
74 xFactory
= createSingleFactory( static_cast< XMultiServiceFactory
*>(pServiceManager
),
76 OleClient_CreateInstance
, seqServiceNames
);
78 else if(pServiceManager
&& aImplName
== "com.sun.star.comp.ole.OleServer")
80 xFactory
= createOneInstanceFactory( static_cast< XMultiServiceFactory
*>(pServiceManager
),
82 OleServer_CreateInstance
, seqServiceNames
);
88 pRet
= xFactory
.get();
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */