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

Generated by: LCOV version 1.10