LCOV - code coverage report
Current view: top level - sw/inc - unobaseclass.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 20 20 100.0 %
Date: 2014-11-03 Functions: 103 111 92.8 %
Legend: Lines: hit not hit

          Line data    Source code
       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 <com/sun/star/lang/XUnoTunnel.hpp>
      23             : #include <com/sun/star/lang/XServiceInfo.hpp>
      24             : #include <com/sun/star/container/XEnumeration.hpp>
      25             : 
      26             : #include <cppuhelper/implbase2.hxx>
      27             : 
      28             : class SfxPoolItem;
      29             : class SwClient;
      30             : class SwDoc;
      31             : 
      32             : typedef ::cppu::WeakImplHelper2
      33             : <   ::com::sun::star::lang::XServiceInfo
      34             : ,   ::com::sun::star::container::XEnumeration
      35             : >
      36             : SwSimpleEnumeration_Base;
      37             : 
      38             : enum CursorType
      39             : {
      40             :     CURSOR_INVALID,
      41             :     CURSOR_BODY,
      42             :     CURSOR_FRAME,
      43             :     CURSOR_TBLTEXT,
      44             :     CURSOR_FOOTNOTE,
      45             :     CURSOR_HEADER,
      46             :     CURSOR_FOOTER,
      47             :     CURSOR_REDLINE,
      48             :     CURSOR_ALL,         // for Search&Replace
      49             :     CURSOR_SELECTION,   // create a paragraph enumeration from
      50             :                         // a text range or cursor
      51             :     CURSOR_SELECTION_IN_TABLE,
      52             :     CURSOR_META,         // meta/meta-field
      53             : };
      54             : 
      55             : /*
      56             :     Start/EndAction or Start/EndAllAction
      57             : */
      58             : class UnoActionContext
      59             : {
      60             :     private:
      61             :         SwDoc * m_pDoc;
      62             : 
      63             :     public:
      64             :         UnoActionContext(SwDoc *const pDoc);
      65             :         ~UnoActionContext();
      66             : 
      67             :         void InvalidateDocument() { m_pDoc = 0; }
      68             : };
      69             : 
      70             : /*
      71             :     interrupt Actions for a little while
      72             : */
      73             : class UnoActionRemoveContext
      74             : {
      75             :     private:
      76             :         SwDoc *const m_pDoc;
      77             : 
      78             :     public:
      79             :         UnoActionRemoveContext(SwDoc *const pDoc);
      80             :         ~UnoActionRemoveContext();
      81             : };
      82             : 
      83             : /// helper function for implementing SwClient::Modify
      84             : void ClientModify(SwClient* pClient, const SfxPoolItem *pOld, const SfxPoolItem *pNew);
      85             : 
      86             : #include <boost/utility.hpp>
      87             : #include <osl/mutex.hxx>
      88             : #include <vcl/svapp.hxx>
      89             : 
      90             : namespace sw {
      91             : 
      92             :     /// Smart pointer class ensuring that the pointed object is deleted with a locked SolarMutex.
      93             :     template<typename T> class UnoImplPtr
      94             :         : private ::boost::noncopyable
      95             :     {
      96             :         private:
      97             :             T * m_p;
      98             : 
      99             :         public:
     100      711703 :             UnoImplPtr(T *const i_p)
     101      711703 :                 : m_p(i_p)
     102             :             {
     103             :                 SAL_WARN_IF(!i_p, "sw", "UnoImplPtr: null");
     104      711703 :             }
     105             : 
     106      711634 :             ~UnoImplPtr()
     107             :             {
     108      711634 :                 SolarMutexGuard g;
     109      711634 :                 delete m_p; // #i105557#: call dtor with locked solar mutex
     110      711634 :                 m_p = 0;
     111      711634 :             }
     112             : 
     113             :             T & operator * () const { return *m_p; }
     114             : 
     115     6292744 :             T * operator ->() const { return  m_p; }
     116             : 
     117      190528 :             T * get        () const { return  m_p; }
     118             :     };
     119             : 
     120             :     template< class C > C *
     121     1046272 :     UnoTunnelGetImplementation(
     122             :             ::com::sun::star::uno::Reference<
     123             :                 ::com::sun::star::lang::XUnoTunnel > const & xUnoTunnel)
     124             :     {
     125     1046272 :         if (!xUnoTunnel.is()) { return 0; }
     126             :         C *const pC( reinterpret_cast< C* >(
     127             :                         ::sal::static_int_cast< sal_IntPtr >(
     128     1046272 :                             xUnoTunnel->getSomething(C::getUnoTunnelId()))));
     129     1046272 :         return pC;
     130             :     }
     131             : 
     132             :     template< class C > sal_Int64
     133     1044998 :     UnoTunnelImpl(const ::com::sun::star::uno::Sequence< sal_Int8 > & rId,
     134             :                   C *const pThis)
     135             :     {
     136     2089996 :         if ((rId.getLength() == 16) &&
     137     1044998 :             (0 == memcmp(C::getUnoTunnelId().getConstArray(),
     138     2089996 :                                     rId.getConstArray(), 16)))
     139             :         {
     140             :             return ::sal::static_int_cast< sal_Int64 >(
     141      203174 :                     reinterpret_cast< sal_IntPtr >(pThis) );
     142             :         }
     143      841824 :         return 0;
     144             :     }
     145             : 
     146             :     ::com::sun::star::uno::Sequence< OUString >
     147             :     GetSupportedServiceNamesImpl(
     148             :             size_t const nServices, char const*const pServices[]);
     149             : 
     150             : } // namespace sw
     151             : 
     152             : #endif // INCLUDED_SW_INC_UNOBASECLASS_HXX
     153             : 
     154             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10