Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / embedserv / source / embed / register.cxx
blobcd28a61d5470d25faa956b83332fb5768f5f1ab7
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 .
19 #ifdef _MSC_VER
20 #pragma warning(disable : 4917 4555)
21 #endif
23 #ifdef __MINGW32__
24 #define INITGUID
25 #endif
26 #include "servprov.hxx"
27 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
28 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
29 #include <com/sun/star/registry/XRegistryKey.hpp>
30 #include <com/sun/star/registry/InvalidRegistryException.hpp>
31 #include <rtl/ustring.h>
32 #include <cppuhelper/factory.hxx>
35 using namespace ::com::sun::star;
38 uno::Reference<uno::XInterface> SAL_CALL EmbedServer_createInstance(
39 const uno::Reference<lang::XMultiServiceFactory> & xSMgr)
40 throw (uno::Exception)
42 uno::Reference<uno::XInterface > xService = *new EmbedServer_Impl( xSMgr );
43 return xService;
46 OUString SAL_CALL EmbedServer_getImplementationName() throw()
48 return OUString("com.sun.star.comp.ole.EmbedServer");
52 uno::Sequence< OUString > SAL_CALL EmbedServer_getSupportedServiceNames() throw()
54 uno::Sequence<OUString> aServiceNames { "com.sun.star.document.OleEmbeddedServerRegistration" };
55 return aServiceNames;
58 extern "C" {
60 SAL_DLLPUBLIC_EXPORT void * SAL_CALL emser_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
62 void * pRet = 0;
64 OUString aImplName( OUString::createFromAscii( pImplName ) );
65 uno::Reference< lang::XSingleServiceFactory > xFactory;
67 if(pServiceManager && aImplName.equals( EmbedServer_getImplementationName() ) )
69 xFactory= ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>(pServiceManager),
70 EmbedServer_getImplementationName(),
71 EmbedServer_createInstance,
72 EmbedServer_getSupportedServiceNames() );
75 if (xFactory.is())
77 xFactory->acquire();
78 pRet = xFactory.get();
81 return pRet;
84 } // extern "C"
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */