Coverage Report

Created: 2026-03-31 11:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sw/source/uibase/uno/unodoc.cxx
Line
Count
Source
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
#include <config_fuzzers.h>
23
24
#include <com/sun/star/frame/XModel3.hpp>
25
26
#include <sfx2/sfxmodelfactory.hxx>
27
#include <swdll.hxx>
28
#include <docsh.hxx>
29
#include <globdoc.hxx>
30
#include <wdocsh.hxx>
31
#include <vcl/svapp.hxx>
32
#include <unomailmerge.hxx>
33
34
using namespace ::com::sun::star;
35
36
// com.sun.star.comp.Writer.TextDocument
37
38
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
39
Writer_SwTextDocument_get_implementation(
40
    css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const& args)
41
8.17k
{
42
8.17k
    SolarMutexGuard aGuard;
43
8.17k
    SwGlobals::ensure();
44
8.17k
    css::uno::Reference<css::uno::XInterface> xInterface = sfx2::createSfxModelInstance(args,
45
8.17k
        [](SfxModelFlags _nCreationFlags)
46
8.17k
        {
47
8.17k
            rtl::Reference<SfxObjectShell> pShell = new SwDocShell(_nCreationFlags);
48
8.17k
            return pShell->GetModel();
49
8.17k
        });
50
8.17k
    xInterface->acquire();
51
8.17k
    return xInterface.get();
52
8.17k
}
53
54
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
55
com_sun_star_comp_Writer_WebDocument_get_implementation(css::uno::XComponentContext*,
56
                                                        css::uno::Sequence<css::uno::Any> const &)
57
0
{
58
0
    SolarMutexGuard aGuard;
59
0
    SwGlobals::ensure();
60
0
    rtl::Reference<SfxObjectShell> pShell = new SwWebDocShell;
61
0
    uno::Reference< uno::XInterface > model( pShell->GetModel() );
62
0
    model->acquire();
63
0
    return model.get();
64
0
}
65
66
67
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
68
com_sun_star_comp_Writer_GlobalDocument_get_implementation(css::uno::XComponentContext*,
69
                                                           css::uno::Sequence<css::uno::Any> const &)
70
0
{
71
0
    SolarMutexGuard aGuard;
72
0
    SwGlobals::ensure();
73
0
    rtl::Reference<SfxObjectShell> pShell = new SwGlobalDocShell(SfxObjectCreateMode::STANDARD);
74
0
    uno::Reference< uno::XInterface > model( pShell->GetModel() );
75
0
    model->acquire();
76
0
    return model.get();
77
0
}
78
79
80
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
81
SwXMailMerge_get_implementation(css::uno::XComponentContext*,
82
                                css::uno::Sequence<css::uno::Any> const &)
83
0
{
84
#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
85
    SolarMutexGuard aGuard;
86
87
    //the module may not be loaded
88
    SwGlobals::ensure();
89
    return cppu::acquire(new SwXMailMerge());
90
#else
91
0
    return nullptr;
92
0
#endif
93
0
}
94
95
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */