LCOV - code coverage report
Current view: top level - svl/source/numbers - numuno.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 39 39 100.0 %
Date: 2015-06-13 12:38:46 Functions: 14 14 100.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             : 
      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        3544 : class SvNumFmtSuppl_Impl
      31             : {
      32             : public:
      33             :     SvNumberFormatter*                  pFormatter;
      34             :     mutable ::comphelper::SharedMutex   aMutex;
      35             : 
      36        3991 :     explicit SvNumFmtSuppl_Impl(SvNumberFormatter* p) :
      37        3991 :         pFormatter(p) {}
      38             : };
      39             : 
      40             : 
      41             : // Default ctor for getReflection
      42         149 : SvNumberFormatsSupplierObj::SvNumberFormatsSupplierObj()
      43             : {
      44         149 :     pImpl = new SvNumFmtSuppl_Impl(NULL);
      45         149 : }
      46             : 
      47        3842 : SvNumberFormatsSupplierObj::SvNumberFormatsSupplierObj(SvNumberFormatter* pForm)
      48             : {
      49        3842 :     pImpl = new SvNumFmtSuppl_Impl(pForm);
      50        3842 : }
      51             : 
      52       10484 : SvNumberFormatsSupplierObj::~SvNumberFormatsSupplierObj()
      53             : {
      54        3544 :     delete pImpl;
      55        6940 : }
      56             : 
      57        1329 : ::comphelper::SharedMutex& SvNumberFormatsSupplierObj::getSharedMutex() const
      58             : {
      59        1329 :     return pImpl->aMutex;
      60             : }
      61             : 
      62       69280 : SvNumberFormatter* SvNumberFormatsSupplierObj::GetNumberFormatter() const
      63             : {
      64       69280 :     return pImpl->pFormatter;
      65             : }
      66             : 
      67        8355 : void SvNumberFormatsSupplierObj::SetNumberFormatter(SvNumberFormatter* pNew)
      68             : {
      69             :     // The old Numberformatter has been retired, do not access it anymore!
      70        8355 :     pImpl->pFormatter = pNew;
      71        8355 : }
      72             : 
      73             : // XNumberFormatsSupplier
      74             : 
      75         327 : uno::Reference<beans::XPropertySet> SAL_CALL SvNumberFormatsSupplierObj::getNumberFormatSettings()
      76             :                                         throw(uno::RuntimeException, std::exception)
      77             : {
      78         327 :     ::osl::MutexGuard aGuard( pImpl->aMutex );
      79             : 
      80         327 :     return new SvNumberFormatSettingsObj( *this, pImpl->aMutex );
      81             : }
      82             : 
      83       13264 : uno::Reference<util::XNumberFormats> SAL_CALL SvNumberFormatsSupplierObj::getNumberFormats()
      84             :                                         throw(uno::RuntimeException, std::exception)
      85             : {
      86       13264 :     ::osl::MutexGuard aGuard( pImpl->aMutex );
      87             : 
      88       13264 :     return new SvNumberFormatsObj( *this, pImpl->aMutex );
      89             : }
      90             : 
      91             : // XUnoTunnel
      92             : 
      93       33935 : sal_Int64 SAL_CALL SvNumberFormatsSupplierObj::getSomething(
      94             :                 const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException, std::exception)
      95             : {
      96       67870 :     if ( rId.getLength() == 16 &&
      97       33935 :           0 == memcmp( getUnoTunnelId().getConstArray(),
      98       67870 :                                     rId.getConstArray(), 16 ) )
      99             :     {
     100       33925 :         return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
     101             :     }
     102          10 :     return 0;
     103             : }
     104             : 
     105             : namespace
     106             : {
     107             :     class theSvNumberFormatsSupplierObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvNumberFormatsSupplierObjUnoTunnelId > {};
     108             : }
     109             : 
     110             : // static
     111       73105 : const uno::Sequence<sal_Int8>& SvNumberFormatsSupplierObj::getUnoTunnelId()
     112             : {
     113       73105 :     return theSvNumberFormatsSupplierObjUnoTunnelId::get().getSeq();
     114             : }
     115             : 
     116             : // static
     117       12465 : SvNumberFormatsSupplierObj* SvNumberFormatsSupplierObj::getImplementation(
     118             :                                 const uno::Reference<util::XNumberFormatsSupplier>& rObj )
     119             : {
     120       12465 :     SvNumberFormatsSupplierObj* pRet = NULL;
     121       12465 :     uno::Reference<lang::XUnoTunnel> xUT(rObj, uno::UNO_QUERY);
     122       12465 :     if (xUT.is())
     123       12465 :         pRet = reinterpret_cast<SvNumberFormatsSupplierObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething( getUnoTunnelId() )));
     124       12465 :     return pRet;
     125             : }
     126             : 
     127             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11