LibreOffice Module sw (master)  1
unodoc.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 <sal/config.h>
21 #include <config_features.h>
22 
23 #include <sfx2/sfxmodelfactory.hxx>
24 #include <swdll.hxx>
25 #include <docsh.hxx>
26 #include <globdoc.hxx>
27 #include <wdocsh.hxx>
28 #include <vcl/svapp.hxx>
29 #include <unomailmerge.hxx>
30 
31 using namespace ::com::sun::star;
32 
33 // com.sun.star.comp.Writer.TextDocument
34 
35 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
37  css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const& args)
38 {
39  SolarMutexGuard aGuard;
41  css::uno::Reference<css::uno::XInterface> xInterface = sfx2::createSfxModelInstance(args,
42  [&](SfxModelFlags _nCreationFlags)
43  {
44  SfxObjectShell* pShell = new SwDocShell( _nCreationFlags );
45  return pShell->GetModel();
46  });
47  xInterface->acquire();
48  return xInterface.get();
49 }
50 
51 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
53  css::uno::Sequence<css::uno::Any> const &)
54 {
55  SolarMutexGuard aGuard;
57  SfxObjectShell* pShell = new SwWebDocShell;
58  uno::Reference< uno::XInterface > model( pShell->GetModel() );
59  model->acquire();
60  return model.get();
61 }
62 
63 
64 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
66  css::uno::Sequence<css::uno::Any> const &)
67 {
68  SolarMutexGuard aGuard;
70  SfxObjectShell* pShell = new SwGlobalDocShell( SfxObjectCreateMode::STANDARD );
71  uno::Reference< uno::XInterface > model( pShell->GetModel() );
72  model->acquire();
73  return model.get();
74 }
75 
76 
77 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
78 SwXMailMerge_get_implementation(css::uno::XComponentContext*,
79  css::uno::Sequence<css::uno::Any> const &)
80 {
81 #if HAVE_FEATURE_DBCONNECTIVITY
82  SolarMutexGuard aGuard;
83 
84  //the module may not be loaded
86  return cppu::acquire(new SwXMailMerge());
87 #else
88  return nullptr;
89 #endif
90 }
91 
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * Writer_SwTextDocument_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &args)
Definition: unodoc.cxx:36
css::uno::Reference< css::frame::XModel > GetModel() const
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Writer_WebDocument_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Definition: unodoc.cxx:52
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Writer_GlobalDocument_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Definition: unodoc.cxx:65
tuple model
void ensure()
Definition: swdll.cxx:67
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SwXMailMerge_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Definition: unodoc.cxx:78
css::uno::Reference< css::uno::XInterface > createSfxModelInstance(const css::uno::Sequence< css::uno::Any > &rxArgs, std::function< css::uno::Reference< css::uno::XInterface >(SfxModelFlags)> creationFunc)
SfxModelFlags