LibreOffice Module sw (master)  1
unobaseclass.hxx
Go to the documentation of this file.
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/XUnoTunnel.hpp>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/container/XEnumeration.hpp>
26 
27 #include <cppuhelper/implbase.hxx>
28 #include <vcl/svapp.hxx>
29 
30 class SfxPoolItem;
31 class SwClient;
32 class SwDoc;
34 
35 typedef ::cppu::WeakImplHelper
36 < css::lang::XServiceInfo
37 , css::container::XEnumeration
38 >
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
54  Meta, // meta/meta-field
55 };
56 
57 /*
58  Start/EndAction or Start/EndAllAction
59 */
61 {
62 private:
64 
65 public:
66  UnoActionContext(SwDoc *const pDoc);
67  ~UnoActionContext() COVERITY_NOEXCEPT_FALSE;
68 };
69 
70 /*
71  interrupt Actions for a little while
72  FIXME: this is a vile abomination that may cause recursive layout actions!
73  C'thulhu fhtagn.
74 */
76 {
77 private:
78  SwDoc *const m_pDoc;
79 
80 public:
81  UnoActionRemoveContext(SwDoc *const pDoc);
82  UnoActionRemoveContext(SwUnoTableCursor const& rCursor);
83  ~UnoActionRemoveContext() COVERITY_NOEXCEPT_FALSE;
84 };
85 
87 void ClientModify(SwClient* pClient, const SfxPoolItem *pOld, const SfxPoolItem *pNew);
88 
89 namespace sw {
90  template<typename T>
92  {
93  void operator()(T* pUnoImpl)
94  {
95  SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex
96  delete pUnoImpl;
97  }
98  };
100  template<typename T>
101  using UnoImplPtr = std::unique_ptr<T, UnoImplPtrDeleter<T> >;
102 
103  template< class C > C *
104  UnoTunnelGetImplementation( css::uno::Reference< css::lang::XUnoTunnel > const & xUnoTunnel)
105  {
106  if (!xUnoTunnel.is()) { return 0; }
107  C *const pC( reinterpret_cast< C* >(
108  ::sal::static_int_cast< sal_IntPtr >(
109  xUnoTunnel->getSomething(C::getUnoTunnelId()))));
110  return pC;
111  }
112 
113  template< class C > sal_Int64
114  UnoTunnelImpl(const css::uno::Sequence< sal_Int8 > & rId,
115  C *const pThis)
116  {
117  if ((rId.getLength() == 16) &&
118  (0 == memcmp(C::getUnoTunnelId().getConstArray(),
119  rId.getConstArray(), 16)))
120  {
121  return ::sal::static_int_cast< sal_Int64 >(
122  reinterpret_cast< sal_IntPtr >(pThis) );
123  }
124  return 0;
125  }
126 
127 } // namespace sw
128 
129 #endif // INCLUDED_SW_INC_UNOBASECLASS_HXX
130 
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
C * UnoTunnelGetImplementation(css::uno::Reference< css::lang::XUnoTunnel > const &xUnoTunnel)
CursorType
void ClientModify(SwClient *pClient, const SfxPoolItem *pOld, const SfxPoolItem *pNew)
helper function for implementing SwClient::Modify
Definition: unoobj2.cxx:296
~UnoActionContext() COVERITY_NOEXCEPT_FALSE
Definition: unoobj2.cxx:236
Definition: doc.hxx:185
UnoActionContext(SwDoc *const pDoc)
Definition: unoobj2.cxx:226
sal_Int64 UnoTunnelImpl(const css::uno::Sequence< sal_Int8 > &rId, C *const pThis)
Dialog to specify the properties of date form field.
Definition: accfrmobj.cxx:40
#define C
void operator()(T *pUnoImpl)
std::unique_ptr< T, UnoImplPtrDeleter< T > > UnoImplPtr
Smart pointer class ensuring that the pointed object is deleted with a locked SolarMutex.
::cppu::WeakImplHelper< css::lang::XServiceInfo, css::container::XEnumeration > SwSimpleEnumeration_Base