1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
19 #ifndef INCLUDED_SVL_ZFORLIST_HXX
20 #define INCLUDED_SVL_ZFORLIST_HXX
22 #include <config_options.h>
23 #include <svl/svldllapi.h>
24 #include <rtl/ustrbuf.hxx>
25 #include <rtl/ustring.hxx>
26 #include <o3tl/typed_flags_set.hxx>
27 #include <i18nlangtag/lang.h>
28 #include <com/sun/star/util/NumberFormat.hpp>
29 #include <unotools/localedatawrapper.hxx>
30 #include <tools/link.hxx>
31 #include <svl/ondemand.hxx>
32 #include <svl/nfkeytab.hxx>
38 namespace com::sun::star::i18n
{ class XNumberFormatCode
; }
39 namespace com::sun::star::i18n
{ struct Currency
; }
40 namespace com::sun::star::i18n
{ struct NumberFormatCode
; }
45 class CalendarWrapper
;
47 class ImpSvNumberformatScan
;
48 class ImpSvNumberInputScan
;
50 namespace com::sun::star::uno
{ class XComponentContext
; }
52 #define SV_COUNTRY_LANGUAGE_OFFSET 10000 // Max count of formats per country/language
53 #define SV_MAX_COUNT_STANDARD_FORMATS 100 // Max count of builtin default formats per CL
55 constexpr size_t NF_MAX_FORMAT_SYMBOLS
= 100;
57 /// The built-in @ Text format, offset within a locale, key in the locale the
58 /// number formatter was constructed with.
59 constexpr sal_uInt32 NF_STANDARD_FORMAT_TEXT
= SV_MAX_COUNT_STANDARD_FORMATS
;
61 constexpr sal_uInt32 NUMBERFORMAT_ENTRY_NOT_FOUND
= 0xffffffff; /// MAX_ULONG
63 enum class SvNumFormatType
: sal_Int16
65 /** selects all number formats.
67 ALL
= css::util::NumberFormat::ALL
, // 0
68 /** selects only user-defined number formats.
70 DEFINED
= css::util::NumberFormat::DEFINED
, // 1
71 /** selects date formats.
73 DATE
= css::util::NumberFormat::DATE
, // 2
74 /** selects time formats.
76 TIME
= css::util::NumberFormat::TIME
, // 4
77 /** selects currency formats.
79 CURRENCY
= css::util::NumberFormat::CURRENCY
, // 8
80 /** selects decimal number formats.
82 NUMBER
= css::util::NumberFormat::NUMBER
, // 16
83 /** selects scientific number formats.
85 SCIENTIFIC
= css::util::NumberFormat::SCIENTIFIC
, // 32
86 /** selects number formats for fractions.
88 FRACTION
= css::util::NumberFormat::FRACTION
, // 64
89 /** selects percentage number formats.
91 PERCENT
= css::util::NumberFormat::PERCENT
, // 128
92 /** selects text number formats.
94 TEXT
= css::util::NumberFormat::TEXT
, // 256
95 /** selects number formats which contain date and time.
97 DATETIME
= DATE
| TIME
, // 6
98 /** selects boolean number formats.
100 LOGICAL
= css::util::NumberFormat::LOGICAL
, // 1024
101 /** is used as a return value if no format exists.
103 UNDEFINED
= css::util::NumberFormat::UNDEFINED
, // 2048
104 /** @internal is used to flag an empty sub format.
105 @since LibreOffice 5.1
107 EMPTY
= css::util::NumberFormat::EMPTY
, // 4096
108 /** @internal selects a time duration format.
110 @since LibreOffice 6.2
112 DURATION
= css::util::NumberFormat::DURATION
, // 8196
115 template<> struct typed_flags
<SvNumFormatType
> : is_typed_flags
<SvNumFormatType
, 0x3dff> {};
118 /** enum values for <method>SvNumberFormatter::GetFormatIndex</method>
121 Builtin standard formats, order should be also the arrangement in the
122 dialog list box representation.</p>
126 <li>SYSTEM: As set in System Regional Settings.
127 <li>SYS: short/long defined, order and separators from System Regional Settings.
128 <li>DEF: short/long and order defined, separators from System Regional Settings.
129 <li>DIN: all settings hard coded as DIN (Deutsche Industrie Norm) and EN (European Norm) require.
130 <li>all other: hard coded
133 Do NOT insert any new values!
134 The values here correspond with those in offapi/com/sun/star/i18n/NumberFormatIndex.idl
135 You may append values though after NF_INDEX_TABLE_LOCALE_DATA_DEFAULTS.
137 enum NfIndexTableOffset
139 NF_NUMERIC_START
= 0,
141 NF_NUMBER_START
= NF_NUMERIC_START
,
142 NF_NUMBER_STANDARD
= NF_NUMBER_START
, // Standard/General
144 NF_NUMBER_DEC2
, // 0.00
145 NF_NUMBER_1000INT
, // #,##0
146 NF_NUMBER_1000DEC2
, // #,##0.00
147 NF_NUMBER_SYSTEM
, // #,##0.00 or whatever is set in System Regional Settings
148 NF_NUMBER_END
= NF_NUMBER_SYSTEM
,
151 NF_SCIENTIFIC_000E000
= NF_SCIENTIFIC_START
, // 0.00E+000
152 NF_SCIENTIFIC_000E00
, // 0.00E+00
153 NF_SCIENTIFIC_END
= NF_SCIENTIFIC_000E00
,
156 NF_PERCENT_INT
= NF_PERCENT_START
, // 0%
157 NF_PERCENT_DEC2
, // 0.00%
158 NF_PERCENT_END
= NF_PERCENT_DEC2
,
161 NF_FRACTION_1D
= NF_FRACTION_START
, // # ?/?
162 NF_FRACTION_2D
, // # ??/??
163 NF_FRACTION_END
= NF_FRACTION_2D
,
165 NF_NUMERIC_END
= NF_FRACTION_END
,
168 NF_CURRENCY_1000INT
= NF_CURRENCY_START
,// #,##0 DM
169 NF_CURRENCY_1000DEC2
, // #,##0.00 DM
170 NF_CURRENCY_1000INT_RED
, // #,##0 DM negative in red
171 NF_CURRENCY_1000DEC2_RED
, // #,##0.00 DM negative in red
172 NF_CURRENCY_1000DEC2_CCC
, // #,##0.00 DEM currency abbreviation
173 NF_CURRENCY_1000DEC2_DASHED
, // #,##0.-- DM
174 NF_CURRENCY_END
= NF_CURRENCY_1000DEC2_DASHED
,
177 NF_DATE_SYSTEM_SHORT
= NF_DATE_START
, // 08.10.97
178 NF_DATE_SYSTEM_LONG
, // Wednesday, 8. October 1997
179 NF_DATE_SYS_DDMMYY
, // 08.10.97
180 NF_DATE_SYS_DDMMYYYY
, // 08.10.1997 THE edit format, formatindex="21"
181 NF_DATE_SYS_DMMMYY
, // 8. Oct 97
182 NF_DATE_SYS_DMMMYYYY
, // 8. Oct 1997
183 NF_DATE_DIN_DMMMYYYY
, // 8. Oct. 1997 DIN
184 NF_DATE_SYS_DMMMMYYYY
, // 8. October 1997
185 NF_DATE_DIN_DMMMMYYYY
, // 8. October 1997 DIN
186 NF_DATE_SYS_NNDMMMYY
, // Wed, 8. Okt 97
187 NF_DATE_DEF_NNDDMMMYY
, // Wed 08.Okt 97
188 NF_DATE_SYS_NNDMMMMYYYY
, // Wed, 8. Oktober 1997
189 NF_DATE_SYS_NNNNDMMMMYYYY
, // Wednesday, 8. Oktober 1997
190 NF_DATE_DIN_MMDD
, // 10-08 DIN
191 NF_DATE_DIN_YYMMDD
, // 97-10-08 DIN
192 NF_DATE_DIN_YYYYMMDD
, // 1997-10-08 DIN
193 NF_DATE_ISO_YYYYMMDD
= NF_DATE_DIN_YYYYMMDD
, // 1997-10-08 ISO clarify with name, formatindex="33"
194 NF_DATE_SYS_MMYY
, // 10.97
195 NF_DATE_SYS_DDMMM
, // 08.Oct
196 NF_DATE_MMMM
, // October
197 NF_DATE_QQJJ
, // 4. Quarter 97
198 NF_DATE_WW
, // week of year
199 NF_DATE_END
= NF_DATE_WW
,
202 NF_TIME_HHMM
= NF_TIME_START
, // HH:MM
203 NF_TIME_HHMMSS
, // HH:MM:SS
204 NF_TIME_HHMMAMPM
, // HH:MM AM/PM
205 NF_TIME_HHMMSSAMPM
, // HH:MM:SS AM/PM
206 NF_TIME_HH_MMSS
, // [HH]:MM:SS formatindex="43"
207 NF_TIME_MMSS00
, // MM:SS,00 formatindex="44"
208 NF_TIME_HH_MMSS00
, // [HH]:MM:SS,00 formatindex="45"
209 NF_TIME_END
= NF_TIME_HH_MMSS00
,
212 NF_DATETIME_SYSTEM_SHORT_HHMM
= NF_DATETIME_START
, // 08.10.97 01:23
213 NF_DATETIME_SYS_DDMMYYYY_HHMMSS
, // 08.10.1997 01:23:45 THE edit format, formatindex="47"
214 NF_DATETIME_END
= NF_DATETIME_SYS_DDMMYYYY_HHMMSS
,
216 NF_BOOLEAN
, // BOOLEAN
219 NF_INDEX_TABLE_LOCALE_DATA_DEFAULTS
, // == 50, old number of predefined entries, i18npool locale data additions start after this
221 // From here on are values of new predefined and built-in formats that are
222 // not in the original NumberFormatIndex.idl
224 // XXX Values appended here must also get a corresponding entry in
225 // svl/source/numbers/zforlist.cxx indexTable[] in the same order.
227 // XXX The dialog's number format shell assumes start/end spans
228 // (NF_..._START and NF_..._END above) to fill its categories with builtin
229 // formats, make new formats known to svx/source/items/numfmtsh.cxx
230 // SvxNumberFormatShell::FillEListWithStd_Impl(), otherwise they will not
231 // be listed at all. Yes that is ugly.
232 // DATETIME formats need to be added to
233 // SvxNumberFormatShell::FillEListWithDateTime_Impl().
235 // New predefined format added to i18npool locale data.
236 NF_DATETIME_SYS_DDMMYYYY_HHMM
= NF_INDEX_TABLE_LOCALE_DATA_DEFAULTS
, // 08.10.1997 01:23 formatindex="50"
238 // No i18npool defined locale data between here and NF_INDEX_TABLE_ENTRIES.
239 NF_INDEX_TABLE_RESERVED_START
,
241 NF_FRACTION_3D
= NF_INDEX_TABLE_RESERVED_START
, // # ???/???
242 NF_FRACTION_2
, // # ?/2
243 NF_FRACTION_4
, // # ?/4
244 NF_FRACTION_8
, // # ?/8
245 NF_FRACTION_16
, // # ??/16
246 NF_FRACTION_10
, // # ??/10
247 NF_FRACTION_100
, // # ??/100
249 NF_DATETIME_ISO_YYYYMMDD_HHMMSS
, // 1997-10-08 01:23:45 ISO (with blank instead of T)
250 NF_DATETIME_ISO_YYYYMMDDTHHMMSS
, // 1997-10-08T01:23:45 ISO
252 // XXX When adding values here, follow the comment above about
253 // svx/source/items/numfmtsh.cxx
255 NF_INDEX_TABLE_ENTRIES
// == 60, reserved to not be used in i18npool locale data.
257 // XXX Adding values above may increment the reserved area that can't be
258 // used by i18npool's locale data FormatCode definitions, see the
259 // description at i18npool/source/localedata/data/locale.dtd for ELEMENT
260 // FormatCode what the current convention's value is. In that case, the
261 // used formatIndex values in i18npool/source/localedata/data/*.xml will
262 // have to be adjusted.
263 // Overlapping the area will bail out with a check in
264 // SvNumberFormatter::ImpInsertFormat() in debug builds.
268 // #45717# IsNumberFormat( "98-10-24", 30, x ), YMD Format set with DMY
269 // International settings doesn't recognize the string as a date.
270 /** enum values for <method>SvNumberFormatter::SetEvalDateFormat</method>
272 <p>How <method>ImpSvNumberInputScan::GetDateRef</method> shall take the
273 DateFormat order (YMD,DMY,MDY) into account, if called from IsNumberFormat
274 with a date format to match against.
276 enum NfEvalDateFormat
278 /** DateFormat only from International, default. */
279 NF_EVALDATEFORMAT_INTL
,
281 /** DateFormat only from date format passed to function (if any).
282 If no date format is passed then the DateFormat is taken from International. */
283 NF_EVALDATEFORMAT_FORMAT
,
285 /** First try the DateFormat from International. If it doesn't match a
286 valid date try the DateFormat from the date format passed. */
287 NF_EVALDATEFORMAT_INTL_FORMAT
,
289 /** First try the DateFormat from the date format passed. If it doesn't
290 match a valid date try the DateFormat from International. */
291 NF_EVALDATEFORMAT_FORMAT_INTL
295 typedef std::map
<sal_uInt32
, SvNumberformat
*> SvNumberFormatTable
;
296 typedef std::map
<sal_uInt16
, sal_uInt32
> SvNumberFormatterIndexTable
;
298 typedef ::std::map
< sal_uInt32
, sal_uInt32
> SvNumberFormatterMergeMap
;
300 typedef ::std::set
< LanguageType
> NfInstalledLocales
;
303 /** Language/country dependent currency entries
305 class UNLESS_MERGELIBS(SVL_DLLPUBLIC
) NfCurrencyEntry
307 OUString aSymbol
; /// currency symbol
308 OUString aBankSymbol
; /// currency abbreviation
309 LanguageType eLanguage
; /// language/country value
310 sal_uInt16 nPositiveFormat
; /// position of symbol
311 sal_uInt16 nNegativeFormat
; /// position of symbol and type and position of negative sign
312 sal_uInt16 nDigits
; /// count of decimal digits
313 sal_Unicode cZeroChar
; /// which character is used for zeros as last decimal digits
315 NfCurrencyEntry( const NfCurrencyEntry
& ) = delete;
316 NfCurrencyEntry
& operator=( const NfCurrencyEntry
& ) = delete;
320 // nDecimalFormat := 0, 1, 2
321 // #,##0 or #,##0.00 or #,##0.-- is returned
322 SVL_DLLPRIVATE OUString
Impl_BuildFormatStringNumChars( const LocaleDataWrapper
&, sal_uInt16 nDecimalFormat
) const;
326 NfCurrencyEntry( const LocaleDataWrapper
& rLocaleData
,
327 LanguageType eLang
);
328 NfCurrencyEntry( const css::i18n::Currency
& rCurr
,
329 const LocaleDataWrapper
& rLocaleData
,
330 LanguageType eLang
);
332 /// Symbols and language identical
333 bool operator==( const NfCurrencyEntry
& r
) const;
335 const OUString
& GetSymbol() const { return aSymbol
; }
336 const OUString
& GetBankSymbol() const { return aBankSymbol
; }
337 LanguageType
GetLanguage() const { return eLanguage
; }
338 sal_uInt16
GetPositiveFormat() const { return nPositiveFormat
; }
339 sal_uInt16
GetNegativeFormat() const { return nNegativeFormat
; }
340 sal_uInt16
GetDigits() const { return nDigits
; }
342 /** [$DM-407] (bBank==false) or [$DEM] (bBank==true)
343 is returned. If bBank==false and
344 bWithoutExtension==true only [$DM] */
345 OUString
BuildSymbolString(bool bBank
, bool bWithoutExtension
= false) const;
347 /** #,##0.00 [$DM-407] is returned, separators
348 from rLoc, incl. minus sign but without [RED] */
349 OUString
BuildPositiveFormatString(bool bBank
, const LocaleDataWrapper
&,
350 sal_uInt16 nDecimalFormat
= 1) const;
351 OUString
BuildNegativeFormatString(bool bBank
, const LocaleDataWrapper
&,
352 sal_uInt16 nDecimalFormat
= 1) const;
354 /** [$DM-407] (or [$DEM] if bBank==true)
355 is appended/prepended to rStr, incl. minus sign */
356 void CompletePositiveFormatString(OUStringBuffer
& rStr
, bool bBank
,
357 sal_uInt16 nPosiFormat
) const;
358 void CompleteNegativeFormatString(OUStringBuffer
& rStr
, bool bBank
,
359 sal_uInt16 nNegaFormat
) const;
361 /// rSymStr is appended/prepended to rStr, incl. minus sign
362 static void CompletePositiveFormatString(OUStringBuffer
& rStr
,
363 const OUString
& rSymStr
, sal_uInt16 nPosiFormat
);
364 static void CompleteNegativeFormatString(OUStringBuffer
& rStr
,
365 const OUString
& rSymStr
, sal_uInt16 nNegaFormat
);
367 /** Representation of a currency (symbol position and
368 negative sign) in other language settings */
369 static sal_uInt16
GetEffectivePositiveFormat( sal_uInt16 nIntlFormat
,
370 sal_uInt16 nCurrFormat
, bool bBank
);
371 static sal_uInt16
GetEffectiveNegativeFormat( sal_uInt16 nIntlFormat
,
372 sal_uInt16 nCurrFormat
, bool bBank
);
374 /// General Unicode Euro symbol
375 static sal_Unicode
GetEuroSymbol() { return u
'\x20AC'; }
378 typedef std::vector
< OUString
> NfWSStringsDtor
;
380 /** Input options to be used with IsNumberFormat() */
381 enum class SvNumInputOptions
: sal_uInt16
384 LAX_TIME
= 1 ///< allow input of minutes or seconds >59
387 template<> struct typed_flags
<SvNumInputOptions
> : is_typed_flags
<SvNumInputOptions
, 0x0001> {};
390 class SvNumberFormatterRegistry_Impl
;
391 class NfCurrencyTable
;
393 class SVL_DLLPUBLIC SvNumberFormatter
395 friend class SvNumberFormatterRegistry_Impl
;
398 * We can't technically have an "infinite" value, so we use an arbitrary
399 * upper precision threshold to represent the "unlimited" precision.
401 static const sal_uInt16 UNLIMITED_PRECISION
;
404 * Precision suitable for numbers displayed in input bar, for instance
405 * Calc's formula input bar.
407 static const sal_uInt16 INPUTSTRING_PRECISION
;
409 /// Preferred ctor with service manager and language/country enum
411 const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
,
415 ~SvNumberFormatter();
417 /// Set CallBack to ColorTable
418 void SetColorLink( const Link
<sal_uInt16
,Color
*>& rColorTableCallBack
);
419 /// Do the CallBack to ColorTable
420 Color
* GetUserDefColor(sal_uInt16 nIndex
);
422 /// Change language/country, also input and format scanner
423 void ChangeIntl( LanguageType eLnge
);
424 /// Change the reference null date
425 void ChangeNullDate(sal_uInt16 nDay
, sal_uInt16 nMonth
, sal_Int16 nYear
);
426 /// Change standard precision
427 void ChangeStandardPrec(short nPrec
);
428 /// Set zero value suppression
429 void SetNoZero(bool bNZ
);
431 /** The language with which the formatter was initialized (system setting),
432 NOT the current language after a ChangeIntl() */
433 LanguageType
GetLanguage() const;
435 // Determine whether two format types are input compatible or not
436 static bool IsCompatible(SvNumFormatType eOldType
, SvNumFormatType eNewType
);
438 /** Get table of formats of a specific type of a locale. A format FIndex is
439 tested whether it has the type and locale requested, if it doesn't
440 match FIndex returns the default format for the type/locale. If no
441 specific format is to be selected FIndex may be initialized to 0. */
442 SvNumberFormatTable
& GetEntryTable(SvNumFormatType eType
,
446 /** Get table of formats of a specific type of a language/country.
447 FIndex returns the default format of that type.
448 If the language/country was never touched before new entries are generated */
449 SvNumberFormatTable
& ChangeCL(SvNumFormatType eType
,
453 /** Get table of formats of the same type as FIndex; eType and rLnge are
454 set accordingly. An unknown format is set to Standard/General */
455 SvNumberFormatTable
& GetFirstEntryTable(SvNumFormatType
& eType
,
457 LanguageType
& rLnge
);
459 /// Delete an entry including the format it is referring to
460 void DeleteEntry(sal_uInt32 nKey
);
462 /** Create new entry of a format code string for language/country.
464 <TRUE/> if string new and ok and inserted.
465 <FALSE/> if string already exists or an unresolvable parse error
466 occurred, in which case nCheckPos is the error position within rString.
467 If the error occurs at position 0 or rString is empty nCheckPos
468 will be 1, so an error in the string is always indicated by
469 nCheckPos not being zero.
470 The content of the rString variable can be changed and corrected
472 nType contains the type of the format.
473 nKey contains the index key of the format.
475 bool PutEntry( OUString
& rString
, sal_Int32
& nCheckPos
, SvNumFormatType
& nType
, sal_uInt32
& nKey
,
476 LanguageType eLnge
= LANGUAGE_DONTKNOW
);
478 /** Same as <method>PutEntry</method> but the format code string is
479 considered to be of language/country eLnge and is converted to
480 language/country eNewLnge */
481 bool PutandConvertEntry( OUString
& rString
, sal_Int32
& nCheckPos
,
482 SvNumFormatType
& nType
, sal_uInt32
& nKey
,
483 LanguageType eLnge
, LanguageType eNewLnge
,
484 bool bConvertDateOrder
);
486 /** Same as <method>PutandConvertEntry</method> but the format code string
487 is considered to be of the System language/country eLnge and is
488 converted to another System language/country eNewLnge. In this case
489 the automatic currency is converted too. */
490 bool PutandConvertEntrySystem( OUString
& rString
, sal_Int32
& nCheckPos
,
491 SvNumFormatType
& nType
, sal_uInt32
& nKey
,
492 LanguageType eLnge
, LanguageType eNewLnge
);
494 /** Similar to <method>PutEntry</method> and
495 <method>PutandConvertEntry</method> or
496 <method>PutandConvertEntrySystem</method>, the format code string
497 passed is considered to be of language/country eLnge. If
498 eLnge==LANGUAGE_SYSTEM the format code has to match eSysLnge, and if
499 eSysLnge is not the current application locale the format code is
500 converted to the current locale. Additionally, if the format code
501 represents an old "automatic" currency format, it is converted to the
502 new default currency format of the eLnge locale. The rString format
503 code passed as an argument may get adapted in case eLnge was used (or
504 is LANGUAGE_SYSTEM and eSysLnge is identical); in case it wasn't the
505 method works on a copy instead, otherwise the resulting string would
506 not match eSysLnge anymore.
508 <p> This method was introduced to handle the legacy currency formats of
509 the "autotbl.fmt" file used by Calc and Writer and convert them to
510 fixed currency codes of the actual currency. Note that in the case of
511 legacy currency formats no special attribution is converted, only the
512 default currency format of the locale is chosen, and that new fixed
513 currency codes are of course not converted to other currencies. The
514 method may also be used as a general method taking, converting and
515 inserting almost arbitrary format codes. To insert or use, for example,
516 the default currency format code matching the current locale, the
517 method could be called with<br/>
520 GetIndexPuttingAndConverting( "0 $", LANGUAGE_SYSTEM, LANGUAGE_ENGLISH_US, ...);
524 The index key of the resulting number format. If the format code
525 was empty, could not be converted or has errors, the eLnge locale's
526 standard number format is chosen instead. The index key is
527 guaranteed to represent some valid number format. If
528 rNewInserted==false and rCheckPos>0 the format code has errors
529 and/or could not be converted.
531 sal_uInt32
GetIndexPuttingAndConverting( OUString
& rString
, LanguageType eLnge
,
532 LanguageType eSysLnge
, SvNumFormatType
& rType
,
533 bool & rNewInserted
, sal_Int32
& rCheckPos
);
535 /** Create a format code string using format nIndex as a template and
536 applying other settings (passed from the dialog) */
537 OUString
GenerateFormat(sal_uInt32 nIndex
,
538 LanguageType eLnge
= LANGUAGE_DONTKNOW
,
539 bool bThousand
= false, bool IsRed
= false,
540 sal_uInt16 nPrecision
= 0, sal_uInt16 nLeadingCnt
= 1);
542 /** Analyze an input string
544 <TRUE/> if input is a number or is matching a format F_Index
545 F_Index is set to a matching format if number, the value is
546 returned in fOutNumber
547 <FALSE/> if input is not a number
549 bool IsNumberFormat( const OUString
& sString
, sal_uInt32
& F_Index
, double& fOutNumber
,
550 SvNumInputOptions eInputOptions
= SvNumInputOptions::NONE
);
552 /// Format a number according to a format index, return string and color
553 void GetOutputString( const double& fOutNumber
, sal_uInt32 nFIndex
,
554 OUString
& sOutString
, const Color
** ppColor
, bool bUseStarFormat
= false );
556 /** Format a string according to a format index, return string and color.
557 Formats only if the format code is of type text or the 4th subcode
558 of a format code is specified, otherwise sOutString will be == "" */
559 void GetOutputString( const OUString
& sString
, sal_uInt32 nFIndex
,
560 OUString
& sOutString
, const Color
** ppColor
, bool bUseStarFormat
= false );
562 /** Format a number according to the standard default format matching
563 the given format index */
564 void GetInputLineString( const double& fOutNumber
,
565 sal_uInt32 nFIndex
, OUString
& rOutString
);
567 /** Format a number according to a format code string to be scanned.
569 <FALSE/> if format code contains an error
570 <TRUE/> else, in which case the string and color are returned.
572 bool GetPreviewString(const OUString
& sFormatString
,
573 double fPreviewNumber
,
574 OUString
& sOutString
,
575 const Color
** ppColor
,
577 bool bUseStarFormat
= false );
579 /** Same as <method>GetPreviewString</method> but the format code string
580 may be either language/country eLnge or en_US english US */
581 bool GetPreviewStringGuess( const OUString
& sFormatString
, double fPreviewNumber
,
582 OUString
& sOutString
, const Color
** ppColor
,
583 LanguageType eLnge
= LANGUAGE_DONTKNOW
);
585 /** Format a string according to a format code string to be scanned.
587 <FALSE/> if format code contains an error
588 <TRUE/> else, in which case the string and color are returned.
590 bool GetPreviewString( const OUString
& sFormatString
, const OUString
& sPreviewString
,
591 OUString
& sOutString
, const Color
** ppColor
,
592 LanguageType eLnge
= LANGUAGE_DONTKNOW
);
594 /** Test whether the format code string is already present in container
596 NUMBERFORMAT_ENTRY_NOT_FOUND if not found, else the format index.
598 sal_uInt32
TestNewString( const OUString
& sFormatString
,
599 LanguageType eLnge
= LANGUAGE_DONTKNOW
);
601 /// Whether format index nFIndex is of type text or not
602 bool IsTextFormat(sal_uInt32 nFIndex
) const;
604 /// Get additional info of a format index, e.g. for dialog box
605 void GetFormatSpecialInfo(sal_uInt32 nFormat
, bool& bThousand
, bool& IsRed
,
606 sal_uInt16
& nPrecision
, sal_uInt16
& nLeadingCnt
);
608 /// Count of decimals
609 sal_uInt16
GetFormatPrecision( sal_uInt32 nFormat
) const;
611 /// Count of integer digits
612 sal_uInt16
GetFormatIntegerDigits( sal_uInt32 nFormat
) const;
614 /** Get additional info of a format code string, e.g. for dialog box.
615 Uses a temporary parse, if possible use only if format code is not
616 present in container yet, otherwise ineffective.
618 0 if format code string parsed without errors, otherwise error
619 position (like nCheckPos on <method>PutEntry</method>)
621 sal_uInt32
GetFormatSpecialInfo( const OUString
&, bool& bThousand
, bool& IsRed
,
622 sal_uInt16
& nPrecision
, sal_uInt16
& nLeadingCnt
,
623 LanguageType eLnge
= LANGUAGE_DONTKNOW
);
625 /// Get return string for Calc CELL() function, "G", "D1", ...
626 OUString
GetCalcCellReturn( sal_uInt32 nFormat
) const;
628 /// Check if format code string may be deleted by user
629 bool IsUserDefined( const OUString
& sStr
, LanguageType eLnge
= LANGUAGE_DONTKNOW
);
631 /** Return the format index of the format code string for language/country,
632 or NUMBERFORMAT_ENTRY_NOT_FOUND */
633 sal_uInt32
GetEntryKey( const OUString
& sStr
, LanguageType eLnge
= LANGUAGE_DONTKNOW
);
635 /// Return the format for a format index
636 const SvNumberformat
* GetEntry( sal_uInt32 nKey
) const;
638 /// Obtain substituted GetFormatEntry(), i.e. system formats.
639 const SvNumberformat
* GetSubstitutedEntry( sal_uInt32 nKey
, sal_uInt32
& o_rNewKey
) const;
641 /// Return the format index of the standard default number format for language/country
642 sal_uInt32
GetStandardIndex(LanguageType eLnge
= LANGUAGE_DONTKNOW
);
644 /// Return the format index of the default format of a type for language/country
645 sal_uInt32
GetStandardFormat(SvNumFormatType eType
, LanguageType eLnge
= LANGUAGE_DONTKNOW
);
647 /** Return the format index of the default format of a type for language/country.
648 Maybe not the default format but a special builtin format, e.g. for
649 NF_TIME_HH_MMSS00, if that format is passed in nFIndex. */
650 sal_uInt32
GetStandardFormat( sal_uInt32 nFIndex
, SvNumFormatType eType
, LanguageType eLnge
);
652 /** Return the format index of the default format of a type for language/country.
653 Maybe not the default format but a special builtin format, e.g. for
654 NF_TIME_HH_MMSS00, or NF_TIME_HH_MMSS if fNumber >= 1.0 */
655 sal_uInt32
GetStandardFormat( double fNumber
, sal_uInt32 nFIndex
, SvNumFormatType eType
,
656 LanguageType eLnge
);
658 /// Whether nFIndex is a special builtin format
659 bool IsSpecialStandardFormat( sal_uInt32 nFIndex
, LanguageType eLnge
);
661 /** Return a time format that best matches fNumber. */
662 sal_uInt32
GetTimeFormat( double fNumber
, LanguageType eLnge
, bool bForceDuration
);
664 /** Return a format and type that best matches the value of fNumber if
665 fNumber is assumed to be a date, time or datetime value, but unknown
666 which. Originally introduced for Chart databrowser editor, probably
667 should not be used otherwise. */
668 sal_uInt32
GuessDateTimeFormat( SvNumFormatType
& rType
, double fNumber
, LanguageType eLnge
);
670 /** Return the corresponding edit format of a format. */
671 sal_uInt32
GetEditFormat( double fNumber
, sal_uInt32 nFIndex
, SvNumFormatType eType
,
672 LanguageType eLnge
, SvNumberformat
const * pFormat
);
674 /// Return the reference date
675 const Date
& GetNullDate() const;
676 /// Return the standard decimal precision
677 sal_uInt16
GetStandardPrec() const;
678 /// Return whether zero suppression is switched on
679 bool GetNoZero() const;
680 /** Get the type of a format (or css::util::NumberFormat::UNDEFINED if no entry),
681 but with css::util::NumberFormat::DEFINED masked out */
682 SvNumFormatType
GetType(sal_uInt32 nFIndex
) const;
685 void ClearMergeTable();
686 /// Merge in all new entries from rNewTable and return a table of resulting new format indices
687 SvNumberFormatterIndexTable
* MergeFormatter(SvNumberFormatter
& rNewTable
);
689 /// Whether a merge table is present or not
690 bool HasMergeFormatTable() const;
691 /// Return the new format index for an old format index, if a merge table exists
692 sal_uInt32
GetMergeFormatIndex( sal_uInt32 nOldFmt
) const;
694 /** Convert the ugly old tools' Table type bloated with new'ed sal_uInt32
695 entries merge table to ::std::map with old index key and new index key.
696 @ATTENTION! Also clears the old table using ClearMergeTable() */
697 SvNumberFormatterMergeMap
ConvertMergeTableToMap();
699 /** Return the format index of a builtin format for a specific language/country.
700 If nFormat is not a builtin format nFormat is returned. */
701 sal_uInt32
GetFormatForLanguageIfBuiltIn( sal_uInt32 nFormat
,
702 LanguageType eLnge
= LANGUAGE_DONTKNOW
);
704 /** Return the format index for a builtin format of a specific language
705 @see NfIndexTableOffset
707 sal_uInt32
GetFormatIndex( NfIndexTableOffset
, LanguageType eLnge
= LANGUAGE_DONTKNOW
);
709 /** Return enum index of a format index of a builtin format,
710 NF_INDEX_TABLE_ENTRIES if it's not a builtin format.
711 @see NfIndexTableOffset
713 NfIndexTableOffset
GetIndexTableOffset( sal_uInt32 nFormat
) const;
715 /** Set evaluation type and order of input date strings
716 @see NfEvalDateFormat
718 void SetEvalDateFormat( NfEvalDateFormat eEDF
);
719 NfEvalDateFormat
GetEvalDateFormat() const;
721 /** Set TwoDigitYearStart, how the input string scanner handles a two digit year.
722 Default from VCL: 1930, 30-99 19xx, 00-29 20xx
724 <p> Historically (prior to src513e) it was a two digit number determining
725 until which number the string scanner recognizes a year to be 20xx,
726 default <= 29 is used by SFX/OfaMiscCfg.
727 The name Year2000 is kept although the actual functionality is now a
728 TwoDigitYearStart which might be in any century.
730 void SetYear2000( sal_uInt16 nVal
);
731 sal_uInt16
GetYear2000() const;
732 static sal_uInt16
GetYear2000Default();
734 sal_uInt16
ExpandTwoDigitYear( sal_uInt16 nYear
) const;
735 static sal_uInt16
ExpandTwoDigitYear( sal_uInt16 nYear
, sal_uInt16 nTwoDigitYearStart
);
737 /// Return the decimal separator matching the locale of the given format
738 OUString
GetFormatDecimalSep( sal_uInt32 nFormat
) const;
740 /// Return the decimal separator matching the given locale / LanguageType.
741 OUString
GetLangDecimalSep( LanguageType nLang
) const;
743 static void resetTheCurrencyTable();
745 /// Return a NfCurrencyTable with pointers to <type>NfCurrencyEntry</type> entries
746 static const NfCurrencyTable
& GetTheCurrencyTable();
748 /** Searches, according to the default locale currency, an entry of the
749 CurrencyTable which is <bold>not</bold> the first (LANGUAGE_SYSTEM) entry.
752 else pointer to NfCurrencyEntry
754 static const NfCurrencyEntry
* MatchSystemCurrency();
756 /** Return a NfCurrencyEntry matching a language/country.
757 If language/country is LANGUAGE_SYSTEM a <method>MatchSystemCurrency</method>
758 call is tried to get an entry. If that fails or the corresponding
759 language/country is not present the entry for LANGUAGE_SYSTEM is returned.
761 static const NfCurrencyEntry
& GetCurrencyEntry( LanguageType
);
763 /** Return a NfCurrencyEntry pointer matching a language/country
764 and currency abbreviation (AKA banking symbol).
765 This method is meant for the configuration of the default currency.
768 else pointer to NfCurrencyEntry
770 static const NfCurrencyEntry
* GetCurrencyEntry( const OUString
& rAbbrev
,
771 LanguageType eLang
);
773 /** Return a NfCurrencyEntry pointer matching the symbol
774 combination of a LegacyOnly currency. Note that this means only that
775 the currency matching both symbols was once used in the Office, but is
776 not offered in dialogs anymore. It doesn't even mean that the currency
777 symbol combination is valid, since the reason for removing it may have
778 been just that. #i61657#
780 A matching entry, or else <NULL/>.
782 static const NfCurrencyEntry
* GetLegacyOnlyCurrencyEntry( const OUString
& rSymbol
, const OUString
& rAbbrev
);
784 /** Set the default system currency. The combination of abbreviation and
785 language must match an existent element of theCurrencyTable. If not,
786 the SYSTEM (current locale) entry becomes the default.
787 This method is meant for the configuration of the default currency.
789 static void SetDefaultSystemCurrency( const OUString
& rAbbrev
, LanguageType eLang
);
791 /** Get all standard formats for a specific currency, formats are
792 appended to the NfWSStringsDtor list.
794 <TRUE/>: generate only format strings with currency abbreviation
795 <FALSE/>: mixed format strings
797 position of default format
799 sal_uInt16
GetCurrencyFormatStrings( NfWSStringsDtor
&, const NfCurrencyEntry
&,
802 /** Whether nFormat is of type css::util::NumberFormat::CURRENCY and the format code
803 contains a new SYMBOLTYPE_CURRENCY and if so which one [$xxx-nnn].
804 If ppEntry is not NULL and exactly one entry is found, a [$xxx-nnn] is
805 returned, even if the format code only contains [$xxx] !
807 bool GetNewCurrencySymbolString( sal_uInt32 nFormat
, OUString
& rSymbol
,
808 const NfCurrencyEntry
** ppEntry
,
809 bool* pBank
= nullptr ) const;
811 /** Look up the corresponding NfCurrencyEntry matching
812 rSymbol (may be CurrencySymbol or CurrencyAbbreviation) and possibly
813 a rExtension (being yyy of [$xxx-yyy]) or a given language/country
814 value. Tries to match a rSymbol with rExtension first, then with
815 eFormatLanguage, then rSymbol only. This is because a currency entry
816 might have been constructed using I18N locale data where a used locale
817 of a currency format code must not necessarily match the locale of
818 the locale data itself, e.g. [$HK$-40C] (being "zh_HK" locale) in
819 zh_CN locale data. Here the rExtension would have the value 0x40c but
820 eFormatLanguage of the number format would have the value of zh_CN
821 locale, the value with which the corresponding CurrencyEntry is
825 Only used for output.
826 If the return value is not <NULL/> this value is set to <TRUE/> if
827 the matching entry was found by comparing rSymbol against the
828 CurrencyAbbreviation (AKA BankSymbol).
829 If the return value is <NULL/> the value of bFoundBank is undefined.
831 Currency symbol, preferably obtained of a format by a call to
832 <method>SvNumberformat::GetNewCurrencySymbol()</method>
834 Currency extension, preferably obtained of a format by a call to
835 <method>SvNumberformat::GetNewCurrencySymbol()</method>
836 @param eFormatLanguage
837 The language/country value of the format of which rSymbol and
838 rExtension are obtained (<method>SvNumberformat::GetLanguage()</method>).
839 @param bOnlyStringLanguage
840 If <TRUE/> only entries with language/country of rExtension are
841 checked, no match on eFormatLanguage. If rExtension is empty all
844 The matching entry if unique (in which case bFoundBank is set),
847 static const NfCurrencyEntry
* GetCurrencyEntry( bool & bFoundBank
,
848 const OUString
& rSymbol
,
849 const OUString
& rExtension
,
850 LanguageType eFormatLanguage
,
851 bool bOnlyStringLanguage
= false );
853 /// Get compatibility ("automatic" old style) currency from I18N locale data
854 void GetCompatibilityCurrency( OUString
& rSymbol
, OUString
& rAbbrev
) const;
856 /// Fill rList with the language/country codes that have been allocated
857 void GetUsedLanguages( std::vector
<LanguageType
>& rList
);
859 /// Fill a NfKeywordIndex table with keywords of a language/country
860 void FillKeywordTable( NfKeywordTable
& rKeywords
, LanguageType eLang
);
862 /** Fill a NfKeywordIndex table with keywords usable in Excel export with
863 GetFormatStringForExcel() or SvNumberformat::GetMappedFormatstring() */
864 void FillKeywordTableForExcel( NfKeywordTable
& rKeywords
);
866 /** Return a format code string suitable for Excel export.
868 @param rTempFormatter
869 SvNumberFormatter to use if a non-en-US format code needs to be
870 converted and put, should not be the same formatter to not
871 pollute the entries of this one here.
873 OUString
GetFormatStringForExcel( sal_uInt32 nKey
, const NfKeywordTable
& rKeywords
,
874 SvNumberFormatter
& rTempFormatter
) const;
876 /** Return a keyword for a language/country and NfKeywordIndex
877 for XML import, to generate number format strings. */
878 OUString
GetKeyword( LanguageType eLnge
, sal_uInt16 nIndex
);
880 /** Return the GENERAL keyword in proper case ("General") for a
881 language/country, used in XML import */
882 OUString
GetStandardName( LanguageType eLnge
);
884 /** Check if a specific locale has supported locale data. */
885 static bool IsLocaleInstalled( LanguageType eLang
);
887 /** Obtain NfKeywordTable used with a format, possibly localized.
889 XXX NOTE: the content (actual keywords) is only valid as long as the
890 locale context of the associated ImpSvNumberformatScan instance does
891 not change to a locale with different keywords, which may happen
892 anytime with a call (implicit or explicit) to
893 SvNumberFormatter::ChangeIntl(). If needed longer, copy-create another
894 NfKeywordTable instance or copy individual elements.
896 If the format specified with nKey does not exist, the content of the
897 NfKeywordTable matches the locale with which the SvNumberFormatter
898 instance was created and initialized.
900 This function preliminary exists for unit tests and otherwise is
903 const NfKeywordTable
& GetKeywords( sal_uInt32 nKey
);
905 /** Access for unit tests. */
906 const NfKeywordTable
& GetEnglishKeywords() const;
908 /** Access for unit tests. */
909 const std::vector
<Color
> & GetStandardColors() const;
911 /** Access for unit tests. */
912 size_t GetMaxDefaultColors() const;
914 struct InputScannerPrivateAccess
{ friend class ImpSvNumberInputScan
; private: InputScannerPrivateAccess() {} };
915 /** Access for input scanner to temporarily (!) switch locales. */
916 OnDemandLocaleDataWrapper
& GetOnDemandLocaleDataWrapper( const InputScannerPrivateAccess
& ) { return xLocaleData
; }
919 mutable ::osl::Mutex m_aMutex
;
920 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
921 LanguageTag maLanguageTag
;
922 std::map
<sal_uInt32
, std::unique_ptr
<SvNumberformat
>> aFTable
; // Table of format keys to format entries
923 typedef std::map
<sal_uInt32
, sal_uInt32
> DefaultFormatKeysMap
;
924 DefaultFormatKeysMap aDefaultFormatKeys
; // Table of default standard to format keys
925 std::unique_ptr
<SvNumberFormatTable
> pFormatTable
; // For the UI dialog
926 std::unique_ptr
<SvNumberFormatterIndexTable
> pMergeTable
; // List of indices for merging two formatters
927 std::unique_ptr
<CharClass
> pCharClass
; // CharacterClassification
928 OnDemandLocaleDataWrapper xLocaleData
; // LocaleData switched between SYSTEM, ENGLISH and other
929 OnDemandTransliterationWrapper xTransliteration
; // Transliteration loaded on demand
930 OnDemandCalendarWrapper xCalendar
; // Calendar loaded on demand
931 OnDemandNativeNumberWrapper xNatNum
; // Native number service loaded on demand
932 std::unique_ptr
<ImpSvNumberInputScan
> pStringScanner
; // Input string scanner
933 std::unique_ptr
<ImpSvNumberformatScan
> pFormatScanner
; // Format code string scanner
934 Link
<sal_uInt16
,Color
*> aColorLink
; // User defined color table CallBack
935 sal_uInt32 MaxCLOffset
; // Max language/country offset used
936 sal_uInt32 nDefaultSystemCurrencyFormat
; // NewCurrency matching SYSTEM locale
937 LanguageType IniLnge
; // Initialized setting language/country
938 LanguageType ActLnge
; // Current setting language/country
939 NfEvalDateFormat eEvalDateFormat
; // DateFormat evaluation
940 bool bNoZero
; // Zero value suppression
942 // cached locale data items needed almost any time
943 OUString aDecimalSep
;
944 OUString aDecimalSepAlt
;
945 OUString aThousandSep
;
948 SVL_DLLPRIVATE
static volatile bool bCurrencyTableInitialized
;
949 SVL_DLLPRIVATE
static sal_uInt16 nSystemCurrencyPosition
;
950 SVL_DLLPRIVATE
static SvNumberFormatterRegistry_Impl
* pFormatterRegistry
;
952 // get the registry, create one if none exists
953 SVL_DLLPRIVATE
static SvNumberFormatterRegistry_Impl
& GetFormatterRegistry();
956 SVL_DLLPRIVATE
void ImpConstruct( LanguageType eLang
);
958 // Generate builtin formats provided by i18n behind CLOffset,
959 // if bNoAdditionalFormats==false also generate additional i18n formats.
960 SVL_DLLPRIVATE
void ImpGenerateFormats( sal_uInt32 CLOffset
, bool bNoAdditionalFormats
);
962 // Generate additional formats provided by i18n
963 SVL_DLLPRIVATE
void ImpGenerateAdditionalFormats( sal_uInt32 CLOffset
,
964 css::uno::Reference
< css::i18n::XNumberFormatCode
> const & rNumberFormatCode
,
965 bool bAfterChangingSystemCL
);
967 SVL_DLLPRIVATE SvNumberformat
* ImpInsertFormat( const css::i18n::NumberFormatCode
& rCode
,
969 bool bAfterChangingSystemCL
= false,
970 sal_Int16 nOrgIndex
= 0 );
972 // Return CLOffset or (MaxCLOffset + SV_COUNTRY_LANGUAGE_OFFSET) if new language/country
973 SVL_DLLPRIVATE sal_uInt32
ImpGetCLOffset(LanguageType eLnge
) const;
975 // Test whether format code already exists, then return index key,
976 // otherwise NUMBERFORMAT_ENTRY_NOT_FOUND
977 SVL_DLLPRIVATE sal_uInt32
ImpIsEntry( const OUString
& rString
,
979 LanguageType eLnge
);
981 // Create builtin formats for language/country if necessary, return CLOffset
982 SVL_DLLPRIVATE sal_uInt32
ImpGenerateCL( LanguageType eLnge
);
984 // Create theCurrencyTable with all <type>NfCurrencyEntry</type>
985 SVL_DLLPRIVATE
static void ImpInitCurrencyTable();
987 // Return the format index of the currency format of the system locale.
988 // Format is created if not already present.
989 SVL_DLLPRIVATE sal_uInt32
ImpGetDefaultSystemCurrencyFormat();
991 // Return the format index of the currency format of the current locale.
992 // Format is created if not already present.
993 SVL_DLLPRIVATE sal_uInt32
ImpGetDefaultCurrencyFormat();
995 // Return the default format for a given type and current locale.
996 // May ONLY be called from within GetStandardFormat().
997 SVL_DLLPRIVATE sal_uInt32
ImpGetDefaultFormat( SvNumFormatType nType
);
999 // Return the index in a sequence of format codes matching an enum of
1000 // NfIndexTableOffset. If not found 0 is returned. If the sequence doesn't
1001 // contain any format code elements a default element is created and inserted.
1002 SVL_DLLPRIVATE sal_Int32
ImpGetFormatCodeIndex( css::uno::Sequence
< css::i18n::NumberFormatCode
>& rSeq
,
1003 const NfIndexTableOffset nTabOff
);
1005 // Adjust a sequence of format codes to contain only one (THE) default
1006 // instead of multiple defaults for short/medium/long types.
1007 // If there is no medium but a short and a long default the long is taken.
1008 // Non-PRODUCT version may check locale data for matching defaults in one
1009 // FormatElement group.
1010 SVL_DLLPRIVATE
void ImpAdjustFormatCodeDefault( css::i18n::NumberFormatCode
* pFormatArr
,
1013 // Obtain the format entry for a given key index.
1014 SVL_DLLPRIVATE SvNumberformat
* GetFormatEntry( sal_uInt32 nKey
);
1015 SVL_DLLPRIVATE
const SvNumberformat
* GetFormatEntry( sal_uInt32 nKey
) const;
1017 // used as a loop body inside of GetNewCurrencySymbolString() and GetCurrencyEntry()
1018 static bool ImpLookupCurrencyEntryLoopBody(
1019 const NfCurrencyEntry
*& pFoundEntry
, bool& bFoundBank
, const NfCurrencyEntry
* pData
,
1020 sal_uInt16 nPos
, const OUString
& rSymbol
);
1022 // link to be set at <method>SvtSysLocaleOptions::SetCurrencyChangeLink()</method>
1023 DECL_DLLPRIVATE_STATIC_LINK( SvNumberFormatter
, CurrencyChangeLink
, LinkParamNone
*, void );
1025 // return position of a special character
1026 sal_Int32
ImpPosToken ( const OUStringBuffer
& sFormat
, sal_Unicode token
, sal_Int32 nStartPos
= 0 ) const;
1028 // Substitute a format during GetFormatEntry(), i.e. system formats.
1029 SvNumberformat
* ImpSubstituteEntry( SvNumberformat
* pFormat
, sal_uInt32
* o_pRealKey
= nullptr );
1031 // own mutex, may also be used by internal class SvNumberFormatterRegistry_Impl
1032 static ::osl::Mutex
& GetGlobalMutex();
1033 ::osl::Mutex
& GetInstanceMutex() const { return m_aMutex
; }
1037 // called by SvNumberFormatterRegistry_Impl::Notify if the default system currency changes
1038 void ResetDefaultSystemCurrency();
1040 // Called by SvNumberFormatterRegistry_Impl::Notify if the system locale's
1041 // date acceptance patterns change.
1042 void InvalidateDateAcceptancePatterns();
1044 // Replace the SYSTEM language/country format codes. Called upon change of
1045 // the user configurable locale.
1046 // Old compatibility codes are replaced, user defined are converted, and
1047 // new format codes are appended.
1048 void ReplaceSystemCL( LanguageType eOldLanguage
);
1050 const css::uno::Reference
<css::uno::XComponentContext
>& GetComponentContext() const;
1052 //! The following method is not to be used from outside but must be
1053 //! public for the InputScanner.
1054 // return the current FormatScanner
1055 const ImpSvNumberformatScan
* GetFormatScanner() const;
1057 //! The following methods are not to be used from outside but must be
1058 //! public for the InputScanner and FormatScanner.
1060 // return current (!) Locale
1061 const LanguageTag
& GetLanguageTag() const;
1063 // return corresponding Transliteration wrapper
1064 const ::utl::TransliterationWrapper
* GetTransliteration() const;
1066 // return the corresponding CharacterClassification wrapper
1067 const CharClass
* GetCharClass() const;
1069 // return the corresponding LocaleData wrapper
1070 const LocaleDataWrapper
* GetLocaleData() const;
1072 // return the corresponding Calendar wrapper
1073 CalendarWrapper
* GetCalendar() const;
1075 // return the corresponding NativeNumberSupplier wrapper
1076 const NativeNumberWrapper
* GetNatNum() const;
1078 // cached locale data items
1080 // return the corresponding decimal separator
1081 const OUString
& GetNumDecimalSep() const;
1083 // return the corresponding decimal separator alternative
1084 const OUString
& GetNumDecimalSepAlt() const;
1086 // return the corresponding group (AKA thousand) separator
1087 const OUString
& GetNumThousandSep() const;
1089 // return the corresponding date separator
1090 const OUString
& GetDateSep() const;
1092 // checks for decimal separator and optional alternative
1093 bool IsDecimalSep( const OUString
& rStr
) const;
1096 #endif // INCLUDED_SVL_ZFORLIST_HXX
1098 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */