Branch libreoffice-5-0-4
[LibreOffice.git] / i18npool / inc / numberformatcode.hxx
blob466acb24240a6f11437b196b7200030168597d16
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 <comphelper/processfactory.hxx>
25 #include <cppuhelper/implbase2.hxx>
27 #include <com/sun/star/i18n/XNumberFormatCode.hpp>
28 #include <com/sun/star/i18n/XLocaleData4.hpp>
29 #include <com/sun/star/uno/Sequence.hxx>
30 #include <com/sun/star/lang/XServiceInfo.hpp>
32 class NumberFormatCodeMapper : public cppu::WeakImplHelper2
34 ::com::sun::star::i18n::XNumberFormatCode,
35 ::com::sun::star::lang::XServiceInfo
38 public:
39 NumberFormatCodeMapper( const ::com::sun::star::uno::Reference <
40 ::com::sun::star::uno::XComponentContext >& rxContext );
41 virtual ~NumberFormatCodeMapper();
43 virtual ::com::sun::star::i18n::NumberFormatCode SAL_CALL getDefault( sal_Int16 nFormatType, sal_Int16 nFormatUsage, const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
44 virtual ::com::sun::star::i18n::NumberFormatCode SAL_CALL getFormatCode( sal_Int16 nFormatIndex, const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
45 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode > SAL_CALL getAllFormatCode( sal_Int16 nFormatUsage, const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
46 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode > SAL_CALL getAllFormatCodes( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
48 //XServiceInfo
49 virtual OUString SAL_CALL getImplementationName()
50 throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
51 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
52 throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
53 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
54 throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
56 private:
57 ::com::sun::star::lang::Locale aLocale;
58 ::com::sun::star::uno::Reference < ::com::sun::star::uno::XComponentContext > mxContext;
59 ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::FormatElement > aFormatSeq;
60 ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XLocaleData4 > mxLocaleData;
61 bool bFormatsValid;
63 void setupLocale( const ::com::sun::star::lang::Locale& rLocale );
64 void getFormats( const ::com::sun::star::lang::Locale& rLocale );
65 static OUString mapElementTypeShortToString(sal_Int16 formatType);
66 static sal_Int16 mapElementTypeStringToShort(const OUString& formatType);
67 static OUString mapElementUsageShortToString(sal_Int16 formatUsage);
68 static sal_Int16 mapElementUsageStringToShort(const OUString& formatUsage);
69 void createLocaleDataObject();
73 #endif // INCLUDED_I18NPOOL_INC_NUMBERFORMATCODE_HXX
75 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */