Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / i18npool / inc / numberformatcode.hxx
blob35951c0c37830d1367fafdcf0470254f2970e9f2
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 .
20 #ifndef INCLUDED_I18NPOOL_INC_NUMBERFORMATCODE_HXX
21 #define INCLUDED_I18NPOOL_INC_NUMBERFORMATCODE_HXX
23 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
24 #include <cppuhelper/implbase.hxx>
26 #include <com/sun/star/i18n/XNumberFormatCode.hpp>
27 #include <com/sun/star/i18n/XLocaleData5.hpp>
28 #include <com/sun/star/uno/Sequence.hxx>
29 #include <com/sun/star/uno/XComponentContext.hpp>
30 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <deque>
33 #include <utility>
35 class NumberFormatCodeMapper : public cppu::WeakImplHelper
37 css::i18n::XNumberFormatCode,
38 css::lang::XServiceInfo
41 public:
42 NumberFormatCodeMapper( const css::uno::Reference <
43 css::uno::XComponentContext >& rxContext );
44 virtual ~NumberFormatCodeMapper() override;
46 virtual css::i18n::NumberFormatCode SAL_CALL getDefault( sal_Int16 nFormatType, sal_Int16 nFormatUsage, const css::lang::Locale& rLocale ) override;
47 virtual css::i18n::NumberFormatCode SAL_CALL getFormatCode( sal_Int16 nFormatIndex, const css::lang::Locale& rLocale ) override;
48 virtual css::uno::Sequence< css::i18n::NumberFormatCode > SAL_CALL getAllFormatCode( sal_Int16 nFormatUsage, const css::lang::Locale& rLocale ) override;
49 virtual css::uno::Sequence< css::i18n::NumberFormatCode > SAL_CALL getAllFormatCodes( const css::lang::Locale& rLocale ) override;
51 //XServiceInfo
52 virtual OUString SAL_CALL getImplementationName() override;
53 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
54 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
56 private:
57 osl::Mutex maMutex;
58 css::uno::Reference < css::i18n::XLocaleData5 > m_xLocaleData;
59 typedef std::pair< css::lang::Locale, css::uno::Sequence< css::i18n::FormatElement > > FormatElementCacheItem;
60 std::deque < FormatElementCacheItem > m_aFormatElementCache;
62 const css::uno::Sequence< css::i18n::FormatElement >& getFormats( const css::lang::Locale& rLocale );
63 static OUString mapElementTypeShortToString(sal_Int16 formatType);
64 static sal_Int16 mapElementTypeStringToShort(const OUString& formatType);
65 static OUString mapElementUsageShortToString(sal_Int16 formatUsage);
66 static sal_Int16 mapElementUsageStringToShort(const OUString& formatUsage);
70 #endif // INCLUDED_I18NPOOL_INC_NUMBERFORMATCODE_HXX
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */