LCOV - code coverage report
Current view: top level - unotools/source/i18n - intlwrapper.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 15 24 62.5 %
Date: 2012-08-25 Functions: 3 5 60.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 8 22 36.4 %

           Branch data     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/intlwrapper.hxx"
      22                 :            : #include <com/sun/star/i18n/CollatorOptions.hpp>
      23                 :            : #include <i18npool/mslangid.hxx>
      24                 :            : 
      25                 :          6 : IntlWrapper::IntlWrapper(
      26                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF,
      27                 :            :             const ::com::sun::star::lang::Locale& rLocale )
      28                 :            :         :
      29                 :            :         aLocale( rLocale ),
      30                 :            :         xSMgr( xSF ),
      31                 :            :         pLocaleData( NULL ),
      32                 :            :         pCollator( NULL ),
      33                 :          6 :         pCaseCollator( NULL )
      34                 :            : {
      35         [ +  - ]:          6 :     eLanguage = MsLangId::convertLocaleToLanguage( aLocale );
      36                 :          6 : }
      37                 :            : 
      38                 :            : 
      39                 :          0 : IntlWrapper::IntlWrapper(
      40                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF,
      41                 :            :             LanguageType eLang )
      42                 :            :         :
      43                 :            :         xSMgr( xSF ),
      44                 :            :         pLocaleData( NULL ),
      45                 :            :         pCollator( NULL ),
      46                 :            :         pCaseCollator( NULL ),
      47                 :          0 :         eLanguage( eLang )
      48                 :            : {
      49         [ #  # ]:          0 :     MsLangId::convertLanguageToLocale( eLanguage, aLocale );
      50                 :          0 : }
      51                 :            : 
      52                 :            : 
      53                 :          6 : IntlWrapper::~IntlWrapper()
      54                 :            : {
      55 [ -  + ][ #  # ]:          6 :     delete pLocaleData;
      56 [ -  + ][ #  # ]:          6 :     delete pCollator;
      57 [ +  + ][ +  - ]:          6 :     delete pCaseCollator;
      58                 :          6 : }
      59                 :            : 
      60                 :            : 
      61                 :          0 : void IntlWrapper::ImplNewLocaleData() const
      62                 :            : {
      63         [ #  # ]:          0 :     ((IntlWrapper*)this)->pLocaleData = new LocaleDataWrapper( xSMgr, aLocale );
      64                 :          0 : }
      65                 :            : 
      66                 :            : 
      67                 :          2 : void IntlWrapper::ImplNewCollator( sal_Bool bCaseSensitive ) const
      68                 :            : {
      69         [ +  - ]:          2 :     CollatorWrapper* p = new CollatorWrapper( xSMgr );
      70         [ +  - ]:          2 :     if ( bCaseSensitive )
      71                 :            :     {
      72                 :          2 :         p->loadDefaultCollator( aLocale, 0 );
      73                 :          2 :         ((IntlWrapper*)this)->pCaseCollator = p;
      74                 :            :     }
      75                 :            :     else
      76                 :            :     {
      77                 :          0 :         p->loadDefaultCollator( aLocale, ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE );
      78                 :          0 :         ((IntlWrapper*)this)->pCollator = p;
      79                 :            :     }
      80                 :          2 : }
      81                 :            : 
      82                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10