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 <cppuhelper/implbase.hxx>
28 #include <sal/log.hxx>
29 #include <osl/mutex.hxx>
30 #include <vcl/svapp.hxx>
35 class SwUnoTableCursor
;
37 typedef ::cppu::WeakImplHelper
38 < css::lang::XServiceInfo
39 , css::container::XEnumeration
41 SwSimpleEnumeration_Base
;
52 All
, // for Search&Replace
53 Selection
, // create a paragraph enumeration from
54 // a text range or cursor
56 Meta
, // meta/meta-field
60 Start/EndAction or Start/EndAllAction
62 class UnoActionContext
68 UnoActionContext(SwDoc
*const pDoc
);
73 interrupt Actions for a little while
74 FIXME: this is a vile abomination that may cause recursive layout actions!
77 class UnoActionRemoveContext
83 UnoActionRemoveContext(SwDoc
*const pDoc
);
84 UnoActionRemoveContext(SwUnoTableCursor
const& rCursor
);
85 ~UnoActionRemoveContext();
88 /// helper function for implementing SwClient::Modify
89 void ClientModify(SwClient
* pClient
, const SfxPoolItem
*pOld
, const SfxPoolItem
*pNew
);
93 struct UnoImplPtrDeleter
95 void operator()(T
* pUnoImpl
)
97 SolarMutexGuard g
; // #i105557#: call dtor with locked solar mutex
101 /// Smart pointer class ensuring that the pointed object is deleted with a locked SolarMutex.
103 using UnoImplPtr
= std::unique_ptr
<T
, UnoImplPtrDeleter
<T
> >;
105 template< class C
> C
*
106 UnoTunnelGetImplementation( css::uno::Reference
< css::lang::XUnoTunnel
> const & xUnoTunnel
)
108 if (!xUnoTunnel
.is()) { return 0; }
109 C
*const pC( reinterpret_cast< C
* >(
110 ::sal::static_int_cast
< sal_IntPtr
>(
111 xUnoTunnel
->getSomething(C::getUnoTunnelId()))));
115 template< class C
> sal_Int64
116 UnoTunnelImpl(const css::uno::Sequence
< sal_Int8
> & rId
,
119 if ((rId
.getLength() == 16) &&
120 (0 == memcmp(C::getUnoTunnelId().getConstArray(),
121 rId
.getConstArray(), 16)))
123 return ::sal::static_int_cast
< sal_Int64
>(
124 reinterpret_cast< sal_IntPtr
>(pThis
) );
129 css::uno::Sequence
< OUString
>
130 GetSupportedServiceNamesImpl(
131 size_t const nServices
, char const*const pServices
[]);
135 #endif // INCLUDED_SW_INC_UNOBASECLASS_HXX
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */