LibreOffice Module extensions (master) 1
servreg.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <osl/time.h>
21#include "ole2uno.hxx"
22#include "servprov.hxx"
23#include <rtl/ustring.hxx>
25
26using namespace cppu;
27
29{
31 return xService;
32}
33
35{
37 return xService;
38}
39
41{
42 Reference<XInterface> xService = *new OleClient( xSMgr);
43 return xService;
44}
45
47{
48 Reference<XInterface > xService = *new OleServer(xSMgr);
49 return xService;
50}
51
52extern "C" SAL_DLLPUBLIC_EXPORT void * oleautobridge_component_getFactory(
53 const char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
54{
55 void * pRet = nullptr;
56
57 OUString aImplName( OUString::createFromAscii( pImplName ) );
59 Sequence<OUString> seqServiceNames;
60 if (pServiceManager && aImplName == "com.sun.star.comp.ole.OleConverter2")
61 {
62 xFactory= createSingleFactory( static_cast< XMultiServiceFactory*>(pServiceManager),
63 aImplName,
64 ConverterProvider_CreateInstance2, seqServiceNames );
65 }
66 else if (pServiceManager && aImplName == "com.sun.star.comp.ole.OleConverterVar1")
67 {
68 xFactory= createSingleFactory( static_cast<XMultiServiceFactory*>(pServiceManager),
69 aImplName,
70 ConverterProvider_CreateInstanceVar1, seqServiceNames );
71 }
72 else if(pServiceManager && aImplName == "com.sun.star.comp.ole.OleClient")
73 {
74 xFactory= createSingleFactory( static_cast< XMultiServiceFactory*>(pServiceManager),
75 aImplName,
76 OleClient_CreateInstance, seqServiceNames );
77 }
78 else if(pServiceManager && aImplName == "com.sun.star.comp.ole.OleServer")
79 {
80 xFactory= createOneInstanceFactory( static_cast< XMultiServiceFactory*>(pServiceManager),
81 aImplName,
82 OleServer_CreateInstance, seqServiceNames );
83 }
84
85 if (xFactory.is())
86 {
87 xFactory->acquire();
88 pRet = xFactory.get();
89 }
90
91 return pRet;
92}
93
94/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XMultiServiceFactory > xSMgr
Reference< XSingleServiceFactory > xFactory
Reference< XSingleServiceFactory > SAL_CALL createOneInstanceFactory(const Reference< XMultiServiceFactory > &rServiceManager, const OUString &rImplementationName, ComponentInstantiation pCreateFunction, const Sequence< OUString > &rServiceNames, rtl_ModuleCount *)
css::uno::Reference< css::uno::XInterface >(SAL_CALL *ComponentInstantiation)(const css CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL createSingleFactory(const css::uno::Reference< css::lang::XMultiServiceFactory > &rServiceManager, const ::rtl::OUString &rImplementationName, ComponentInstantiation pCreateFunction, const css::uno::Sequence< ::rtl::OUString > &rServiceNames, rtl_ModuleCount *pModCount=NULL)
Reference< XInterface > OleClient_CreateInstance(const Reference< XMultiServiceFactory > &xSMgr)
Definition: servreg.cxx:40
SAL_DLLPUBLIC_EXPORT void * oleautobridge_component_getFactory(const char *pImplName, void *pServiceManager, void *)
Definition: servreg.cxx:52
Reference< XInterface > OleServer_CreateInstance(const Reference< XMultiServiceFactory > &xSMgr)
Definition: servreg.cxx:46
Reference< XInterface > ConverterProvider_CreateInstanceVar1(const Reference< XMultiServiceFactory > &xSMgr)
Definition: servreg.cxx:34
Reference< XInterface > ConverterProvider_CreateInstance2(const Reference< XMultiServiceFactory > &xSMgr)
Definition: servreg.cxx:28
#define IUNKNOWN_WRAPPER_IMPL
#define UNO_OBJECT_WRAPPER_REMOTE_OPT