Stop leaking all ScPostIt instances.
[LibreOffice.git] / embedserv / source / embed / register.cxx
blob85b9c4bcc11ad4f2fba4e4b552aaa135bf0e23f2
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( 1 );
55 aServiceNames[0] = "com.sun.star.document.OleEmbeddedServerRegistration";
56 return aServiceNames;
59 extern "C" {
61 SAL_DLLPUBLIC_EXPORT void * SAL_CALL emser_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
63 void * pRet = 0;
65 OUString aImplName( OUString::createFromAscii( pImplName ) );
66 uno::Reference< lang::XSingleServiceFactory > xFactory;
68 if(pServiceManager && aImplName.equals( EmbedServer_getImplementationName() ) )
70 xFactory= ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>(pServiceManager),
71 EmbedServer_getImplementationName(),
72 EmbedServer_createInstance,
73 EmbedServer_getSupportedServiceNames() );
76 if (xFactory.is())
78 xFactory->acquire();
79 pRet = xFactory.get();
82 return pRet;
85 } // extern "C"
87 // Fix strange warnings about some
88 // ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions.
89 // warning C4505: 'xxx' : unreferenced local function has been removed
90 #if defined(_MSC_VER)
91 #pragma warning(disable: 4505)
92 #endif
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */