LibreOffice Module sw (master)  1
unofreg.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 <config_features.h>
21 
22 #include <SwXFilterOptions.hxx>
23 #include <swdll.hxx>
24 #include <unofreg.hxx>
25 #include <unomailmerge.hxx>
26 #include <sal/types.h>
27 #include <cppuhelper/factory.hxx>
28 #include <sfx2/sfxmodelfactory.hxx>
29 #include <vcl/svapp.hxx>
30 
31 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
32 
33 #include <string.h>
34 
35 using namespace ::com::sun::star;
36 using namespace ::com::sun::star::lang;
37 
38 // #i73788#
40 #include <finalthreadmanager.hxx>
41 
42 extern "C"
43 {
44 
45 SAL_DLLPUBLIC_EXPORT void * sw_component_getFactory(
46  const sal_Char * pImplName,
47  void * pServiceManager,
48  void * )
49 {
50  void * pRet = nullptr;
51  if( pServiceManager )
52  {
53  uno::Reference< XMultiServiceFactory > xMSF(
54  static_cast< XMultiServiceFactory * >( pServiceManager ) );
55 
56  uno::Reference< XSingleServiceFactory > xFactory;
57 
58  const sal_Int32 nImplNameLen = strlen( pImplName );
59  if( SwTextDocument_getImplementationName().equalsAsciiL(
60  pImplName, nImplNameLen ) )
61  {
62  xFactory = ::sfx2::createSfxModelFactory( xMSF,
66  }
67 
68  if( xFactory.is())
69  {
70  xFactory->acquire();
71  pRet = xFactory.get();
72  }
73  }
74  return pRet;
75 }
76 
77 } // extern "C"
78 
79 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
80 SwXMailMerge_get_implementation(css::uno::XComponentContext*,
81  css::uno::Sequence<css::uno::Any> const &)
82 {
83 #if HAVE_FEATURE_DBCONNECTIVITY
84  SolarMutexGuard aGuard;
85 
86  //the module may not be loaded
88  return cppu::acquire(new SwXMailMerge());
89 #else
90  return nullptr;
91 #endif
92 }
93 
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Sequence< OUString > SwTextDocument_getSupportedServiceNames()
Definition: unodoc.cxx:33
css::uno::Reference< css::uno::XInterface > SwTextDocument_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory > &rSMgr, SfxModelFlags _nCreationFlags)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SwXMailMerge_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Definition: unofreg.cxx:80
char sal_Char
SAL_DLLPUBLIC_EXPORT void * sw_component_getFactory(const sal_Char *pImplName, void *pServiceManager, void *)
Definition: unofreg.cxx:45
void ensure()
Definition: swdll.cxx:69
OUString SwTextDocument_getImplementationName()
Definition: unodoc.cxx:41