1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
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>
36 class SwUnoTableCursor
;
38 typedef ::cppu::WeakImplHelper
39 < css::lang::XServiceInfo
40 , css::container::XEnumeration
42 SwSimpleEnumeration_Base
;
53 All
, // for Search&Replace
54 Selection
, // create a paragraph enumeration from
55 // a text range or cursor
57 Meta
, // meta/meta-field
62 enum class DeleteAndInsertMode
65 ForceExpandHints
= (1<<0),
66 ForceReplace
= (1<<1),
73 template<> struct typed_flags
<::sw::DeleteAndInsertMode
> : is_typed_flags
<::sw::DeleteAndInsertMode
, 0x03> {};
77 Start/EndAction or Start/EndAllAction
79 class UnoActionContext
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!
94 class UnoActionRemoveContext
100 UnoActionRemoveContext(SwDoc
*const pDoc
);
101 UnoActionRemoveContext(SwUnoTableCursor
const& rCursor
);
102 ~UnoActionRemoveContext() COVERITY_NOEXCEPT_FALSE
;
107 struct UnoImplPtrDeleter
109 void operator()(T
* pUnoImpl
)
111 SolarMutexGuard g
; // #i105557#: call dtor with locked solar mutex
115 /// Smart pointer class ensuring that the pointed object is deleted with a locked SolarMutex.
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()))));
129 template< class C
> sal_Int64
130 UnoTunnelImpl(const css::uno::Sequence
< sal_Int8
> & rId
,
133 if (isUnoTunnelId
<C
>(rId
))
135 return ::sal::static_int_cast
< sal_Int64
>(
136 reinterpret_cast< sal_IntPtr
>(pThis
) );
143 #endif // INCLUDED_SW_INC_UNOBASECLASS_HXX
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */