LCOV - code coverage report
Current view: top level - unotools/source/i18n - collatorwrapper.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 18 26 69.2 %
Date: 2014-11-03 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/collatorwrapper.hxx>
      21             : #include <com/sun/star/i18n/Collator.hpp>
      22             : 
      23             : using namespace ::com::sun::star;
      24             : 
      25          46 : CollatorWrapper::CollatorWrapper ( const uno::Reference< uno::XComponentContext > &rxContext )
      26             : {
      27          46 :     mxInternationalCollator = i18n::Collator::create( rxContext );
      28          46 : }
      29             : 
      30          24 : CollatorWrapper::~CollatorWrapper()
      31             : {
      32          24 : }
      33             : 
      34             : sal_Int32
      35       13304 : CollatorWrapper::compareString (const OUString& s1, const OUString& s2) const
      36             : {
      37             :     try
      38             :     {
      39       13304 :         if (mxInternationalCollator.is())
      40       13304 :             return mxInternationalCollator->compareString (s1, s2);
      41             :     }
      42           0 :     catch (const uno::RuntimeException&)
      43             :     {
      44             :         SAL_WARN( "unotools.i18n","CollatorWrapper: compareString failed");
      45             :     }
      46             : 
      47           0 :     return 0;
      48             : }
      49             : 
      50             : uno::Sequence< OUString >
      51           4 : CollatorWrapper::listCollatorAlgorithms (const lang::Locale& rLocale) const
      52             : {
      53             :     try
      54             :     {
      55           4 :         if (mxInternationalCollator.is())
      56           4 :             return mxInternationalCollator->listCollatorAlgorithms (rLocale);
      57             :     }
      58           0 :     catch (const uno::RuntimeException&)
      59             :     {
      60             :         SAL_WARN( "unotools.i18n","CollatorWrapper: listCollatorAlgorithms failed");
      61             :     }
      62             : 
      63           0 :     return uno::Sequence< OUString > ();
      64             : }
      65             : 
      66             : sal_Int32
      67          30 : CollatorWrapper::loadDefaultCollator (const lang::Locale& rLocale, sal_Int32 nOptions)
      68             : {
      69             :     try
      70             :     {
      71          30 :         if (mxInternationalCollator.is())
      72          30 :             return mxInternationalCollator->loadDefaultCollator (rLocale, nOptions);
      73             :     }
      74           0 :     catch (const uno::RuntimeException&)
      75             :     {
      76             :         SAL_WARN( "unotools.i18n","CollatorWrapper: loadDefaultCollator failed");
      77             :     }
      78             : 
      79           0 :     return 0;
      80             : }
      81             : 
      82             : sal_Int32
      83           8 : CollatorWrapper::loadCollatorAlgorithm (const OUString& rAlgorithm,
      84             :         const lang::Locale& rLocale, sal_Int32 nOptions)
      85             : {
      86             :     try
      87             :     {
      88           8 :         if (mxInternationalCollator.is())
      89           8 :             return mxInternationalCollator->loadCollatorAlgorithm (
      90           8 :                                                         rAlgorithm, rLocale, nOptions);
      91             :     }
      92           0 :     catch (const uno::RuntimeException&)
      93             :     {
      94             :         SAL_WARN( "unotools.i18n","CollatorWrapper: loadCollatorAlgorithm failed");
      95             :     }
      96             : 
      97           0 :     return 0;
      98             : 
      99             : }
     100             : 
     101             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10