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

Generated by: LCOV version 1.10