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

Generated by: LCOV version 1.10