LCOV - code coverage report
Current view: top level - unotools/source/i18n - numberformatcodewrapper.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 16 22 72.7 %
Date: 2014-11-03 Functions: 6 6 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             : #include <unotools/numberformatcodewrapper.hxx>
      21             : #include <com/sun/star/i18n/NumberFormatMapper.hpp>
      22             : 
      23             : using namespace ::com::sun::star;
      24             : using namespace ::com::sun::star::i18n;
      25             : using namespace ::com::sun::star::uno;
      26             : 
      27       53828 : NumberFormatCodeWrapper::NumberFormatCodeWrapper(
      28             :             const Reference< uno::XComponentContext > & rxContext,
      29             :             const lang::Locale& rLocale
      30       53828 :             )
      31             : {
      32       53828 :     setLocale( rLocale );
      33       53828 :     xNFC = i18n::NumberFormatMapper::create( rxContext );
      34       53828 : }
      35             : 
      36       53828 : NumberFormatCodeWrapper::~NumberFormatCodeWrapper()
      37             : {
      38       53828 : }
      39             : 
      40       61652 : void NumberFormatCodeWrapper::setLocale( const ::com::sun::star::lang::Locale& rLocale )
      41             : {
      42       61652 :     aLocale = rLocale;
      43       61652 : }
      44             : 
      45             : ::com::sun::star::i18n::NumberFormatCode
      46       30804 : NumberFormatCodeWrapper::getFormatCode( sal_Int16 formatIndex ) const
      47             : {
      48             :     try
      49             :     {
      50       30804 :         return xNFC->getFormatCode( formatIndex, aLocale );
      51             :     }
      52           0 :     catch ( const Exception& )
      53             :     {
      54             :         SAL_WARN( "unotools.i18n", "getFormatCode: Exception caught!" );
      55             :     }
      56           0 :     return ::com::sun::star::i18n::NumberFormatCode();
      57             : }
      58             : 
      59             : ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode >
      60       77792 : NumberFormatCodeWrapper::getAllFormatCode( sal_Int16 formatUsage ) const
      61             : {
      62             :     try
      63             :     {
      64       77792 :         return xNFC->getAllFormatCode( formatUsage, aLocale );
      65             :     }
      66           0 :     catch ( const Exception& )
      67             :     {
      68             :         SAL_WARN( "unotools.i18n", "getAllFormatCode: Exception caught!" );
      69             :     }
      70           0 :     return ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode > (0);
      71             : }
      72             : 
      73             : ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode >
      74        7824 : NumberFormatCodeWrapper::getAllFormatCodes() const
      75             : {
      76             :     try
      77             :     {
      78        7824 :         return xNFC->getAllFormatCodes( aLocale );
      79             :     }
      80           0 :     catch ( const Exception& )
      81             :     {
      82             :         SAL_WARN( "unotools.i18n", "getAllFormatCodes: Exception caught!" );
      83             :     }
      84           0 :     return ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode > (0);
      85             : }
      86             : 
      87             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10