Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / extensions / source / ole / servreg.cxx
blobcdecefae695c8c928ebe4c82e9a5ca93bc9cdf25
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <osl/time.h>
21 #include "ole2uno.hxx"
22 #include "servprov.hxx"
23 #include <rtl/ustring.hxx>
24 #include <cppuhelper/factory.hxx>
26 using namespace cppu;
28 Reference<XInterface> ConverterProvider_CreateInstance2( const Reference<XMultiServiceFactory> & xSMgr)
30 Reference<XInterface> xService = *new OleConverter( xSMgr);
31 return xService;
34 Reference<XInterface> ConverterProvider_CreateInstanceVar1( const Reference<XMultiServiceFactory> & xSMgr)
36 Reference<XInterface> xService = *new OleConverter( xSMgr, UNO_OBJECT_WRAPPER_REMOTE_OPT, IUNKNOWN_WRAPPER_IMPL);
37 return xService;
40 Reference<XInterface> OleClient_CreateInstance( const Reference<XMultiServiceFactory> & xSMgr)
42 Reference<XInterface> xService = *new OleClient( xSMgr);
43 return xService;
46 Reference<XInterface> OleServer_CreateInstance( const Reference<XMultiServiceFactory> & xSMgr)
48 Reference<XInterface > xService = *new OleServer(xSMgr);
49 return xService;
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),
63 aImplName,
64 ConverterProvider_CreateInstance2, seqServiceNames );
66 else if (pServiceManager && aImplName == "com.sun.star.comp.ole.OleConverterVar1")
68 xFactory= createSingleFactory( static_cast<XMultiServiceFactory*>(pServiceManager),
69 aImplName,
70 ConverterProvider_CreateInstanceVar1, seqServiceNames );
72 else if(pServiceManager && aImplName == "com.sun.star.comp.ole.OleClient")
74 xFactory= createSingleFactory( static_cast< XMultiServiceFactory*>(pServiceManager),
75 aImplName,
76 OleClient_CreateInstance, seqServiceNames );
78 else if(pServiceManager && aImplName == "com.sun.star.comp.ole.OleServer")
80 xFactory= createOneInstanceFactory( static_cast< XMultiServiceFactory*>(pServiceManager),
81 aImplName,
82 OleServer_CreateInstance, seqServiceNames );
85 if (xFactory.is())
87 xFactory->acquire();
88 pRet = xFactory.get();
91 return pRet;
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */