/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.43M | { |
109 | 1.43M | SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex |
110 | 1.43M | delete pUnoImpl; |
111 | 1.43M | } sw::UnoImplPtrDeleter<SwXBookmark::Impl>::operator()(SwXBookmark::Impl*) Line | Count | Source | 108 | 7.85k | { | 109 | 7.85k | SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex | 110 | 7.85k | delete pUnoImpl; | 111 | 7.85k | } |
sw::UnoImplPtrDeleter<SwXContentControl::Impl>::operator()(SwXContentControl::Impl*) Line | Count | Source | 108 | 548 | { | 109 | 548 | SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex | 110 | 548 | delete pUnoImpl; | 111 | 548 | } |
sw::UnoImplPtrDeleter<SwXFieldMaster::Impl>::operator()(SwXFieldMaster::Impl*) Line | Count | Source | 108 | 1.01M | { | 109 | 1.01M | SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex | 110 | 1.01M | delete pUnoImpl; | 111 | 1.01M | } |
sw::UnoImplPtrDeleter<SwXTextField::Impl>::operator()(SwXTextField::Impl*) Line | Count | Source | 108 | 10.8k | { | 109 | 10.8k | SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex | 110 | 10.8k | delete pUnoImpl; | 111 | 10.8k | } |
sw::UnoImplPtrDeleter<SwXFieldEnumeration::Impl>::operator()(SwXFieldEnumeration::Impl*) Line | Count | Source | 108 | 7.47k | { | 109 | 7.47k | SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex | 110 | 7.47k | delete pUnoImpl; | 111 | 7.47k | } |
sw::UnoImplPtrDeleter<SwXFootnote::Impl>::operator()(SwXFootnote::Impl*) Line | Count | Source | 108 | 1.92k | { | 109 | 1.92k | SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex | 110 | 1.92k | delete pUnoImpl; | 111 | 1.92k | } |
sw::UnoImplPtrDeleter<SwXDocumentIndex::Impl>::operator()(SwXDocumentIndex::Impl*) Line | Count | Source | 108 | 3.17k | { | 109 | 3.17k | SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex | 110 | 3.17k | delete pUnoImpl; | 111 | 3.17k | } |
sw::UnoImplPtrDeleter<SwXDocumentIndexMark::Impl>::operator()(SwXDocumentIndexMark::Impl*) Line | Count | Source | 108 | 17 | { | 109 | 17 | SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex | 110 | 17 | delete pUnoImpl; | 111 | 17 | } |
Unexecuted instantiation: sw::UnoImplPtrDeleter<SwXLineBreak::Impl>::operator()(SwXLineBreak::Impl*) sw::UnoImplPtrDeleter<SwXReferenceMark::Impl>::operator()(SwXReferenceMark::Impl*) Line | Count | Source | 108 | 4 | { | 109 | 4 | SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex | 110 | 4 | delete pUnoImpl; | 111 | 4 | } |
Unexecuted instantiation: sw::UnoImplPtrDeleter<SwXMeta::Impl>::operator()(SwXMeta::Impl*) sw::UnoImplPtrDeleter<SwXTextSection::Impl>::operator()(SwXTextSection::Impl*) Line | Count | Source | 108 | 2.71k | { | 109 | 2.71k | SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex | 110 | 2.71k | delete pUnoImpl; | 111 | 2.71k | } |
sw::UnoImplPtrDeleter<SwXNumberingRules::Impl>::operator()(SwXNumberingRules::Impl*) Line | Count | Source | 108 | 290k | { | 109 | 290k | SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex | 110 | 290k | delete pUnoImpl; | 111 | 290k | } |
sw::UnoImplPtrDeleter<SwXTextTable::Impl>::operator()(SwXTextTable::Impl*) Line | Count | Source | 108 | 5.74k | { | 109 | 5.74k | SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex | 110 | 5.74k | delete pUnoImpl; | 111 | 5.74k | } |
Unexecuted instantiation: sw::UnoImplPtrDeleter<SwXCellRange::Impl>::operator()(SwXCellRange::Impl*) sw::UnoImplPtrDeleter<SwXTableRows::Impl>::operator()(SwXTableRows::Impl*) Line | Count | Source | 108 | 2.20k | { | 109 | 2.20k | SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex | 110 | 2.20k | delete pUnoImpl; | 111 | 2.20k | } |
Unexecuted instantiation: sw::UnoImplPtrDeleter<SwXTableColumns::Impl>::operator()(SwXTableColumns::Impl*) sw::UnoImplPtrDeleter<SwXHeadFootText::Impl>::operator()(SwXHeadFootText::Impl*) Line | Count | Source | 108 | 11.3k | { | 109 | 11.3k | SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex | 110 | 11.3k | delete pUnoImpl; | 111 | 11.3k | } |
Unexecuted instantiation: sw::UnoImplPtrDeleter<SwXTextMarkup::Impl>::operator()(SwXTextMarkup::Impl*) sw::UnoImplPtrDeleter<SwXTextDocument::Impl>::operator()(SwXTextDocument::Impl*) Line | Count | Source | 108 | 82.5k | { | 109 | 82.5k | SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex | 110 | 82.5k | delete pUnoImpl; | 111 | 82.5k | } |
|
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: */ |