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

Generated by: LCOV version 1.10