LCOV - code coverage report
Current view: top level - sw/inc - unobaseclass.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 14 14 100.0 %
Date: 2015-06-13 12:38:46 Functions: 48 56 85.7 %
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/implbase.hxx>
      27             : #include <sal/log.hxx>
      28             : 
      29             : class SfxPoolItem;
      30             : class SwClient;
      31             : class SwDoc;
      32             : 
      33             : typedef ::cppu::WeakImplHelper
      34             : <   ::com::sun::star::lang::XServiceInfo
      35             : ,   ::com::sun::star::container::XEnumeration
      36             : >
      37             : SwSimpleEnumeration_Base;
      38             : 
      39             : enum CursorType
      40             : {
      41             :     CURSOR_INVALID,
      42             :     CURSOR_BODY,
      43             :     CURSOR_FRAME,
      44             :     CURSOR_TBLTEXT,
      45             :     CURSOR_FOOTNOTE,
      46             :     CURSOR_HEADER,
      47             :     CURSOR_FOOTER,
      48             :     CURSOR_REDLINE,
      49             :     CURSOR_ALL,         // for Search&Replace
      50             :     CURSOR_SELECTION,   // create a paragraph enumeration from
      51             :                         // a text range or cursor
      52             :     CURSOR_SELECTION_IN_TABLE,
      53             :     CURSOR_META,         // meta/meta-field
      54             : };
      55             : 
      56             : /*
      57             :     Start/EndAction or Start/EndAllAction
      58             : */
      59             : class UnoActionContext
      60             : {
      61             :     private:
      62             :         SwDoc * m_pDoc;
      63             : 
      64             :     public:
      65             :         UnoActionContext(SwDoc *const pDoc);
      66             :         ~UnoActionContext();
      67             : 
      68             :         void InvalidateDocument() { m_pDoc = 0; }
      69             : };
      70             : 
      71             : /*
      72             :     interrupt Actions for a little while
      73             : */
      74             : class UnoActionRemoveContext
      75             : {
      76             :     private:
      77             :         SwDoc *const m_pDoc;
      78             : 
      79             :     public:
      80             :         UnoActionRemoveContext(SwDoc *const pDoc);
      81             :         ~UnoActionRemoveContext();
      82             : };
      83             : 
      84             : /// helper function for implementing SwClient::Modify
      85             : void ClientModify(SwClient* pClient, const SfxPoolItem *pOld, const SfxPoolItem *pNew);
      86             : 
      87             : #include <osl/mutex.hxx>
      88             : #include <vcl/svapp.hxx>
      89             : 
      90             : namespace sw {
      91             :     template<typename T>
      92             :     struct UnoImplPtrDeleter
      93             :     {
      94      395355 :         void operator()(T* pUnoImpl)
      95             :         {
      96      395355 :             SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex
      97      395355 :             delete pUnoImpl;
      98      395355 :         }
      99             :     };
     100             :     /// Smart pointer class ensuring that the pointed object is deleted with a locked SolarMutex.
     101             :     template<typename T>
     102             :     using UnoImplPtr = ::std::unique_ptr<T, UnoImplPtrDeleter<T> >;
     103             : 
     104             :     template< class C > C *
     105      656110 :     UnoTunnelGetImplementation(
     106             :             ::com::sun::star::uno::Reference<
     107             :                 ::com::sun::star::lang::XUnoTunnel > const & xUnoTunnel)
     108             :     {
     109      656110 :         if (!xUnoTunnel.is()) { return 0; }
     110             :         C *const pC( reinterpret_cast< C* >(
     111             :                         ::sal::static_int_cast< sal_IntPtr >(
     112      656110 :                             xUnoTunnel->getSomething(C::getUnoTunnelId()))));
     113      656110 :         return pC;
     114             :     }
     115             : 
     116             :     template< class C > sal_Int64
     117      657029 :     UnoTunnelImpl(const ::com::sun::star::uno::Sequence< sal_Int8 > & rId,
     118             :                   C *const pThis)
     119             :     {
     120     1314058 :         if ((rId.getLength() == 16) &&
     121      657029 :             (0 == memcmp(C::getUnoTunnelId().getConstArray(),
     122     1314058 :                                     rId.getConstArray(), 16)))
     123             :         {
     124             :             return ::sal::static_int_cast< sal_Int64 >(
     125      116277 :                     reinterpret_cast< sal_IntPtr >(pThis) );
     126             :         }
     127      540752 :         return 0;
     128             :     }
     129             : 
     130             :     ::com::sun::star::uno::Sequence< OUString >
     131             :     GetSupportedServiceNamesImpl(
     132             :             size_t const nServices, char const*const pServices[]);
     133             : 
     134             : } // namespace sw
     135             : 
     136             : #endif // INCLUDED_SW_INC_UNOBASECLASS_HXX
     137             : 
     138             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11