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

Generated by: LCOV version 1.10