LCOV - code coverage report
Current view: top level - unotools/source/i18n - nativenumberwrapper.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 12 21 57.1 %
Date: 2015-06-13 12:38:46 Functions: 4 5 80.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 <sal/config.h>
      21             : 
      22             : #include <sal/log.hxx>
      23             : #include <unotools/nativenumberwrapper.hxx>
      24             : #include <com/sun/star/i18n/NativeNumberSupplier.hpp>
      25             : 
      26             : using namespace ::com::sun::star;
      27             : 
      28           1 : NativeNumberWrapper::NativeNumberWrapper(
      29             :             const uno::Reference< uno::XComponentContext > & rxContext
      30           1 :             )
      31             : {
      32           1 :     xNNS = i18n::NativeNumberSupplier::create(rxContext);
      33           1 : }
      34             : 
      35           1 : NativeNumberWrapper::~NativeNumberWrapper()
      36             : {
      37           1 : }
      38             : 
      39             : OUString
      40           1 : NativeNumberWrapper::getNativeNumberString(
      41             :                     const OUString& rNumberString,
      42             :                     const ::com::sun::star::lang::Locale& rLocale,
      43             :                     sal_Int16 nNativeNumberMode ) const
      44             : {
      45             :     try
      46             :     {
      47           1 :         if ( xNNS.is() )
      48           1 :             return xNNS->getNativeNumberString( rNumberString, rLocale, nNativeNumberMode );
      49             :     }
      50           0 :     catch ( const uno::Exception& )
      51             :     {
      52             :         SAL_WARN( "unotools.i18n", "getNativeNumberString: Exception caught!" );
      53             :     }
      54           0 :     return OUString();
      55             : }
      56             : 
      57             : i18n::NativeNumberXmlAttributes
      58           0 : NativeNumberWrapper::convertToXmlAttributes(
      59             :                     const ::com::sun::star::lang::Locale& rLocale,
      60             :                     sal_Int16 nNativeNumberMode ) const
      61             : {
      62             :     try
      63             :     {
      64           0 :         if ( xNNS.is() )
      65           0 :             return xNNS->convertToXmlAttributes( rLocale, nNativeNumberMode );
      66             :     }
      67           0 :     catch ( const uno::Exception& )
      68             :     {
      69             :         SAL_WARN( "unotools.i18n", "convertToXmlAttributes: Exception caught!" );
      70             :     }
      71           0 :     return i18n::NativeNumberXmlAttributes();
      72             : }
      73             : 
      74             : sal_Int16
      75           1 : NativeNumberWrapper::convertFromXmlAttributes(
      76             :                     const i18n::NativeNumberXmlAttributes& rAttr ) const
      77             : {
      78             :     try
      79             :     {
      80           1 :         if ( xNNS.is() )
      81           1 :             return xNNS->convertFromXmlAttributes( rAttr );
      82             :     }
      83           0 :     catch ( const uno::Exception& )
      84             :     {
      85             :         SAL_WARN( "unotools.i18n", "convertFromXmlAttributes: Exception caught!" );
      86             :     }
      87           0 :     return 0;
      88             : }
      89             : 
      90             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11