Version 3.6.0.2, tag libreoffice-3.6.0.2
[LibreOffice.git] / i18npool / inc / numberformatcode.hxx
blob9fb98ad54640135a45185b7fd993d450e30d4ba6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _I18N_NUMBERFORMATCODE_HXX_
30 #define _I18N_NUMBERFORMATCODE_HXX_
32 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33 #include <comphelper/processfactory.hxx>
34 #include <cppuhelper/implbase2.hxx> // helper for implementations
36 #include <com/sun/star/i18n/XNumberFormatCode.hpp>
37 #include <com/sun/star/i18n/XLocaleData.hpp>
38 #include <com/sun/star/uno/Sequence.hxx>
39 #include <com/sun/star/lang/XServiceInfo.hpp>
41 class NumberFormatCodeMapper : public cppu::WeakImplHelper2
43 ::com::sun::star::i18n::XNumberFormatCode,
44 ::com::sun::star::lang::XServiceInfo
47 public:
48 NumberFormatCodeMapper( const ::com::sun::star::uno::Reference <
49 ::com::sun::star::lang::XMultiServiceFactory >& rxMSF );
50 ~NumberFormatCodeMapper();
52 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);
53 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);
54 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);
55 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);
57 //XServiceInfo
58 virtual rtl::OUString SAL_CALL getImplementationName(void)
59 throw( ::com::sun::star::uno::RuntimeException );
60 virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
61 throw( ::com::sun::star::uno::RuntimeException );
62 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void)
63 throw( ::com::sun::star::uno::RuntimeException );
65 private:
66 ::com::sun::star::lang::Locale aLocale;
67 ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > xMSF;
68 ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::FormatElement > aFormatSeq;
69 ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XLocaleData > xlocaleData;
70 sal_Bool bFormatsValid;
72 void setupLocale( const ::com::sun::star::lang::Locale& rLocale );
73 void getFormats( const ::com::sun::star::lang::Locale& rLocale );
74 ::rtl::OUString mapElementTypeShortToString(sal_Int16 formatType);
75 sal_Int16 mapElementTypeStringToShort(const ::rtl::OUString& formatType);
76 ::rtl::OUString mapElementUsageShortToString(sal_Int16 formatUsage);
77 sal_Int16 mapElementUsageStringToShort(const ::rtl::OUString& formatUsage);
78 void createLocaleDataObject();
82 #endif // _I18N_NUMBERFORMATCODE_HXX_
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */