LCOV - code coverage report
Current view: top level - unotools/source/i18n - numberformatcodewrapper.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 22 0.0 %
Date: 2014-04-14 Functions: 0 6 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             : #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           0 : NumberFormatCodeWrapper::NumberFormatCodeWrapper(
      29             :             const Reference< uno::XComponentContext > & rxContext,
      30             :             const lang::Locale& rLocale
      31           0 :             )
      32             : {
      33           0 :     setLocale( rLocale );
      34           0 :     xNFC = i18n::NumberFormatMapper::create( rxContext );
      35           0 : }
      36             : 
      37           0 : NumberFormatCodeWrapper::~NumberFormatCodeWrapper()
      38             : {
      39           0 : }
      40             : 
      41           0 : void NumberFormatCodeWrapper::setLocale( const ::com::sun::star::lang::Locale& rLocale )
      42             : {
      43           0 :     aLocale = rLocale;
      44           0 : }
      45             : 
      46             : ::com::sun::star::i18n::NumberFormatCode
      47           0 : NumberFormatCodeWrapper::getFormatCode( sal_Int16 formatIndex ) const
      48             : {
      49             :     try
      50             :     {
      51           0 :         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           0 : NumberFormatCodeWrapper::getAllFormatCode( sal_Int16 formatUsage ) const
      62             : {
      63             :     try
      64             :     {
      65           0 :         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           0 : NumberFormatCodeWrapper::getAllFormatCodes() const
      76             : {
      77             :     try
      78             :     {
      79           0 :         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