update credits
[LibreOffice.git] / unotools / source / i18n / intlwrapper.cxx
blob0382e768ab1618e5ae1b4adcc5c2e8a9b4bbea14
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include "unotools/intlwrapper.hxx"
22 #include <com/sun/star/i18n/CollatorOptions.hpp>
23 #include <i18nlangtag/mslangid.hxx>
24 #include <comphelper/processfactory.hxx>
26 IntlWrapper::IntlWrapper(
27 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rxContext,
28 const LanguageTag& rLanguageTag )
30 maLanguageTag( rLanguageTag ),
31 m_xContext( rxContext ),
32 pLocaleData( NULL ),
33 pCollator( NULL ),
34 pCaseCollator( NULL )
38 IntlWrapper::IntlWrapper(
39 const LanguageTag& rLanguageTag )
41 maLanguageTag( rLanguageTag ),
42 m_xContext( comphelper::getProcessComponentContext() ),
43 pLocaleData( NULL ),
44 pCollator( NULL ),
45 pCaseCollator( NULL )
49 IntlWrapper::~IntlWrapper()
51 delete pLocaleData;
52 delete pCollator;
53 delete pCaseCollator;
57 void IntlWrapper::ImplNewLocaleData() const
59 ((IntlWrapper*)this)->pLocaleData = new LocaleDataWrapper( m_xContext, maLanguageTag );
63 void IntlWrapper::ImplNewCollator( sal_Bool bCaseSensitive ) const
65 CollatorWrapper* p = new CollatorWrapper( m_xContext );
66 if ( bCaseSensitive )
68 p->loadDefaultCollator( maLanguageTag.getLocale(), 0 );
69 ((IntlWrapper*)this)->pCaseCollator = p;
71 else
73 p->loadDefaultCollator( maLanguageTag.getLocale(),
74 ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE );
75 ((IntlWrapper*)this)->pCollator = p;
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */