xref: /AOO41X/main/svl/inc/svl/zforlist.hxx (revision e81522ab7deac2166acad22c877bd52a7b0a2c2f)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _ZFORLIST_HXX
24 #define _ZFORLIST_HXX
25 
26 #include "svl/svldllapi.h"
27 #include <tools/string.hxx>
28 #ifndef _TABLE_HXX //autogen
29 #include <tools/table.hxx>
30 #endif
31 #include <i18npool/lang.h>
32 #include <svl/svarray.hxx>
33 #include <com/sun/star/uno/Reference.hxx>
34 #include <com/sun/star/lang/Locale.hpp>
35 #include <com/sun/star/i18n/NumberFormatCode.hpp>
36 #include <unotools/localedatawrapper.hxx>
37 #include <svl/ondemand.hxx>
38 #include <tools/link.hxx>
39 #include <svl/nfkeytab.hxx>
40 
41 #include <map>
42 
43 class Date;
44 class SvStream;
45 class Color;
46 class SvUShorts;
47 class CharClass;
48 class CalendarWrapper;
49 
50 class ImpSvNumberformatScan;
51 class ImpSvNumberInputScan;
52 class SvNumberformat;
53 
54 namespace com { namespace sun { namespace star {
55     namespace lang {
56         class XMultiServiceFactory;
57     }
58 }}}
59 
60 
61 #define SV_COUNTRY_LANGUAGE_OFFSET  8000    // Max count of formats per country/language
62 #define SV_MAX_ANZ_STANDARD_FORMATE  100    // Max count of builtin default formats per CL
63 
64 // Format types
65 #ifndef NUMBERFORMAT_ALL
66 //  also defined in com/sun/star/util/NumberFormat.hpp
67 //! => put in single .idl file and include here
68 #define NUMBERFORMAT_ALL             0x000  /// Just for Output of total list, not a real format type
69 #define NUMBERFORMAT_DEFINED         0x001  /// Format defined by user
70 #define NUMBERFORMAT_DATE            0x002  /// Number as date
71 #define NUMBERFORMAT_TIME            0x004  /// Number as time
72 #define NUMBERFORMAT_CURRENCY        0x008  /// Number as currency
73 #define NUMBERFORMAT_NUMBER          0x010  /// Any "normal" number format
74 #define NUMBERFORMAT_SCIENTIFIC      0x020  /// Number as scientific
75 #define NUMBERFORMAT_FRACTION        0x040  /// Number as fraction
76 #define NUMBERFORMAT_PERCENT         0x080  /// Number as percent
77 #define NUMBERFORMAT_TEXT            0x100  /// Text format
78 #define NUMBERFORMAT_DATETIME        0x006  /// Number as date and time
79 #define NUMBERFORMAT_LOGICAL         0x400  /// Number as boolean value
80 #define NUMBERFORMAT_UNDEFINED       0x800  /// Format undefined yet in analyzing
81 #endif
82 #define NUMBERFORMAT_ENTRY_NOT_FOUND (sal_uInt32)(0xffffffff)   /// MAX_ULONG
83 
84 
85 /** enum values for <method>SvNumberFormatter::GetFormatIndex</method>
86 
87     <p>
88     Builtin standard formats, order should be also the arrangement in the
89     dialog list box representation.</p>
90 
91     <p>
92     Date specials:<ul>
93     <li>SYSTEM: As set in System Regional Settings.
94     <li>SYS: short/long defined, order and separators from System Regional Settings.
95     <li>DEF: short/long and order defined, separators from System Regional Settings.
96     <li>DIN: all settings hard coded as DIN (Deutsche Industrie Norm) and EN (European Norm) require.
97     <li>all other: hard coded
98     </ul>
99  */
100 enum NfIndexTableOffset
101 {
102     NF_NUMERIC_START = 0,
103 
104     NF_NUMBER_START = NF_NUMERIC_START,
105     NF_NUMBER_STANDARD = NF_NUMBER_START,   // Standard/General
106     NF_NUMBER_INT,                          // 0
107     NF_NUMBER_DEC2,                         // 0.00
108     NF_NUMBER_1000INT,                      // #,##0
109     NF_NUMBER_1000DEC2,                     // #,##0.00
110     NF_NUMBER_SYSTEM,                       // #,##0.00 or whatever is set in System Regional Settings
111     NF_NUMBER_END = NF_NUMBER_SYSTEM,
112 
113     NF_SCIENTIFIC_START,
114     NF_SCIENTIFIC_000E000 = NF_SCIENTIFIC_START,    // 0.00E+000
115     NF_SCIENTIFIC_000E00,                           // 0.00E+00
116     NF_SCIENTIFIC_END = NF_SCIENTIFIC_000E00,
117 
118     NF_PERCENT_START,
119     NF_PERCENT_INT = NF_PERCENT_START,      // 0%
120     NF_PERCENT_DEC2,                        // 0.00%
121     NF_PERCENT_END = NF_PERCENT_DEC2,
122 
123     NF_FRACTION_START,
124     NF_FRACTION_1 = NF_FRACTION_START,      // # ?/?
125     NF_FRACTION_2,                          // # ??/??
126     NF_FRACTION_END = NF_FRACTION_2,
127 
128     NF_NUMERIC_END = NF_FRACTION_END,
129 
130     NF_CURRENCY_START,
131     NF_CURRENCY_1000INT = NF_CURRENCY_START,// #,##0 DM
132     NF_CURRENCY_1000DEC2,                   // #,##0.00 DM
133     NF_CURRENCY_1000INT_RED,                // #,##0 DM         negative in red
134     NF_CURRENCY_1000DEC2_RED,               // #,##0.00 DM      negative in red
135     NF_CURRENCY_1000DEC2_CCC,               // #,##0.00 DEM     currency abbreviation
136     NF_CURRENCY_1000DEC2_DASHED,            // #,##0.-- DM
137     NF_CURRENCY_END = NF_CURRENCY_1000DEC2_DASHED,
138 
139     NF_DATE_START,
140     NF_DATE_SYSTEM_SHORT = NF_DATE_START,   // 08.10.97
141     NF_DATE_SYSTEM_LONG,                    // Wednesday, 8. October 1997
142     NF_DATE_SYS_DDMMYY,                     // 08.10.97
143     NF_DATE_SYS_DDMMYYYY,                   // 08.10.1997
144     NF_DATE_SYS_DMMMYY,                     // 8. Oct 97
145     NF_DATE_SYS_DMMMYYYY,                   // 8. Oct 1997
146     NF_DATE_DIN_DMMMYYYY,                   // 8. Oct. 1997                 DIN
147     NF_DATE_SYS_DMMMMYYYY,                  // 8. October 1997
148     NF_DATE_DIN_DMMMMYYYY,                  // 8. October 1997              DIN
149     NF_DATE_SYS_NNDMMMYY,                   // Wed, 8. Okt 97
150     NF_DATE_DEF_NNDDMMMYY,                  // Wed 08.Okt 97
151     NF_DATE_SYS_NNDMMMMYYYY,                // Wed, 8. Oktober 1997
152     NF_DATE_SYS_NNNNDMMMMYYYY,              // Wednesday, 8. Oktober 1997
153     NF_DATE_DIN_MMDD,                       // 10-08                        DIN
154     NF_DATE_DIN_YYMMDD,                     // 97-10-08                     DIN
155     NF_DATE_DIN_YYYYMMDD,                   // 1997-10-08                   DIN
156     NF_DATE_SYS_MMYY,                       // 10.97
157     NF_DATE_SYS_DDMMM,                      // 08.Oct
158     NF_DATE_MMMM,                           // October
159     NF_DATE_QQJJ,                           // 4. Quarter 97
160     NF_DATE_WW,                             // week of year
161     NF_DATE_END = NF_DATE_WW,
162 
163     NF_TIME_START,
164     NF_TIME_HHMM = NF_TIME_START,           // HH:MM
165     NF_TIME_HHMMSS,                         // HH:MM:SS
166     NF_TIME_HHMMAMPM,                       // HH:MM AM/PM
167     NF_TIME_HHMMSSAMPM,                     // HH:MM:SS AM/PM
168     NF_TIME_HH_MMSS,                        // [HH]:MM:SS
169     NF_TIME_MMSS00,                         // MM:SS,00
170     NF_TIME_HH_MMSS00,                      // [HH]:MM:SS,00
171     NF_TIME_END = NF_TIME_HH_MMSS00,
172 
173     NF_DATETIME_START,
174     NF_DATETIME_SYSTEM_SHORT_HHMM = NF_DATETIME_START,  // 08.10.97 01:23
175     NF_DATETIME_SYS_DDMMYYYY_HHMMSS,        // 08.10.1997 01:23:45
176     NF_DATETIME_END = NF_DATETIME_SYS_DDMMYYYY_HHMMSS,
177 
178     NF_BOOLEAN,                             // BOOLEAN
179     NF_TEXT,                                // @
180     NF_INDEX_TABLE_ENTRIES
181 };
182 
183 
184 // #45717# IsNumberFormat( "98-10-24", 30, x ), YMD Format set with DMY
185 // International settings doesn't recognize the string as a date.
186 /** enum values for <method>SvNumberFormatter::SetEvalDateFormat</method>
187 
188     <p>How <method>ImpSvNumberInputScan::GetDateRef</method> shall take the
189     DateFormat order (YMD,DMY,MDY) into account, if called from IsNumberFormat
190     with a date format to match against.
191  */
192 enum NfEvalDateFormat
193 {
194     /** DateFormat only from International, default. */
195     NF_EVALDATEFORMAT_INTL,
196 
197     /** DateFormat only from date format passed to function (if any).
198         If no date format is passed then the DateFormat is taken from International. */
199     NF_EVALDATEFORMAT_FORMAT,
200 
201     /** First try the DateFormat from International. If it doesn't match a
202         valid date try the DateFormat from the date format passed. */
203     NF_EVALDATEFORMAT_INTL_FORMAT,
204 
205     /** First try the DateFormat from the date format passed. If it doesn't
206         match a valid date try the DateFormat from International. */
207     NF_EVALDATEFORMAT_FORMAT_INTL
208 };
209 
210 
211 //#if 0 // _SOLAR__PRIVATE
212 #define _ZFORLIST_DECLARE_TABLE
213 //#endif
214 #ifdef _ZFORLIST_DECLARE_TABLE
215 DECLARE_TABLE (SvNumberFormatTable, SvNumberformat*)
216 DECLARE_TABLE (SvNumberFormatterIndexTable, sal_uInt32*)
217 #else
218 typedef Table SvNumberFormatTable;
219 typedef Table SvNumberFormatterIndexTable;
220 #endif
221 
222 typedef ::std::map< sal_uInt32, sal_uInt32 > SvNumberFormatterMergeMap;
223 
224 
225 /** Language/country dependent currency entries
226  */
227 class SVL_DLLPUBLIC NfCurrencyEntry
228 {
229     String          aSymbol;            /// currency symbol
230     String          aBankSymbol;        /// currency abbreviation
231     LanguageType    eLanguage;          /// language/country value
232     sal_uInt16          nPositiveFormat;    /// position of symbol
233     sal_uInt16          nNegativeFormat;    /// position of symbol and type and position of negative sign
234     sal_uInt16          nDigits;            /// count of decimal digits
235     sal_Unicode     cZeroChar;          /// which character is used for zeros as last decimal digits
236 
237                         /// not implemented, prevent usage
238                         NfCurrencyEntry( const NfCurrencyEntry& );
239                         /// not implemented, prevent usage
240     NfCurrencyEntry&    operator=( const NfCurrencyEntry& );
241 
242 private:
243 
244 //#if 0 // _SOLAR__PRIVATE
245                         // nDecimalFormat := 0, 1, 2
246                         // #,##0 or #,##0.00 or #,##0.-- are assigned
247     SVL_DLLPRIVATE void             Impl_BuildFormatStringNumChars( String&,
248                             const LocaleDataWrapper&, sal_uInt16 nDecimalFormat ) const;
249 //#endif    // __PRIVATE
250 
251 public:
252 
253                         NfCurrencyEntry();
254                         NfCurrencyEntry( const LocaleDataWrapper& rLocaleData,
255                             LanguageType eLang );
256                         NfCurrencyEntry(
257                             const ::com::sun::star::i18n::Currency & rCurr,
258                             const LocaleDataWrapper& rLocaleData,
259                             LanguageType eLang );
~NfCurrencyEntry()260                         ~NfCurrencyEntry() {}
261 
262                         /// Symbols and language identical
263     sal_Bool                operator==( const NfCurrencyEntry& r ) const;
264 
265                         /// Set this format to be the EURo entry, overwrite other settings
266     void                SetEuro();
267     sal_Bool                IsEuro() const;
268 
269                         /** Apply format information (nPositiveFormat,
270                             nNegativeFormat, nDigits, cZeroChar) of another format. */
271     void                ApplyVariableInformation( const NfCurrencyEntry& );
272 
GetSymbol() const273     const String&       GetSymbol() const           { return aSymbol; }
GetBankSymbol() const274     const String&       GetBankSymbol() const       { return aBankSymbol; }
GetLanguage() const275     LanguageType        GetLanguage() const         { return eLanguage; }
GetPositiveFormat() const276     sal_uInt16              GetPositiveFormat() const   { return nPositiveFormat; }
GetNegativeFormat() const277     sal_uInt16              GetNegativeFormat() const   { return nNegativeFormat; }
GetDigits() const278     sal_uInt16              GetDigits() const           { return nDigits; }
GetZeroChar() const279     sal_Unicode         GetZeroChar() const         { return cZeroChar; }
280 
281                         /** [$DM-407] (bBank==sal_False) or [$DEM] (bBank==sal_True)
282                             is assigned to rStr, if bBank==sal_False and
283                             bWithoutExtension==sal_True only [$DM] */
284     void                BuildSymbolString( String& rStr, sal_Bool bBank,
285                             sal_Bool bWithoutExtension = sal_False ) const;
286 
287                         /** #,##0.00 [$DM-407] is assigned to rStr, separators
288                              from rLoc, incl. minus sign but without [RED] */
289     void                BuildPositiveFormatString( String& rStr, sal_Bool bBank,
290                             const LocaleDataWrapper&, sal_uInt16 nDecimalFormat = 1 ) const;
291     void                BuildNegativeFormatString( String& rStr, sal_Bool bBank,
292                             const LocaleDataWrapper&, sal_uInt16 nDecimalFormat = 1 ) const;
293 
294                         /** [$DM-407] (or [$DEM] if bBank==sal_True)
295                             is appended/prepended to rStr, incl. minus sign */
296     void                CompletePositiveFormatString( String& rStr, sal_Bool bBank,
297                             sal_uInt16 nPosiFormat ) const;
298     void                CompleteNegativeFormatString( String& rStr, sal_Bool bBank,
299                             sal_uInt16 nNegaFormat ) const;
300 
301                         /// rSymStr is appended/prepended to rStr, incl. minus sign
302     static  void        CompletePositiveFormatString( String& rStr,
303                             const String& rSymStr, sal_uInt16 nPosiFormat );
304     static  void        CompleteNegativeFormatString( String& rStr,
305                             const String& rSymStr, sal_uInt16 nNegaFormat );
306 
307                         /** Representation of a currency (symbol position and
308                             negative sign) in other language settings */
309     static  sal_uInt16      GetEffectivePositiveFormat( sal_uInt16 nIntlFormat,
310                             sal_uInt16 nCurrFormat, sal_Bool bBank );
311     static  sal_uInt16      GetEffectiveNegativeFormat( sal_uInt16 nIntlFormat,
312                             sal_uInt16 nCurrFormat, sal_Bool bBank );
313 
314                         /// General Unicode Euro symbol
GetEuroSymbol()315     static inline sal_Unicode   GetEuroSymbol() { return sal_Unicode(0x20AC); }
316                         /** Platform and CharSet dependent Euro symbol,
317                             needed for import/export */
318     static  sal_Char    GetEuroSymbol( rtl_TextEncoding eTextEncoding );
319 };
320 
321 typedef NfCurrencyEntry* NfCurrencyEntryPtr;
322 SV_DECL_PTRARR_DEL( NfCurrencyTable, NfCurrencyEntryPtr, 128, 1 )
323 typedef String* WSStringPtr;
324 SV_DECL_PTRARR_DEL_VISIBILITY( NfWSStringsDtor, WSStringPtr, 8, 1, SVL_DLLPUBLIC )
325 
326 
327 class SvNumberFormatterRegistry_Impl;
328 
329 class SVL_DLLPUBLIC SvNumberFormatter
330 {
331 public:
332     /**
333      * We can't technically have an "infinite" value, so we use an arbitrary
334      * upper precision threshold to represent the "unlimited" precision.
335      */
336     static const sal_uInt16 UNLIMITED_PRECISION;
337 
338     /**
339      * Precision suitable for numbers displayed in input bar, for instance
340      * Calc's formula input bar.
341      */
342     static const sal_uInt16 INPUTSTRING_PRECISION;
343 
344     /// Preferred ctor with service manager and language/country enum
345     SvNumberFormatter(
346         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMgr,
347         LanguageType eLang
348         );
349 
350     /// Depricated ctor without service manager
351     SvNumberFormatter( LanguageType eLang );
352 
353     ~SvNumberFormatter();
354 
355     /// Set CallBack to ColorTable
SetColorLink(const Link & rColorTableCallBack)356     void SetColorLink( const Link& rColorTableCallBack )    { aColorLink = rColorTableCallBack; }
357     /// Do the CallBack to ColorTable
358     Color* GetUserDefColor(sal_uInt16 nIndex);
359 
360     /// Change language/country, also input and format scanner
361     void ChangeIntl( LanguageType eLnge );
362     /// Change the reference null date
363     void ChangeNullDate(sal_uInt16 nDay, sal_uInt16 nMonth, sal_uInt16 nYear);
364     /// Change standard precision
365     void ChangeStandardPrec(short nPrec);
366     /// Set zero value suppression
SetNoZero(sal_Bool bNZ)367     void SetNoZero(sal_Bool bNZ) { bNoZero = bNZ; }
368 
369     /** The language with which the formatter was initialized (system setting),
370         NOT the current language after a ChangeIntl() */
GetLanguage() const371     LanguageType GetLanguage() const { return IniLnge; }
372 
373     // Determine whether two format types are input compatible or not
374     sal_Bool IsCompatible(short eOldType, short eNewType);
375 
376     /** Get table of formats of a specific type of a locale. A format FIndex is
377         tested whether it has the type and locale requested, if it doesn't
378         match FIndex returns the default format for the type/locale. If no
379         specific format is to be selected FIndex may be initialized to 0. */
380     SvNumberFormatTable& GetEntryTable(short eType,
381                                        sal_uInt32& FIndex,
382                                        LanguageType eLnge);
383 
384     /** Get table of formats of a specific type of a language/country.
385         FIndex returns the default format of that type.
386         If the language/country was never touched before new entries are generated */
387     SvNumberFormatTable& ChangeCL(short eType,
388                                   sal_uInt32& FIndex,
389                                   LanguageType eLnge);
390 
391     /** Get table of formats of the same type as FIndex; eType and rLnge are
392         set accordingly. An unknown format is set to Standard/General */
393     SvNumberFormatTable& GetFirstEntryTable(short& eType,
394                                             sal_uInt32& FIndex,
395                                             LanguageType& rLnge);
396 
397     /// Delete an entry including the format it is refering to
398     void DeleteEntry(sal_uInt32 nKey);
399 
400     /** Create new entry of a format code string for language/country.
401         @return
402             <TRUE/> if string new and ok and inserted.
403             <FALSE/> if string already exists or an unresolvable parse error
404             occured, in which case nCheckPos is the error position within rString.
405             If the error occurs at position 0 or rString is empty nCheckPos
406             will be 1, so an error in the string is always indicated by
407             nCheckPos not being zero.
408             The content of the rString variable can be changed and corrected
409             by the method.
410             nType contains the type of the format.
411             nKey contains the index key of the format.
412      */
413     sal_Bool PutEntry( String& rString, xub_StrLen& nCheckPos, short& nType, sal_uInt32& nKey,
414                   LanguageType eLnge = LANGUAGE_DONTKNOW );
415 
416     /** Same as <method>PutEntry</method> but the format code string is
417         considered to be of language/country eLnge and is converted to
418         language/country eNewLnge */
419     sal_Bool PutandConvertEntry( String& rString, xub_StrLen& nCheckPos,
420                              short& nType, sal_uInt32& nKey,
421                              LanguageType eLnge, LanguageType eNewLnge );
422 
423     /** Same as <method>PutandConvertEntry</method> but the format code string
424         is considered to be of the System language/country eLnge and is
425         converted to another System language/country eNewLnge. In this case
426         the automatic currency is converted too. */
427     sal_Bool PutandConvertEntrySystem( String& rString, xub_StrLen& nCheckPos,
428                              short& nType, sal_uInt32& nKey,
429                              LanguageType eLnge, LanguageType eNewLnge );
430 
431     /** Similar to <method>PutEntry</method> and
432         <method>PutandConvertEntry</method> or
433         <method>PutandConvertEntrySystem</method>, the format code string
434         passed is considered to be of language/country eLnge. If
435         eLnge==LANGUAGE_SYSTEM the format code has to match eSysLnge, and if
436         eSysLnge is not the current application locale the format code is
437         converted to the current locale. Additionally, if the format code
438         represents an old "automatic" currency format, it is converted to the
439         new default currency format of the eLnge locale. The rString format
440         code passed as an argument may get adapted in case eLnge was used (or
441         is LANGUAGE_SYSTEM and eSysLnge is identical); in case it wasn't the
442         method works on a copy instead, otherwise the resulting string would
443         not match eSysLnge anymore.
444 
445         <p> This method was introduced to handle the legacy currency formats of
446         the "autotbl.fmt" file used by Calc and Writer and convert them to
447         fixed currency codes of the actual currency. Note that in the case of
448         legacy currency formats no special attribution is converted, only the
449         default currency format of the locale is chosen, and that new fixed
450         currency codes are of course not converted to other currencies. The
451         method may also be used as a general method taking, converting and
452         inserting almost arbitrary format codes. To insert or use, for example,
453         the default currency format code matching the current locale, the
454         method could be called with<br/>
455 
456         <code>
457         GetIndexPuttingAndConverting( "0 $", LANGUAGE_SYSTEM, LANGUAGE_ENGLISH_US, ...);
458         </code>
459 
460         @return
461             The index key of the resulting number format. If the format code
462             was empty, could not be converted or has errors, the eLnge locale's
463             standard number format is chosen instead. The index key is
464             guaranteed to represent some valid number format. If
465             rNewInserted==sal_False and rCheckPos>0 the format code has errors
466             and/or could not be converted.
467      */
468     sal_uInt32 GetIndexPuttingAndConverting( String & rString, LanguageType eLnge,
469                                         LanguageType eSysLnge, short & rType,
470                                         sal_Bool & rNewInserted,
471                                         xub_StrLen & rCheckPos );
472 
473     /** Create a format code string using format nIndex as a template and
474         applying other settings (passed from the dialog) */
475     void GenerateFormat( String& sString, sal_uInt32 nIndex,
476                         LanguageType eLnge = LANGUAGE_DONTKNOW,
477                         sal_Bool bThousand = sal_False, sal_Bool IsRed = sal_False,
478                         sal_uInt16 nPrecision = 0, sal_uInt16 nAnzLeading = 1 );
479 
480     /** Analyze an input string
481         @return
482             <TRUE/> if input is a number or is matching a format F_Index
483                 F_Index is set to a matching format if number, the value is
484                 returned in fOutNumber
485             <FALSE/> if input is not a number
486      */
487     sal_Bool IsNumberFormat( const String& sString, sal_uInt32& F_Index, double& fOutNumber );
488 
489     /// Format a number according to a format index, return string and color
490     void GetOutputString( const double& fOutNumber, sal_uInt32 nFIndex,
491                           String& sOutString, Color** ppColor );
492 
493     /** Format a string according to a format index, return string and color.
494         Formats only if the format code is of type text or the 4th subcode
495         of a format code is specified, otherwise sOutString will be == "" */
496     void GetOutputString( String& sString, sal_uInt32 nFIndex,
497                           String& sOutString, Color** ppColor );
498 
499     /** Format a number according to the standard default format matching
500         the given format index */
501     void GetInputLineString( const double& fOutNumber,
502                             sal_uInt32 nFIndex, String& sOutString );
503 
504     /** Format a number according to a format code string to be scanned.
505         @return
506             <FALSE/> if format code contains an error
507             <TRUE/> else, in which case the string and color are returned.
508      */
509     sal_Bool GetPreviewString( const String& sFormatString, double fPreviewNumber,
510                           String& sOutString, Color** ppColor,
511                           LanguageType eLnge = LANGUAGE_DONTKNOW );
512 
513     /** Same as <method>GetPreviewString</method> but the format code string
514         may be either language/country eLnge or en_US english US */
515     sal_Bool GetPreviewStringGuess( const String& sFormatString, double fPreviewNumber,
516                           String& sOutString, Color** ppColor,
517                           LanguageType eLnge = LANGUAGE_DONTKNOW );
518 
519     /** Format a string according to a format code string to be scanned.
520         @return
521             <FALSE/> if format code contains an error
522             <TRUE/> else, in which case the string and color are returned.
523      */
524     sal_Bool GetPreviewString( const String& sFormatString, const String& sPreviewString,
525                           String& sOutString, Color** ppColor,
526                           LanguageType eLnge = LANGUAGE_DONTKNOW );
527 
528     /** Test whether the format code string is already present in container
529         @return
530             NUMBERFORMAT_ENTRY_NOT_FOUND if not found, else the format index.
531      */
532     sal_uInt32 TestNewString( const String& sFormatString,
533                         LanguageType eLnge = LANGUAGE_DONTKNOW );
534 
535     /// Whether format index nFIndex is of type text or not
536     sal_Bool IsTextFormat(sal_uInt32 nFIndex) const;
537     /// Whether the 4th string subcode of format index nFIndex is present
538     sal_Bool HasTextFormat(sal_uInt32 nFIndex) const;
539 
540     /// Load all formats from a stream
541     sal_Bool Load( SvStream& rStream );
542     /// Save all formats to a stream
543     sal_Bool Save( SvStream& rStream ) const;
544     /// Reset of "Used" flags
545     void PrepareSave();
546 
547     /// Flag format index as used
548     void SetFormatUsed(sal_uInt32 nFIndex);
549 
550     /// Get additional info of a format index, e.g. for dialog box
551     void GetFormatSpecialInfo(sal_uInt32 nFormat, sal_Bool& bThousand, sal_Bool& IsRed,
552                               sal_uInt16& nPrecision, sal_uInt16& nAnzLeading);
553 
554     /// Count of decimals
555     sal_uInt16 GetFormatPrecision( sal_uInt32 nFormat ) const;
556 
557     /** Get additional info of a format code string, e.g. for dialog box.
558         Uses a temporary parse, if possible use only if format code is not
559         present in container yet, otherwise ineffective.
560         @return
561             0 if format code string parsed without errors, otherwise error
562             position (like nCheckPos on <method>PutEntry</method>)
563      */
564     sal_uInt32 GetFormatSpecialInfo( const String&, sal_Bool& bThousand, sal_Bool& IsRed,
565                               sal_uInt16& nPrecision, sal_uInt16& nAnzLeading,
566                               LanguageType eLnge = LANGUAGE_DONTKNOW );
567 
568     /// Check if format code string may be deleted by user
569     sal_Bool IsUserDefined( const String& sStr, LanguageType eLnge = LANGUAGE_DONTKNOW );
570 
571     /** Return the format index of the format code string for language/country,
572         or NUMBERFORMAT_ENTRY_NOT_FOUND */
573     sal_uInt32 GetEntryKey( const String& sStr, LanguageType eLnge = LANGUAGE_DONTKNOW );
574 
575     /// Return the format for a format index
GetEntry(sal_uInt32 nKey) const576     const SvNumberformat* GetEntry(sal_uInt32 nKey) const
577         { return (SvNumberformat*) aFTable.Get(nKey); }
578 
579     /// Return the format index of the standard default number format for language/country
580     sal_uInt32 GetStandardIndex(LanguageType eLnge = LANGUAGE_DONTKNOW);
581 
582     /// Return the format index of the default format of a type for language/country
583     sal_uInt32 GetStandardFormat(short eType, LanguageType eLnge = LANGUAGE_DONTKNOW);
584 
585     /** Return the format index of the default format of a type for language/country.
586         Maybe not the default format but a special builtin format, e.g. for
587         NF_TIME_HH_MMSS00, if that format is passed in nFIndex. */
588     sal_uInt32 GetStandardFormat( sal_uInt32 nFIndex, short eType, LanguageType eLnge );
589 
590     /** Return the format index of the default format of a type for language/country.
591         Maybe not the default format but a special builtin format, e.g. for
592         NF_TIME_HH_MMSS00, or NF_TIME_HH_MMSS if fNumber >= 1.0  */
593     sal_uInt32 GetStandardFormat( double fNumber, sal_uInt32 nFIndex, short eType,
594                             LanguageType eLnge );
595 
596     /// Whether nFIndex is a special builtin format
597     sal_Bool IsSpecialStandardFormat( sal_uInt32 nFIndex, LanguageType eLnge );
598 
599     /// Return the reference date
600     Date* GetNullDate();
601     /// Return the standard decimal precision
602     sal_uInt16 GetStandardPrec();
603     /// Return whether zero suppression is switched on
GetNoZero()604     sal_Bool GetNoZero() { return bNoZero; }
605     /** Get the type of a format (or NUMBERFORMAT_UNDEFINED if no entry),
606         but with NUMBERFORMAT_DEFINED masked out */
607     short GetType(sal_uInt32 nFIndex);
608 
609     /// As the name says
610     void ClearMergeTable();
611     /// Merge in all new entries from rNewTable and return a table of resulting new format indices
612     SvNumberFormatterIndexTable* MergeFormatter(SvNumberFormatter& rNewTable);
613 
614     /// Whether a merge table is present or not
615     inline sal_Bool HasMergeFmtTbl() const;
616     /// Return the new format index for an old format index, if a merge table exists
617     inline sal_uInt32 GetMergeFmtIndex( sal_uInt32 nOldFmt ) const;
618 
619     /** Convert the ugly old tools' Table type bloated with new'ed sal_uInt32
620         entries merge table to ::std::map with old index key and new index key.
621         @ATTENTION! Also clears the old table using ClearMergeTable() */
622     SvNumberFormatterMergeMap ConvertMergeTableToMap();
623 
624     /// Return the last used position ever of a language/country combination
625     sal_uInt16 GetLastInsertKey(sal_uInt32 CLOffset);
626 
627     /** Return the format index of a builtin format for a specific language/country.
628         If nFormat is not a builtin format nFormat is returned. */
629     sal_uInt32 GetFormatForLanguageIfBuiltIn( sal_uInt32 nFormat,
630                                     LanguageType eLnge = LANGUAGE_DONTKNOW );
631 
632     /** Return the format index for a builtin format of a specific language
633         @see NfIndexTableOffset
634      */
635     sal_uInt32 GetFormatIndex( NfIndexTableOffset, LanguageType eLnge = LANGUAGE_DONTKNOW );
636 
637     /** Return enum index of a format index of a builtin format,
638         NF_INDEX_TABLE_ENTRIES if it's not a builtin format.
639         @see NfIndexTableOffset
640      */
641     NfIndexTableOffset GetIndexTableOffset( sal_uInt32 nFormat ) const;
642 
643     /** Set evaluation type and order of input date strings
644         @see NfEvalDateFormat
645      */
SetEvalDateFormat(NfEvalDateFormat eEDF)646     void SetEvalDateFormat( NfEvalDateFormat eEDF ) { eEvalDateFormat = eEDF; }
GetEvalDateFormat() const647     NfEvalDateFormat GetEvalDateFormat() const { return eEvalDateFormat; }
648 
649     /** Set TwoDigitYearStart, how the input string scanner handles a two digit year.
650         Default from VCL: 1930, 30-99 19xx, 00-29 20xx
651 
652         <p> Historically (prior to src513e) it was a two digit number determing
653         until which number the string scanner recognizes a year to be 20xx,
654         default <= 29 is used by SFX/OfaMiscCfg.
655         The name Year2000 is kept although the actual functionality is now a
656         TwoDigitYearStart which might be in any century.
657      */
658     void    SetYear2000( sal_uInt16 nVal );
659     sal_uInt16  GetYear2000() const;
660     static  sal_uInt16  GetYear2000Default();
661 
662     sal_uInt16  ExpandTwoDigitYear( sal_uInt16 nYear ) const;
663     inline  static  sal_uInt16  ExpandTwoDigitYear( sal_uInt16 nYear, sal_uInt16 nTwoDigitYearStart );
664 
665     /// DEPRICATED: Return first character of the decimal separator of the current language/country
GetDecSep() const666     sal_Unicode GetDecSep() const { return GetNumDecimalSep().GetChar(0); }
667     /// Return the decimal separator of the current language/country
GetDecimalSep() const668     String GetDecimalSep() const { return GetNumDecimalSep(); }
669 
670     /// Return the decimal separator matching the locale of the given format
671     String GetFormatDecimalSep( sal_uInt32 nFormat ) const;
672 
673     /// Return a <type>SvPtrArr</type> with pointers to <type>NfCurrencyEntry</type> entries
674     static const NfCurrencyTable& GetTheCurrencyTable();
675 
676     /** Searches, according to the default locale currency, an entry of the
677         CurrencyTable which is <bold>not</bold> the first (LANGUAGE_SYSTEM) entry.
678         @return
679             <NULL/> if not found
680             else pointer to <type>NfCurrencyEntry</type>
681      */
682     static const NfCurrencyEntry*  MatchSystemCurrency();
683 
684     /** Return a <type>NfCurrencyEntry</type> matching a language/country.
685         If language/country is LANGUAGE_SYSTEM a <method>MatchSystemCurrency</method>
686         call is tried to get an entry. If that fails or the corresponding
687         language/country is not present the entry for LANGUAGE_SYSTEM is returned.
688      */
689     static const NfCurrencyEntry&  GetCurrencyEntry( LanguageType );
690 
691     /** Return a <type>NfCurrencyEntry</type> pointer matching a language/country
692         and currency abbreviation (AKA banking symbol).
693         This method is meant for the configuration of the default currency.
694         @return
695             <NULL/> if not found
696             else pointer to <type>NfCurrencyEntry</type>
697      */
698     static const NfCurrencyEntry*  GetCurrencyEntry( const String& rAbbrev,
699                 LanguageType eLang );
700 
701     /** Return a <type>NfCurrencyEntry</type> pointer matching the symbol
702         combination of a LegacyOnly currency. Note that this means only that
703         the currency matching both symbols was once used in the Office, but is
704         not offered in dialogs anymore. It doesn't even mean that the currency
705         symbol combination is valid, since the reason for removing it may have
706         been just that. #i61657#
707         @return
708             A matching entry, or else <NULL/>.
709      */
710     static const NfCurrencyEntry* GetLegacyOnlyCurrencyEntry(
711             const String& rSymbol, const String& rAbbrev );
712 
713     /** Set the default system currency. The combination of abbreviation and
714         language must match an existent element of theCurrencyTable. If not,
715         the SYSTEM (current locale) entry becomes the default.
716         This method is meant for the configuration of the default currency.
717      */
718     static void SetDefaultSystemCurrency( const String& rAbbrev, LanguageType eLang );
719 
720     /** Get all standard formats for a specific currency, formats are
721         appended to the <type>NfWSStringsDtor</type> list.
722         @param bBank
723             <TRUE/>: generate only format strings with currency abbreviation
724             <FALSE/>: mixed format strings
725         @return
726             position of default format
727      */
728     sal_uInt16  GetCurrencyFormatStrings( NfWSStringsDtor&, const NfCurrencyEntry&,
729                 sal_Bool bBank ) const;
730 
731     /** Whether nFormat is of type NUMBERFORMAT_CURRENCY and the format code
732         contains a new SYMBOLTYPE_CURRENCY and if so which one [$xxx-nnn].
733         If ppEntry is not NULL and exactly one entry is found, a [$xxx-nnn] is
734         returned, even if the format code only contains [$xxx] !
735      */
736     sal_Bool    GetNewCurrencySymbolString( sal_uInt32 nFormat, String& rSymbol,
737                 const NfCurrencyEntry** ppEntry = NULL, sal_Bool* pBank = NULL ) const;
738 
739     /** Look up the corresponding <type>NfCurrencyEntry</type> matching
740         rSymbol (may be CurrencySymbol or CurrencyAbbreviation) and possibly
741         a rExtension (being yyy of [$xxx-yyy]) or a given language/country
742         value. Tries to match a rSymbol with rExtension first, then with
743         eFormatLanguage, then rSymbol only. This is because a currency entry
744         might have been constructed using I18N locale data where a used locale
745         of a currrency format code must not necessarily match the locale of
746         the locale data itself, e.g. [$HK$-40C] (being "zh_HK" locale) in
747         zh_CN locale data. Here the rExtension would have the value 0x40c but
748         eFormatLanguage of the number format would have the value of zh_CN
749         locale, the value with which the corresponding CurrencyEntry is
750         constructed.
751 
752         @param bFoundBank
753             Only used for output.
754             If the return value is not <NULL/> this value is set to <TRUE/> if
755             the matching entry was found by comparing rSymbol against the
756             CurrencyAbbreviation (AKA BankSymbol).
757             If the return value is <NULL/> the value of bFoundBank is undefined.
758         @param rSymbol
759             Currency symbol, preferably obtained of a format by a call to
760             <method>SvNumberformat::GetNewCurrencySymbol()</method>
761         @param rExtension
762             Currency extension, preferably obtained of a format by a call to
763             <method>SvNumberformat::GetNewCurrencySymbol()</method>
764         @param eFormatLanguage
765             The language/country value of the format of which rSymbol and
766             rExtension are obtained (<method>SvNumberformat::GetLanguage()</method>).
767         @param bOnlyStringLanguage
768             If <TRUE/> only entries with language/country of rExtension are
769             checked, no match on eFormatLanguage. If rExtension is empty all
770             entries are checked.
771         @return
772             The matching entry if unique (in which case bFoundBank is set),
773             else <NULL/>.
774      */
775     static const NfCurrencyEntry* GetCurrencyEntry( sal_Bool & bFoundBank,
776                 const String& rSymbol, const String& rExtension,
777                 LanguageType eFormatLanguage, sal_Bool bOnlyStringLanguage = sal_False );
778 
779     /// Get compatibility ("automatic" old style) currency from I18N locale data
780     void GetCompatibilityCurrency( String& rSymbol, String& rAbbrev ) const;
781 
782     /// Fill rList with the language/country codes that have been allocated
783     void    GetUsedLanguages( SvUShorts& rList );
784 
785     /// Fill a <type>NfKeywordIndex</type> table with keywords of a language/country
786     void    FillKeywordTable( NfKeywordTable& rKeywords, LanguageType eLang );
787 
788     /** Return a keyword for a language/country and <type>NfKeywordIndex</type>
789         for XML import, to generate number format strings. */
790     String GetKeyword( LanguageType eLnge, sal_uInt16 nIndex );
791 
792     /** Return the GENERAL keyword in proper case ("General") for a
793         language/country, used in XML import */
794     String GetStandardName( LanguageType eLnge );
795 
796     /// Skip a NumberFormatter in stream, Chart needs this
797     static void SkipNumberFormatterInStream( SvStream& );
798 
799     const String& GetTrueString();
800     const String& GetFalseString();
801 
802 
803 private:
804     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager;
805     ::com::sun::star::lang::Locale aLocale;
806     SvNumberFormatTable aFTable;            // Table of format keys to format entries
807     Table aDefaultFormatKeys;               // Table of default standard to format keys
808     SvNumberFormatTable* pFormatTable;      // For the UI dialog
809     SvNumberFormatterIndexTable* pMergeTable;               // List of indices for merging two formatters
810     CharClass* pCharClass;                  // CharacterClassification
811     OnDemandLocaleDataWrapper xLocaleData;  // LocaleData switched between SYSTEM, ENGLISH and other
812     OnDemandTransliterationWrapper xTransliteration;    // Transliteration loaded on demand
813     OnDemandCalendarWrapper xCalendar;      // Calendar loaded on demand
814     OnDemandNativeNumberWrapper xNatNum;    // Native number service loaded on demand
815     ImpSvNumberInputScan* pStringScanner;   // Input string scanner
816     ImpSvNumberformatScan* pFormatScanner;  // Format code string scanner
817     Link aColorLink;                        // User defined color table CallBack
818     sal_uInt32 MaxCLOffset;                     // Max language/country offset used
819     sal_uInt32 nDefaultSystemCurrencyFormat;        // NewCurrency matching SYSTEM locale
820     LanguageType IniLnge;                   // Initialized setting language/country
821     LanguageType ActLnge;                   // Current setting language/country
822     NfEvalDateFormat eEvalDateFormat;       // DateFormat evaluation
823     sal_Bool bNoZero;                           // Zero value suppression
824 
825     // cached locale data items needed almost any time
826     String aDecimalSep;
827     String aThousandSep;
828     String aDateSep;
829 
830 #ifdef _ZFORLIST_CXX                // ----- private Methoden -----
831 
832     SVL_DLLPRIVATE static sal_Bool          bCurrencyTableInitialized;
833     SVL_DLLPRIVATE static sal_uInt16            nSystemCurrencyPosition;
834     SVL_DLLPRIVATE static SvNumberFormatterRegistry_Impl* pFormatterRegistry;
835 
836     // get the registry, create one if none exists
837     SVL_DLLPRIVATE static SvNumberFormatterRegistry_Impl& GetFormatterRegistry();
838 
839     // called by ctors
840     SVL_DLLPRIVATE void ImpConstruct( LanguageType eLang );
841 
842     // Changes initialized language/country, clears the entries and generates
843     // new ones, may ONLY be called by the binary file format load
844     SVL_DLLPRIVATE void ImpChangeSysCL( LanguageType eLnge, sal_Bool bLoadingSO5 );
845 
846     // Generate builtin formats provided by i18n behind CLOffset,
847     // if bLoadingSO5==sal_False also generate additional i18n formats.
848     SVL_DLLPRIVATE void ImpGenerateFormats( sal_uInt32 CLOffset, sal_Bool bLoadingSO5 );
849 
850     // Generate additional formats provided by i18n
851     SVL_DLLPRIVATE void ImpGenerateAdditionalFormats(
852                 sal_uInt32 CLOffset,
853                 NumberFormatCodeWrapper& rNumberFormatCode,
854                 sal_Bool bAfterLoadingSO5 );
855 
856     SVL_DLLPRIVATE SvNumberformat* ImpInsertFormat(
857                 const ::com::sun::star::i18n::NumberFormatCode& rCode,
858                 sal_uInt32 nPos,
859                 sal_Bool bAfterLoadingSO5 = sal_False,
860                 sal_Int16 nOrgIndex = 0 );
861     // ImpInsertNewStandardFormat for new (since version ...) builtin formats
862     SVL_DLLPRIVATE SvNumberformat* ImpInsertNewStandardFormat(
863                 const ::com::sun::star::i18n::NumberFormatCode& rCode,
864                 sal_uInt32 nPos,
865                 sal_uInt16 nVersion,
866                 sal_Bool bAfterLoadingSO5 = sal_False,
867                 sal_Int16 nOrgIndex = 0 );
868 
869     // Return CLOffset or (MaxCLOffset + SV_COUNTRY_LANGUAGE_OFFSET) if new language/country
870     SVL_DLLPRIVATE sal_uInt32 ImpGetCLOffset(LanguageType eLnge) const;
871 
872     // Test whether format code already exists, then return index key,
873     // otherwise NUMBERFORMAT_ENTRY_NOT_FOUND
874     SVL_DLLPRIVATE sal_uInt32 ImpIsEntry( const String& rString,
875                         sal_uInt32 CLOffset,
876                         LanguageType eLnge );
877 
878     // Create builtin formats for language/country if necessary, return CLOffset
879     SVL_DLLPRIVATE sal_uInt32 ImpGenerateCL( LanguageType eLnge, sal_Bool bLoadingSO5 = sal_False );
880 
881     // Build negative currency format, old compatibility style
882     SVL_DLLPRIVATE void ImpGetNegCurrFormat( String& sNegStr, const String& rCurrSymbol );
883     // Build positive currency format, old compatibility style
884     SVL_DLLPRIVATE void ImpGetPosCurrFormat( String& sPosStr, const String& rCurrSymbol );
885 
886     // Create <type>theCurrencyTable</type> with all <type>NfCurrencyEntry</type>
887     SVL_DLLPRIVATE static void ImpInitCurrencyTable();
888 
889     // Return the format index of the currency format of the system locale.
890     // Format is created if not already present.
891     SVL_DLLPRIVATE sal_uInt32   ImpGetDefaultSystemCurrencyFormat();
892 
893     // Return the format index of the currency format of the current locale.
894     // Format is created if not already present.
895     SVL_DLLPRIVATE sal_uInt32   ImpGetDefaultCurrencyFormat();
896 
897     // Return the default format for a given type and current locale.
898     // May ONLY be called from within GetStandardFormat().
899     SVL_DLLPRIVATE sal_uInt32   ImpGetDefaultFormat( short nType );
900 
901     // Return the index in a sequence of format codes matching an enum of
902     // NfIndexTableOffset. If not found 0 is returned. If the sequence doesn't
903     // contain any format code elements a default element is created and inserted.
904     SVL_DLLPRIVATE sal_Int32 ImpGetFormatCodeIndex(
905         ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode >& rSeq,
906         const NfIndexTableOffset nTabOff );
907 
908     // Adjust a sequence of format codes to contain only one (THE) default
909     // instead of multiple defaults for short/medium/long types.
910     // If there is no medium but a short and a long default the long is taken.
911     // Return the default index in the sequence.
912     // Non-PRODUCT version may check locale data for matching defaults in one
913     // FormatElement group.
914     SVL_DLLPRIVATE sal_Int32 ImpAdjustFormatCodeDefault(
915         ::com::sun::star::i18n::NumberFormatCode * pFormatArr,
916         sal_Int32 nCount, sal_Bool bCheckCorrectness = sal_True
917         );
918 
919     // used as a loop body inside of GetNewCurrencySymbolString() and GetCurrencyEntry()
920 #ifndef DBG_UTIL
921     inline
922 #endif
923         static sal_Bool ImpLookupCurrencyEntryLoopBody(
924             const NfCurrencyEntry*& pFoundEntry, sal_Bool& bFoundBank,
925             const NfCurrencyEntry* pData, sal_uInt16 nPos, const String& rSymbol );
926 
927     // link to be set at <method>SvtSysLocaleOptions::SetCurrencyChangeLink()</method>
928     DECL_DLLPRIVATE_STATIC_LINK( SvNumberFormatter, CurrencyChangeLink, void* );
929 
930 #endif // _ZFORLIST_CXX
931 
932 public:
933 
934     // own static mutex, may also be used by internal class SvNumberFormatterRegistry_Impl
935     static ::osl::Mutex&        GetMutex();
936 
937     // called by SvNumberFormatterRegistry_Impl::Notify if the default system currency changes
938     void ResetDefaultSystemCurrency();
939 
940     // Replace the SYSTEM language/country format codes. Called upon change of
941     // the user configurable locale.
942     // Old compatibility codes are replaced, user defined are converted, and
943     // new format codes are appended.
944     void ReplaceSystemCL( LanguageType eOldLanguage );
945 
946     inline ::com::sun::star::uno::Reference<
947         ::com::sun::star::lang::XMultiServiceFactory >
GetServiceManager() const948         GetServiceManager() const { return xServiceManager; }
949 
950 
951 
952     //! The following method is not to be used from outside but must be
953     //! public for the InputScanner.
954     // return the current FormatScanner
GetFormatScanner() const955     inline const ImpSvNumberformatScan* GetFormatScanner() const { return pFormatScanner; }
956 
957 
958 
959     //! The following methods are not to be used from outside but must be
960     //! public for the InputScanner and FormatScanner.
961 
962     // return current (!) Locale
GetLocale() const963     inline const ::com::sun::star::lang::Locale& GetLocale() const { return aLocale; }
964 
965     // return corresponding Transliteration wrapper
GetTransliteration() const966     inline const ::utl::TransliterationWrapper* GetTransliteration() const
967                 { return xTransliteration.get(); }
968 
969     // return corresponding Transliteration wrapper with loadModuleByImplName()
GetTransliterationForModule(const String & rModule,LanguageType eLang) const970     inline const ::utl::TransliterationWrapper* GetTransliterationForModule(
971             const String& rModule, LanguageType eLang ) const
972                 { return xTransliteration.getForModule( rModule, eLang ); }
973 
974     // return the corresponding CharacterClassification wrapper
GetCharClass() const975     inline const CharClass* GetCharClass() const { return pCharClass; }
976 
977     // return the corresponding LocaleData wrapper
GetLocaleData() const978     inline const LocaleDataWrapper* GetLocaleData() const { return xLocaleData.get(); }
979 
980     // return the corresponding Calendar wrapper
GetCalendar() const981     inline CalendarWrapper* GetCalendar() const { return xCalendar.get(); }
982 
983     // return the corresponding NativeNumberSupplier wrapper
GetNatNum() const984     inline const NativeNumberWrapper* GetNatNum() const { return xNatNum.get(); }
985 
986     // cached locale data items
987 
988     // return the corresponding decimal separator
GetNumDecimalSep() const989     inline const String& GetNumDecimalSep() const { return aDecimalSep; }
990 
991     // return the corresponding group (AKA thousand) separator
GetNumThousandSep() const992     inline const String& GetNumThousandSep() const { return aThousandSep; }
993 
994     // return the corresponding date separator
GetDateSep() const995     inline const String& GetDateSep() const { return aDateSep; }
996 
997 };
998 
999 
1000 // --------------------------- inline --------------------------------------
1001 
GetMergeFmtIndex(sal_uInt32 nOldFmt) const1002 inline sal_uInt32 SvNumberFormatter::GetMergeFmtIndex( sal_uInt32 nOldFmt ) const
1003 {
1004     sal_uInt32* pU = (pMergeTable && pMergeTable->Count()) ? (sal_uInt32*)pMergeTable->Get( nOldFmt ) : 0;
1005     return pU ? *pU : nOldFmt;
1006 }
1007 
HasMergeFmtTbl() const1008 inline sal_Bool SvNumberFormatter::HasMergeFmtTbl() const
1009 {
1010     return pMergeTable && (0 != pMergeTable->Count());
1011 }
1012 
1013 
1014 // static
ExpandTwoDigitYear(sal_uInt16 nYear,sal_uInt16 nTwoDigitYearStart)1015 inline sal_uInt16 SvNumberFormatter::ExpandTwoDigitYear(
1016             sal_uInt16 nYear, sal_uInt16 nTwoDigitYearStart )
1017 {
1018     if ( nYear < 100 )
1019     {
1020         if ( nYear < (nTwoDigitYearStart % 100) )
1021             return nYear + (((nTwoDigitYearStart / 100) + 1) * 100);
1022         else
1023             return nYear + ((nTwoDigitYearStart / 100) * 100);
1024     }
1025     return nYear;
1026 }
1027 
1028 
1029 
1030 #endif  // _ZFORLIST_HXX
1031