Line data Source code
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 <osl/diagnose.h>
28 : #include <cppuhelper/factory.hxx>
29 : #include <sfx2/sfxmodelfactory.hxx>
30 : #include <vcl/svapp.hxx>
31 :
32 : #include <string.h>
33 :
34 : using namespace ::com::sun::star;
35 : using namespace ::com::sun::star::lang;
36 :
37 : // #i73788#
38 : #include <cppuhelper/implementationentry.hxx>
39 : #include <finalthreadmanager.hxx>
40 :
41 : extern "C"
42 : {
43 :
44 59 : SAL_DLLPUBLIC_EXPORT void * SAL_CALL sw_component_getFactory(
45 : const sal_Char * pImplName,
46 : void * pServiceManager,
47 : void * )
48 : {
49 59 : void * pRet = 0;
50 59 : if( pServiceManager )
51 : {
52 : uno::Reference< XMultiServiceFactory > xMSF(
53 59 : static_cast< XMultiServiceFactory * >( pServiceManager ) );
54 :
55 118 : uno::Reference< XSingleServiceFactory > xFactory;
56 :
57 59 : const sal_Int32 nImplNameLen = strlen( pImplName );
58 118 : if( SwTextDocument_getImplementationName().equalsAsciiL(
59 118 : pImplName, nImplNameLen ) )
60 : {
61 116 : xFactory = ::sfx2::createSfxModelFactory( xMSF,
62 : SwTextDocument_getImplementationName(),
63 : SwTextDocument_createInstance,
64 58 : SwTextDocument_getSupportedServiceNames() );
65 : }
66 2 : else if( SwUnoModule_getImplementationName().equalsAsciiL(
67 2 : pImplName, nImplNameLen ) )
68 : {
69 2 : xFactory = ::cppu::createSingleFactory( xMSF,
70 : SwUnoModule_getImplementationName(),
71 : SwUnoModule_createInstance,
72 1 : SwUnoModule_getSupportedServiceNames() );
73 : }
74 :
75 59 : if( xFactory.is())
76 : {
77 59 : xFactory->acquire();
78 59 : pRet = xFactory.get();
79 59 : }
80 : }
81 59 : return pRet;
82 : }
83 :
84 : } // extern "C"
85 :
86 : extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL
87 8 : SwXMailMerge_get_implementation(::com::sun::star::uno::XComponentContext*,
88 : ::com::sun::star::uno::Sequence<css::uno::Any> const &)
89 : {
90 : #if HAVE_FEATURE_DBCONNECTIVITY
91 8 : SolarMutexGuard aGuard;
92 :
93 : //the module may not be loaded
94 8 : SwGlobals::ensure();
95 8 : return cppu::acquire(new SwXMailMerge());
96 : #else
97 : return nullptr;
98 : #endif
99 : }
100 :
101 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|