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

Generated by: LCOV version 1.10