LCOV - code coverage report
Current view: top level - unotools/source/i18n - intlwrapper.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 14 23 60.9 %
Date: 2014-11-03 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           6 : 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           6 :         pCaseCollator( NULL )
      34             : {
      35           6 : }
      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          12 : IntlWrapper::~IntlWrapper()
      49             : {
      50           6 :     delete pLocaleData;
      51           6 :     delete pCollator;
      52           6 :     delete pCaseCollator;
      53           6 : }
      54             : 
      55           0 : void IntlWrapper::ImplNewLocaleData() const
      56             : {
      57           0 :     ((IntlWrapper*)this)->pLocaleData = new LocaleDataWrapper( m_xContext, maLanguageTag );
      58           0 : }
      59             : 
      60           2 : void IntlWrapper::ImplNewCollator( bool bCaseSensitive ) const
      61             : {
      62           2 :     CollatorWrapper* p = new CollatorWrapper( m_xContext );
      63           2 :     if ( bCaseSensitive )
      64             :     {
      65           2 :         p->loadDefaultCollator( maLanguageTag.getLocale(), 0 );
      66           2 :         ((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 :         ((IntlWrapper*)this)->pCollator = p;
      73             :     }
      74           2 : }
      75             : 
      76             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10