LibreOffice Module sc (master)  1
numberformatsbuffer.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #include <sal/config.h>
21 
22 #include <string_view>
23 
24 #include <numberformatsbuffer.hxx>
25 #include <biffhelper.hxx>
26 
27 #include <com/sun/star/i18n/NumberFormatIndex.hpp>
28 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
29 #include <com/sun/star/util/XNumberFormatTypes.hpp>
30 #include <com/sun/star/util/XNumberFormats.hpp>
31 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
32 #include <officecfg/Setup.hxx>
33 #include <officecfg/System.hxx>
34 #include <rtl/strbuf.hxx>
35 #include <rtl/string.hxx>
36 #include <osl/diagnose.h>
37 #include <osl/thread.h>
38 #include <rtl/ustrbuf.hxx>
39 #include <svl/intitem.hxx>
40 #include <svl/itemset.hxx>
43 #include <oox/token/tokens.hxx>
44 #include <scitems.hxx>
45 #include <document.hxx>
46 #include <ftools.hxx>
47 
48 namespace oox::xls {
49 
50 using namespace ::com::sun::star::lang;
51 using namespace ::com::sun::star::uno;
52 using namespace ::com::sun::star::util;
53 
54 namespace {
55 
57 struct BuiltinFormat
58 {
59  sal_Int32 mnNumFmtId;
60  const char* mpcFmtCode;
61  sal_Int16 mnPredefId;
62  sal_Int32 mnReuseId;
63 };
64 
66 #define NUMFMT_STRING( INDEX, FORMATCODE ) \
67  { INDEX, FORMATCODE, -1, -1 }
68 
70 #define NUMFMT_PREDEF( INDEX, PREDEFINED ) \
71  { INDEX, nullptr, css::i18n::NumberFormatIndex::PREDEFINED, -1 }
72 
74 #define NUMFMT_REUSE( INDEX, REUSED_INDEX ) \
75  { INDEX, nullptr, -1, REUSED_INDEX }
76 
78 #define NUMFMT_ENDTABLE() \
79  { -1, nullptr, -1, -1 }
80 
90 #define NUMFMT_ALLDATETIMES( SYSTEMDATE, DAY, DAYSEP, MONTH, MONTHSEP, YEAR, HOUR12, HOUR24 ) \
91  NUMFMT_STRING( 14, SYSTEMDATE ), \
92  NUMFMT_STRING( 15, DAY DAYSEP MONTH MONTHSEP YEAR ), \
93  NUMFMT_STRING( 16, DAY DAYSEP MONTH ), \
94  NUMFMT_STRING( 17, MONTH MONTHSEP YEAR ), \
95  NUMFMT_STRING( 18, HOUR12 ":mm AM/PM" ), \
96  NUMFMT_STRING( 19, HOUR12 ":mm:ss AM/PM" ), \
97  NUMFMT_STRING( 20, HOUR24 ":mm" ), \
98  NUMFMT_STRING( 21, HOUR24 ":mm:ss" ), \
99  NUMFMT_STRING( 22, SYSTEMDATE " " HOUR24 ":mm" )
100 
107 #define NUMFMT_TIME_CJK( INDEX, HOURFORMAT, HOUR, MINUTE, SECOND ) \
108  NUMFMT_STRING( INDEX + 0, HOURFORMAT "\"" HOUR "\"mm\"" MINUTE "\"" ), \
109  NUMFMT_STRING( INDEX + 1, HOURFORMAT "\"" HOUR "\"mm\"" MINUTE "\"ss\"" SECOND "\"" )
110 
117 #define NUMFMT_ALLTIMES_CJK( HOUR12, HOUR24, HOUR, MINUTE, SECOND ) \
118  NUMFMT_TIME_CJK( 32, HOUR24, HOUR, MINUTE, SECOND ), \
119  NUMFMT_TIME_CJK( 34, "AM/PM" HOUR12, HOUR, MINUTE, SECOND )
120 
127 #define NUMFMT_CURRENCY_SYMBOL_MINUS_NUMBER( INDEX, SYMBOL, SPACE, MODIF ) \
128  NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0;" MODIF SYMBOL SPACE "-#,##0" ), \
129  NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0;" "[RED]" MODIF SYMBOL SPACE "-#,##0" ), \
130  NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00;" MODIF SYMBOL SPACE "-#,##0.00" ), \
131  NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00;" "[RED]" MODIF SYMBOL SPACE "-#,##0.00" )
132 
138 #define NUMFMT_ACCOUNTING_SYMBOL_MINUS_NUMBER( INDEX, SYMBOL, SPACE ) \
139  NUMFMT_STRING( INDEX + 0, "_ " "* #,##0_ ;" "_ " "* -#,##0_ ;" "_ " "* \"-\"_ ;" "_ @_ " ), \
140  NUMFMT_STRING( INDEX + 1, "_ " SYMBOL SPACE "* #,##0_ ;" "_ " SYMBOL SPACE "* -#,##0_ ;" "_ " SYMBOL SPACE "* \"-\"_ ;" "_ @_ " ), \
141  NUMFMT_STRING( INDEX + 2, "_ " "* #,##0.00_ ;" "_ " "* -#,##0.00_ ;" "_ " "* \"-\"?\?_ ;" "_ @_ " ), \
142  NUMFMT_STRING( INDEX + 3, "_ " SYMBOL SPACE "* #,##0.00_ ;" "_ " SYMBOL SPACE "* -#,##0.00_ ;" "_ " SYMBOL SPACE "* \"-\"?\?_ ;" "_ @_ " )
143 
149 #define NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( SYMBOL, SPACE ) \
150  NUMFMT_CURRENCY_SYMBOL_MINUS_NUMBER( 5, SYMBOL, SPACE, "" ), \
151  NUMFMT_CURRENCY_SYMBOL_MINUS_NUMBER( 37, "", "", "" ), \
152  NUMFMT_ACCOUNTING_SYMBOL_MINUS_NUMBER( 41, SYMBOL, SPACE )
153 
160 #define NUMFMT_CURRENCY_SYMBOL_NUMBER_MINUS( INDEX, SYMBOL, SPACE, MODIF ) \
161  NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0_-;" MODIF SYMBOL SPACE "#,##0-" ), \
162  NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0_-;" "[RED]" MODIF SYMBOL SPACE "#,##0-" ), \
163  NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00_-;" MODIF SYMBOL SPACE "#,##0.00-" ), \
164  NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00_-;" "[RED]" MODIF SYMBOL SPACE "#,##0.00-" )
165 
171 #define NUMFMT_ACCOUNTING_SYMBOL_NUMBER_MINUS( INDEX, SYMBOL, SPACE ) \
172  NUMFMT_STRING( INDEX + 0, "_-" "* #,##0_-;" "_-" "* #,##0-;" "_-" "* \"-\"_-;" "_-@_-" ), \
173  NUMFMT_STRING( INDEX + 1, "_-" SYMBOL SPACE "* #,##0_-;" "_-" SYMBOL SPACE "* #,##0-;" "_-" SYMBOL SPACE "* \"-\"_-;" "_-@_-" ), \
174  NUMFMT_STRING( INDEX + 2, "_-" "* #,##0.00_-;" "_-" "* #,##0.00-;" "_-" "* \"-\"?\?_-;" "_-@_-" ), \
175  NUMFMT_STRING( INDEX + 3, "_-" SYMBOL SPACE "* #,##0.00_-;" "_-" SYMBOL SPACE "* #,##0.00-;" "_-" SYMBOL SPACE "* \"-\"?\?_-;" "_-@_-" )
176 
182 #define NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( SYMBOL, SPACE ) \
183  NUMFMT_CURRENCY_SYMBOL_NUMBER_MINUS( 5, SYMBOL, SPACE, "" ), \
184  NUMFMT_CURRENCY_SYMBOL_NUMBER_MINUS( 37, "", "", "" ), \
185  NUMFMT_ACCOUNTING_SYMBOL_NUMBER_MINUS( 41, SYMBOL, SPACE )
186 
193 #define NUMFMT_CURRENCY_NUMBER_SYMBOL_MINUS( INDEX, SYMBOL, SPACE, MODIF ) \
194  NUMFMT_STRING( INDEX + 0, MODIF "#,##0" SPACE SYMBOL "_-;" MODIF "#,##0" SPACE SYMBOL "-" ), \
195  NUMFMT_STRING( INDEX + 1, MODIF "#,##0" SPACE SYMBOL "_-;" "[RED]" MODIF "#,##0" SPACE SYMBOL "-" ), \
196  NUMFMT_STRING( INDEX + 2, MODIF "#,##0.00" SPACE SYMBOL "_-;" MODIF "#,##0.00" SPACE SYMBOL "-" ), \
197  NUMFMT_STRING( INDEX + 3, MODIF "#,##0.00" SPACE SYMBOL "_-;" "[RED]" MODIF "#,##0.00" SPACE SYMBOL "-" )
198 
205 #define NUMFMT_ACCOUNTING_NUMBER_SYMBOL_MINUS( INDEX, SYMBOL, BLINDS, SPACE ) \
206  NUMFMT_STRING( INDEX + 0, "_-* #,##0" SPACE BLINDS "_-;_-* #,##0" SPACE BLINDS "-;_-* \"-\"" SPACE BLINDS "_-;_-@_-" ), \
207  NUMFMT_STRING( INDEX + 1, "_-* #,##0" SPACE SYMBOL "_-;_-* #,##0" SPACE SYMBOL "-;_-* \"-\"" SPACE SYMBOL "_-;_-@_-" ), \
208  NUMFMT_STRING( INDEX + 2, "_-* #,##0.00" SPACE BLINDS "_-;_-* #,##0.00" SPACE BLINDS "-;_-* \"-\"?\?" SPACE BLINDS "_-;_-@_-" ), \
209  NUMFMT_STRING( INDEX + 3, "_-* #,##0.00" SPACE SYMBOL "_-;_-* #,##0.00" SPACE SYMBOL "-;_-* \"-\"?\?" SPACE SYMBOL "_-;_-@_-" )
210 
217 #define NUMFMT_ALLCURRENCIES_NUMBER_SYMBOL_MINUS( SYMBOL, BLINDS, SPACE ) \
218  NUMFMT_CURRENCY_NUMBER_SYMBOL_MINUS( 5, SYMBOL, SPACE, "" ), \
219  NUMFMT_CURRENCY_NUMBER_SYMBOL_MINUS( 37, BLINDS, SPACE, "" ), \
220  NUMFMT_ACCOUNTING_NUMBER_SYMBOL_MINUS( 41, SYMBOL, BLINDS, SPACE )
221 
228 #define NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( INDEX, SYMBOL, SPACE, MODIF ) \
229  NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0;" MODIF "-" SYMBOL SPACE "#,##0" ), \
230  NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0;" "[RED]" MODIF "-" SYMBOL SPACE "#,##0" ), \
231  NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00;" MODIF "-" SYMBOL SPACE "#,##0.00" ), \
232  NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00;" "[RED]" MODIF "-" SYMBOL SPACE "#,##0.00" )
233 
239 #define NUMFMT_ACCOUNTING_MINUS_SYMBOL_NUMBER( INDEX, SYMBOL, SPACE ) \
240  NUMFMT_STRING( INDEX + 0, "_-" "* #,##0_-;" "-" "* #,##0_-;" "_-" "* \"-\"_-;" "_-@_-" ), \
241  NUMFMT_STRING( INDEX + 1, "_-" SYMBOL SPACE "* #,##0_-;" "-" SYMBOL SPACE "* #,##0_-;" "_-" SYMBOL SPACE "* \"-\"_-;" "_-@_-" ), \
242  NUMFMT_STRING( INDEX + 2, "_-" "* #,##0.00_-;" "-" "* #,##0.00_-;" "_-" "* \"-\"?\?_-;" "_-@_-" ), \
243  NUMFMT_STRING( INDEX + 3, "_-" SYMBOL SPACE "* #,##0.00_-;" "-" SYMBOL SPACE "* #,##0.00_-;" "_-" SYMBOL SPACE "* \"-\"?\?_-;" "_-@_-" )
244 
250 #define NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( SYMBOL, SPACE ) \
251  NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( 5, SYMBOL, SPACE, "" ), \
252  NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( 37, "", "", "" ), \
253  NUMFMT_ACCOUNTING_MINUS_SYMBOL_NUMBER( 41, SYMBOL, SPACE )
254 
261 #define NUMFMT_CURRENCY_MINUS_NUMBER_SYMBOL( INDEX, SYMBOL, SPACE, MODIF ) \
262  NUMFMT_STRING( INDEX + 0, MODIF "#,##0" SPACE SYMBOL ";" MODIF "-#,##0" SPACE SYMBOL ), \
263  NUMFMT_STRING( INDEX + 1, MODIF "#,##0" SPACE SYMBOL ";" "[RED]" MODIF "-#,##0" SPACE SYMBOL ), \
264  NUMFMT_STRING( INDEX + 2, MODIF "#,##0.00" SPACE SYMBOL ";" MODIF "-#,##0.00" SPACE SYMBOL ), \
265  NUMFMT_STRING( INDEX + 3, MODIF "#,##0.00" SPACE SYMBOL ";" "[RED]" MODIF "-#,##0.00" SPACE SYMBOL )
266 
273 #define NUMFMT_ACCOUNTING_MINUS_NUMBER_SYMBOL( INDEX, SYMBOL, BLINDS, SPACE ) \
274  NUMFMT_STRING( INDEX + 0, "_-* #,##0" SPACE BLINDS "_-;-* #,##0" SPACE BLINDS "_-;_-* \"-\"" SPACE BLINDS "_-;_-@_-" ), \
275  NUMFMT_STRING( INDEX + 1, "_-* #,##0" SPACE SYMBOL "_-;-* #,##0" SPACE SYMBOL "_-;_-* \"-\"" SPACE SYMBOL "_-;_-@_-" ), \
276  NUMFMT_STRING( INDEX + 2, "_-* #,##0.00" SPACE BLINDS "_-;-* #,##0.00" SPACE BLINDS "_-;_-* \"-\"?\?" SPACE BLINDS "_-;_-@_-" ), \
277  NUMFMT_STRING( INDEX + 3, "_-* #,##0.00" SPACE SYMBOL "_-;-* #,##0.00" SPACE SYMBOL "_-;_-* \"-\"?\?" SPACE SYMBOL "_-;_-@_-" )
278 
285 #define NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( SYMBOL, BLINDS, SPACE ) \
286  NUMFMT_CURRENCY_MINUS_NUMBER_SYMBOL( 5, SYMBOL, SPACE, "" ), \
287  NUMFMT_CURRENCY_MINUS_NUMBER_SYMBOL( 37, BLINDS, SPACE, "" ), \
288  NUMFMT_ACCOUNTING_MINUS_NUMBER_SYMBOL( 41, SYMBOL, BLINDS, SPACE )
289 
296 #define NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( INDEX, SYMBOL, SPACE, MODIF ) \
297  NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0_);" MODIF "(" SYMBOL SPACE "#,##0)" ), \
298  NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0_);" "[RED]" MODIF "(" SYMBOL SPACE "#,##0)" ), \
299  NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00_);" MODIF "(" SYMBOL SPACE "#,##0.00)" ), \
300  NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00_);" "[RED]" MODIF "(" SYMBOL SPACE "#,##0.00)" )
301 
307 #define NUMFMT_ACCOUNTING_OPEN_SYMBOL_NUMBER_CLOSE( INDEX, SYMBOL, SPACE ) \
308  NUMFMT_STRING( INDEX + 0, "_(" "* #,##0_);" "_(" "* (#,##0);" "_(" "* \"-\"_);" "_(@_)" ), \
309  NUMFMT_STRING( INDEX + 1, "_(" SYMBOL SPACE "* #,##0_);" "_(" SYMBOL SPACE "* (#,##0);" "_(" SYMBOL SPACE "* \"-\"_);" "_(@_)" ), \
310  NUMFMT_STRING( INDEX + 2, "_(" "* #,##0.00_);" "_(" "* (#,##0.00);" "_(" "* \"-\"?\?_);" "_(@_)" ), \
311  NUMFMT_STRING( INDEX + 3, "_(" SYMBOL SPACE "* #,##0.00_);" "_(" SYMBOL SPACE "* (#,##0.00);" "_(" SYMBOL SPACE "* \"-\"?\?_);" "_(@_)" )
312 
318 #define NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( SYMBOL, SPACE ) \
319  NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 5, SYMBOL, SPACE, "" ), \
320  NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 37, "", "", "" ), \
321  NUMFMT_ACCOUNTING_OPEN_SYMBOL_NUMBER_CLOSE( 41, SYMBOL, SPACE )
322 
329 #define NUMFMT_CURRENCY_OPEN_NUMBER_SYMBOL_CLOSE( INDEX, SYMBOL, SPACE, MODIF ) \
330  NUMFMT_STRING( INDEX + 0, MODIF "#,##0" SPACE SYMBOL "_);" MODIF "(#,##0" SPACE SYMBOL ")" ), \
331  NUMFMT_STRING( INDEX + 1, MODIF "#,##0" SPACE SYMBOL "_);" "[RED]" MODIF "(#,##0" SPACE SYMBOL ")" ), \
332  NUMFMT_STRING( INDEX + 2, MODIF "#,##0.00" SPACE SYMBOL "_);" MODIF "(#,##0.00" SPACE SYMBOL ")" ), \
333  NUMFMT_STRING( INDEX + 3, MODIF "#,##0.00" SPACE SYMBOL "_);" "[RED]" MODIF "(#,##0.00" SPACE SYMBOL ")" )
334 
341 #define NUMFMT_ACCOUNTING_OPEN_NUMBER_SYMBOL_CLOSE( INDEX, SYMBOL, BLINDS, SPACE ) \
342  NUMFMT_STRING( INDEX + 0, "_ * #,##0_)" SPACE BLINDS "_ ;_ * (#,##0)" SPACE BLINDS "_ ;_ * \"-\"_)" SPACE BLINDS "_ ;_ @_ " ), \
343  NUMFMT_STRING( INDEX + 1, "_ * #,##0_)" SPACE SYMBOL "_ ;_ * (#,##0)" SPACE SYMBOL "_ ;_ * \"-\"_)" SPACE SYMBOL "_ ;_ @_ " ), \
344  NUMFMT_STRING( INDEX + 2, "_ * #,##0.00_)" SPACE BLINDS "_ ;_ * (#,##0.00)" SPACE BLINDS "_ ;_ * \"-\"?\?_)" SPACE BLINDS "_ ;_ @_ " ), \
345  NUMFMT_STRING( INDEX + 3, "_ * #,##0.00_)" SPACE SYMBOL "_ ;_ * (#,##0.00)" SPACE SYMBOL "_ ;_ * \"-\"?\?_)" SPACE SYMBOL "_ ;_ @_ " )
346 
353 #define NUMFMT_ALLCURRENCIES_OPEN_NUMBER_SYMBOL_CLOSE( SYMBOL, BLINDS, SPACE ) \
354  NUMFMT_CURRENCY_OPEN_NUMBER_SYMBOL_CLOSE( 5, SYMBOL, SPACE, "" ), \
355  NUMFMT_CURRENCY_OPEN_NUMBER_SYMBOL_CLOSE( 37, BLINDS, SPACE, "" ), \
356  NUMFMT_ACCOUNTING_OPEN_NUMBER_SYMBOL_CLOSE( 41, SYMBOL, BLINDS, SPACE )
357 
358 // currency unit characters
359 #define UTF8_BAHT "\340\270\277"
360 #define UTF8_COLON "\342\202\241"
361 #define UTF8_CURR_AR_AE "\330\257.\330\245."
362 #define UTF8_CURR_AR_BH "\330\257.\330\250."
363 #define UTF8_CURR_AR_DZ "\330\257.\330\254."
364 #define UTF8_CURR_AR_EG "\330\254.\331\205."
365 #define UTF8_CURR_AR_IQ "\330\257.\330\271."
366 #define UTF8_CURR_AR_JO "\330\257.\330\247."
367 #define UTF8_CURR_AR_KW "\330\257.\331\203."
368 #define UTF8_CURR_AR_LB "\331\204.\331\204."
369 #define UTF8_CURR_AR_LY "\330\257.\331\204."
370 #define UTF8_CURR_AR_MA "\330\257.\331\205."
371 #define UTF8_CURR_AR_OM "\330\261.\330\271."
372 #define UTF8_CURR_AR_QA "\330\261.\331\202."
373 #define UTF8_CURR_AR_SA "\330\261.\330\263."
374 #define UTF8_CURR_AR_SY "\331\204.\330\263."
375 #define UTF8_CURR_AR_TN "\330\257.\330\252."
376 #define UTF8_CURR_AR_YE "\330\261.\331\212."
377 #define UTF8_CURR_BN_IN "\340\246\237\340\246\276"
378 #define UTF8_CURR_FA_IR "\330\261\331\212\330\247\331\204"
379 #define UTF8_CURR_GU_IN "\340\252\260\340\253\202"
380 #define UTF8_CURR_HI_IN "\340\244\260\340\245\201"
381 #define UTF8_CURR_KN_IN "\340\262\260\340\263\202"
382 #define UTF8_CURR_ML_IN "\340\264\225"
383 #define UTF8_CURR_PA_IN "\340\250\260\340\251\201"
384 #define UTF8_CURR_TA_IN "\340\256\260\340\257\202"
385 #define UTF8_CURR_TE_IN "\340\260\260\340\261\202"
386 #define UTF8_DONG "\342\202\253"
387 #define UTF8_EURO "\342\202\254"
388 #define UTF8_POUND_GB "\302\243"
389 #define UTF8_RUFIYAA "\336\203"
390 #define UTF8_SHEQEL "\342\202\252"
391 #define UTF8_TUGRUG "\342\202\256"
392 #define UTF8_WON "\342\202\251"
393 #define UTF8_YEN_CN "\357\277\245"
394 #define UTF8_YEN_JP "\302\245"
395 
396 // Unicode characters for currency units
397 #define UTF8_CCARON_LC "\304\215"
398 #define UTF8_LSTROKE_LC "\305\202"
399 // Armenian
400 #define UTF8_HY_DA_LC "\325\244"
401 #define UTF8_HY_REH_LC "\326\200"
402 // Cyrillic
403 #define UTF8_CYR_G_LC "\320\263"
404 #define UTF8_CYR_L_LC "\320\273"
405 #define UTF8_CYR_M_LC "\320\274"
406 #define UTF8_CYR_N_LC "\320\275"
407 #define UTF8_CYR_O_LC "\320\276"
408 #define UTF8_CYR_R_LC "\321\200"
409 #define UTF8_CYR_S_LC "\321\201"
410 #define UTF8_CYR_W_LC "\320\262"
411 
412 // Japanese/Chinese date/time characters
413 #define UTF8_CJ_YEAR "\345\271\264"
414 #define UTF8_CJ_MON "\346\234\210"
415 #define UTF8_CJ_DAY "\346\227\245"
416 #define UTF8_CJ_HOUR "\346\231\202"
417 #define UTF8_CJ_MIN "\345\210\206"
418 #define UTF8_CJ_SEC "\347\247\222"
419 
420 // Chinese Simplified date/time characters
421 #define UTF8_CS_YEAR "\345\271\264"
422 #define UTF8_CS_MON "\346\234\210"
423 #define UTF8_CS_DAY "\346\227\245"
424 #define UTF8_CS_HOUR "\346\227\266"
425 #define UTF8_CS_MIN "\345\210\206"
426 #define UTF8_CS_SEC "\347\247\222"
427 
428 // Korean date/time characters
429 #define UTF8_KO_YEAR "\353\205\204"
430 #define UTF8_KO_MON "\354\233\224"
431 #define UTF8_KO_DAY "\354\235\274"
432 #define UTF8_KO_HOUR "\354\213\234"
433 #define UTF8_KO_MIN "\353\266\204"
434 #define UTF8_KO_SEC "\354\264\210"
435 
437 const BuiltinFormat spBuiltinFormats_BASE[] =
438 {
439  // 0..13 numeric and currency formats
440  NUMFMT_PREDEF( 0, NUMBER_STANDARD ), // General
441  NUMFMT_PREDEF( 1, NUMBER_INT ), // 0
442  NUMFMT_PREDEF( 2, NUMBER_DEC2 ), // 0.00
443  NUMFMT_PREDEF( 3, NUMBER_1000INT ), // #,##0
444  NUMFMT_PREDEF( 4, NUMBER_1000DEC2 ), // #,##0.00
445  NUMFMT_PREDEF( 5, CURRENCY_1000INT ), // #,##0[symbol]
446  NUMFMT_PREDEF( 6, CURRENCY_1000INT_RED ), // #,##0[symbol];[RED]-#,##0[symbol]
447  NUMFMT_PREDEF( 7, CURRENCY_1000DEC2 ), // #,##0.00[symbol]
448  NUMFMT_PREDEF( 8, CURRENCY_1000DEC2_RED ), // #,##0.00[symbol];[RED]-#,##0.00[symbol]
449  NUMFMT_PREDEF( 9, PERCENT_INT ), // 0%
450  NUMFMT_PREDEF( 10, PERCENT_DEC2 ), // 0.00%
451  NUMFMT_PREDEF( 11, SCIENTIFIC_000E00 ), // 0.00E+00
452  NUMFMT_PREDEF( 12, FRACTION_1 ), // # ?/?
453  NUMFMT_PREDEF( 13, FRACTION_2 ), // # ??/??
454 
455  // 14...22 date and time formats
456  NUMFMT_PREDEF( 14, DATE_SYS_DDMMYYYY ),
457  NUMFMT_PREDEF( 15, DATE_SYS_DMMMYY ),
458  NUMFMT_PREDEF( 16, DATE_SYS_DDMMM ),
459  NUMFMT_PREDEF( 17, DATE_SYS_MMYY ),
460  NUMFMT_PREDEF( 18, TIME_HHMMAMPM ),
461  NUMFMT_PREDEF( 19, TIME_HHMMSSAMPM ),
462  NUMFMT_PREDEF( 20, TIME_HHMM ),
463  NUMFMT_PREDEF( 21, TIME_HHMMSS ),
464  NUMFMT_PREDEF( 22, DATETIME_SYSTEM_SHORT_HHMM ),
465 
466  // 23...36 international formats
467  NUMFMT_REUSE( 23, 0 ),
468  NUMFMT_REUSE( 24, 0 ),
469  NUMFMT_REUSE( 25, 0 ),
470  NUMFMT_REUSE( 26, 0 ),
471  NUMFMT_REUSE( 27, 14 ),
472  NUMFMT_REUSE( 28, 14 ),
473  NUMFMT_REUSE( 29, 14 ),
474  NUMFMT_REUSE( 30, 14 ),
475  NUMFMT_REUSE( 31, 14 ),
476  NUMFMT_REUSE( 32, 21 ),
477  NUMFMT_REUSE( 33, 21 ),
478  NUMFMT_REUSE( 34, 21 ),
479  NUMFMT_REUSE( 35, 21 ),
480  NUMFMT_REUSE( 36, 14 ),
481 
482  // 37...44 accounting formats, defaults without currency symbol here
483  NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( 37, "", "", "" ),
485 
486  // 45...49 more special formats
487  NUMFMT_STRING( 45, "mm:ss" ),
488  NUMFMT_STRING( 46, "[h]:mm:ss" ),
489  NUMFMT_STRING( 47, "mm:ss.0" ),
490  NUMFMT_STRING( 48, "##0.0E+0" ),
491  NUMFMT_PREDEF( 49, TEXT ),
492 
493  // 50...81 international formats
494  NUMFMT_REUSE( 50, 14 ),
495  NUMFMT_REUSE( 51, 14 ),
496  NUMFMT_REUSE( 52, 14 ),
497  NUMFMT_REUSE( 53, 14 ),
498  NUMFMT_REUSE( 54, 14 ),
499  NUMFMT_REUSE( 55, 14 ),
500  NUMFMT_REUSE( 56, 14 ),
501  NUMFMT_REUSE( 57, 14 ),
502  NUMFMT_REUSE( 58, 14 ),
503  NUMFMT_REUSE( 59, 1 ),
504  NUMFMT_REUSE( 60, 2 ),
505  NUMFMT_REUSE( 61, 3 ),
506  NUMFMT_REUSE( 62, 4 ),
507  NUMFMT_REUSE( 63, 5 ),
508  NUMFMT_REUSE( 64, 6 ),
509  NUMFMT_REUSE( 65, 7 ),
510  NUMFMT_REUSE( 66, 8 ),
511  NUMFMT_REUSE( 67, 9 ),
512  NUMFMT_REUSE( 68, 10 ),
513  NUMFMT_REUSE( 69, 12 ),
514  NUMFMT_REUSE( 70, 13 ),
515  NUMFMT_REUSE( 71, 14 ),
516  NUMFMT_REUSE( 72, 14 ),
517  NUMFMT_REUSE( 73, 15 ),
518  NUMFMT_REUSE( 74, 16 ),
519  NUMFMT_REUSE( 75, 17 ),
520  NUMFMT_REUSE( 76, 20 ),
521  NUMFMT_REUSE( 77, 21 ),
522  NUMFMT_REUSE( 78, 22 ),
523  NUMFMT_REUSE( 79, 45 ),
524  NUMFMT_REUSE( 80, 46 ),
525  NUMFMT_REUSE( 81, 47 ),
526 
527  // 82...163 not used, must not occur in a file (Excel may crash)
528 
530 };
531 
533 const BuiltinFormat spBuiltinFormats_ar_AE[] =
534 {
535  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
538 };
539 
541 const BuiltinFormat spBuiltinFormats_ar_BH[] =
542 {
543  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
546 };
547 
549 const BuiltinFormat spBuiltinFormats_ar_DZ[] =
550 {
551  NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
554 };
555 
557 const BuiltinFormat spBuiltinFormats_ar_EG[] =
558 {
559  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
562 };
563 
565 const BuiltinFormat spBuiltinFormats_ar_IQ[] =
566 {
567  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
570 };
571 
573 const BuiltinFormat spBuiltinFormats_ar_JO[] =
574 {
575  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
578 };
579 
581 const BuiltinFormat spBuiltinFormats_ar_KW[] =
582 {
583  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
586 };
587 
589 const BuiltinFormat spBuiltinFormats_ar_LB[] =
590 {
591  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
594 };
595 
597 const BuiltinFormat spBuiltinFormats_ar_LY[] =
598 {
599  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
602 };
603 
605 const BuiltinFormat spBuiltinFormats_ar_MA[] =
606 {
607  NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
610 };
611 
613 const BuiltinFormat spBuiltinFormats_ar_OM[] =
614 {
615  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
618 };
619 
621 const BuiltinFormat spBuiltinFormats_ar_QA[] =
622 {
623  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
626 };
627 
629 const BuiltinFormat spBuiltinFormats_ar_SA[] =
630 {
631  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
634 };
635 
637 const BuiltinFormat spBuiltinFormats_ar_SY[] =
638 {
639  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
642 };
643 
645 const BuiltinFormat spBuiltinFormats_ar_TN[] =
646 {
647  NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
650 };
651 
653 const BuiltinFormat spBuiltinFormats_ar_YE[] =
654 {
655  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
658 };
659 
661 const BuiltinFormat spBuiltinFormats_be_BY[] =
662 {
663  // space character is group separator, literal spaces must be quoted
664  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
667 };
668 
670 const BuiltinFormat spBuiltinFormats_bg_BG[] =
671 {
672  // space character is group separator, literal spaces must be quoted
673  NUMFMT_ALLDATETIMES( "DD.M.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
674  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"" UTF8_CYR_L_LC UTF8_CYR_W_LC "\"", "_" UTF8_CYR_L_LC "_" UTF8_CYR_W_LC, "\\ " ),
676 };
677 
679 const BuiltinFormat spBuiltinFormats_bn_IN[] =
680 {
681  NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
684 };
685 
687 const BuiltinFormat spBuiltinFormats_cs_CZ[] =
688 {
689  // space character is group separator, literal spaces must be quoted
690  NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
693 };
694 
696 const BuiltinFormat spBuiltinFormats_da_DK[] =
697 {
698  NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
701 };
702 
704 const BuiltinFormat spBuiltinFormats_de_AT[] =
705 {
706  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
709 };
710 
712 const BuiltinFormat spBuiltinFormats_de_CH[] =
713 {
714  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ". ", "MMM", " ", "YY", "h", "hh" ),
715  NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"SFr.\"", " " ),
717 };
718 
720 const BuiltinFormat spBuiltinFormats_de_DE[] =
721 {
722  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ". ", "MMM", " ", "YY", "h", "hh" ),
725 };
726 
728 const BuiltinFormat spBuiltinFormats_de_LI[] =
729 {
730  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ". ", "MMM", " ", "YY", "h", "hh" ),
733 };
734 
736 const BuiltinFormat spBuiltinFormats_de_LU[] =
737 {
738  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
741 };
742 
744 const BuiltinFormat spBuiltinFormats_div_MV[] =
745 {
746  NUMFMT_ALLDATETIMES( "DD/MM/YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
749 };
750 
752 const BuiltinFormat spBuiltinFormats_el_GR[] =
753 {
754  NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
757 };
758 
760 const BuiltinFormat spBuiltinFormats_en_AU[] =
761 {
762  NUMFMT_ALLDATETIMES( "D/MM/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
765 };
766 
768 const BuiltinFormat spBuiltinFormats_en_BZ[] =
769 {
770  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
773 };
774 
776 const BuiltinFormat spBuiltinFormats_en_CA[] =
777 {
778  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
781 };
782 
784 const BuiltinFormat spBuiltinFormats_en_CB[] =
785 {
786  NUMFMT_ALLDATETIMES( "MM/DD/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
789 };
790 
792 const BuiltinFormat spBuiltinFormats_en_GB[] =
793 {
794  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
797 };
798 
800 const BuiltinFormat spBuiltinFormats_en_IE[] =
801 {
802  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
805 };
806 
808 const BuiltinFormat spBuiltinFormats_en_JM[] =
809 {
810  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
813 };
814 
816 const BuiltinFormat spBuiltinFormats_en_NZ[] =
817 {
818  NUMFMT_ALLDATETIMES( "D/MM/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
821 };
822 
824 const BuiltinFormat spBuiltinFormats_en_PH[] =
825 {
826  NUMFMT_ALLDATETIMES( "M/D/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
829 };
830 
832 const BuiltinFormat spBuiltinFormats_en_TT[] =
833 {
834  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
837 };
838 
840 const BuiltinFormat spBuiltinFormats_en_US[] =
841 {
842  NUMFMT_ALLDATETIMES( "M/D/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
845 };
846 
848 const BuiltinFormat spBuiltinFormats_en_ZA[] =
849 {
850  NUMFMT_ALLDATETIMES( "YYYY/MM/DD", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
853 };
854 
856 const BuiltinFormat spBuiltinFormats_en_ZW[] =
857 {
858  NUMFMT_ALLDATETIMES( "M/D/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
861 };
862 
864 const BuiltinFormat spBuiltinFormats_es_AR[] =
865 {
866  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
869 };
870 
872 const BuiltinFormat spBuiltinFormats_es_BO[] =
873 {
874  // slashes must be quoted to prevent conversion to minus
875  NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
878 };
879 
881 const BuiltinFormat spBuiltinFormats_es_CL[] =
882 {
883  NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
886 };
887 
889 const BuiltinFormat spBuiltinFormats_es_CO[] =
890 {
891  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
894 };
895 
897 const BuiltinFormat spBuiltinFormats_es_CR[] =
898 {
899  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
902 };
903 
905 const BuiltinFormat spBuiltinFormats_es_DO[] =
906 {
907  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
910 };
911 
913 const BuiltinFormat spBuiltinFormats_es_EC[] =
914 {
915  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
918 };
919 
921 const BuiltinFormat spBuiltinFormats_es_ES[] =
922 {
923  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
926 };
927 
929 const BuiltinFormat spBuiltinFormats_es_GT[] =
930 {
931  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
934 };
935 
937 const BuiltinFormat spBuiltinFormats_es_HN[] =
938 {
939  // slashes must be quoted to prevent conversion to minus
940  NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
943 };
944 
946 const BuiltinFormat spBuiltinFormats_es_MX[] =
947 {
948  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
951 };
952 
954 const BuiltinFormat spBuiltinFormats_es_NI[] =
955 {
956  // slashes must be quoted to prevent conversion to minus
957  NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
960 };
961 
963 const BuiltinFormat spBuiltinFormats_es_PA[] =
964 {
965  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
968 };
969 
971 const BuiltinFormat spBuiltinFormats_es_PE[] =
972 {
973  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
976 };
977 
979 const BuiltinFormat spBuiltinFormats_es_PR[] =
980 {
981  // slashes must be quoted to prevent conversion to minus
982  NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
985 };
986 
988 const BuiltinFormat spBuiltinFormats_es_PY[] =
989 {
990  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
993 };
994 
996 const BuiltinFormat spBuiltinFormats_es_SV[] =
997 {
998  // slashes must be quoted to prevent conversion to minus
999  NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
1001  NUMFMT_ENDTABLE()
1002 };
1003 
1005 const BuiltinFormat spBuiltinFormats_es_UY[] =
1006 {
1007  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
1009  NUMFMT_ENDTABLE()
1010 };
1011 
1013 const BuiltinFormat spBuiltinFormats_es_VE[] =
1014 {
1015  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
1017  NUMFMT_ENDTABLE()
1018 };
1019 
1021 const BuiltinFormat spBuiltinFormats_et_EE[] =
1022 {
1023  // space character is group separator, literal spaces must be quoted
1024  NUMFMT_ALLDATETIMES( "D.MM.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1025  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"kr\"", "_k_r", "\\ " ),
1026  NUMFMT_ENDTABLE()
1027 };
1028 
1030 const BuiltinFormat spBuiltinFormats_fa_IR[] =
1031 {
1032  NUMFMT_ALLDATETIMES( "YYYY/MM/DD", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
1034  NUMFMT_ENDTABLE()
1035 };
1036 
1038 const BuiltinFormat spBuiltinFormats_fi_FI[] =
1039 {
1040  // space character is group separator, literal spaces must be quoted
1041  NUMFMT_STRING( 9, "0\\ %" ),
1042  NUMFMT_STRING( 10, "0.00\\ %" ),
1043  NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1045  NUMFMT_ENDTABLE()
1046 };
1047 
1049 const BuiltinFormat spBuiltinFormats_fo_FO[] =
1050 {
1051  NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1053  NUMFMT_ENDTABLE()
1054 };
1055 
1057 const BuiltinFormat spBuiltinFormats_fr_BE[] =
1058 {
1059  NUMFMT_ALLDATETIMES( "D/MM/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1061  NUMFMT_ENDTABLE()
1062 };
1063 
1065 const BuiltinFormat spBuiltinFormats_fr_CA[] =
1066 {
1067  // space character is group separator, literal spaces must be quoted
1068  NUMFMT_ALLDATETIMES( "YYYY-MM-DD", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1070  NUMFMT_ENDTABLE()
1071 };
1072 
1074 const BuiltinFormat spBuiltinFormats_fr_CH[] =
1075 {
1076  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1077  NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"SFr.\"", " " ),
1078  NUMFMT_ENDTABLE()
1079 };
1080 
1082 const BuiltinFormat spBuiltinFormats_fr_FR[] =
1083 {
1084  // space character is group separator, literal spaces must be quoted
1085  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1087  NUMFMT_ENDTABLE()
1088 };
1089 
1091 const BuiltinFormat spBuiltinFormats_fr_LU[] =
1092 {
1093  // space character is group separator, literal spaces must be quoted
1094  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1096  NUMFMT_ENDTABLE()
1097 };
1098 
1100 const BuiltinFormat spBuiltinFormats_fr_MC[] =
1101 {
1102  // space character is group separator, literal spaces must be quoted
1103  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1105  NUMFMT_ENDTABLE()
1106 };
1107 
1109 const BuiltinFormat spBuiltinFormats_gl_ES[] =
1110 {
1111  NUMFMT_ALLDATETIMES( "DD/MM/YY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1113  NUMFMT_ENDTABLE()
1114 };
1115 
1117 const BuiltinFormat spBuiltinFormats_gu_IN[] =
1118 {
1119  NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1121  NUMFMT_ENDTABLE()
1122 };
1123 
1125 const BuiltinFormat spBuiltinFormats_he_IL[] =
1126 {
1127  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1129  NUMFMT_ENDTABLE()
1130 };
1131 
1133 const BuiltinFormat spBuiltinFormats_hi_IN[] =
1134 {
1135  NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1137  NUMFMT_ENDTABLE()
1138 };
1139 
1141 const BuiltinFormat spBuiltinFormats_hr_BA[] =
1142 {
1143  NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1144  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"KM\"", "_K_M", " " ),
1145  NUMFMT_ENDTABLE()
1146 };
1147 
1149 const BuiltinFormat spBuiltinFormats_hr_HR[] =
1150 {
1151  NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1152  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"kn\"", "_k_n", " " ),
1153  NUMFMT_ENDTABLE()
1154 };
1155 
1157 const BuiltinFormat spBuiltinFormats_hu_HU[] =
1158 {
1159  // space character is group separator, literal spaces must be quoted
1160  // MMM is rendered differently in Calc and Excel (see #i41488#)
1161  NUMFMT_ALLDATETIMES( "YYYY.MM.DD", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1162  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"Ft\"", "_F_t", "\\ " ),
1163  NUMFMT_ENDTABLE()
1164 };
1165 
1167 const BuiltinFormat spBuiltinFormats_hy_AM[] =
1168 {
1169  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1170  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"" UTF8_HY_DA_LC UTF8_HY_REH_LC ".\"", "_" UTF8_HY_DA_LC "_" UTF8_HY_REH_LC "_.", " " ),
1171  NUMFMT_ENDTABLE()
1172 };
1173 
1175 const BuiltinFormat spBuiltinFormats_id_ID[] =
1176 {
1177  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1179  NUMFMT_ENDTABLE()
1180 };
1181 
1183 const BuiltinFormat spBuiltinFormats_is_IS[] =
1184 {
1185  NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "hh" ),
1186  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"kr.\"", "_k_r_.", " " ),
1187  NUMFMT_ENDTABLE()
1188 };
1189 
1191 const BuiltinFormat spBuiltinFormats_it_CH[] =
1192 {
1193  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1194  NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"SFr.\"", " " ),
1195  NUMFMT_ENDTABLE()
1196 };
1197 
1199 const BuiltinFormat spBuiltinFormats_it_IT[] =
1200 {
1201  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1203  NUMFMT_ENDTABLE()
1204 };
1205 
1207 const BuiltinFormat spBuiltinFormats_ka_GE[] =
1208 {
1209  // space character is group separator, literal spaces must be quoted
1210  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1211  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"Lari\"", "_L_a_r_i", "\\ " ),
1212  NUMFMT_ENDTABLE()
1213 };
1214 
1216 const BuiltinFormat spBuiltinFormats_kk_KZ[] =
1217 {
1218  // space character is group separator, literal spaces must be quoted
1219  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1221  NUMFMT_ENDTABLE()
1222 };
1223 
1225 const BuiltinFormat spBuiltinFormats_kn_IN[] =
1226 {
1227  NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1229  NUMFMT_ENDTABLE()
1230 };
1231 
1233 const BuiltinFormat spBuiltinFormats_ky_KG[] =
1234 {
1235  // space character is group separator, literal spaces must be quoted
1236  NUMFMT_ALLDATETIMES( "DD.MM.YY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1238  NUMFMT_ENDTABLE()
1239 };
1240 
1242 const BuiltinFormat spBuiltinFormats_lt_LT[] =
1243 {
1244  NUMFMT_ALLDATETIMES( "YYYY.MM.DD", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1245  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"Lt\"", "_L_t", " " ),
1246  NUMFMT_ENDTABLE()
1247 };
1248 
1250 const BuiltinFormat spBuiltinFormats_lv_LV[] =
1251 {
1252  // space character is group separator, literal spaces must be quoted
1253  NUMFMT_ALLDATETIMES( "YYYY.MM.DD", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1254  NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "\"Ls\"", "\\ " ),
1255  NUMFMT_ENDTABLE()
1256 };
1257 
1259 const BuiltinFormat spBuiltinFormats_ml_IN[] =
1260 {
1261  NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1263  NUMFMT_ENDTABLE()
1264 };
1265 
1267 const BuiltinFormat spBuiltinFormats_mn_MN[] =
1268 {
1269  NUMFMT_ALLDATETIMES( "YY.MM.DD", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1271  NUMFMT_ENDTABLE()
1272 };
1273 
1275 const BuiltinFormat spBuiltinFormats_ms_BN[] =
1276 {
1277  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1279  NUMFMT_ENDTABLE()
1280 };
1281 
1283 const BuiltinFormat spBuiltinFormats_ms_MY[] =
1284 {
1285  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1287  NUMFMT_ENDTABLE()
1288 };
1289 
1291 const BuiltinFormat spBuiltinFormats_mt_MT[] =
1292 {
1293  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1295  NUMFMT_ENDTABLE()
1296 };
1297 
1299 const BuiltinFormat spBuiltinFormats_nl_BE[] =
1300 {
1301  // slashes must be quoted to prevent conversion to minus
1302  NUMFMT_ALLDATETIMES( "D\\/MM\\/YYYY", "D", "\\/", "MMM", "\\/", "YY", "h", "h" ),
1304  NUMFMT_ENDTABLE()
1305 };
1306 
1308 const BuiltinFormat spBuiltinFormats_nl_NL[] =
1309 {
1310  NUMFMT_ALLDATETIMES( "D-M-YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1312  NUMFMT_ENDTABLE()
1313 };
1314 
1316 const BuiltinFormat spBuiltinFormats_no_NO[] =
1317 {
1318  // space character is group separator, literal spaces must be quoted
1319  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1320  NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"kr\"", "\\ " ),
1321  NUMFMT_ENDTABLE()
1322 };
1323 
1325 const BuiltinFormat spBuiltinFormats_pa_IN[] =
1326 {
1327  NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
1329  NUMFMT_ENDTABLE()
1330 };
1331 
1333 const BuiltinFormat spBuiltinFormats_pl_PL[] =
1334 {
1335  // space character is group separator, literal spaces must be quoted
1336  // MMM is rendered differently in Calc and Excel (see #i72300#)
1337  NUMFMT_ALLDATETIMES( "YYYY-MM-DD", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1339  NUMFMT_ENDTABLE()
1340 };
1341 
1343 const BuiltinFormat spBuiltinFormats_pt_BR[] =
1344 {
1345  NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "/", "MMM", "/", "YY", "h", "hh" ),
1347  NUMFMT_ENDTABLE()
1348 };
1349 
1351 const BuiltinFormat spBuiltinFormats_pt_PT[] =
1352 {
1353  NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1355  NUMFMT_ENDTABLE()
1356 };
1357 
1359 const BuiltinFormat spBuiltinFormats_ro_RO[] =
1360 {
1361  // space character is group separator, literal spaces must be quoted (but see #i75367#)
1362  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1363  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"lei\"", "_l_e_i", "\\ " ),
1364  NUMFMT_ENDTABLE()
1365 };
1366 
1368 const BuiltinFormat spBuiltinFormats_ru_RU[] =
1369 {
1370  // space character is group separator, literal spaces must be quoted
1371  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1373  NUMFMT_ENDTABLE()
1374 };
1375 
1377 const BuiltinFormat spBuiltinFormats_sk_SK[] =
1378 {
1379  // space character is group separator, literal spaces must be quoted
1380  NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1381  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"Sk\"", "_S_k", "\\ " ),
1382  NUMFMT_ENDTABLE()
1383 };
1384 
1386 const BuiltinFormat spBuiltinFormats_sl_SI[] =
1387 {
1388  NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1389  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"SIT\"", "_S_I_T", " " ),
1390  NUMFMT_ENDTABLE()
1391 };
1392 
1394 const BuiltinFormat spBuiltinFormats_sv_FI[] =
1395 {
1396  // space character is group separator, literal spaces must be quoted
1397  NUMFMT_STRING( 9, "0\\ %" ),
1398  NUMFMT_STRING( 10, "0.00\\ %" ),
1399  NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "hh" ),
1401  NUMFMT_ENDTABLE()
1402 };
1403 
1405 const BuiltinFormat spBuiltinFormats_sv_SE[] =
1406 {
1407  // space character is group separator, literal spaces must be quoted
1408  NUMFMT_ALLDATETIMES( "YYYY-MM-DD", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1409  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"kr\"", "_k_r", "\\ " ),
1410  NUMFMT_ENDTABLE()
1411 };
1412 
1414 const BuiltinFormat spBuiltinFormats_sw_TZ[] =
1415 {
1416  NUMFMT_ALLDATETIMES( "M/D/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1418  NUMFMT_ENDTABLE()
1419 };
1420 
1422 const BuiltinFormat spBuiltinFormats_ta_IN[] =
1423 {
1424  NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1426  NUMFMT_ENDTABLE()
1427 };
1428 
1430 const BuiltinFormat spBuiltinFormats_te_IN[] =
1431 {
1432  NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1434  NUMFMT_ENDTABLE()
1435 };
1436 
1438 const BuiltinFormat spBuiltinFormats_th_TH[] =
1439 {
1440  NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1443  NUMFMT_STRING( 59, "t0" ),
1444  NUMFMT_STRING( 60, "t0.00" ),
1445  NUMFMT_STRING( 61, "t#,##0" ),
1446  NUMFMT_STRING( 62, "t#,##0.00" ),
1447  NUMFMT_STRING( 67, "t0%" ),
1448  NUMFMT_STRING( 68, "t0.00%" ),
1449  NUMFMT_STRING( 69, "t# ?/?" ),
1450  NUMFMT_STRING( 70, "t# ?\?/?\?" ),
1451  NUMFMT_STRING( 71, "tD/M/EE" ),
1452  NUMFMT_STRING( 72, "tD-MMM-E" ),
1453  NUMFMT_STRING( 73, "tD-MMM" ),
1454  NUMFMT_STRING( 74, "tMMM-E" ),
1455  NUMFMT_STRING( 75, "th:mm" ),
1456  NUMFMT_STRING( 76, "th:mm:ss" ),
1457  NUMFMT_STRING( 77, "tD/M/EE h:mm" ),
1458  NUMFMT_STRING( 78, "tmm:ss" ),
1459  NUMFMT_STRING( 79, "t[h]:mm:ss" ),
1460  NUMFMT_STRING( 80, "tmm:ss.0" ),
1461  NUMFMT_STRING( 81, "D/M/E" ),
1462  NUMFMT_ENDTABLE()
1463 };
1464 
1466 const BuiltinFormat spBuiltinFormats_tr_TR[] =
1467 {
1468  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1469  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"TL\"", "_T_L", " " ),
1470  NUMFMT_ENDTABLE()
1471 };
1472 
1474 const BuiltinFormat spBuiltinFormats_tt_RU[] =
1475 {
1476  // space character is group separator, literal spaces must be quoted
1477  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1479  NUMFMT_ENDTABLE()
1480 };
1481 
1483 const BuiltinFormat spBuiltinFormats_uk_UA[] =
1484 {
1485  // space character is group separator, literal spaces must be quoted
1486  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1488  NUMFMT_ENDTABLE()
1489 };
1490 
1492 const BuiltinFormat spBuiltinFormats_ur_PK[] =
1493 {
1494  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1496  NUMFMT_ENDTABLE()
1497 };
1498 
1500 const BuiltinFormat spBuiltinFormats_vi_VN[] =
1501 {
1502  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1504  NUMFMT_ENDTABLE()
1505 };
1506 
1507 // CJK ------------------------------------------------------------------------
1508 
1510 const BuiltinFormat spBuiltinFormats_CJK[] =
1511 {
1512  NUMFMT_REUSE( 29, 28 ),
1513  NUMFMT_REUSE( 36, 27 ),
1514  NUMFMT_REUSE( 50, 27 ),
1515  NUMFMT_REUSE( 51, 28 ),
1516  NUMFMT_REUSE( 52, 34 ),
1517  NUMFMT_REUSE( 53, 35 ),
1518  NUMFMT_REUSE( 54, 28 ),
1519  NUMFMT_REUSE( 55, 34 ),
1520  NUMFMT_REUSE( 56, 35 ),
1521  NUMFMT_REUSE( 57, 27 ),
1522  NUMFMT_REUSE( 58, 28 ),
1523  NUMFMT_ENDTABLE()
1524 };
1525 
1527 const BuiltinFormat spBuiltinFormats_ja_JP[] =
1528 {
1529  NUMFMT_ALLDATETIMES( "YYYY/MM/DD", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1531  NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "$", "", "" ),
1532  NUMFMT_STRING( 27, "[$-411]GE.MM.DD" ),
1533  NUMFMT_STRING( 28, "[$-411]GGGE\"" UTF8_CJ_YEAR "\"MM\"" UTF8_CJ_MON "\"DD\"" UTF8_CJ_DAY "\"" ),
1534  NUMFMT_STRING( 30, "MM/DD/YY" ),
1535  NUMFMT_STRING( 31, "YYYY\"" UTF8_CJ_YEAR "\"MM\"" UTF8_CJ_MON "\"DD\"" UTF8_CJ_DAY "\"" ),
1537  NUMFMT_STRING( 34, "YYYY\"" UTF8_CJ_YEAR "\"MM\"" UTF8_CJ_MON "\"" ),
1538  NUMFMT_STRING( 35, "MM\"" UTF8_CJ_MON "\"DD\"" UTF8_CJ_DAY "\"" ),
1539  NUMFMT_ENDTABLE()
1540 };
1541 
1543 const BuiltinFormat spBuiltinFormats_ko_KR[] =
1544 {
1545  NUMFMT_ALLDATETIMES( "YYYY-MM-DD", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1547  NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "$", "", "" ),
1548  NUMFMT_STRING( 27, "YYYY" UTF8_CJ_YEAR " MM" UTF8_CJ_MON " DD" UTF8_CJ_DAY ),
1549  NUMFMT_STRING( 28, "MM-DD" ),
1550  NUMFMT_STRING( 30, "MM-DD-YY" ),
1551  NUMFMT_STRING( 31, "YYYY" UTF8_KO_YEAR " MM" UTF8_KO_MON " DD" UTF8_KO_DAY ),
1553  // slashes must be quoted to prevent conversion to minus
1554  NUMFMT_STRING( 34, "YYYY\\/MM\\/DD" ),
1555  NUMFMT_REUSE( 35, 14 ),
1556  NUMFMT_ENDTABLE()
1557 };
1558 
1560 const BuiltinFormat spBuiltinFormats_zh_CN[] =
1561 {
1562  NUMFMT_ALLDATETIMES( "YYYY-M-D", "D", "-", "MMM", "-", "YY", "h", "h" ),
1565  NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "$", "", "" ),
1566  NUMFMT_STRING( 27, "YYYY\"" UTF8_CS_YEAR "\"M\"" UTF8_CS_MON "\"" ),
1567  NUMFMT_STRING( 28, "M\"" UTF8_CS_MON "\"D\"" UTF8_CS_DAY "\"" ),
1568  NUMFMT_STRING( 30, "M-D-YY" ),
1569  NUMFMT_STRING( 31, "YYYY\"" UTF8_CS_YEAR "\"M\"" UTF8_CS_MON "\"D\"" UTF8_CS_DAY "\"" ),
1570  NUMFMT_REUSE( 52, 27 ),
1571  NUMFMT_REUSE( 53, 28 ),
1572  NUMFMT_ENDTABLE()
1573 };
1574 
1576 const BuiltinFormat spBuiltinFormats_zh_HK[] =
1577 {
1578  NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1581  NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "\"US$\"", "", "" ),
1582  NUMFMT_STRING( 27, "[$-404]D/M/E" ),
1583  NUMFMT_STRING( 28, "[$-404]D\"" UTF8_CJ_DAY "\"M\"" UTF8_CJ_MON "\"E\"" UTF8_CJ_YEAR "\"" ),
1584  NUMFMT_STRING( 30, "M/D/YY" ),
1585  NUMFMT_STRING( 31, "D\"" UTF8_CJ_DAY "\"M\"" UTF8_CJ_MON "\"YYYY\"" UTF8_CJ_YEAR "\"" ),
1586  NUMFMT_ENDTABLE()
1587 };
1588 
1590 const BuiltinFormat spBuiltinFormats_zh_MO[] =
1591 {
1592  NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1595  NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "\"US$\"", "", "" ),
1596  NUMFMT_STRING( 27, "[$-404]D/M/E" ),
1597  NUMFMT_STRING( 28, "[$-404]D\"" UTF8_CJ_DAY "\"M\"" UTF8_CJ_MON "\"E\"" UTF8_CJ_YEAR "\"" ),
1598  NUMFMT_STRING( 30, "M/D/YY" ),
1599  NUMFMT_STRING( 31, "D\"" UTF8_CJ_DAY "\"M\"" UTF8_CJ_MON "\"YYYY\"" UTF8_CJ_YEAR "\"" ),
1600  NUMFMT_ENDTABLE()
1601 };
1602 
1604 const BuiltinFormat spBuiltinFormats_zh_SG[] =
1605 {
1606  NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1609  NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "$", "", "" ),
1610  NUMFMT_STRING( 27, "YYYY\"" UTF8_CS_YEAR "\"M\"" UTF8_CS_MON "\"" ),
1611  NUMFMT_STRING( 28, "M\"" UTF8_CS_MON "\"D\"" UTF8_CS_DAY "\"" ),
1612  NUMFMT_STRING( 30, "M/D/YY" ),
1613  NUMFMT_STRING( 31, "D\"" UTF8_CS_DAY "\"M\"" UTF8_CS_MON "\"YYYY\"" UTF8_CS_YEAR "\"" ),
1614  NUMFMT_ENDTABLE()
1615 };
1616 
1618 const BuiltinFormat spBuiltinFormats_zh_TW[] =
1619 {
1620  NUMFMT_ALLDATETIMES( "YYYY/M/D", "D", "-", "MMM", "-", "YY", "hh", "hh" ),
1623  NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "\"US$\"", "", "" ),
1624  NUMFMT_STRING( 27, "[$-404]E/M/D" ),
1625  NUMFMT_STRING( 28, "[$-404]E\"" UTF8_CJ_YEAR "\"M\"" UTF8_CJ_MON "\"D\"" UTF8_CJ_DAY "\"" ),
1626  NUMFMT_STRING( 30, "M/D/YY" ),
1627  NUMFMT_STRING( 31, "YYYY\"" UTF8_CJ_YEAR "\"M\"" UTF8_CJ_MON "\"D\"" UTF8_CJ_DAY "\"" ),
1628  NUMFMT_ENDTABLE()
1629 };
1630 
1632 struct BuiltinFormatTable
1633 {
1634  const char* mpcLocale;
1635  const char* mpcParent;
1636  const BuiltinFormat* mpFormats;
1637 };
1638 
1639 const BuiltinFormatTable spBuiltinFormatTables[] =
1640 { // locale parent format table
1641  { "*", "", spBuiltinFormats_BASE }, // Base table
1642  { "af-ZA", "*", spBuiltinFormats_en_ZA }, // Afrikaans, South Africa
1643  { "ar-AE", "*", spBuiltinFormats_ar_AE }, // Arabic, U.A.E.
1644  { "ar-BH", "*", spBuiltinFormats_ar_BH }, // Arabic, Bahrain
1645  { "ar-DZ", "*", spBuiltinFormats_ar_DZ }, // Arabic, Algeria
1646  { "ar-EG", "*", spBuiltinFormats_ar_EG }, // Arabic, Egypt
1647  { "ar-IQ", "*", spBuiltinFormats_ar_IQ }, // Arabic, Iraq
1648  { "ar-JO", "*", spBuiltinFormats_ar_JO }, // Arabic, Jordan
1649  { "ar-KW", "*", spBuiltinFormats_ar_KW }, // Arabic, Kuwait
1650  { "ar-LB", "*", spBuiltinFormats_ar_LB }, // Arabic, Lebanon
1651  { "ar-LY", "*", spBuiltinFormats_ar_LY }, // Arabic, Libya
1652  { "ar-MA", "*", spBuiltinFormats_ar_MA }, // Arabic, Morocco
1653  { "ar-OM", "*", spBuiltinFormats_ar_OM }, // Arabic, Oman
1654  { "ar-QA", "*", spBuiltinFormats_ar_QA }, // Arabic, Qatar
1655  { "ar-SA", "*", spBuiltinFormats_ar_SA }, // Arabic, Saudi Arabia
1656  { "ar-SY", "*", spBuiltinFormats_ar_SY }, // Arabic, Syria
1657  { "ar-TN", "*", spBuiltinFormats_ar_TN }, // Arabic, Tunisia
1658  { "ar-YE", "*", spBuiltinFormats_ar_YE }, // Arabic, Yemen
1659  { "be-BY", "*", spBuiltinFormats_be_BY }, // Belarusian, Belarus
1660  { "bg-BG", "*", spBuiltinFormats_bg_BG }, // Bulgarian, Bulgaria
1661  { "bn-IN", "*", spBuiltinFormats_bn_IN }, // Bengali, India
1662  { "ca-ES", "*", spBuiltinFormats_es_ES }, // Catalan, Spain
1663  { "cs-CZ", "*", spBuiltinFormats_cs_CZ }, // Czech, Czech Republic
1664  { "cy-GB", "*", spBuiltinFormats_en_GB }, // Welsh, United Kingdom
1665  { "da-DK", "*", spBuiltinFormats_da_DK }, // Danish, Denmark
1666  { "de-AT", "*", spBuiltinFormats_de_AT }, // German, Austria
1667  { "de-CH", "*", spBuiltinFormats_de_CH }, // German, Switzerland
1668  { "de-DE", "*", spBuiltinFormats_de_DE }, // German, Germany
1669  { "de-LI", "*", spBuiltinFormats_de_LI }, // German, Liechtenstein
1670  { "de-LU", "*", spBuiltinFormats_de_LU }, // German, Luxembourg
1671  { "div-MV", "*", spBuiltinFormats_div_MV }, // Divehi, Maldives
1672  { "el-GR", "*", spBuiltinFormats_el_GR }, // Greek, Greece
1673  { "en-AU", "*", spBuiltinFormats_en_AU }, // English, Australia
1674  { "en-BZ", "*", spBuiltinFormats_en_BZ }, // English, Belize
1675  { "en-CA", "*", spBuiltinFormats_en_CA }, // English, Canada
1676  { "en-CB", "*", spBuiltinFormats_en_CB }, // English, Caribbean
1677  { "en-GB", "*", spBuiltinFormats_en_GB }, // English, United Kingdom
1678  { "en-IE", "*", spBuiltinFormats_en_IE }, // English, Ireland
1679  { "en-JM", "*", spBuiltinFormats_en_JM }, // English, Jamaica
1680  { "en-NZ", "*", spBuiltinFormats_en_NZ }, // English, New Zealand
1681  { "en-PH", "*", spBuiltinFormats_en_PH }, // English, Philippines
1682  { "en-TT", "*", spBuiltinFormats_en_TT }, // English, Trinidad and Tobago
1683  { "en-US", "*", spBuiltinFormats_en_US }, // English, USA
1684  { "en-ZA", "*", spBuiltinFormats_en_ZA }, // English, South Africa
1685  { "en-ZW", "*", spBuiltinFormats_en_ZW }, // English, Zimbabwe
1686  { "es-AR", "*", spBuiltinFormats_es_AR }, // Spanish, Argentina
1687  { "es-BO", "*", spBuiltinFormats_es_BO }, // Spanish, Bolivia
1688  { "es-CL", "*", spBuiltinFormats_es_CL }, // Spanish, Chile
1689  { "es-CO", "*", spBuiltinFormats_es_CO }, // Spanish, Colombia
1690  { "es-CR", "*", spBuiltinFormats_es_CR }, // Spanish, Costa Rica
1691  { "es-DO", "*", spBuiltinFormats_es_DO }, // Spanish, Dominican Republic
1692  { "es-EC", "*", spBuiltinFormats_es_EC }, // Spanish, Ecuador
1693  { "es-ES", "*", spBuiltinFormats_es_ES }, // Spanish, Spain
1694  { "es-GT", "*", spBuiltinFormats_es_GT }, // Spanish, Guatemala
1695  { "es-HN", "*", spBuiltinFormats_es_HN }, // Spanish, Honduras
1696  { "es-MX", "*", spBuiltinFormats_es_MX }, // Spanish, Mexico
1697  { "es-NI", "*", spBuiltinFormats_es_NI }, // Spanish, Nicaragua
1698  { "es-PA", "*", spBuiltinFormats_es_PA }, // Spanish, Panama
1699  { "es-PE", "*", spBuiltinFormats_es_PE }, // Spanish, Peru
1700  { "es-PR", "*", spBuiltinFormats_es_PR }, // Spanish, Puerto Rico
1701  { "es-PY", "*", spBuiltinFormats_es_PY }, // Spanish, Paraguay
1702  { "es-SV", "*", spBuiltinFormats_es_SV }, // Spanish, El Salvador
1703  { "es-UY", "*", spBuiltinFormats_es_UY }, // Spanish, Uruguay
1704  { "es-VE", "*", spBuiltinFormats_es_VE }, // Spanish, Venezuela
1705  { "et-EE", "*", spBuiltinFormats_et_EE }, // Estonian, Estonia
1706  { "fa-IR", "*", spBuiltinFormats_fa_IR }, // Farsi, Iran
1707  { "fi-FI", "*", spBuiltinFormats_fi_FI }, // Finnish, Finland
1708  { "fo-FO", "*", spBuiltinFormats_fo_FO }, // Faroese, Faroe Islands
1709  { "fr-BE", "*", spBuiltinFormats_fr_BE }, // French, Belgium
1710  { "fr-CA", "*", spBuiltinFormats_fr_CA }, // French, Canada
1711  { "fr-CH", "*", spBuiltinFormats_fr_CH }, // French, Switzerland
1712  { "fr-FR", "*", spBuiltinFormats_fr_FR }, // French, France
1713  { "fr-LU", "*", spBuiltinFormats_fr_LU }, // French, Luxembourg
1714  { "fr-MC", "*", spBuiltinFormats_fr_MC }, // French, Monaco
1715  { "gl-ES", "*", spBuiltinFormats_gl_ES }, // Galizian, Spain
1716  { "gu-IN", "*", spBuiltinFormats_gu_IN }, // Gujarati, India
1717  { "he-IL", "*", spBuiltinFormats_he_IL }, // Hebrew, Israel
1718  { "hi-IN", "*", spBuiltinFormats_hi_IN }, // Hindi, India
1719  { "hr-BA", "*", spBuiltinFormats_hr_BA }, // Croatian, Bosnia and Herzegowina
1720  { "hr-HR", "*", spBuiltinFormats_hr_HR }, // Croatian, Croatia
1721  { "hu-HU", "*", spBuiltinFormats_hu_HU }, // Hungarian, Hungary
1722  { "hy-AM", "*", spBuiltinFormats_hy_AM }, // Armenian, Armenia
1723  { "id-ID", "*", spBuiltinFormats_id_ID }, // Indonesian, Indonesia
1724  { "is-IS", "*", spBuiltinFormats_is_IS }, // Icelandic, Iceland
1725  { "it-CH", "*", spBuiltinFormats_it_CH }, // Italian, Switzerland
1726  { "it-IT", "*", spBuiltinFormats_it_IT }, // Italian, Italy
1727  { "ka-GE", "*", spBuiltinFormats_ka_GE }, // Georgian, Georgia
1728  { "kk-KZ", "*", spBuiltinFormats_kk_KZ }, // Kazakh, Kazakhstan
1729  { "kn-IN", "*", spBuiltinFormats_kn_IN }, // Kannada, India
1730  { "kok-IN", "*", spBuiltinFormats_hi_IN }, // Konkani, India
1731  { "ky-KG", "*", spBuiltinFormats_ky_KG }, // Kyrgyz, Kyrgyzstan
1732  { "lt-LT", "*", spBuiltinFormats_lt_LT }, // Lithuanian, Lithuania
1733  { "lv-LV", "*", spBuiltinFormats_lv_LV }, // Latvian, Latvia
1734  { "mi-NZ", "*", spBuiltinFormats_en_NZ }, // Maori, New Zealand
1735  { "ml-IN", "*", spBuiltinFormats_ml_IN }, // Malayalam, India
1736  { "mn-MN", "*", spBuiltinFormats_mn_MN }, // Mongolian, Mongolia
1737  { "mr-IN", "*", spBuiltinFormats_hi_IN }, // Marathi, India
1738  { "ms-BN", "*", spBuiltinFormats_ms_BN }, // Malay, Brunei Darussalam
1739  { "ms-MY", "*", spBuiltinFormats_ms_MY }, // Malay, Malaysia
1740  { "mt-MT", "*", spBuiltinFormats_mt_MT }, // Maltese, Malta
1741  { "nb-NO", "*", spBuiltinFormats_no_NO }, // Norwegian Bokmal, Norway
1742  { "nl-BE", "*", spBuiltinFormats_nl_BE }, // Dutch, Belgium
1743  { "nl-NL", "*", spBuiltinFormats_nl_NL }, // Dutch, Netherlands
1744  { "nn-NO", "*", spBuiltinFormats_no_NO }, // Norwegian Nynorsk, Norway
1745  { "nso-ZA", "*", spBuiltinFormats_en_ZA }, // Northern Sotho, South Africa
1746  { "pa-IN", "*", spBuiltinFormats_pa_IN }, // Punjabi, India
1747  { "pl-PL", "*", spBuiltinFormats_pl_PL }, // Polish, Poland
1748  { "pt-BR", "*", spBuiltinFormats_pt_BR }, // Portuguese, Brazil
1749  { "pt-PT", "*", spBuiltinFormats_pt_PT }, // Portuguese, Portugal
1750  { "qu-BO", "*", spBuiltinFormats_es_BO }, // Quechua, Bolivia
1751  { "qu-EC", "*", spBuiltinFormats_es_EC }, // Quechua, Ecuador
1752  { "qu-PE", "*", spBuiltinFormats_es_PE }, // Quechua, Peru
1753  { "ro-RO", "*", spBuiltinFormats_ro_RO }, // Romanian, Romania
1754  { "ru-RU", "*", spBuiltinFormats_ru_RU }, // Russian, Russian Federation
1755  { "sa-IN", "*", spBuiltinFormats_hi_IN }, // Sanskrit, India
1756  { "se-FI", "*", spBuiltinFormats_fi_FI }, // Sami, Finland
1757  { "se-NO", "*", spBuiltinFormats_no_NO }, // Sami, Norway
1758  { "se-SE", "*", spBuiltinFormats_sv_SE }, // Sami, Sweden
1759  { "sk-SK", "*", spBuiltinFormats_sk_SK }, // Slovak, Slovakia
1760  { "sl-SI", "*", spBuiltinFormats_sl_SI }, // Slovenian, Slovenia
1761  { "sv-FI", "*", spBuiltinFormats_sv_FI }, // Swedish, Finland
1762  { "sv-SE", "*", spBuiltinFormats_sv_SE }, // Swedish, Sweden
1763  { "sw-TZ", "*", spBuiltinFormats_sw_TZ }, // Swahili, Tanzania
1764  { "syr-SY", "*", spBuiltinFormats_ar_SY }, // Syriac, Syria
1765  { "syr-TR", "*", spBuiltinFormats_tr_TR }, // Syriac, Turkey
1766  { "ta-IN", "*", spBuiltinFormats_ta_IN }, // Tamil, India
1767  { "te-IN", "*", spBuiltinFormats_te_IN }, // Telugu, India
1768  { "th-TH", "*", spBuiltinFormats_th_TH }, // Thai, Thailand
1769  { "tn-ZA", "*", spBuiltinFormats_en_ZA }, // Tswana, South Africa
1770  { "tr-TR", "*", spBuiltinFormats_tr_TR }, // Turkish, Turkey
1771  { "tt-RU", "*", spBuiltinFormats_tt_RU }, // Tatar, Russian Federation
1772  { "uk-UA", "*", spBuiltinFormats_uk_UA }, // Ukrainian, Ukraine
1773  { "ur-PK", "*", spBuiltinFormats_ur_PK }, // Urdu, Pakistan
1774  { "vi-VN", "*", spBuiltinFormats_vi_VN }, // Vietnamese, Viet Nam
1775  { "xh-ZA", "*", spBuiltinFormats_en_ZA }, // Xhosa, South Africa
1776  { "zu-ZA", "*", spBuiltinFormats_en_ZA }, // Zulu, South Africa
1777 
1778  { "*CJK", "*", spBuiltinFormats_CJK }, // CJK base table
1779  { "ja-JP", "*CJK", spBuiltinFormats_ja_JP }, // Japanese, Japan
1780  { "ko-KR", "*CJK", spBuiltinFormats_ko_KR }, // Korean, South Korea
1781  { "zh-CN", "*CJK", spBuiltinFormats_zh_CN }, // Chinese, China
1782  { "zh-HK", "*CJK", spBuiltinFormats_zh_HK }, // Chinese, Hong Kong
1783  { "zh-MO", "*CJK", spBuiltinFormats_zh_MO }, // Chinese, Macau
1784  { "zh-SG", "*CJK", spBuiltinFormats_zh_SG }, // Chinese, Singapore
1785  { "zh-TW", "*CJK", spBuiltinFormats_zh_TW } // Chinese, Taiwan
1786 };
1787 
1788 } // namespace
1789 
1791  mnPredefId( -1 )
1792 {
1793 }
1794 
1796  mnIndex( 0 )
1797 {
1798 }
1799 
1800 namespace {
1801 
1802 sal_Int32 lclCreatePredefinedFormat( const Reference< XNumberFormats >& rxNumFmts,
1803  sal_Int16 nPredefId, const Locale& rToLocale )
1804 {
1805  sal_Int32 nIndex = 0;
1806  try
1807  {
1808  Reference< XNumberFormatTypes > xNumFmtTypes( rxNumFmts, UNO_QUERY_THROW );
1809  nIndex = (nPredefId >= 0) ?
1810  xNumFmtTypes->getFormatIndex( nPredefId, rToLocale ) :
1811  xNumFmtTypes->getStandardIndex( rToLocale );
1812  }
1813  catch( Exception& )
1814  {
1815  OSL_FAIL( OStringBuffer( "lclCreatePredefinedFormat - cannot create predefined number format " ).
1816  append( OString::number( nPredefId ) ).getStr() );
1817  }
1818  return nIndex;
1819 }
1820 
1821 sal_Int32 lclCreateFormat( const Reference< XNumberFormats >& rxNumFmts,
1822  const OUString& rFmtCode, const Locale& rToLocale, const Locale& rFromLocale )
1823 {
1824  sal_Int32 nIndex = 0;
1825  try
1826  {
1827  nIndex = rxNumFmts->addNewConverted( rFmtCode, rFromLocale, rToLocale );
1828  }
1829  catch( Exception& )
1830  {
1831  // BIFF2-BIFF4 stores standard format explicitly in stream
1832  if( rFmtCode.equalsIgnoreAsciiCase( "general" ) )
1833  {
1834  nIndex = lclCreatePredefinedFormat( rxNumFmts, 0, rToLocale );
1835  }
1836  else
1837  {
1838  // do not assert fractional number formats with fixed denominator
1839  OSL_ENSURE( rFmtCode.startsWith( "#\\ ?/" ) ||
1840  rFmtCode.startsWith( "#\\ ?\?/" ) ||
1841  rFmtCode.startsWith( "#\\ ?\?\?/" ),
1842  OStringBuffer( "lclCreateFormat - cannot create number format '" ).
1843  append( OUStringToOString( rFmtCode, osl_getThreadTextEncoding() ) ).
1844  append( '\'' ).getStr() );
1845  }
1846  }
1847  return nIndex;
1848 }
1849 
1851 class NumberFormatFinalizer
1852 {
1853 public:
1854  explicit NumberFormatFinalizer( const WorkbookHelper& rHelper );
1855 
1856  void operator()( NumberFormat& rNumFmt ) const
1857  { rNumFmt.finalizeImport( mxNumFmts, maEnUsLocale ); }
1858 
1859 private:
1860  Reference< XNumberFormats > mxNumFmts;
1862 };
1863 
1864 NumberFormatFinalizer::NumberFormatFinalizer( const WorkbookHelper& rHelper ) :
1865  maEnUsLocale( "en", "US", OUString() )
1866 {
1867  try
1868  {
1869  Reference< XNumberFormatsSupplier > xNumFmtsSupp( rHelper.getDocument(), UNO_QUERY_THROW );
1870  mxNumFmts = xNumFmtsSupp->getNumberFormats();
1871  }
1872  catch( Exception& )
1873  {
1874  }
1875  OSL_ENSURE( mxNumFmts.is(), "NumberFormatFinalizer::NumberFormatFinalizer - cannot get number formats" );
1876 }
1877 
1878 sal_Int32 lclPosToken ( const OUString& sFormat, std::u16string_view sSearch, sal_Int32 nStartPos )
1879 {
1880  sal_Int32 nLength = sFormat.getLength();
1881  for ( sal_Int32 i = nStartPos; i < nLength && i >= 0 ; i++ )
1882  {
1883  switch(sFormat[i])
1884  {
1885  case '\"' : // skip text
1886  i = sFormat.indexOf('\"',i+1);
1887  break;
1888  case '[' : // skip condition
1889  i = sFormat.indexOf(']',i+1);
1890  break;
1891  default :
1892  if ( sFormat.match(sSearch, i) )
1893  return i;
1894  break;
1895  }
1896  if ( i < 0 )
1897  i--;
1898  }
1899  return -2;
1900 }
1901 
1902 } // namespace
1903 
1904 NumberFormat::NumberFormat( const WorkbookHelper& rHelper ) :
1905  WorkbookHelper( rHelper )
1906 {
1907 }
1908 
1909 void NumberFormat::setFormatCode( const OUString& rFmtCode )
1910 {
1911  // Special case for fraction code '\ ?/?', it is passed to us in xml, the '\' is not
1912  // an escape character but merely should be telling the formatter to display the next
1913  // char in the format ( afaics it does that anyhow )
1914  sal_Int32 nPosEscape = 0;
1915  sal_Int32 nErase = 0;
1916  sal_Int32 nLastIndex = rFmtCode.getLength() - 1;
1917  OUStringBuffer sFormat = rFmtCode;
1918 
1919  while ( ( nPosEscape = lclPosToken( rFmtCode, u"\\ ", nPosEscape ) ) > 0 )
1920  {
1921  sal_Int32 nPos = nPosEscape + 2;
1922  while ( nPos < nLastIndex && ( rFmtCode[nPos] == '?' || rFmtCode[nPos] == '#' || rFmtCode[nPos] == '0' ) )
1923  nPos++;
1924  if ( nPos < nLastIndex && rFmtCode[nPos] == '/' )
1925  {
1926  sFormat.remove(nPosEscape - nErase, 1);
1927  nErase ++;
1928  } // tdf#81939 preserve other escape characters
1929  nPosEscape = lclPosToken( rFmtCode, u";", nPosEscape ); // skip to next format
1930  }
1931  maModel.maFmtCode = sFormat.makeStringAndClear();
1932 }
1933 
1934 void NumberFormat::setFormatCode( const Locale& rLocale, const char* pcFmtCode )
1935 {
1936  maModel.maLocale = rLocale;
1937  maModel.maFmtCode = OStringToOUString( std::string_view( pcFmtCode ), RTL_TEXTENCODING_UTF8 );
1938  maModel.mnPredefId = -1;
1939 }
1940 
1941 void NumberFormat::setPredefinedId( const Locale& rLocale, sal_Int16 nPredefId )
1942 {
1943  maModel.maLocale = rLocale;
1944  maModel.maFmtCode.clear();
1945  maModel.mnPredefId = nPredefId;
1946 }
1947 
1948 void NumberFormat::finalizeImport( const Reference< XNumberFormats >& rxNumFmts, const Locale& rFromLocale )
1949 {
1950  if( rxNumFmts.is() && !maModel.maFmtCode.isEmpty() )
1951  maApiData.mnIndex = lclCreateFormat( rxNumFmts, maModel.maFmtCode, maModel.maLocale, rFromLocale );
1952  else
1953  maApiData.mnIndex = lclCreatePredefinedFormat( rxNumFmts, maModel.mnPredefId, maModel.maLocale );
1954 }
1955 
1956 sal_uInt32 NumberFormat::fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs ) const
1957 {
1958  const ScDocument& rDoc = getScDocument();
1959  static sal_uInt32 nDflt = rDoc.GetFormatTable()->GetStandardIndex( ScGlobal::eLnge );
1960  sal_uInt32 nScNumFmt = nDflt;
1961  if ( maApiData.mnIndex )
1962  nScNumFmt = maApiData.mnIndex;
1963 
1964  ScfTools::PutItem( rItemSet, SfxUInt32Item( ATTR_VALUE_FORMAT, nScNumFmt ), bSkipPoolDefs );
1965  if( rItemSet.GetItemState( ATTR_VALUE_FORMAT, false ) == SfxItemState::SET )
1966  ScGlobal::AddLanguage( rItemSet, *(rDoc.GetFormatTable()) );
1967  else
1968  nScNumFmt = 0;
1969 
1970  return nScNumFmt;
1971 }
1972 
1974  : WorkbookHelper(rHelper)
1975  , mnHighestId(0)
1976 {
1977  // get the current locale
1978  // try user-defined locale setting
1979  maLocaleStr = officecfg::Setup::L10N::ooSetupSystemLocale::get();
1980  // if set to "use system", get locale from system
1981  if( maLocaleStr.isEmpty() )
1982  maLocaleStr = officecfg::System::L10N::Locale::get();
1983 
1984  // create built-in formats for current locale
1986 }
1987 
1988 NumberFormatRef NumberFormatsBuffer::createNumFmt( sal_uInt32 nNumFmtId, const OUString& rFmtCode )
1989 {
1990  NumberFormatRef xNumFmt;
1991  xNumFmt = std::make_shared<NumberFormat>( *this );
1992  maNumFmts[ nNumFmtId ] = xNumFmt;
1993  if ( nNumFmtId > mnHighestId )
1994  mnHighestId = nNumFmtId;
1995  xNumFmt->setFormatCode( rFmtCode );
1996  return xNumFmt;
1997 }
1998 
2000 {
2001  sal_Int32 nNumFmtId = rAttribs.getInteger( XML_numFmtId, -1 );
2002  OUString aFmtCode = rAttribs.getXString( XML_formatCode, OUString() );
2003  return createNumFmt( nNumFmtId, aFmtCode );
2004 }
2005 
2007 {
2008  sal_Int32 nNumFmtId = rStrm.readuInt16();
2009  OUString aFmtCode = BiffHelper::readString( rStrm );
2010  createNumFmt( nNumFmtId, aFmtCode );
2011 }
2012 
2014 {
2015  maNumFmts.forEach( NumberFormatFinalizer( *this ) );
2016 }
2017 
2018 sal_uInt32 NumberFormatsBuffer::fillToItemSet( SfxItemSet& rItemSet, sal_uInt32 nNumFmtId, bool bSkipPoolDefs ) const
2019 {
2020  const NumberFormat* pNumFmt = maNumFmts.get(nNumFmtId).get();
2021  if (!pNumFmt)
2022  return 0;
2023 
2024  return pNumFmt->fillToItemSet( rItemSet, bSkipPoolDefs);
2025 }
2026 
2028 {
2029  // build a map containing pointers to all tables
2030  typedef ::std::map< OUString, const BuiltinFormatTable* > BuiltinMap;
2031  BuiltinMap aBuiltinMap;
2032  for(auto const &rTable : spBuiltinFormatTables)
2033  aBuiltinMap[ OUString::createFromAscii(rTable.mpcLocale) ] = &rTable;
2034 
2035  // convert locale string to locale struct
2037 
2038  // build a list of table pointers for the current locale, with all parent tables
2039  typedef ::std::vector< const BuiltinFormatTable* > BuiltinVec;
2040  BuiltinVec aBuiltinVec;
2041  BuiltinMap::const_iterator aMIt = aBuiltinMap.find( maLocaleStr ), aMEnd = aBuiltinMap.end();
2042  OSL_ENSURE( aMIt != aMEnd,
2043  OStringBuffer( "NumberFormatsBuffer::insertBuiltinFormats - locale '" ).
2044  append( OUStringToOString( maLocaleStr, RTL_TEXTENCODING_ASCII_US ) ).
2045  append( "' not supported (#i29949#)" ).getStr() );
2046  // start with default table, if no table has been found
2047  if( aMIt == aMEnd )
2048  aMIt = aBuiltinMap.find( "*" );
2049  OSL_ENSURE( aMIt != aMEnd, "NumberFormatsBuffer::insertBuiltinFormats - default map not found" );
2050  // insert all tables into the vector
2051  for( ; aMIt != aMEnd; aMIt = aBuiltinMap.find( OUString::createFromAscii( aMIt->second->mpcParent ) ) )
2052  aBuiltinVec.push_back( aMIt->second );
2053 
2054  // insert the default formats in the format map (in reverse order from default table to system locale)
2055  std::map< sal_uInt32, sal_uInt32 > aReuseMap;
2056  for( BuiltinVec::reverse_iterator aVIt = aBuiltinVec.rbegin(), aVEnd = aBuiltinVec.rend(); aVIt != aVEnd; ++aVIt )
2057  {
2058  // do not put the current system locale for default table
2059  Locale aLocale;
2060  if( (*aVIt)->mpcParent[ 0 ] != '\0' && OUString::createFromAscii((*aVIt)->mpcLocale) != maLocaleStr )
2061  aLocale = aSysLocale;
2062  for( const BuiltinFormat* pBuiltin = (*aVIt)->mpFormats; pBuiltin && (pBuiltin->mnNumFmtId >= 0); ++pBuiltin )
2063  {
2064  NumberFormatRef& rxNumFmt = maNumFmts[ pBuiltin->mnNumFmtId ];
2065  rxNumFmt = std::make_shared<NumberFormat>( *this );
2066 
2067  bool bReuse = false;
2068  if( pBuiltin->mpcFmtCode )
2069  rxNumFmt->setFormatCode( aLocale, pBuiltin->mpcFmtCode );
2070  else if( pBuiltin->mnPredefId >= 0 )
2071  rxNumFmt->setPredefinedId( aLocale, pBuiltin->mnPredefId );
2072  else
2073  bReuse = pBuiltin->mnReuseId >= 0;
2074 
2075  if( bReuse )
2076  aReuseMap[ pBuiltin->mnNumFmtId ] = pBuiltin->mnReuseId;
2077  else
2078  aReuseMap.erase( pBuiltin->mnNumFmtId );
2079  }
2080  }
2081 
2082  // copy reused number formats
2083  for( const auto& [rNumFmtId, rReuseId] : aReuseMap )
2084  {
2085  maNumFmts[ rNumFmtId ] = maNumFmts[ rReuseId ];
2086  if ( rNumFmtId > mnHighestId )
2087  mnHighestId = rNumFmtId;
2088  }
2089 }
2090 
2091 } // namespace oox
2092 
2093 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Helper class to provide access to global workbook data.
#define UTF8_EURO
#define NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE(INDEX, SYMBOL, SPACE, MODIF)
Defines builtin currency formats INDEX...INDEX+3 in the following format: "[opening parenthesis]...
#define UTF8_CYR_N_LC
const char * mpcParent
The locale for this table.
#define UTF8_CURR_ML_IN
#define UTF8_RUFIYAA
sal_Int32 nIndex
sal_uInt32 mnHighestId
Current office locale.
#define UTF8_CURR_GU_IN
#define UTF8_CURR_KN_IN
#define UTF8_CURR_AR_DZ
OptValue< OUString > getXString(sal_Int32 nAttrToken) const
#define UTF8_CS_YEAR
#define NUMFMT_ENDTABLE()
Terminates a built-in number format table.
sal_Int32 mnNumFmtId
#define UTF8_KO_MON
const char * mpcLocale
OptValue< sal_Int32 > getInteger(sal_Int32 nAttrToken) const
void setPredefinedId(const css::lang::Locale &rLocale, sal_Int16 nPredefId)
Sets the passed predefined format code identifier.
NumberFormatsBuffer(const WorkbookHelper &rHelper)
#define UTF8_CYR_O_LC
#define NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE(SYMBOL, SPACE)
Defines builtin currency formats 5...8 (with currency symbol), 37...40 (blind currency symbol)...
#define UTF8_BAHT
#define UTF8_YEN_CN
#define UTF8_CURR_AR_YE
#define UTF8_KO_YEAR
#define UTF8_YEN_JP
void finalizeImport(const css::uno::Reference< css::util::XNumberFormats > &rxNumFmts, const css::lang::Locale &rFromLocale)
Final processing after import of all style settings.
#define UTF8_CURR_AR_KW
#define UTF8_CURR_AR_IQ
#define UTF8_CURR_AR_SY
OUString maLocaleStr
List of number formats.
#define UTF8_CS_SEC
#define UTF8_CYR_G_LC
sal_uInt16 readuInt16()
#define UTF8_CYR_R_LC
#define UTF8_CS_MIN
#define UTF8_KO_SEC
const BuiltinFormat * mpFormats
The locale of the parent table.
#define UTF8_CJ_MON
#define UTF8_KO_HOUR
sal_uInt32 GetStandardIndex(LanguageType eLnge=LANGUAGE_DONTKNOW)
#define UTF8_CS_HOUR
#define UTF8_CURR_AR_MA
#define UTF8_CURR_AR_LB
#define UTF8_CURR_AR_SA
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
#define NUMFMT_STRING(INDEX, FORMATCODE)
Defines a literal built-in number format.
NumberFormatRef importNumFmt(const AttributeList &rAttribs)
Inserts a new number format code.
#define UTF8_CJ_SEC
#define UTF8_CS_MON
static SC_DLLPUBLIC void AddLanguage(SfxItemSet &rSet, const SvNumberFormatter &rFormatter)
Adds a language item to the item set, if the number format item contains a language that differs from...
Definition: global.cxx:952
Reference< XNumberFormats > mxNumFmts
std::shared_ptr< NumberFormat > NumberFormatRef
#define UTF8_HY_DA_LC
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Definition: documen2.cxx:438
#define UTF8_CURR_TE_IN
#define NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL(SYMBOL, BLINDS, SPACE)
Defines builtin currency formats 5...8 (with currency symbol), 37...40 (blind currency symbol)...
static void PutItem(SfxItemSet &rItemSet, const SfxPoolItem &rItem, sal_uInt16 nWhichId, bool bSkipPoolDef)
Puts the item into the passed item set.
Definition: ftools.cxx:209
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
int i
#define UTF8_CURR_BN_IN
sal_uInt32 fillToItemSet(SfxItemSet &rItemSet, bool bSkipPoolDefs=false) const
#define NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER(SYMBOL, SPACE)
Defines builtin currency formats 5...8 (with currency symbol), 37...40 (blind currency symbol)...
#define UTF8_CURR_AR_EG
#define UTF8_CJ_HOUR
sal_uInt32 fillToItemSet(SfxItemSet &rItemSet, sal_uInt32 nNumFmtId, bool bSkipPoolDefs) const
static OUString readString(SequenceInputStream &rStrm, bool b32BitLen=true)
Reads a BIFF12 string with leading 16-bit or 32-bit length field.
Definition: biffhelper.cxx:78
#define UTF8_CJ_MIN
#define NUMFMT_ALLCURRENCIES_OPEN_NUMBER_SYMBOL_CLOSE(SYMBOL, BLINDS, SPACE)
Defines builtin currency formats 5...8 (with currency symbol), 37...40 (blind currency symbol)...
#define UTF8_CYR_S_LC
sal_Int16 mnPredefId
Format string, UTF-8, may be 0 (mnPredefId is used then).
float u
#define UTF8_CURR_TA_IN
void setFormatCode(const OUString &rFmtCode)
Sets the passed format code.
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
Contains all data for a number format code.
#define NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER(INDEX, SYMBOL, SPACE, MODIF)
Defines builtin currency formats INDEX...INDEX+3 in the following format: "[minus], symbol, number".
#define UTF8_CYR_M_LC
static SC_DLLPUBLIC LanguageType eLnge
Definition: global.hxx:549
#define UTF8_CURR_AR_JO
#define UTF8_CURR_FA_IR
void insertBuiltinFormats()
Inserts built-in number formats for the current system language.
Locale maEnUsLocale
css::lang::Locale maLocale
#define NUMFMT_ALLDATETIMES(SYSTEMDATE, DAY, DAYSEP, MONTH, MONTHSEP, YEAR, HOUR12, HOUR24)
Defines builtin date and time formats 14...22.
#define UTF8_CURR_AR_TN
NumberFormatRef createNumFmt(sal_uInt32 nNumFmtId, const OUString &rFmtCode)
Inserts a new number format.
#define NUMFMT_ALLCURRENCIES_NUMBER_SYMBOL_MINUS(SYMBOL, BLINDS, SPACE)
Defines builtin currency formats 5...8 (with currency symbol), 37...40 (blind currency symbol)...
#define NUMFMT_ALLTIMES_CJK(HOUR12, HOUR24, HOUR, MINUTE, SECOND)
Defines builtin time formats 32...35 for CJK locales.
#define NUMFMT_ACCOUNTING_MINUS_SYMBOL_NUMBER(INDEX, SYMBOL, SPACE)
Defines builtin accounting formats INDEX...INDEX+3 in the following order: "[minus], symbol, number".
#define UTF8_CURR_PA_IN
mapped_type get(key_type nKey) const
const char * mpcFmtCode
Built-in number format index.
#define NUMFMT_PREDEF(INDEX, PREDEFINED)
Defines a built-in number format that maps to an own predefined format.
#define UTF8_CJ_YEAR
sal_Int32 mnReuseId
Predefined format index, if mpcFmtCode is 0.
#define UTF8_POUND_GB
#define UTF8_CYR_W_LC
#define NUMFMT_REUSE(INDEX, REUSED_INDEX)
Defines a built-in number format that is the same as the specified in nReuseId.
#define UTF8_CCARON_LC
#define UTF8_CS_DAY
#define UTF8_CURR_AR_LY
#define UTF8_LSTROKE_LC
#define UTF8_WON
#define UTF8_TUGRUG
#define UTF8_KO_DAY
#define NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS(SYMBOL, SPACE)
Defines builtin currency formats 5...8 (with currency symbol), 37...40 (blind currency symbol)...
#define NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER(SYMBOL, SPACE)
Defines builtin currency formats 5...8 (with currency symbol), 37...40 (blind currency symbol)...
#define NUMFMT_TIME_CJK(INDEX, HOURFORMAT, HOUR, MINUTE, SECOND)
Defines builtin time formats INDEX and INDEX+1 for CJK locales.
#define UTF8_CURR_AR_BH
sal_Int32 nLength
#define UTF8_COLON
#define UTF8_CYR_L_LC
int mnIndex
#define UTF8_CURR_AR_OM
#define UTF8_SHEQEL
void forEach(const FunctorType &rFunctor) const
TEXT
#define UTF8_KO_MIN
#define UTF8_HY_REH_LC
#define UTF8_CURR_HI_IN
sal_uInt16 nPos
#define UTF8_DONG
#define UTF8_CJ_DAY
#define UTF8_CURR_AR_QA
#define UTF8_CURR_AR_AE
ApiNumFmtData()
API number format index.
void finalizeImport()
Final processing after import of all style settings.
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)