LibreOffice Module unotools (master) 1
intlwrapper.cxx
Go to the documentation of this file.
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
23#include <com/sun/star/i18n/CollatorOptions.hpp>
25#include <utility>
26
28 :
29 maLanguageTag(std::move( aLanguageTag )),
31{
32}
33
35{
36}
37
39{
40 const_cast<IntlWrapper*>(this)->pLocaleData.reset( new LocaleDataWrapper( m_xContext, maLanguageTag ) );
41}
42
43void IntlWrapper::ImplNewCollator( bool bCaseSensitive ) const
44{
45 if ( bCaseSensitive )
46 {
47 const_cast<IntlWrapper*>(this)->moCaseCollator.emplace(m_xContext);
48 const_cast<IntlWrapper*>(this)->moCaseCollator->loadDefaultCollator( maLanguageTag.getLocale(), 0 );
49 }
50 else
51 {
52 const_cast<IntlWrapper*>(this)->moCollator.emplace(m_xContext);
53 const_cast<IntlWrapper*>(this)->moCollator->loadDefaultCollator( maLanguageTag.getLocale(),
54 css::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE );
55 }
56}
57
58/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XComponentContext > m_xContext
A wrapper of I18N wrappers.
Definition: intlwrapper.hxx:52
std::optional< CollatorWrapper > moCollator
Definition: intlwrapper.hxx:58
void ImplNewLocaleData() const
Definition: intlwrapper.cxx:38
std::unique_ptr< LocaleDataWrapper > pLocaleData
Definition: intlwrapper.hxx:57
LanguageTag maLanguageTag
Definition: intlwrapper.hxx:54
void ImplNewCollator(bool bCaseSensitive) const
Definition: intlwrapper.cxx:43
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: intlwrapper.hxx:55
std::optional< CollatorWrapper > moCaseCollator
Definition: intlwrapper.hxx:59
IntlWrapper(LanguageTag aLanguageTag)
Definition: intlwrapper.cxx:27
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
This class can be accessed without locking because we load all of the data in the constructor.
LanguageTag maLanguageTag
Reference< XComponentContext > getProcessComponentContext()