Teach symstore more duplicated DLLs
[LibreOffice.git] / sw / inc / unobaseclass.hxx
blob9f7db995de534e8891aff18d3405a43b55020c08
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SW_INC_UNOBASECLASS_HXX
20 #define INCLUDED_SW_INC_UNOBASECLASS_HXX
22 #include <memory>
23 #include <com/sun/star/lang/XUnoTunnel.hpp>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/container/XEnumeration.hpp>
27 #include <comphelper/servicehelper.hxx>
28 #include <cppuhelper/implbase.hxx>
30 #include <o3tl/typed_flags_set.hxx>
32 #include <vcl/svapp.hxx>
34 class SfxPoolItem;
35 class SwDoc;
36 class SwUnoTableCursor;
38 typedef ::cppu::WeakImplHelper
39 < css::lang::XServiceInfo
40 , css::container::XEnumeration
42 SwSimpleEnumeration_Base;
44 enum class CursorType
46 Body,
47 Frame,
48 TableText,
49 Footnote,
50 Header,
51 Footer,
52 Redline,
53 All, // for Search&Replace
54 Selection, // create a paragraph enumeration from
55 // a text range or cursor
56 SelectionInTable,
57 Meta, // meta/meta-field
60 namespace sw {
62 enum class DeleteAndInsertMode
64 Default = 0,
65 ForceExpandHints = (1<<0),
66 ForceReplace = (1<<1),
69 } // namespace sw
71 namespace o3tl
73 template<> struct typed_flags<::sw::DeleteAndInsertMode> : is_typed_flags<::sw::DeleteAndInsertMode, 0x03> {};
77 Start/EndAction or Start/EndAllAction
79 class UnoActionContext
81 private:
82 SwDoc * m_pDoc;
84 public:
85 UnoActionContext(SwDoc *const pDoc);
86 ~UnoActionContext() COVERITY_NOEXCEPT_FALSE;
90 interrupt Actions for a little while
91 FIXME: this is a vile abomination that may cause recursive layout actions!
92 C'thulhu fhtagn.
94 class UnoActionRemoveContext
96 private:
97 SwDoc *const m_pDoc;
99 public:
100 UnoActionRemoveContext(SwDoc *const pDoc);
101 UnoActionRemoveContext(SwUnoTableCursor const& rCursor);
102 ~UnoActionRemoveContext() COVERITY_NOEXCEPT_FALSE;
105 namespace sw {
106 template<typename T>
107 struct UnoImplPtrDeleter
109 void operator()(T* pUnoImpl)
111 SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex
112 delete pUnoImpl;
115 /// Smart pointer class ensuring that the pointed object is deleted with a locked SolarMutex.
116 template<typename T>
117 using UnoImplPtr = std::unique_ptr<T, UnoImplPtrDeleter<T> >;
119 template< class C > C *
120 UnoTunnelGetImplementation( css::uno::Reference< css::lang::XUnoTunnel > const & xUnoTunnel)
122 if (!xUnoTunnel.is()) { return 0; }
123 C *const pC( reinterpret_cast< C* >(
124 ::sal::static_int_cast< sal_IntPtr >(
125 xUnoTunnel->getSomething(C::getUnoTunnelId()))));
126 return pC;
129 template< class C > sal_Int64
130 UnoTunnelImpl(const css::uno::Sequence< sal_Int8 > & rId,
131 C *const pThis)
133 if (isUnoTunnelId<C>(rId))
135 return ::sal::static_int_cast< sal_Int64 >(
136 reinterpret_cast< sal_IntPtr >(pThis) );
138 return 0;
141 } // namespace sw
143 #endif // INCLUDED_SW_INC_UNOBASECLASS_HXX
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */