LCOV - code coverage report
Current view: top level - unotools/source/i18n - intlwrapper.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 14 23 60.9 %
Date: 2015-06-13 12:38:46 Functions: 3 5 60.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/intlwrapper.hxx>
      21             : #include <com/sun/star/i18n/CollatorOptions.hpp>
      22             : #include <i18nlangtag/mslangid.hxx>
      23             : #include <comphelper/processfactory.hxx>
      24             : 
      25           4 : IntlWrapper::IntlWrapper(
      26             :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rxContext,
      27             :             const LanguageTag& rLanguageTag )
      28             :         :
      29             :         maLanguageTag( rLanguageTag ),
      30             :         m_xContext( rxContext ),
      31             :         pLocaleData( NULL ),
      32             :         pCollator( NULL ),
      33           4 :         pCaseCollator( NULL )
      34             : {
      35           4 : }
      36             : 
      37           0 : IntlWrapper::IntlWrapper(
      38             :             const LanguageTag& rLanguageTag )
      39             :         :
      40             :         maLanguageTag( rLanguageTag ),
      41             :         m_xContext( comphelper::getProcessComponentContext() ),
      42             :         pLocaleData( NULL ),
      43             :         pCollator( NULL ),
      44           0 :         pCaseCollator( NULL )
      45             : {
      46           0 : }
      47             : 
      48           8 : IntlWrapper::~IntlWrapper()
      49             : {
      50           4 :     delete pLocaleData;
      51           4 :     delete pCollator;
      52           4 :     delete pCaseCollator;
      53           4 : }
      54             : 
      55           0 : void IntlWrapper::ImplNewLocaleData() const
      56             : {
      57           0 :     const_cast<IntlWrapper*>(this)->pLocaleData = new LocaleDataWrapper( m_xContext, maLanguageTag );
      58           0 : }
      59             : 
      60           1 : void IntlWrapper::ImplNewCollator( bool bCaseSensitive ) const
      61             : {
      62           1 :     CollatorWrapper* p = new CollatorWrapper( m_xContext );
      63           1 :     if ( bCaseSensitive )
      64             :     {
      65           1 :         p->loadDefaultCollator( maLanguageTag.getLocale(), 0 );
      66           1 :         const_cast<IntlWrapper*>(this)->pCaseCollator = p;
      67             :     }
      68             :     else
      69             :     {
      70           0 :         p->loadDefaultCollator( maLanguageTag.getLocale(),
      71           0 :                 ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE );
      72           0 :         const_cast<IntlWrapper*>(this)->pCollator = p;
      73             :     }
      74           1 : }
      75             : 
      76             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11