LCOV - code coverage report
Current view: top level - sw/inc - unobaseclass.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 20 0.0 %
Date: 2014-04-14 Functions: 0 111 0.0 %
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             :     template<typename T> class UnoImplPtr
      93             :         : private ::boost::noncopyable
      94             :     {
      95             :         private:
      96             :             T * m_p;
      97             : 
      98             :         public:
      99           0 :             UnoImplPtr(T *const i_p)
     100           0 :                 : m_p(i_p)
     101             :             {
     102             :                 SAL_WARN_IF(!i_p, "sw", "UnoImplPtr: null");
     103           0 :             }
     104             : 
     105           0 :             ~UnoImplPtr()
     106             :             {
     107           0 :                 SolarMutexGuard g;
     108           0 :                 delete m_p; // #i105557#: call dtor with locked solar mutex
     109           0 :                 m_p = 0;
     110           0 :             }
     111             : 
     112             :             T & operator * () const { return *m_p; }
     113             : 
     114           0 :             T * operator ->() const { return  m_p; }
     115             : 
     116           0 :             T * get        () const { return  m_p; }
     117             :     };
     118             : 
     119             :     template< class C > C *
     120           0 :     UnoTunnelGetImplementation(
     121             :             ::com::sun::star::uno::Reference<
     122             :                 ::com::sun::star::lang::XUnoTunnel > const & xUnoTunnel)
     123             :     {
     124           0 :         if (!xUnoTunnel.is()) { return 0; }
     125             :         C *const pC( reinterpret_cast< C* >(
     126             :                         ::sal::static_int_cast< sal_IntPtr >(
     127           0 :                             xUnoTunnel->getSomething(C::getUnoTunnelId()))));
     128           0 :         return pC;
     129             :     }
     130             : 
     131             :     template< class C > sal_Int64
     132           0 :     UnoTunnelImpl(const ::com::sun::star::uno::Sequence< sal_Int8 > & rId,
     133             :                   C *const pThis)
     134             :     {
     135           0 :         if ((rId.getLength() == 16) &&
     136           0 :             (0 == memcmp(C::getUnoTunnelId().getConstArray(),
     137           0 :                                     rId.getConstArray(), 16)))
     138             :         {
     139             :             return ::sal::static_int_cast< sal_Int64 >(
     140           0 :                     reinterpret_cast< sal_IntPtr >(pThis) );
     141             :         }
     142           0 :         return 0;
     143             :     }
     144             : 
     145             :     ::com::sun::star::uno::Sequence< OUString >
     146             :     GetSupportedServiceNamesImpl(
     147             :             size_t const nServices, char const*const pServices[]);
     148             : 
     149             : } // namespace sw
     150             : 
     151             : #endif // INCLUDED_SW_INC_UNOBASECLASS_HXX
     152             : 
     153             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10