bump product version to 5.0.4.1
[LibreOffice.git] / extensions / source / ole / servreg.cxx
blob60e39ae25df089e6dd8752108ad8db816d7ed95f
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>
25 using namespace ole_adapter;
26 using namespace cppu;
29 namespace ole_adapter
32 Reference<XInterface> SAL_CALL ConverterProvider_CreateInstance2( const Reference<XMultiServiceFactory> & xSMgr)
33 throw(Exception)
35 Reference<XInterface> xService = *new OleConverter_Impl2( xSMgr);
36 return xService;
39 Reference<XInterface> SAL_CALL ConverterProvider_CreateInstanceVar1( const Reference<XMultiServiceFactory> & xSMgr)
40 throw(Exception)
42 Reference<XInterface> xService = *new OleConverter_Impl2( xSMgr, UNO_OBJECT_WRAPPER_REMOTE_OPT, IUNKNOWN_WRAPPER_IMPL);
43 return xService;
46 Reference<XInterface> SAL_CALL OleClient_CreateInstance( const Reference<XMultiServiceFactory> & xSMgr)
47 throw(Exception)
49 Reference<XInterface> xService = *new OleClient_Impl( xSMgr);
50 return xService;
53 Reference<XInterface> SAL_CALL OleServer_CreateInstance( const Reference<XMultiServiceFactory> & xSMgr)
54 throw (Exception)
56 Reference<XInterface > xService = *new OleServer_Impl(xSMgr);
57 return xService;
59 } // end namespace
61 extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL oleautobridge_component_getFactory(
62 const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
64 void * pRet = 0;
66 OUString aImplName( OUString::createFromAscii( pImplName ) );
67 Reference< XSingleServiceFactory > xFactory;
68 Sequence<OUString> seqServiceNames;
69 if (pServiceManager && aImplName.equals( reinterpret_cast<const sal_Unicode*>(L"com.sun.star.comp.ole.OleConverter2") ))
71 xFactory= createSingleFactory( reinterpret_cast< XMultiServiceFactory*>(pServiceManager),
72 OUString("com.sun.star.comp.ole.OleConverter2"),
73 ConverterProvider_CreateInstance2, seqServiceNames );
75 else if (pServiceManager && aImplName.equals( reinterpret_cast<const sal_Unicode*>(L"com.sun.star.comp.ole.OleConverterVar1") ))
77 xFactory= createSingleFactory( reinterpret_cast<XMultiServiceFactory*>(pServiceManager),
78 OUString("com.sun.star.comp.ole.OleConverterVar1"),
79 ConverterProvider_CreateInstanceVar1, seqServiceNames );
81 else if(pServiceManager && aImplName.equals(reinterpret_cast<const sal_Unicode*>(L"com.sun.star.comp.ole.OleClient")))
83 xFactory= createSingleFactory( reinterpret_cast< XMultiServiceFactory*>(pServiceManager),
84 OUString("com.sun.star.comp.ole.OleClient"),
85 OleClient_CreateInstance, seqServiceNames );
87 else if(pServiceManager && aImplName.equals(reinterpret_cast<const sal_Unicode*>(L"com.sun.star.comp.ole.OleServer")))
89 xFactory= createOneInstanceFactory( reinterpret_cast< XMultiServiceFactory*>(pServiceManager),
90 OUString("com.sun.star.comp.ole.OleServer"),
91 OleServer_CreateInstance, seqServiceNames );
94 if (xFactory.is())
96 xFactory->acquire();
97 pRet = xFactory.get();
100 return pRet;
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */