1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: numberformatcode.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _I18N_NUMBERFORMATCODE_HXX_
32 #define _I18N_NUMBERFORMATCODE_HXX_
34 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
35 #include <comphelper/processfactory.hxx>
36 #include <cppuhelper/implbase2.hxx> // helper for implementations
38 #include <com/sun/star/i18n/XNumberFormatCode.hpp>
39 #include <com/sun/star/i18n/XLocaleData.hpp>
40 #include <com/sun/star/uno/Sequence.hxx>
41 #include <com/sun/star/lang/XServiceInfo.hpp>
43 class NumberFormatCodeMapper
: public cppu::WeakImplHelper2
45 ::com::sun::star::i18n::XNumberFormatCode
,
46 ::com::sun::star::lang::XServiceInfo
50 NumberFormatCodeMapper( const ::com::sun::star::uno::Reference
<
51 ::com::sun::star::lang::XMultiServiceFactory
>& rxMSF
);
52 ~NumberFormatCodeMapper();
54 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
);
55 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
);
56 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
);
57 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
);
60 virtual rtl::OUString SAL_CALL
getImplementationName(void)
61 throw( ::com::sun::star::uno::RuntimeException
);
62 virtual sal_Bool SAL_CALL
supportsService(const rtl::OUString
& ServiceName
)
63 throw( ::com::sun::star::uno::RuntimeException
);
64 virtual ::com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
getSupportedServiceNames(void)
65 throw( ::com::sun::star::uno::RuntimeException
);
68 ::com::sun::star::lang::Locale aLocale
;
69 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> xMSF
;
70 ::com::sun::star::uno::Sequence
< ::com::sun::star::i18n::FormatElement
> aFormatSeq
;
71 ::com::sun::star::uno::Reference
< ::com::sun::star::i18n::XLocaleData
> xlocaleData
;
72 sal_Bool bFormatsValid
;
74 void setupLocale( const ::com::sun::star::lang::Locale
& rLocale
);
75 void getFormats( const ::com::sun::star::lang::Locale
& rLocale
);
76 ::rtl::OUString
mapElementTypeShortToString(sal_Int16 formatType
);
77 sal_Int16
mapElementTypeStringToShort(const ::rtl::OUString
& formatType
);
78 ::rtl::OUString
mapElementUsageShortToString(sal_Int16 formatUsage
);
79 sal_Int16
mapElementUsageStringToShort(const ::rtl::OUString
& formatUsage
);
80 void createLocaleDataObject();
84 #endif // _I18N_NUMBERFORMATCODE_HXX_