Coverage Report

Created: 2026-10-14 09:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sw/inc/unobaseclass.hxx
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
#ifndef INCLUDED_SW_INC_UNOBASECLASS_HXX
20
#define INCLUDED_SW_INC_UNOBASECLASS_HXX
21
22
#include <memory>
23
#include <com/sun/star/lang/XServiceInfo.hpp>
24
#include <com/sun/star/container/XEnumeration.hpp>
25
26
#include <cppuhelper/implbase.hxx>
27
28
#include <o3tl/typed_flags_set.hxx>
29
30
#include <vcl/svapp.hxx>
31
32
class SwDoc;
33
class SwUnoTableCursor;
34
35
typedef ::cppu::WeakImplHelper
36
<   css::lang::XServiceInfo
37
,   css::container::XEnumeration
38
>
39
SwSimpleEnumeration_Base;
40
41
enum class CursorType
42
{
43
    Body,
44
    Frame,
45
    TableText,
46
    Footnote,
47
    Header,
48
    Footer,
49
    Redline,
50
    All,         // for Search&Replace
51
    Selection,   // create a paragraph enumeration from
52
                        // a text range or cursor
53
    SelectionInTable,
54
    Meta,         // meta/meta-field
55
    ContentControl,
56
};
57
58
namespace sw {
59
60
enum class DeleteAndInsertMode
61
{
62
    Default = 0,
63
    ForceExpandHints = (1<<0),
64
    ForceReplace = (1<<1),
65
};
66
67
} // namespace sw
68
69
namespace o3tl
70
{
71
    template<> struct typed_flags<::sw::DeleteAndInsertMode> : is_typed_flags<::sw::DeleteAndInsertMode, 0x03> {};
72
}
73
74
/*
75
    Start/EndAction or Start/EndAllAction
76
*/
77
class UnoActionContext
78
{
79
private:
80
        SwDoc * m_pDoc;
81
82
public:
83
        UnoActionContext(SwDoc *const pDoc);
84
        ~UnoActionContext() COVERITY_NOEXCEPT_FALSE;
85
};
86
87
/*
88
    interrupt Actions for a little while
89
    FIXME: this is a vile abomination that may cause recursive layout actions!
90
    C'thulhu fhtagn.
91
*/
92
class UnoActionRemoveContext
93
{
94
private:
95
    SwDoc *const m_pDoc;
96
97
public:
98
    UnoActionRemoveContext(SwDoc *const pDoc);
99
    UnoActionRemoveContext(SwUnoTableCursor const& rCursor);
100
    ~UnoActionRemoveContext() COVERITY_NOEXCEPT_FALSE;
101
};
102
103
namespace sw {
104
    template<typename T>
105
    struct UnoImplPtrDeleter
106
    {
107
        void operator()(T* pUnoImpl)
108
1.46M
        {
109
1.46M
            SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex
110
1.46M
            delete pUnoImpl;
111
1.46M
        }
sw::UnoImplPtrDeleter<SwXBookmark::Impl>::operator()(SwXBookmark::Impl*)
Line
Count
Source
108
10.0k
        {
109
10.0k
            SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex
110
10.0k
            delete pUnoImpl;
111
10.0k
        }
sw::UnoImplPtrDeleter<SwXContentControl::Impl>::operator()(SwXContentControl::Impl*)
Line
Count
Source
108
497
        {
109
497
            SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex
110
497
            delete pUnoImpl;
111
497
        }
sw::UnoImplPtrDeleter<SwXFieldMaster::Impl>::operator()(SwXFieldMaster::Impl*)
Line
Count
Source
108
993k
        {
109
993k
            SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex
110
993k
            delete pUnoImpl;
111
993k
        }
sw::UnoImplPtrDeleter<SwXTextField::Impl>::operator()(SwXTextField::Impl*)
Line
Count
Source
108
13.7k
        {
109
13.7k
            SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex
110
13.7k
            delete pUnoImpl;
111
13.7k
        }
sw::UnoImplPtrDeleter<SwXFieldEnumeration::Impl>::operator()(SwXFieldEnumeration::Impl*)
Line
Count
Source
108
11.9k
        {
109
11.9k
            SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex
110
11.9k
            delete pUnoImpl;
111
11.9k
        }
sw::UnoImplPtrDeleter<SwXFootnote::Impl>::operator()(SwXFootnote::Impl*)
Line
Count
Source
108
5.04k
        {
109
5.04k
            SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex
110
5.04k
            delete pUnoImpl;
111
5.04k
        }
sw::UnoImplPtrDeleter<SwXDocumentIndex::Impl>::operator()(SwXDocumentIndex::Impl*)
Line
Count
Source
108
4.07k
        {
109
4.07k
            SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex
110
4.07k
            delete pUnoImpl;
111
4.07k
        }
sw::UnoImplPtrDeleter<SwXDocumentIndexMark::Impl>::operator()(SwXDocumentIndexMark::Impl*)
Line
Count
Source
108
21
        {
109
21
            SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex
110
21
            delete pUnoImpl;
111
21
        }
Unexecuted instantiation: sw::UnoImplPtrDeleter<SwXLineBreak::Impl>::operator()(SwXLineBreak::Impl*)
sw::UnoImplPtrDeleter<SwXReferenceMark::Impl>::operator()(SwXReferenceMark::Impl*)
Line
Count
Source
108
5
        {
109
5
            SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex
110
5
            delete pUnoImpl;
111
5
        }
Unexecuted instantiation: sw::UnoImplPtrDeleter<SwXMeta::Impl>::operator()(SwXMeta::Impl*)
sw::UnoImplPtrDeleter<SwXTextSection::Impl>::operator()(SwXTextSection::Impl*)
Line
Count
Source
108
4.23k
        {
109
4.23k
            SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex
110
4.23k
            delete pUnoImpl;
111
4.23k
        }
sw::UnoImplPtrDeleter<SwXNumberingRules::Impl>::operator()(SwXNumberingRules::Impl*)
Line
Count
Source
108
320k
        {
109
320k
            SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex
110
320k
            delete pUnoImpl;
111
320k
        }
sw::UnoImplPtrDeleter<SwXTextTable::Impl>::operator()(SwXTextTable::Impl*)
Line
Count
Source
108
9.73k
        {
109
9.73k
            SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex
110
9.73k
            delete pUnoImpl;
111
9.73k
        }
Unexecuted instantiation: sw::UnoImplPtrDeleter<SwXCellRange::Impl>::operator()(SwXCellRange::Impl*)
sw::UnoImplPtrDeleter<SwXTableRows::Impl>::operator()(SwXTableRows::Impl*)
Line
Count
Source
108
4.00k
        {
109
4.00k
            SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex
110
4.00k
            delete pUnoImpl;
111
4.00k
        }
Unexecuted instantiation: sw::UnoImplPtrDeleter<SwXTableColumns::Impl>::operator()(SwXTableColumns::Impl*)
sw::UnoImplPtrDeleter<SwXHeadFootText::Impl>::operator()(SwXHeadFootText::Impl*)
Line
Count
Source
108
14.1k
        {
109
14.1k
            SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex
110
14.1k
            delete pUnoImpl;
111
14.1k
        }
Unexecuted instantiation: sw::UnoImplPtrDeleter<SwXTextMarkup::Impl>::operator()(SwXTextMarkup::Impl*)
sw::UnoImplPtrDeleter<SwXTextDocument::Impl>::operator()(SwXTextDocument::Impl*)
Line
Count
Source
108
77.3k
        {
109
77.3k
            SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex
110
77.3k
            delete pUnoImpl;
111
77.3k
        }
112
    };
113
    /// Smart pointer class ensuring that the pointed object is deleted with a locked SolarMutex.
114
    template<typename T>
115
    using UnoImplPtr = std::unique_ptr<T, UnoImplPtrDeleter<T> >;
116
117
} // namespace sw
118
119
#endif // INCLUDED_SW_INC_UNOBASECLASS_HXX
120
121
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */