xref: /AOO41X/main/unotools/inc/unotools/localedatawrapper.hxx (revision bae3752ec30c258ca902793e4eea3c818b0bcaad)
1*bae3752eSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*bae3752eSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*bae3752eSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*bae3752eSAndrew Rist  * distributed with this work for additional information
6*bae3752eSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*bae3752eSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*bae3752eSAndrew Rist  * "License"); you may not use this file except in compliance
9*bae3752eSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*bae3752eSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*bae3752eSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*bae3752eSAndrew Rist  * software distributed under the License is distributed on an
15*bae3752eSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*bae3752eSAndrew Rist  * KIND, either express or implied.  See the License for the
17*bae3752eSAndrew Rist  * specific language governing permissions and limitations
18*bae3752eSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*bae3752eSAndrew Rist  *************************************************************/
21*bae3752eSAndrew Rist 
22*bae3752eSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _UNOTOOLS_LOCALEDATAWRAPPER_HXX
25cdf0e10cSrcweir #define _UNOTOOLS_LOCALEDATAWRAPPER_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <tools/string.hxx>
28cdf0e10cSrcweir #include <com/sun/star/i18n/XLocaleData2.hpp>
29cdf0e10cSrcweir #include <com/sun/star/i18n/LocaleItem.hpp>
30cdf0e10cSrcweir #include <com/sun/star/i18n/reservedWords.hpp>
31cdf0e10cSrcweir #include <unotools/readwritemutexguard.hxx>
32cdf0e10cSrcweir #include "unotools/unotoolsdllapi.h"
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #ifndef BOOST_SHARED_PTR_HPP_INCLUDED
35cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
36cdf0e10cSrcweir #endif
37cdf0e10cSrcweir 
38cdf0e10cSrcweir 
39cdf0e10cSrcweir namespace com { namespace sun { namespace star {
40cdf0e10cSrcweir 	namespace lang {
41cdf0e10cSrcweir 		class XMultiServiceFactory;
42cdf0e10cSrcweir 	}
43cdf0e10cSrcweir }}}
44cdf0e10cSrcweir class Date;
45cdf0e10cSrcweir class Time;
46cdf0e10cSrcweir class CalendarWrapper;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 
49cdf0e10cSrcweir enum DateFormat {
50cdf0e10cSrcweir     MDY,
51cdf0e10cSrcweir     DMY,
52cdf0e10cSrcweir     YMD
53cdf0e10cSrcweir };
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 
56cdf0e10cSrcweir enum MeasurementSystem {
57cdf0e10cSrcweir     MEASURE_METRIC,
58cdf0e10cSrcweir     MEASURE_US
59cdf0e10cSrcweir };
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 
62cdf0e10cSrcweir class UNOTOOLS_DLLPUBLIC LocaleDataWrapper
63cdf0e10cSrcweir {
64cdf0e10cSrcweir     static  sal_uInt8                nLocaleDataChecking;    // 0:=dontknow, 1:=yes, 2:=no
65cdf0e10cSrcweir 
66cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >    xSMgr;
67cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData2 >            xLD;
68cdf0e10cSrcweir     ::com::sun::star::lang::Locale                                                      aLocale;
69cdf0e10cSrcweir     ::boost::shared_ptr< ::com::sun::star::i18n::Calendar >                             xDefaultCalendar;
70cdf0e10cSrcweir     ::com::sun::star::i18n::LocaleDataItem                                              aLocaleDataItem;
71cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::rtl::OUString >                                  aReservedWordSeq;
72cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< sal_Int32 >                                        aGrouping;
73cdf0e10cSrcweir 	// cached items
74cdf0e10cSrcweir 	String						aLocaleItem[::com::sun::star::i18n::LocaleItem::COUNT];
75cdf0e10cSrcweir 	String						aReservedWord[::com::sun::star::i18n::reservedWords::COUNT];
76cdf0e10cSrcweir 	String						aCurrSymbol;
77cdf0e10cSrcweir 	String						aCurrBankSymbol;
78cdf0e10cSrcweir 	int							nDateFormat;
79cdf0e10cSrcweir 	int							nLongDateFormat;
80cdf0e10cSrcweir 	sal_uInt16						nCurrPositiveFormat;
81cdf0e10cSrcweir 	sal_uInt16						nCurrNegativeFormat;
82cdf0e10cSrcweir 	sal_uInt16						nCurrDigits;
83cdf0e10cSrcweir 	sal_Bool						bLocaleDataItemValid;
84cdf0e10cSrcweir 	sal_Bool						bReservedWordValid;
85cdf0e10cSrcweir     mutable ::utl::ReadWriteMutex   aMutex;
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 	// dummies, to be implemented or provided by XML locale data
88cdf0e10cSrcweir 	sal_Unicode					cCurrZeroChar;
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 								// not implemented, prevent usage
92cdf0e10cSrcweir 								LocaleDataWrapper( const LocaleDataWrapper& );
93cdf0e10cSrcweir 			LocaleDataWrapper&	operator=( const LocaleDataWrapper& );
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 								// whenever Locale changes
96cdf0e10cSrcweir 			void				invalidateData();
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 			void				getOneLocaleItemImpl( sal_Int16 nItem );
99cdf0e10cSrcweir 			const String&		getOneLocaleItem( sal_Int16 nItem ) const;
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 			void				getOneReservedWordImpl( sal_Int16 nWord );
102cdf0e10cSrcweir 			const String&		getOneReservedWord( sal_Int16 nWord ) const;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 			void				getCurrSymbolsImpl();
105cdf0e10cSrcweir 			void				getCurrFormatsImpl();
106cdf0e10cSrcweir 
107cdf0e10cSrcweir             void                scanCurrFormatImpl( const String& rCode,
108cdf0e10cSrcweir 									xub_StrLen nStart, xub_StrLen& nSign,
109cdf0e10cSrcweir 									xub_StrLen& nPar, xub_StrLen& nNum,
110cdf0e10cSrcweir 									xub_StrLen& nBlank, xub_StrLen& nSym );
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 			void				getDateFormatsImpl();
113cdf0e10cSrcweir             DateFormat          scanDateFormatImpl( const String& rCode );
114cdf0e10cSrcweir 
115cdf0e10cSrcweir             void                getDefaultCalendarImpl();
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 			sal_Unicode*		ImplAddFormatNum( sal_Unicode* pBuf,
118cdf0e10cSrcweir                                     sal_Int64 nNumber, sal_uInt16 nDecimals,
119cdf0e10cSrcweir                                     sal_Bool bUseThousandSep, sal_Bool bTrailingZeros ) const;
120cdf0e10cSrcweir 
121cdf0e10cSrcweir             void                getDigitGroupingImpl();
122cdf0e10cSrcweir 
123cdf0e10cSrcweir public:
124cdf0e10cSrcweir 								LocaleDataWrapper(
125cdf0e10cSrcweir 									const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF,
126cdf0e10cSrcweir 									const ::com::sun::star::lang::Locale& rLocale
127cdf0e10cSrcweir 									);
128cdf0e10cSrcweir 								~LocaleDataWrapper();
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     /** Get the service factory, meant to be able to create a CalendarWrapper
131cdf0e10cSrcweir         from a LocaleDataWrapper. Note that the service factory may be
132cdf0e10cSrcweir         non-existent if this LocaleDataWrapper was created without one and
133cdf0e10cSrcweir         lives "on the grassland". The CalendarWrapper ctor can handle that
134cdf0e10cSrcweir         though. */
135cdf0e10cSrcweir     const ::com::sun::star::uno::Reference<
getServiceFactory() const136cdf0e10cSrcweir         ::com::sun::star::lang::XMultiServiceFactory > & getServiceFactory()
137cdf0e10cSrcweir         const { return xSMgr; }
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 	/// set a new Locale to request
140cdf0e10cSrcweir 			void				setLocale( const ::com::sun::star::lang::Locale& rLocale );
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 	/// get current requested Locale
143cdf0e10cSrcweir     const ::com::sun::star::lang::Locale& getLocale() const;
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 	/// get current loaded Locale, which might differ from the requested Locale
146cdf0e10cSrcweir 	::com::sun::star::lang::Locale getLoadedLocale() const;
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 	// Wrapper implementations of service LocaleData
150cdf0e10cSrcweir 
151cdf0e10cSrcweir     ::com::sun::star::i18n::LanguageCountryInfo getLanguageCountryInfo() const;
152cdf0e10cSrcweir     ::com::sun::star::i18n::LocaleDataItem getLocaleItem() const;
153cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Calendar > getAllCalendars() const;
154cdf0e10cSrcweir     /// NOTE: this wraps XLocaleData2::getAllCurrencies2() in fact.
155cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Currency2 > getAllCurrencies() const;
156cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::FormatElement > getAllFormats() const;
157cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Implementation > getCollatorImplementations() const;
158cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::rtl::OUString > getTransliterations() const;
159cdf0e10cSrcweir 	::com::sun::star::i18n::ForbiddenCharacters getForbiddenCharacters() const;
160cdf0e10cSrcweir 	::com::sun::star::uno::Sequence< ::rtl::OUString > getReservedWord() const;
161cdf0e10cSrcweir 	::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > getAllInstalledLocaleNames() const;
162cdf0e10cSrcweir 
163cdf0e10cSrcweir 	/// same as the wrapper implementation but static
164cdf0e10cSrcweir 	static ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > getInstalledLocaleNames();
165cdf0e10cSrcweir 
166cdf0e10cSrcweir 	/** Get LanguageTypes for all installed locales which are unambiguous
167cdf0e10cSrcweir 		convertible back and forth between locale ISO strings and MS-LCID
168cdf0e10cSrcweir 		LanguageType. Upon the first time the function is called when
169cdf0e10cSrcweir         locale data checking is enabled, messages are shown for locales not
170cdf0e10cSrcweir         matching, excluding already known problems.
171cdf0e10cSrcweir 		(e.g. used in number formatter dialog init)
172cdf0e10cSrcweir 	 */
173cdf0e10cSrcweir 	static ::com::sun::star::uno::Sequence< sal_uInt16 > getInstalledLanguageTypes();
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 	/// maps the LocaleData string to the International enum
176cdf0e10cSrcweir 			MeasurementSystem	mapMeasurementStringToEnum( const String& rMS ) const;
177cdf0e10cSrcweir 
178cdf0e10cSrcweir     /// Convenience method to obtain the default calendar.
179cdf0e10cSrcweir     const ::boost::shared_ptr< ::com::sun::star::i18n::Calendar > getDefaultCalendar() const;
180cdf0e10cSrcweir 
181cdf0e10cSrcweir     /// Convenience method to obtain the day names of the default calendar.
182cdf0e10cSrcweir     const ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > getDefaultCalendarDays() const;
183cdf0e10cSrcweir 
184cdf0e10cSrcweir     /// Convenience method to obtain the month names of the default calendar.
185cdf0e10cSrcweir     const ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > getDefaultCalendarMonths() const;
186cdf0e10cSrcweir 
187cdf0e10cSrcweir     /** Obtain digit grouping. The usually known grouping by thousands (#,###)
188cdf0e10cSrcweir         is actually only one of possible groupings. Another one, for example,
189cdf0e10cSrcweir         used in India is group by 3 and then by 2 indefinitely (#,##,###). The
190cdf0e10cSrcweir         integer sequence returned here specifies grouping from right to left
191cdf0e10cSrcweir         (!), with a 0 entry designating the end of rules and the previous value
192cdf0e10cSrcweir         to be repeated indefinitely. Hence the sequence {3,0} specifies the
193cdf0e10cSrcweir         usual grouping by thousands, whereas the sequence {3,2,0} specifies
194cdf0e10cSrcweir         Indian grouping. The sal_Int32* getConstArray() can be passed directly
195cdf0e10cSrcweir         to the ::rtl::math::doubleToString() methods as argument for the
196cdf0e10cSrcweir         pGroups parameter. */
197cdf0e10cSrcweir     const ::com::sun::star::uno::Sequence< sal_Int32 > getDigitGrouping() const;
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 	// Functionality of class International methods, LocaleItem
200cdf0e10cSrcweir 
getDateSep() const201cdf0e10cSrcweir 	inline	const String&		getDateSep() const
202cdf0e10cSrcweir 									{ return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::DATE_SEPARATOR ); }
getNumThousandSep() const203cdf0e10cSrcweir 	inline	const String&		getNumThousandSep() const
204cdf0e10cSrcweir 									{ return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::THOUSAND_SEPARATOR ); }
getNumDecimalSep() const205cdf0e10cSrcweir 	inline	const String&		getNumDecimalSep() const
206cdf0e10cSrcweir 									{ return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::DECIMAL_SEPARATOR ); }
getTimeSep() const207cdf0e10cSrcweir 	inline	const String&		getTimeSep() const
208cdf0e10cSrcweir 									{ return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::TIME_SEPARATOR ); }
getTime100SecSep() const209cdf0e10cSrcweir 	inline	const String&		getTime100SecSep() const
210cdf0e10cSrcweir 									{ return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::TIME_100SEC_SEPARATOR ); }
getListSep() const211cdf0e10cSrcweir 	inline	const String&		getListSep() const
212cdf0e10cSrcweir 									{ return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::LIST_SEPARATOR ); }
getQuotationMarkStart() const213cdf0e10cSrcweir 	inline	const String&		getQuotationMarkStart() const
214cdf0e10cSrcweir 									{ return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::SINGLE_QUOTATION_START ); }
getQuotationMarkEnd() const215cdf0e10cSrcweir 	inline	const String&		getQuotationMarkEnd() const
216cdf0e10cSrcweir 									{ return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::SINGLE_QUOTATION_END ); }
getDoubleQuotationMarkStart() const217cdf0e10cSrcweir 	inline	const String&		getDoubleQuotationMarkStart() const
218cdf0e10cSrcweir 									{ return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::DOUBLE_QUOTATION_START ); }
getDoubleQuotationMarkEnd() const219cdf0e10cSrcweir 	inline	const String&		getDoubleQuotationMarkEnd() const
220cdf0e10cSrcweir 									{ return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::DOUBLE_QUOTATION_END ); }
getMeasurementSystem() const221cdf0e10cSrcweir 	inline	const String&		getMeasurementSystem() const
222cdf0e10cSrcweir 									{ return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::MEASUREMENT_SYSTEM ); }
getMeasurementSystemEnum() const223cdf0e10cSrcweir 	inline	MeasurementSystem	getMeasurementSystemEnum() const
224cdf0e10cSrcweir 									{ return mapMeasurementStringToEnum( getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::MEASUREMENT_SYSTEM ) ); }
getTimeAM() const225cdf0e10cSrcweir 	inline	const String&		getTimeAM() const
226cdf0e10cSrcweir 									{ return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::TIME_AM ); }
getTimePM() const227cdf0e10cSrcweir 	inline	const String&		getTimePM() const
228cdf0e10cSrcweir 									{ return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::TIME_PM ); }
getLongDateDayOfWeekSep() const229cdf0e10cSrcweir 	inline	const String&		getLongDateDayOfWeekSep() const
230cdf0e10cSrcweir 									{ return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::LONG_DATE_DAY_OF_WEEK_SEPARATOR ); }
getLongDateDaySep() const231cdf0e10cSrcweir 	inline	const String&		getLongDateDaySep() const
232cdf0e10cSrcweir 									{ return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::LONG_DATE_DAY_SEPARATOR ); }
getLongDateMonthSep() const233cdf0e10cSrcweir 	inline	const String&		getLongDateMonthSep() const
234cdf0e10cSrcweir 									{ return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::LONG_DATE_MONTH_SEPARATOR ); }
getLongDateYearSep() const235cdf0e10cSrcweir 	inline	const String&		getLongDateYearSep() const
236cdf0e10cSrcweir 									{ return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::LONG_DATE_YEAR_SEPARATOR ); }
237cdf0e10cSrcweir 
238cdf0e10cSrcweir 	// currency
239cdf0e10cSrcweir 			const String&		getCurrSymbol() const;
240cdf0e10cSrcweir 			const String&		getCurrBankSymbol() const;
241cdf0e10cSrcweir 			sal_uInt16				getCurrPositiveFormat() const;
242cdf0e10cSrcweir 			sal_uInt16				getCurrNegativeFormat() const;
243cdf0e10cSrcweir 			sal_uInt16				getCurrDigits() const;
244cdf0e10cSrcweir 
245cdf0e10cSrcweir     // simple date and time formatting
246cdf0e10cSrcweir 			DateFormat			getDateFormat() const;
247cdf0e10cSrcweir 			DateFormat			getLongDateFormat() const;
248cdf0e10cSrcweir                                 /// only numerical values of Gregorian calendar
249cdf0e10cSrcweir 			String				getDate( const Date& rDate ) const;
250cdf0e10cSrcweir 			String				getTime( const Time& rTime, sal_Bool bSec = sal_True,
251cdf0e10cSrcweir 									sal_Bool b100Sec = sal_False ) const;
252cdf0e10cSrcweir             String              getDuration( const Time& rTime,
253cdf0e10cSrcweir                                     sal_Bool bSec = sal_True, sal_Bool b100Sec = sal_False ) const;
254cdf0e10cSrcweir 
255cdf0e10cSrcweir                                 /** The CalendarWrapper already <b>MUST</b>
256cdf0e10cSrcweir                                     have loaded a calendar.
257cdf0e10cSrcweir                                     @param nDisplayDayOfWeek
258cdf0e10cSrcweir                                         0 := abbreviated name
259cdf0e10cSrcweir                                         1 := full name
260cdf0e10cSrcweir                                     @param bDayOfMonthWithLeadingZero
261cdf0e10cSrcweir                                         <FALSE/> := without leading zero
262cdf0e10cSrcweir                                         <TRUE/>  := with leading zero if <10
263cdf0e10cSrcweir                                     @param nDisplayMonth
264cdf0e10cSrcweir                                         0 := abbreviated name
265cdf0e10cSrcweir                                         1 := full name
266cdf0e10cSrcweir                                     @param bTwoDigitYear
267cdf0e10cSrcweir                                         <FALSE/> := full year
268cdf0e10cSrcweir                                         <TRUE/>  := year % 100
269cdf0e10cSrcweir                                  */
270cdf0e10cSrcweir             String              getLongDate( const Date& rDate,
271cdf0e10cSrcweir                                     CalendarWrapper& rCal,
272cdf0e10cSrcweir                                     sal_Int16 nDisplayDayOfWeek = 1,
273cdf0e10cSrcweir                                     sal_Bool bDayOfMonthWithLeadingZero = sal_False,
274cdf0e10cSrcweir                                     sal_Int16 nDisplayMonth = 1,
275cdf0e10cSrcweir                                     sal_Bool bTwoDigitYear = sal_False
276cdf0e10cSrcweir                                     ) const;
277cdf0e10cSrcweir 
278cdf0e10cSrcweir                                 /** Simple number formatting
279cdf0e10cSrcweir                                     @param nNumber
280cdf0e10cSrcweir                                         value * 10**nDecimals
281cdf0e10cSrcweir                                     @param bTrailingZeros
282cdf0e10cSrcweir                                     </sal_True>  := always display trailing zeros in
283cdf0e10cSrcweir                                         decimal places, even if integer value.
284cdf0e10cSrcweir                                     </sal_False> := trailing zeros are only displayed
285cdf0e10cSrcweir                                         if the value is not an integer value.
286cdf0e10cSrcweir                                  */
287cdf0e10cSrcweir             String              getNum( sal_Int64 nNumber, sal_uInt16 nDecimals,
288cdf0e10cSrcweir                                     sal_Bool bUseThousandSep = sal_True,
289cdf0e10cSrcweir                                     sal_Bool bTrailingZeros = sal_True ) const;
290cdf0e10cSrcweir 
291cdf0e10cSrcweir                                 /// "Secure" currency formatted string.
292cdf0e10cSrcweir             String              getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals,
293cdf0e10cSrcweir                                     const String& rCurrencySymbol,
294cdf0e10cSrcweir                                     sal_Bool bUseThousandSep = sal_True ) const;
295cdf0e10cSrcweir                                 /** Default currency formatted string, use with
296cdf0e10cSrcweir                                     care as default currency may change in any
297cdf0e10cSrcweir                                     locale, for example, DEM -> EUR */
getCurr(sal_Int64 nNumber,sal_uInt16 nDecimals,sal_Bool bUseThousandSep=sal_True) const298cdf0e10cSrcweir             String              getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals,
299cdf0e10cSrcweir                                         sal_Bool bUseThousandSep = sal_True ) const
300cdf0e10cSrcweir                                     { return getCurr( nNumber, nDecimals,
301cdf0e10cSrcweir                                         getCurrSymbol(), bUseThousandSep ); }
302cdf0e10cSrcweir 
303cdf0e10cSrcweir     // dummy returns, to be implemented
getCurrZeroChar() const304cdf0e10cSrcweir 	inline	sal_Unicode			getCurrZeroChar() const
305cdf0e10cSrcweir 									{ return cCurrZeroChar; }
isNumLeadingZero() const306cdf0e10cSrcweir     inline  sal_Bool                isNumLeadingZero() const
307cdf0e10cSrcweir                                     { return sal_True; }
308cdf0e10cSrcweir                                 /// standard decimal places
getNumDigits() const309cdf0e10cSrcweir     inline  sal_uInt16              getNumDigits() const
310cdf0e10cSrcweir                                     { return 2; }
isNumTrailingZeros() const311cdf0e10cSrcweir     inline  sal_Bool                isNumTrailingZeros() const
312cdf0e10cSrcweir                                     { return sal_True; }
313cdf0e10cSrcweir 
314cdf0e10cSrcweir 
315cdf0e10cSrcweir 	// reserved words
316cdf0e10cSrcweir 
getTrueWord() const317cdf0e10cSrcweir 	inline	const String&		getTrueWord() const
318cdf0e10cSrcweir 									{ return getOneReservedWord( ::com::sun::star::i18n::reservedWords::TRUE_WORD ); }
getFalseWord() const319cdf0e10cSrcweir 	inline	const String&		getFalseWord() const
320cdf0e10cSrcweir 									{ return getOneReservedWord( ::com::sun::star::i18n::reservedWords::FALSE_WORD ); }
321cdf0e10cSrcweir     /// return a quarter string matching nQuarter (0..3) => "1st quarter" .. "4th quarter"
getQuarterWord(sal_Int16 nQuarter) const322cdf0e10cSrcweir     inline  const String&       getQuarterWord( sal_Int16 nQuarter ) const
323cdf0e10cSrcweir                                     { return getOneReservedWord( ::com::sun::star::i18n::reservedWords::QUARTER1_WORD + nQuarter ); }
getAboveWord() const324cdf0e10cSrcweir 	inline	const String&		getAboveWord() const
325cdf0e10cSrcweir 									{ return getOneReservedWord( ::com::sun::star::i18n::reservedWords::ABOVE_WORD ); }
getBelowWord() const326cdf0e10cSrcweir 	inline	const String&		getBelowWord() const
327cdf0e10cSrcweir 									{ return getOneReservedWord( ::com::sun::star::i18n::reservedWords::BELOW_WORD ); }
328cdf0e10cSrcweir     /// return a quarter abbreviation string matching nQuarter (0..3) => "Q1" .. "Q2"
getQuarterAbbreviation(sal_Int16 nQuarter) const329cdf0e10cSrcweir     inline  const String&       getQuarterAbbreviation( sal_Int16 nQuarter ) const
330cdf0e10cSrcweir                                     { return getOneReservedWord( ::com::sun::star::i18n::reservedWords::QUARTER1_ABBREVIATION + nQuarter ); }
331cdf0e10cSrcweir 
332cdf0e10cSrcweir     /** Return whether locale data checks are enabled.
333cdf0e10cSrcweir         Checks are enabled if the environment variable
334cdf0e10cSrcweir         OOO_ENABLE_LOCALE_DATA_CHECKS is set to 'Y' or 'Yes' (or any other
335cdf0e10cSrcweir         string starting with 'Y') or '1'.
336cdf0e10cSrcweir         Also used in conjunction with the number formatter. */
areChecksEnabled()337cdf0e10cSrcweir     static  inline  bool        areChecksEnabled()
338cdf0e10cSrcweir                                     {
339cdf0e10cSrcweir                                         if (nLocaleDataChecking == 0)
340cdf0e10cSrcweir                                             evaluateLocaleDataChecking();
341cdf0e10cSrcweir                                         return nLocaleDataChecking == 1;
342cdf0e10cSrcweir                                     }
343cdf0e10cSrcweir 
344cdf0e10cSrcweir     /** Append locale info to string, used with locale data checking.
345cdf0e10cSrcweir         A string similar to "de_DE requested\n en_US loaded" is appended. */
346cdf0e10cSrcweir 			String&			    appendLocaleInfo( String& rDebugMsg ) const;
347cdf0e10cSrcweir 
348cdf0e10cSrcweir     /** Ouput a message during locale data checking. The (UTF-8) string is
349cdf0e10cSrcweir         written to stderr and in a non-product build or if DBG_UTIL is enabled
350cdf0e10cSrcweir         also raised as an assertion message box. */
351cdf0e10cSrcweir     static  void                outputCheckMessage( const String& rMsg );
352cdf0e10cSrcweir     static  void                outputCheckMessage( const char* pStr);
353cdf0e10cSrcweir 
354cdf0e10cSrcweir private:
355cdf0e10cSrcweir     static  void                evaluateLocaleDataChecking();
356cdf0e10cSrcweir };
357cdf0e10cSrcweir 
358cdf0e10cSrcweir 
359cdf0e10cSrcweir #endif // _UNOTOOLS_LOCALEDATAWRAPPER_HXX
360