Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / embedserv / source / embed / register.cxx
blob8f593d877a1f9f56076fbad45ac93ec5c4e1de4b
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 <servprov.hxx>
21 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
22 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
23 #include <com/sun/star/registry/XRegistryKey.hpp>
24 #include <com/sun/star/registry/InvalidRegistryException.hpp>
25 #include <rtl/ustring.h>
26 #include <cppuhelper/factory.hxx>
29 using namespace ::com::sun::star;
31 /// @throws uno::Exception
32 static uno::Reference<uno::XInterface> EmbedServer_createInstance(
33 const uno::Reference<lang::XMultiServiceFactory> & xSMgr)
35 uno::Reference<uno::XInterface > xService = *new EmbedServer_Impl( xSMgr );
36 return xService;
39 static OUString EmbedServer_getImplementationName() throw()
41 return "com.sun.star.comp.ole.EmbedServer";
45 static uno::Sequence< OUString > EmbedServer_getSupportedServiceNames() throw()
47 uno::Sequence<OUString> aServiceNames { "com.sun.star.document.OleEmbeddedServerRegistration" };
48 return aServiceNames;
51 extern "C" {
53 SAL_DLLPUBLIC_EXPORT void * emser_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
55 void * pRet = nullptr;
57 OUString aImplName( OUString::createFromAscii( pImplName ) );
58 uno::Reference< lang::XSingleServiceFactory > xFactory;
60 if(pServiceManager && aImplName.equals( EmbedServer_getImplementationName() ) )
62 xFactory= ::cppu::createOneInstanceFactory( static_cast< lang::XMultiServiceFactory*>(pServiceManager),
63 EmbedServer_getImplementationName(),
64 EmbedServer_createInstance,
65 EmbedServer_getSupportedServiceNames() );
68 if (xFactory.is())
70 xFactory->acquire();
71 pRet = xFactory.get();
74 return pRet;
77 } // extern "C"
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */