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

Generated by: LCOV version 1.10