LCOV - code coverage report
Current view: top level - libreoffice/svl/source/numbers - numuno.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 35 43 81.4 %
Date: 2012-12-27 Functions: 13 16 81.2 %
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             : 
      31         139 : class SvNumFmtSuppl_Impl
      32             : {
      33             : public:
      34             :     SvNumberFormatter*                  pFormatter;
      35             :     mutable ::comphelper::SharedMutex   aMutex;
      36             : 
      37         319 :     SvNumFmtSuppl_Impl(SvNumberFormatter* p) :
      38         319 :         pFormatter(p) {}
      39             : };
      40             : 
      41             : //------------------------------------------------------------------------
      42             : 
      43             : // Default-ctor fuer getReflection
      44           0 : SvNumberFormatsSupplierObj::SvNumberFormatsSupplierObj()
      45             : {
      46           0 :     pImpl = new SvNumFmtSuppl_Impl(NULL);
      47           0 : }
      48             : 
      49         319 : SvNumberFormatsSupplierObj::SvNumberFormatsSupplierObj(SvNumberFormatter* pForm)
      50             : {
      51         319 :     pImpl = new SvNumFmtSuppl_Impl(pForm);
      52         319 : }
      53             : 
      54         417 : SvNumberFormatsSupplierObj::~SvNumberFormatsSupplierObj()
      55             : {
      56         139 :     delete pImpl;
      57         278 : }
      58             : 
      59           0 : ::comphelper::SharedMutex& SvNumberFormatsSupplierObj::getSharedMutex() const
      60             : {
      61           0 :     return pImpl->aMutex;
      62             : }
      63             : 
      64        1908 : SvNumberFormatter* SvNumberFormatsSupplierObj::GetNumberFormatter() const
      65             : {
      66        1908 :     return pImpl->pFormatter;
      67             : }
      68             : 
      69         227 : void SvNumberFormatsSupplierObj::SetNumberFormatter(SvNumberFormatter* pNew)
      70             : {
      71             :     //  der alte Numberformatter ist ungueltig geworden, nicht mehr darauf zugreifen!
      72         227 :     pImpl->pFormatter = pNew;
      73         227 : }
      74             : 
      75           0 : void SvNumberFormatsSupplierObj::NumberFormatDeleted(sal_uInt32)
      76             : {
      77             :     //  Basis-Implementierung tut nix...
      78           0 : }
      79             : 
      80          11 : void SvNumberFormatsSupplierObj::SettingsChanged()
      81             : {
      82             :     //  Basis-Implementierung tut nix...
      83          11 : }
      84             : 
      85             : // XNumberFormatsSupplier
      86             : 
      87          12 : uno::Reference<beans::XPropertySet> SAL_CALL SvNumberFormatsSupplierObj::getNumberFormatSettings()
      88             :                                         throw(uno::RuntimeException)
      89             : {
      90          12 :     ::osl::MutexGuard aGuard( pImpl->aMutex );
      91             : 
      92          12 :     return new SvNumberFormatSettingsObj( *this, pImpl->aMutex );
      93             : }
      94             : 
      95         320 : uno::Reference<util::XNumberFormats> SAL_CALL SvNumberFormatsSupplierObj::getNumberFormats()
      96             :                                         throw(uno::RuntimeException)
      97             : {
      98         320 :     ::osl::MutexGuard aGuard( pImpl->aMutex );
      99             : 
     100         320 :     return new SvNumberFormatsObj( *this, pImpl->aMutex );
     101             : }
     102             : 
     103             : // XUnoTunnel
     104             : 
     105         878 : sal_Int64 SAL_CALL SvNumberFormatsSupplierObj::getSomething(
     106             :                 const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException)
     107             : {
     108        1756 :     if ( rId.getLength() == 16 &&
     109         878 :           0 == memcmp( getUnoTunnelId().getConstArray(),
     110        1756 :                                     rId.getConstArray(), 16 ) )
     111             :     {
     112         878 :         return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
     113             :     }
     114           0 :     return 0;
     115             : }
     116             : 
     117             : namespace
     118             : {
     119             :     class theSvNumberFormatsSupplierObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvNumberFormatsSupplierObjUnoTunnelId > {};
     120             : }
     121             : 
     122             : // static
     123        2166 : const uno::Sequence<sal_Int8>& SvNumberFormatsSupplierObj::getUnoTunnelId()
     124             : {
     125        2166 :     return theSvNumberFormatsSupplierObjUnoTunnelId::get().getSeq();
     126             : }
     127             : 
     128             : // static
     129         537 : SvNumberFormatsSupplierObj* SvNumberFormatsSupplierObj::getImplementation(
     130             :                                 const uno::Reference<util::XNumberFormatsSupplier> xObj )
     131             : {
     132         537 :     SvNumberFormatsSupplierObj* pRet = NULL;
     133         537 :     uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY );
     134         537 :     if (xUT.is())
     135         537 :         pRet = reinterpret_cast<SvNumberFormatsSupplierObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething( getUnoTunnelId() )));
     136         537 :     return pRet;
     137             : }
     138             : 
     139             : 
     140             : //------------------------------------------------------------------------
     141             : 
     142             : 
     143             : 
     144             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10