bump product version to 4.1.6.2
[LibreOffice.git] / include / unotools / intlwrapper.hxx
blob9165be22b414d0fbdeaa7ddcee4e3a12fd4c0a27
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 .
19 #include "unotools/unotoolsdllapi.h"
21 #ifndef _UNOTOOLS_INTLWRAPPER_HXX
22 #define _UNOTOOLS_INTLWRAPPER_HXX
23 #include <unotools/charclass.hxx>
24 #include <unotools/localedatawrapper.hxx>
25 #include <unotools/calendarwrapper.hxx>
26 #include <unotools/collatorwrapper.hxx>
27 #include <i18nlangtag/lang.h>
28 #include <i18nlangtag/languagetag.hxx>
31 /**
32 A wrapper of I18N wrappers. Using this is more expensive than using some
33 single wrapper classes so use it only if you must pass a single pointer
34 without knowing in advance what is needed, e.g. for
35 SfxPoolItem::GetPresentation(). Remember that this wrapper was only created
36 for convenience to bypass some oddities, if possible don't use it. <p>
38 Implemented are only the const get...() methods of the wrappers, which are
39 loaded on demand, for consistency reasons no change of locale is possible.
40 Only default calendar and default collator are supported. <p>
42 One exception though is the calendar wrapper: to be able to set a value and
43 retrieve calendar values it is not const, so methods using this should
44 reset the calendar to the previous value if it isn't sure where the
45 IntlWrapper did come from. <p>
47 class UNOTOOLS_DLLPUBLIC IntlWrapper
49 private:
51 LanguageTag maLanguageTag;
52 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
54 LocaleDataWrapper* pLocaleData;
55 CollatorWrapper* pCollator;
56 CollatorWrapper* pCaseCollator;
58 void ImplNewLocaleData() const;
59 void ImplNewCollator( sal_Bool bCaseSensitive ) const;
62 public:
63 IntlWrapper(
64 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rxContext,
65 const LanguageTag& rLanguageTag
67 IntlWrapper(
68 const LanguageTag& rLanguageTag
70 ~IntlWrapper();
72 const LanguageTag& getLanguageTag() const { return maLanguageTag; }
74 const LocaleDataWrapper* getLocaleData() const
76 if ( !pLocaleData )
77 ImplNewLocaleData();
78 return pLocaleData;
80 /// case insensitive collator, simple IGNORE_CASE
81 const CollatorWrapper* getCollator() const
83 if ( !pCollator )
84 ImplNewCollator( sal_False );
85 return pCollator;
87 /// case sensitive collator
88 const CollatorWrapper* getCaseCollator() const
90 if ( !pCaseCollator )
91 ImplNewCollator( sal_True );
92 return pCaseCollator;
96 #endif // _UNOTOOLS_INTLWRAPPER_HXX
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */