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 SW_UNOBASECLASS_HXX
20 #define SW_UNOBASECLASS_HXX
22 #include <com/sun/star/lang/XUnoTunnel.hpp>
23 #include <com/sun/star/lang/XServiceInfo.hpp>
24 #include <com/sun/star/container/XEnumeration.hpp>
26 #include <cppuhelper/implbase2.hxx>
34 typedef ::cppu::WeakImplHelper2
35 < ::com::sun::star::lang::XServiceInfo
36 , ::com::sun::star::container::XEnumeration
38 SwSimpleEnumeration_Base
;
50 CURSOR_ALL
, // for Search&Replace
51 CURSOR_SELECTION
, // create a paragraph enumeration from
52 // a text range or cursor
53 CURSOR_SELECTION_IN_TABLE
,
54 CURSOR_META
, // meta/meta-field
58 Start/EndAction or Start/EndAllAction
60 class UnoActionContext
66 UnoActionContext(SwDoc
*const pDoc
);
69 void InvalidateDocument() { m_pDoc
= 0; }
73 interrupt Actions for a little while
75 class UnoActionRemoveContext
81 UnoActionRemoveContext(SwDoc
*const pDoc
);
82 ~UnoActionRemoveContext();
85 /// helper function for implementing SwClient::Modify
86 void ClientModify(SwClient
* pClient
, const SfxPoolItem
*pOld
, const SfxPoolItem
*pNew
);
89 #include <boost/utility.hpp>
90 #include <osl/diagnose.h>
91 #include <osl/mutex.hxx>
92 #include <vcl/svapp.hxx>
96 template<typename T
> class UnoImplPtr
97 : private ::boost::noncopyable
103 UnoImplPtr(T
*const i_p
)
106 OSL_ENSURE(i_p
, "UnoImplPtr: null");
112 delete m_p
; // #i105557#: call dtor with locked solar mutex
116 T
& operator * () const { return *m_p
; }
118 T
* operator ->() const { return m_p
; }
120 T
* get () const { return m_p
; }
123 template< class C
> C
*
124 UnoTunnelGetImplementation(
125 ::com::sun::star::uno::Reference
<
126 ::com::sun::star::lang::XUnoTunnel
> const & xUnoTunnel
)
128 if (!xUnoTunnel
.is()) { return 0; }
129 C
*const pC( reinterpret_cast< C
* >(
130 ::sal::static_int_cast
< sal_IntPtr
>(
131 xUnoTunnel
->getSomething(C::getUnoTunnelId()))));
135 template< class C
> sal_Int64
136 UnoTunnelImpl(const ::com::sun::star::uno::Sequence
< sal_Int8
> & rId
,
139 if ((rId
.getLength() == 16) &&
140 (0 == memcmp(C::getUnoTunnelId().getConstArray(),
141 rId
.getConstArray(), 16)))
143 return ::sal::static_int_cast
< sal_Int64
>(
144 reinterpret_cast< sal_IntPtr
>(pThis
) );
149 ::com::sun::star::uno::Sequence
< OUString
>
150 GetSupportedServiceNamesImpl(
151 size_t const nServices
, char const*const pServices
[]);
152 sal_Bool
SupportsServiceImpl(
153 size_t const nServices
, char const*const pServices
[],
154 OUString
const & rServiceName
);
158 #endif // SW_UNOBASECLASS_HXX
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */