LCOV - code coverage report
Current view: top level - svl/source/numbers - numuno.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 41 43 95.3 %
Date: 2014-11-03 Functions: 15 16 93.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             : 
      20             : 
      21             : #include <comphelper/servicehelper.hxx>
      22             : 
      23             : #include <svl/numuno.hxx>
      24             : #include "numfmuno.hxx"
      25             : #include <svl/zforlist.hxx>
      26             : 
      27             : using namespace com::sun::star;
      28             : 
      29             : 
      30        5647 : class SvNumFmtSuppl_Impl
      31             : {
      32             : public:
      33             :     SvNumberFormatter*                  pFormatter;
      34             :     mutable ::comphelper::SharedMutex   aMutex;
      35             : 
      36        5815 :     SvNumFmtSuppl_Impl(SvNumberFormatter* p) :
      37        5815 :         pFormatter(p) {}
      38             : };
      39             : 
      40             : 
      41             : // Default ctor for getReflection
      42         284 : SvNumberFormatsSupplierObj::SvNumberFormatsSupplierObj()
      43             : {
      44         284 :     pImpl = new SvNumFmtSuppl_Impl(NULL);
      45         284 : }
      46             : 
      47        5531 : SvNumberFormatsSupplierObj::SvNumberFormatsSupplierObj(SvNumberFormatter* pForm)
      48             : {
      49        5531 :     pImpl = new SvNumFmtSuppl_Impl(pForm);
      50        5531 : }
      51             : 
      52       16659 : SvNumberFormatsSupplierObj::~SvNumberFormatsSupplierObj()
      53             : {
      54        5647 :     delete pImpl;
      55       11012 : }
      56             : 
      57         964 : ::comphelper::SharedMutex& SvNumberFormatsSupplierObj::getSharedMutex() const
      58             : {
      59         964 :     return pImpl->aMutex;
      60             : }
      61             : 
      62       82173 : SvNumberFormatter* SvNumberFormatsSupplierObj::GetNumberFormatter() const
      63             : {
      64       82173 :     return pImpl->pFormatter;
      65             : }
      66             : 
      67       14962 : void SvNumberFormatsSupplierObj::SetNumberFormatter(SvNumberFormatter* pNew)
      68             : {
      69             :     // The old Numberformatter has been retired, do not access it anymore!
      70       14962 :     pImpl->pFormatter = pNew;
      71       14962 : }
      72             : 
      73           0 : void SvNumberFormatsSupplierObj::NumberFormatDeleted(sal_uInt32)
      74             : {
      75             :     // Base implementation; does nothing
      76           0 : }
      77             : 
      78         128 : void SvNumberFormatsSupplierObj::SettingsChanged()
      79             : {
      80             :     // Base implementation; does nothing
      81         128 : }
      82             : 
      83             : // XNumberFormatsSupplier
      84             : 
      85         352 : uno::Reference<beans::XPropertySet> SAL_CALL SvNumberFormatsSupplierObj::getNumberFormatSettings()
      86             :                                         throw(uno::RuntimeException, std::exception)
      87             : {
      88         352 :     ::osl::MutexGuard aGuard( pImpl->aMutex );
      89             : 
      90         352 :     return new SvNumberFormatSettingsObj( *this, pImpl->aMutex );
      91             : }
      92             : 
      93       13415 : uno::Reference<util::XNumberFormats> SAL_CALL SvNumberFormatsSupplierObj::getNumberFormats()
      94             :                                         throw(uno::RuntimeException, std::exception)
      95             : {
      96       13415 :     ::osl::MutexGuard aGuard( pImpl->aMutex );
      97             : 
      98       13415 :     return new SvNumberFormatsObj( *this, pImpl->aMutex );
      99             : }
     100             : 
     101             : // XUnoTunnel
     102             : 
     103       44127 : sal_Int64 SAL_CALL SvNumberFormatsSupplierObj::getSomething(
     104             :                 const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException, std::exception)
     105             : {
     106       88254 :     if ( rId.getLength() == 16 &&
     107       44127 :           0 == memcmp( getUnoTunnelId().getConstArray(),
     108       88254 :                                     rId.getConstArray(), 16 ) )
     109             :     {
     110       44111 :         return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
     111             :     }
     112          16 :     return 0;
     113             : }
     114             : 
     115             : namespace
     116             : {
     117             :     class theSvNumberFormatsSupplierObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvNumberFormatsSupplierObjUnoTunnelId > {};
     118             : }
     119             : 
     120             : // static
     121       93016 : const uno::Sequence<sal_Int8>& SvNumberFormatsSupplierObj::getUnoTunnelId()
     122             : {
     123       93016 :     return theSvNumberFormatsSupplierObjUnoTunnelId::get().getSeq();
     124             : }
     125             : 
     126             : // static
     127        9539 : SvNumberFormatsSupplierObj* SvNumberFormatsSupplierObj::getImplementation(
     128             :                                 const uno::Reference<util::XNumberFormatsSupplier> xObj )
     129             : {
     130        9539 :     SvNumberFormatsSupplierObj* pRet = NULL;
     131        9539 :     uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY );
     132        9539 :     if (xUT.is())
     133        9539 :         pRet = reinterpret_cast<SvNumberFormatsSupplierObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething( getUnoTunnelId() )));
     134        9539 :     return pRet;
     135             : }
     136             : 
     137             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10