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>
41 #include <svl/numformat.hxx>
44 #include <oox/token/tokens.hxx>
45 #include <scitems.hxx>
46 #include <document.hxx>
47 #include <ftools.hxx>
48 
49 namespace oox::xls {
50 
51 using namespace ::com::sun::star::lang;
52 using namespace ::com::sun::star::uno;
53 using namespace ::com::sun::star::util;
54 
55 namespace {
56 
58 struct BuiltinFormat
59 {
60  sal_Int32 mnNumFmtId;
61  const char* mpcFmtCode;
62  sal_Int16 mnPredefId;
63  sal_Int32 mnReuseId;
64 };
65 
67 #define NUMFMT_STRING( INDEX, FORMATCODE ) \
68  { INDEX, FORMATCODE, -1, -1 }
69 
71 #define NUMFMT_PREDEF( INDEX, PREDEFINED ) \
72  { INDEX, nullptr, css::i18n::NumberFormatIndex::PREDEFINED, -1 }
73 
75 #define NUMFMT_REUSE( INDEX, REUSED_INDEX ) \
76  { INDEX, nullptr, -1, REUSED_INDEX }
77 
79 #define NUMFMT_ENDTABLE() \
80  { -1, nullptr, -1, -1 }
81 
91 #define NUMFMT_ALLDATETIMES( SYSTEMDATE, DAY, DAYSEP, MONTH, MONTHSEP, YEAR, HOUR12, HOUR24 ) \
92  NUMFMT_STRING( 14, SYSTEMDATE ), \
93  NUMFMT_STRING( 15, DAY DAYSEP MONTH MONTHSEP YEAR ), \
94  NUMFMT_STRING( 16, DAY DAYSEP MONTH ), \
95  NUMFMT_STRING( 17, MONTH MONTHSEP YEAR ), \
96  NUMFMT_STRING( 18, HOUR12 ":mm AM/PM" ), \
97  NUMFMT_STRING( 19, HOUR12 ":mm:ss AM/PM" ), \
98  NUMFMT_STRING( 20, HOUR24 ":mm" ), \
99  NUMFMT_STRING( 21, HOUR24 ":mm:ss" ), \
100  NUMFMT_STRING( 22, SYSTEMDATE " " HOUR24 ":mm" )
101 
108 #define NUMFMT_TIME_CJK( INDEX, HOURFORMAT, HOUR, MINUTE, SECOND ) \
109  NUMFMT_STRING( INDEX + 0, HOURFORMAT "\"" HOUR "\"mm\"" MINUTE "\"" ), \
110  NUMFMT_STRING( INDEX + 1, HOURFORMAT "\"" HOUR "\"mm\"" MINUTE "\"ss\"" SECOND "\"" )
111 
118 #define NUMFMT_ALLTIMES_CJK( HOUR12, HOUR24, HOUR, MINUTE, SECOND ) \
119  NUMFMT_TIME_CJK( 32, HOUR24, HOUR, MINUTE, SECOND ), \
120  NUMFMT_TIME_CJK( 34, "AM/PM" HOUR12, HOUR, MINUTE, SECOND )
121 
128 #define NUMFMT_CURRENCY_SYMBOL_MINUS_NUMBER( INDEX, SYMBOL, SPACE, MODIF ) \
129  NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0;" MODIF SYMBOL SPACE "-#,##0" ), \
130  NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0;" "[RED]" MODIF SYMBOL SPACE "-#,##0" ), \
131  NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00;" MODIF SYMBOL SPACE "-#,##0.00" ), \
132  NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00;" "[RED]" MODIF SYMBOL SPACE "-#,##0.00" )
133 
139 #define NUMFMT_ACCOUNTING_SYMBOL_MINUS_NUMBER( INDEX, SYMBOL, SPACE ) \
140  NUMFMT_STRING( INDEX + 0, "_ " "* #,##0_ ;" "_ " "* -#,##0_ ;" "_ " "* \"-\"_ ;" "_ @_ " ), \
141  NUMFMT_STRING( INDEX + 1, "_ " SYMBOL SPACE "* #,##0_ ;" "_ " SYMBOL SPACE "* -#,##0_ ;" "_ " SYMBOL SPACE "* \"-\"_ ;" "_ @_ " ), \
142  NUMFMT_STRING( INDEX + 2, "_ " "* #,##0.00_ ;" "_ " "* -#,##0.00_ ;" "_ " "* \"-\"?\?_ ;" "_ @_ " ), \
143  NUMFMT_STRING( INDEX + 3, "_ " SYMBOL SPACE "* #,##0.00_ ;" "_ " SYMBOL SPACE "* -#,##0.00_ ;" "_ " SYMBOL SPACE "* \"-\"?\?_ ;" "_ @_ " )
144 
150 #define NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( SYMBOL, SPACE ) \
151  NUMFMT_CURRENCY_SYMBOL_MINUS_NUMBER( 5, SYMBOL, SPACE, "" ), \
152  NUMFMT_CURRENCY_SYMBOL_MINUS_NUMBER( 37, "", "", "" ), \
153  NUMFMT_ACCOUNTING_SYMBOL_MINUS_NUMBER( 41, SYMBOL, SPACE )
154 
161 #define NUMFMT_CURRENCY_SYMBOL_NUMBER_MINUS( INDEX, SYMBOL, SPACE, MODIF ) \
162  NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0_-;" MODIF SYMBOL SPACE "#,##0-" ), \
163  NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0_-;" "[RED]" MODIF SYMBOL SPACE "#,##0-" ), \
164  NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00_-;" MODIF SYMBOL SPACE "#,##0.00-" ), \
165  NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00_-;" "[RED]" MODIF SYMBOL SPACE "#,##0.00-" )
166 
172 #define NUMFMT_ACCOUNTING_SYMBOL_NUMBER_MINUS( INDEX, SYMBOL, SPACE ) \
173  NUMFMT_STRING( INDEX + 0, "_-" "* #,##0_-;" "_-" "* #,##0-;" "_-" "* \"-\"_-;" "_-@_-" ), \
174  NUMFMT_STRING( INDEX + 1, "_-" SYMBOL SPACE "* #,##0_-;" "_-" SYMBOL SPACE "* #,##0-;" "_-" SYMBOL SPACE "* \"-\"_-;" "_-@_-" ), \
175  NUMFMT_STRING( INDEX + 2, "_-" "* #,##0.00_-;" "_-" "* #,##0.00-;" "_-" "* \"-\"?\?_-;" "_-@_-" ), \
176  NUMFMT_STRING( INDEX + 3, "_-" SYMBOL SPACE "* #,##0.00_-;" "_-" SYMBOL SPACE "* #,##0.00-;" "_-" SYMBOL SPACE "* \"-\"?\?_-;" "_-@_-" )
177 
183 #define NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( SYMBOL, SPACE ) \
184  NUMFMT_CURRENCY_SYMBOL_NUMBER_MINUS( 5, SYMBOL, SPACE, "" ), \
185  NUMFMT_CURRENCY_SYMBOL_NUMBER_MINUS( 37, "", "", "" ), \
186  NUMFMT_ACCOUNTING_SYMBOL_NUMBER_MINUS( 41, SYMBOL, SPACE )
187 
194 #define NUMFMT_CURRENCY_NUMBER_SYMBOL_MINUS( INDEX, SYMBOL, SPACE, MODIF ) \
195  NUMFMT_STRING( INDEX + 0, MODIF "#,##0" SPACE SYMBOL "_-;" MODIF "#,##0" SPACE SYMBOL "-" ), \
196  NUMFMT_STRING( INDEX + 1, MODIF "#,##0" SPACE SYMBOL "_-;" "[RED]" MODIF "#,##0" SPACE SYMBOL "-" ), \
197  NUMFMT_STRING( INDEX + 2, MODIF "#,##0.00" SPACE SYMBOL "_-;" MODIF "#,##0.00" SPACE SYMBOL "-" ), \
198  NUMFMT_STRING( INDEX + 3, MODIF "#,##0.00" SPACE SYMBOL "_-;" "[RED]" MODIF "#,##0.00" SPACE SYMBOL "-" )
199 
206 #define NUMFMT_ACCOUNTING_NUMBER_SYMBOL_MINUS( INDEX, SYMBOL, BLINDS, SPACE ) \
207  NUMFMT_STRING( INDEX + 0, "_-* #,##0" SPACE BLINDS "_-;_-* #,##0" SPACE BLINDS "-;_-* \"-\"" SPACE BLINDS "_-;_-@_-" ), \
208  NUMFMT_STRING( INDEX + 1, "_-* #,##0" SPACE SYMBOL "_-;_-* #,##0" SPACE SYMBOL "-;_-* \"-\"" SPACE SYMBOL "_-;_-@_-" ), \
209  NUMFMT_STRING( INDEX + 2, "_-* #,##0.00" SPACE BLINDS "_-;_-* #,##0.00" SPACE BLINDS "-;_-* \"-\"?\?" SPACE BLINDS "_-;_-@_-" ), \
210  NUMFMT_STRING( INDEX + 3, "_-* #,##0.00" SPACE SYMBOL "_-;_-* #,##0.00" SPACE SYMBOL "-;_-* \"-\"?\?" SPACE SYMBOL "_-;_-@_-" )
211 
218 #define NUMFMT_ALLCURRENCIES_NUMBER_SYMBOL_MINUS( SYMBOL, BLINDS, SPACE ) \
219  NUMFMT_CURRENCY_NUMBER_SYMBOL_MINUS( 5, SYMBOL, SPACE, "" ), \
220  NUMFMT_CURRENCY_NUMBER_SYMBOL_MINUS( 37, BLINDS, SPACE, "" ), \
221  NUMFMT_ACCOUNTING_NUMBER_SYMBOL_MINUS( 41, SYMBOL, BLINDS, SPACE )
222 
229 #define NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( INDEX, SYMBOL, SPACE, MODIF ) \
230  NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0;" MODIF "-" SYMBOL SPACE "#,##0" ), \
231  NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0;" "[RED]" MODIF "-" SYMBOL SPACE "#,##0" ), \
232  NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00;" MODIF "-" SYMBOL SPACE "#,##0.00" ), \
233  NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00;" "[RED]" MODIF "-" SYMBOL SPACE "#,##0.00" )
234 
240 #define NUMFMT_ACCOUNTING_MINUS_SYMBOL_NUMBER( INDEX, SYMBOL, SPACE ) \
241  NUMFMT_STRING( INDEX + 0, "_-" "* #,##0_-;" "-" "* #,##0_-;" "_-" "* \"-\"_-;" "_-@_-" ), \
242  NUMFMT_STRING( INDEX + 1, "_-" SYMBOL SPACE "* #,##0_-;" "-" SYMBOL SPACE "* #,##0_-;" "_-" SYMBOL SPACE "* \"-\"_-;" "_-@_-" ), \
243  NUMFMT_STRING( INDEX + 2, "_-" "* #,##0.00_-;" "-" "* #,##0.00_-;" "_-" "* \"-\"?\?_-;" "_-@_-" ), \
244  NUMFMT_STRING( INDEX + 3, "_-" SYMBOL SPACE "* #,##0.00_-;" "-" SYMBOL SPACE "* #,##0.00_-;" "_-" SYMBOL SPACE "* \"-\"?\?_-;" "_-@_-" )
245 
251 #define NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( SYMBOL, SPACE ) \
252  NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( 5, SYMBOL, SPACE, "" ), \
253  NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( 37, "", "", "" ), \
254  NUMFMT_ACCOUNTING_MINUS_SYMBOL_NUMBER( 41, SYMBOL, SPACE )
255 
262 #define NUMFMT_CURRENCY_MINUS_NUMBER_SYMBOL( INDEX, SYMBOL, SPACE, MODIF ) \
263  NUMFMT_STRING( INDEX + 0, MODIF "#,##0" SPACE SYMBOL ";" MODIF "-#,##0" SPACE SYMBOL ), \
264  NUMFMT_STRING( INDEX + 1, MODIF "#,##0" SPACE SYMBOL ";" "[RED]" MODIF "-#,##0" SPACE SYMBOL ), \
265  NUMFMT_STRING( INDEX + 2, MODIF "#,##0.00" SPACE SYMBOL ";" MODIF "-#,##0.00" SPACE SYMBOL ), \
266  NUMFMT_STRING( INDEX + 3, MODIF "#,##0.00" SPACE SYMBOL ";" "[RED]" MODIF "-#,##0.00" SPACE SYMBOL )
267 
274 #define NUMFMT_ACCOUNTING_MINUS_NUMBER_SYMBOL( INDEX, SYMBOL, BLINDS, SPACE ) \
275  NUMFMT_STRING( INDEX + 0, "_-* #,##0" SPACE BLINDS "_-;-* #,##0" SPACE BLINDS "_-;_-* \"-\"" SPACE BLINDS "_-;_-@_-" ), \
276  NUMFMT_STRING( INDEX + 1, "_-* #,##0" SPACE SYMBOL "_-;-* #,##0" SPACE SYMBOL "_-;_-* \"-\"" SPACE SYMBOL "_-;_-@_-" ), \
277  NUMFMT_STRING( INDEX + 2, "_-* #,##0.00" SPACE BLINDS "_-;-* #,##0.00" SPACE BLINDS "_-;_-* \"-\"?\?" SPACE BLINDS "_-;_-@_-" ), \
278  NUMFMT_STRING( INDEX + 3, "_-* #,##0.00" SPACE SYMBOL "_-;-* #,##0.00" SPACE SYMBOL "_-;_-* \"-\"?\?" SPACE SYMBOL "_-;_-@_-" )
279 
286 #define NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( SYMBOL, BLINDS, SPACE ) \
287  NUMFMT_CURRENCY_MINUS_NUMBER_SYMBOL( 5, SYMBOL, SPACE, "" ), \
288  NUMFMT_CURRENCY_MINUS_NUMBER_SYMBOL( 37, BLINDS, SPACE, "" ), \
289  NUMFMT_ACCOUNTING_MINUS_NUMBER_SYMBOL( 41, SYMBOL, BLINDS, SPACE )
290 
297 #define NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( INDEX, SYMBOL, SPACE, MODIF ) \
298  NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0_);" MODIF "(" SYMBOL SPACE "#,##0)" ), \
299  NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0_);" "[RED]" MODIF "(" SYMBOL SPACE "#,##0)" ), \
300  NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00_);" MODIF "(" SYMBOL SPACE "#,##0.00)" ), \
301  NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00_);" "[RED]" MODIF "(" SYMBOL SPACE "#,##0.00)" )
302 
308 #define NUMFMT_ACCOUNTING_OPEN_SYMBOL_NUMBER_CLOSE( INDEX, SYMBOL, SPACE ) \
309  NUMFMT_STRING( INDEX + 0, "_(" "* #,##0_);" "_(" "* (#,##0);" "_(" "* \"-\"_);" "_(@_)" ), \
310  NUMFMT_STRING( INDEX + 1, "_(" SYMBOL SPACE "* #,##0_);" "_(" SYMBOL SPACE "* (#,##0);" "_(" SYMBOL SPACE "* \"-\"_);" "_(@_)" ), \
311  NUMFMT_STRING( INDEX + 2, "_(" "* #,##0.00_);" "_(" "* (#,##0.00);" "_(" "* \"-\"?\?_);" "_(@_)" ), \
312  NUMFMT_STRING( INDEX + 3, "_(" SYMBOL SPACE "* #,##0.00_);" "_(" SYMBOL SPACE "* (#,##0.00);" "_(" SYMBOL SPACE "* \"-\"?\?_);" "_(@_)" )
313 
319 #define NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( SYMBOL, SPACE ) \
320  NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 5, SYMBOL, SPACE, "" ), \
321  NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 37, "", "", "" ), \
322  NUMFMT_ACCOUNTING_OPEN_SYMBOL_NUMBER_CLOSE( 41, SYMBOL, SPACE )
323 
330 #define NUMFMT_CURRENCY_OPEN_NUMBER_SYMBOL_CLOSE( INDEX, SYMBOL, SPACE, MODIF ) \
331  NUMFMT_STRING( INDEX + 0, MODIF "#,##0" SPACE SYMBOL "_);" MODIF "(#,##0" SPACE SYMBOL ")" ), \
332  NUMFMT_STRING( INDEX + 1, MODIF "#,##0" SPACE SYMBOL "_);" "[RED]" MODIF "(#,##0" SPACE SYMBOL ")" ), \
333  NUMFMT_STRING( INDEX + 2, MODIF "#,##0.00" SPACE SYMBOL "_);" MODIF "(#,##0.00" SPACE SYMBOL ")" ), \
334  NUMFMT_STRING( INDEX + 3, MODIF "#,##0.00" SPACE SYMBOL "_);" "[RED]" MODIF "(#,##0.00" SPACE SYMBOL ")" )
335 
342 #define NUMFMT_ACCOUNTING_OPEN_NUMBER_SYMBOL_CLOSE( INDEX, SYMBOL, BLINDS, SPACE ) \
343  NUMFMT_STRING( INDEX + 0, "_ * #,##0_)" SPACE BLINDS "_ ;_ * (#,##0)" SPACE BLINDS "_ ;_ * \"-\"_)" SPACE BLINDS "_ ;_ @_ " ), \
344  NUMFMT_STRING( INDEX + 1, "_ * #,##0_)" SPACE SYMBOL "_ ;_ * (#,##0)" SPACE SYMBOL "_ ;_ * \"-\"_)" SPACE SYMBOL "_ ;_ @_ " ), \
345  NUMFMT_STRING( INDEX + 2, "_ * #,##0.00_)" SPACE BLINDS "_ ;_ * (#,##0.00)" SPACE BLINDS "_ ;_ * \"-\"?\?_)" SPACE BLINDS "_ ;_ @_ " ), \
346  NUMFMT_STRING( INDEX + 3, "_ * #,##0.00_)" SPACE SYMBOL "_ ;_ * (#,##0.00)" SPACE SYMBOL "_ ;_ * \"-\"?\?_)" SPACE SYMBOL "_ ;_ @_ " )
347 
354 #define NUMFMT_ALLCURRENCIES_OPEN_NUMBER_SYMBOL_CLOSE( SYMBOL, BLINDS, SPACE ) \
355  NUMFMT_CURRENCY_OPEN_NUMBER_SYMBOL_CLOSE( 5, SYMBOL, SPACE, "" ), \
356  NUMFMT_CURRENCY_OPEN_NUMBER_SYMBOL_CLOSE( 37, BLINDS, SPACE, "" ), \
357  NUMFMT_ACCOUNTING_OPEN_NUMBER_SYMBOL_CLOSE( 41, SYMBOL, BLINDS, SPACE )
358 
359 // currency unit characters
360 #define UTF8_BAHT "\340\270\277"
361 #define UTF8_COLON "\342\202\241"
362 #define UTF8_CURR_AR_AE "\330\257.\330\245."
363 #define UTF8_CURR_AR_BH "\330\257.\330\250."
364 #define UTF8_CURR_AR_DZ "\330\257.\330\254."
365 #define UTF8_CURR_AR_EG "\330\254.\331\205."
366 #define UTF8_CURR_AR_IQ "\330\257.\330\271."
367 #define UTF8_CURR_AR_JO "\330\257.\330\247."
368 #define UTF8_CURR_AR_KW "\330\257.\331\203."
369 #define UTF8_CURR_AR_LB "\331\204.\331\204."
370 #define UTF8_CURR_AR_LY "\330\257.\331\204."
371 #define UTF8_CURR_AR_MA "\330\257.\331\205."
372 #define UTF8_CURR_AR_OM "\330\261.\330\271."
373 #define UTF8_CURR_AR_QA "\330\261.\331\202."
374 #define UTF8_CURR_AR_SA "\330\261.\330\263."
375 #define UTF8_CURR_AR_SY "\331\204.\330\263."
376 #define UTF8_CURR_AR_TN "\330\257.\330\252."
377 #define UTF8_CURR_AR_YE "\330\261.\331\212."
378 #define UTF8_CURR_BN_IN "\340\246\237\340\246\276"
379 #define UTF8_CURR_FA_IR "\330\261\331\212\330\247\331\204"
380 #define UTF8_CURR_GU_IN "\340\252\260\340\253\202"
381 #define UTF8_CURR_HI_IN "\340\244\260\340\245\201"
382 #define UTF8_CURR_KN_IN "\340\262\260\340\263\202"
383 #define UTF8_CURR_ML_IN "\340\264\225"
384 #define UTF8_CURR_PA_IN "\340\250\260\340\251\201"
385 #define UTF8_CURR_TA_IN "\340\256\260\340\257\202"
386 #define UTF8_CURR_TE_IN "\340\260\260\340\261\202"
387 #define UTF8_DONG "\342\202\253"
388 #define UTF8_EURO "\342\202\254"
389 #define UTF8_POUND_GB "\302\243"
390 #define UTF8_RUFIYAA "\336\203"
391 #define UTF8_SHEQEL "\342\202\252"
392 #define UTF8_TUGRUG "\342\202\256"
393 #define UTF8_WON "\342\202\251"
394 #define UTF8_YEN_CN "\357\277\245"
395 #define UTF8_YEN_JP "\302\245"
396 
397 // Unicode characters for currency units
398 #define UTF8_CCARON_LC "\304\215"
399 #define UTF8_LSTROKE_LC "\305\202"
400 // Armenian
401 #define UTF8_HY_DA_LC "\325\244"
402 #define UTF8_HY_REH_LC "\326\200"
403 // Cyrillic
404 #define UTF8_CYR_G_LC "\320\263"
405 #define UTF8_CYR_L_LC "\320\273"
406 #define UTF8_CYR_M_LC "\320\274"
407 #define UTF8_CYR_N_LC "\320\275"
408 #define UTF8_CYR_O_LC "\320\276"
409 #define UTF8_CYR_R_LC "\321\200"
410 #define UTF8_CYR_S_LC "\321\201"
411 #define UTF8_CYR_W_LC "\320\262"
412 
413 // Japanese/Chinese date/time characters
414 #define UTF8_CJ_YEAR "\345\271\264"
415 #define UTF8_CJ_MON "\346\234\210"
416 #define UTF8_CJ_DAY "\346\227\245"
417 #define UTF8_CJ_HOUR "\346\231\202"
418 #define UTF8_CJ_MIN "\345\210\206"
419 #define UTF8_CJ_SEC "\347\247\222"
420 
421 // Chinese Simplified date/time characters
422 #define UTF8_CS_YEAR "\345\271\264"
423 #define UTF8_CS_MON "\346\234\210"
424 #define UTF8_CS_DAY "\346\227\245"
425 #define UTF8_CS_HOUR "\346\227\266"
426 #define UTF8_CS_MIN "\345\210\206"
427 #define UTF8_CS_SEC "\347\247\222"
428 
429 // Korean date/time characters
430 #define UTF8_KO_YEAR "\353\205\204"
431 #define UTF8_KO_MON "\354\233\224"
432 #define UTF8_KO_DAY "\354\235\274"
433 #define UTF8_KO_HOUR "\354\213\234"
434 #define UTF8_KO_MIN "\353\266\204"
435 #define UTF8_KO_SEC "\354\264\210"
436 
438 const BuiltinFormat spBuiltinFormats_BASE[] =
439 {
440  // 0..13 numeric and currency formats
441  NUMFMT_PREDEF( 0, NUMBER_STANDARD ), // General
442  NUMFMT_PREDEF( 1, NUMBER_INT ), // 0
443  NUMFMT_PREDEF( 2, NUMBER_DEC2 ), // 0.00
444  NUMFMT_PREDEF( 3, NUMBER_1000INT ), // #,##0
445  NUMFMT_PREDEF( 4, NUMBER_1000DEC2 ), // #,##0.00
446  NUMFMT_PREDEF( 5, CURRENCY_1000INT ), // #,##0[symbol]
447  NUMFMT_PREDEF( 6, CURRENCY_1000INT_RED ), // #,##0[symbol];[RED]-#,##0[symbol]
448  NUMFMT_PREDEF( 7, CURRENCY_1000DEC2 ), // #,##0.00[symbol]
449  NUMFMT_PREDEF( 8, CURRENCY_1000DEC2_RED ), // #,##0.00[symbol];[RED]-#,##0.00[symbol]
450  NUMFMT_PREDEF( 9, PERCENT_INT ), // 0%
451  NUMFMT_PREDEF( 10, PERCENT_DEC2 ), // 0.00%
452  NUMFMT_PREDEF( 11, SCIENTIFIC_000E00 ), // 0.00E+00
453  NUMFMT_PREDEF( 12, FRACTION_1 ), // # ?/?
454  NUMFMT_PREDEF( 13, FRACTION_2 ), // # ??/??
455 
456  // 14...22 date and time formats
457  NUMFMT_PREDEF( 14, DATE_SYS_DDMMYYYY ),
458  NUMFMT_PREDEF( 15, DATE_SYS_DMMMYY ),
459  NUMFMT_PREDEF( 16, DATE_SYS_DDMMM ),
460  NUMFMT_PREDEF( 17, DATE_SYS_MMYY ),
461  NUMFMT_PREDEF( 18, TIME_HHMMAMPM ),
462  NUMFMT_PREDEF( 19, TIME_HHMMSSAMPM ),
463  NUMFMT_PREDEF( 20, TIME_HHMM ),
464  NUMFMT_PREDEF( 21, TIME_HHMMSS ),
465  NUMFMT_PREDEF( 22, DATETIME_SYSTEM_SHORT_HHMM ),
466 
467  // 23...36 international formats
468  NUMFMT_REUSE( 23, 0 ),
469  NUMFMT_REUSE( 24, 0 ),
470  NUMFMT_REUSE( 25, 0 ),
471  NUMFMT_REUSE( 26, 0 ),
472  NUMFMT_REUSE( 27, 14 ),
473  NUMFMT_REUSE( 28, 14 ),
474  NUMFMT_REUSE( 29, 14 ),
475  NUMFMT_REUSE( 30, 14 ),
476  NUMFMT_REUSE( 31, 14 ),
477  NUMFMT_REUSE( 32, 21 ),
478  NUMFMT_REUSE( 33, 21 ),
479  NUMFMT_REUSE( 34, 21 ),
480  NUMFMT_REUSE( 35, 21 ),
481  NUMFMT_REUSE( 36, 14 ),
482 
483  // 37...44 accounting formats, defaults without currency symbol here
484  NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( 37, "", "", "" ),
486 
487  // 45...49 more special formats
488  NUMFMT_STRING( 45, "mm:ss" ),
489  NUMFMT_STRING( 46, "[h]:mm:ss" ),
490  NUMFMT_STRING( 47, "mm:ss.0" ),
491  NUMFMT_STRING( 48, "##0.0E+0" ),
492  NUMFMT_PREDEF( 49, TEXT ),
493 
494  // 50...81 international formats
495  NUMFMT_REUSE( 50, 14 ),
496  NUMFMT_REUSE( 51, 14 ),
497  NUMFMT_REUSE( 52, 14 ),
498  NUMFMT_REUSE( 53, 14 ),
499  NUMFMT_REUSE( 54, 14 ),
500  NUMFMT_REUSE( 55, 14 ),
501  NUMFMT_REUSE( 56, 14 ),
502  NUMFMT_REUSE( 57, 14 ),
503  NUMFMT_REUSE( 58, 14 ),
504  NUMFMT_REUSE( 59, 1 ),
505  NUMFMT_REUSE( 60, 2 ),
506  NUMFMT_REUSE( 61, 3 ),
507  NUMFMT_REUSE( 62, 4 ),
508  NUMFMT_REUSE( 63, 5 ),
509  NUMFMT_REUSE( 64, 6 ),
510  NUMFMT_REUSE( 65, 7 ),
511  NUMFMT_REUSE( 66, 8 ),
512  NUMFMT_REUSE( 67, 9 ),
513  NUMFMT_REUSE( 68, 10 ),
514  NUMFMT_REUSE( 69, 12 ),
515  NUMFMT_REUSE( 70, 13 ),
516  NUMFMT_REUSE( 71, 14 ),
517  NUMFMT_REUSE( 72, 14 ),
518  NUMFMT_REUSE( 73, 15 ),
519  NUMFMT_REUSE( 74, 16 ),
520  NUMFMT_REUSE( 75, 17 ),
521  NUMFMT_REUSE( 76, 20 ),
522  NUMFMT_REUSE( 77, 21 ),
523  NUMFMT_REUSE( 78, 22 ),
524  NUMFMT_REUSE( 79, 45 ),
525  NUMFMT_REUSE( 80, 46 ),
526  NUMFMT_REUSE( 81, 47 ),
527 
528  // 82...163 not used, must not occur in a file (Excel may crash)
529 
531 };
532 
534 const BuiltinFormat spBuiltinFormats_ar_AE[] =
535 {
536  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
539 };
540 
542 const BuiltinFormat spBuiltinFormats_ar_BH[] =
543 {
544  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
547 };
548 
550 const BuiltinFormat spBuiltinFormats_ar_DZ[] =
551 {
552  NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
555 };
556 
558 const BuiltinFormat spBuiltinFormats_ar_EG[] =
559 {
560  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
563 };
564 
566 const BuiltinFormat spBuiltinFormats_ar_IQ[] =
567 {
568  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
571 };
572 
574 const BuiltinFormat spBuiltinFormats_ar_JO[] =
575 {
576  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
579 };
580 
582 const BuiltinFormat spBuiltinFormats_ar_KW[] =
583 {
584  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
587 };
588 
590 const BuiltinFormat spBuiltinFormats_ar_LB[] =
591 {
592  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
595 };
596 
598 const BuiltinFormat spBuiltinFormats_ar_LY[] =
599 {
600  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
603 };
604 
606 const BuiltinFormat spBuiltinFormats_ar_MA[] =
607 {
608  NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
611 };
612 
614 const BuiltinFormat spBuiltinFormats_ar_OM[] =
615 {
616  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
619 };
620 
622 const BuiltinFormat spBuiltinFormats_ar_QA[] =
623 {
624  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
627 };
628 
630 const BuiltinFormat spBuiltinFormats_ar_SA[] =
631 {
632  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
635 };
636 
638 const BuiltinFormat spBuiltinFormats_ar_SY[] =
639 {
640  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
643 };
644 
646 const BuiltinFormat spBuiltinFormats_ar_TN[] =
647 {
648  NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
651 };
652 
654 const BuiltinFormat spBuiltinFormats_ar_YE[] =
655 {
656  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
659 };
660 
662 const BuiltinFormat spBuiltinFormats_be_BY[] =
663 {
664  // space character is group separator, literal spaces must be quoted
665  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
668 };
669 
671 const BuiltinFormat spBuiltinFormats_bg_BG[] =
672 {
673  // space character is group separator, literal spaces must be quoted
674  NUMFMT_ALLDATETIMES( "DD.M.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
675  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"" UTF8_CYR_L_LC UTF8_CYR_W_LC "\"", "_" UTF8_CYR_L_LC "_" UTF8_CYR_W_LC, "\\ " ),
677 };
678 
680 const BuiltinFormat spBuiltinFormats_bn_IN[] =
681 {
682  NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
685 };
686 
688 const BuiltinFormat spBuiltinFormats_cs_CZ[] =
689 {
690  // space character is group separator, literal spaces must be quoted
691  NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
694 };
695 
697 const BuiltinFormat spBuiltinFormats_da_DK[] =
698 {
699  NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
702 };
703 
705 const BuiltinFormat spBuiltinFormats_de_AT[] =
706 {
707  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
710 };
711 
713 const BuiltinFormat spBuiltinFormats_de_CH[] =
714 {
715  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ". ", "MMM", " ", "YY", "h", "hh" ),
716  NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"SFr.\"", " " ),
718 };
719 
721 const BuiltinFormat spBuiltinFormats_de_DE[] =
722 {
723  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ". ", "MMM", " ", "YY", "h", "hh" ),
726 };
727 
729 const BuiltinFormat spBuiltinFormats_de_LI[] =
730 {
731  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ". ", "MMM", " ", "YY", "h", "hh" ),
734 };
735 
737 const BuiltinFormat spBuiltinFormats_de_LU[] =
738 {
739  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
742 };
743 
745 const BuiltinFormat spBuiltinFormats_div_MV[] =
746 {
747  NUMFMT_ALLDATETIMES( "DD/MM/YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
750 };
751 
753 const BuiltinFormat spBuiltinFormats_el_GR[] =
754 {
755  NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
758 };
759 
761 const BuiltinFormat spBuiltinFormats_en_AU[] =
762 {
763  NUMFMT_ALLDATETIMES( "D/MM/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
766 };
767 
769 const BuiltinFormat spBuiltinFormats_en_BZ[] =
770 {
771  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
774 };
775 
777 const BuiltinFormat spBuiltinFormats_en_CA[] =
778 {
779  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
782 };
783 
785 const BuiltinFormat spBuiltinFormats_en_CB[] =
786 {
787  NUMFMT_ALLDATETIMES( "MM/DD/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
790 };
791 
793 const BuiltinFormat spBuiltinFormats_en_GB[] =
794 {
795  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
798 };
799 
801 const BuiltinFormat spBuiltinFormats_en_IE[] =
802 {
803  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
806 };
807 
809 const BuiltinFormat spBuiltinFormats_en_JM[] =
810 {
811  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
814 };
815 
817 const BuiltinFormat spBuiltinFormats_en_NZ[] =
818 {
819  NUMFMT_ALLDATETIMES( "D/MM/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
822 };
823 
825 const BuiltinFormat spBuiltinFormats_en_PH[] =
826 {
827  NUMFMT_ALLDATETIMES( "M/D/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
830 };
831 
833 const BuiltinFormat spBuiltinFormats_en_TT[] =
834 {
835  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
838 };
839 
841 const BuiltinFormat spBuiltinFormats_en_US[] =
842 {
843  NUMFMT_ALLDATETIMES( "M/D/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
846 };
847 
849 const BuiltinFormat spBuiltinFormats_en_ZA[] =
850 {
851  NUMFMT_ALLDATETIMES( "YYYY/MM/DD", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
854 };
855 
857 const BuiltinFormat spBuiltinFormats_en_ZW[] =
858 {
859  NUMFMT_ALLDATETIMES( "M/D/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
862 };
863 
865 const BuiltinFormat spBuiltinFormats_es_AR[] =
866 {
867  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
870 };
871 
873 const BuiltinFormat spBuiltinFormats_es_BO[] =
874 {
875  // slashes must be quoted to prevent conversion to minus
876  NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
879 };
880 
882 const BuiltinFormat spBuiltinFormats_es_CL[] =
883 {
884  NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
887 };
888 
890 const BuiltinFormat spBuiltinFormats_es_CO[] =
891 {
892  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
895 };
896 
898 const BuiltinFormat spBuiltinFormats_es_CR[] =
899 {
900  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
903 };
904 
906 const BuiltinFormat spBuiltinFormats_es_DO[] =
907 {
908  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
911 };
912 
914 const BuiltinFormat spBuiltinFormats_es_EC[] =
915 {
916  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
919 };
920 
922 const BuiltinFormat spBuiltinFormats_es_ES[] =
923 {
924  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
927 };
928 
930 const BuiltinFormat spBuiltinFormats_es_GT[] =
931 {
932  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
935 };
936 
938 const BuiltinFormat spBuiltinFormats_es_HN[] =
939 {
940  // slashes must be quoted to prevent conversion to minus
941  NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
944 };
945 
947 const BuiltinFormat spBuiltinFormats_es_MX[] =
948 {
949  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
952 };
953 
955 const BuiltinFormat spBuiltinFormats_es_NI[] =
956 {
957  // slashes must be quoted to prevent conversion to minus
958  NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
961 };
962 
964 const BuiltinFormat spBuiltinFormats_es_PA[] =
965 {
966  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
969 };
970 
972 const BuiltinFormat spBuiltinFormats_es_PE[] =
973 {
974  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
977 };
978 
980 const BuiltinFormat spBuiltinFormats_es_PR[] =
981 {
982  // slashes must be quoted to prevent conversion to minus
983  NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
986 };
987 
989 const BuiltinFormat spBuiltinFormats_es_PY[] =
990 {
991  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
994 };
995 
997 const BuiltinFormat spBuiltinFormats_es_SV[] =
998 {
999  // slashes must be quoted to prevent conversion to minus
1000  NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
1002  NUMFMT_ENDTABLE()
1003 };
1004 
1006 const BuiltinFormat spBuiltinFormats_es_UY[] =
1007 {
1008  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
1010  NUMFMT_ENDTABLE()
1011 };
1012 
1014 const BuiltinFormat spBuiltinFormats_es_VE[] =
1015 {
1016  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
1018  NUMFMT_ENDTABLE()
1019 };
1020 
1022 const BuiltinFormat spBuiltinFormats_et_EE[] =
1023 {
1024  // space character is group separator, literal spaces must be quoted
1025  NUMFMT_ALLDATETIMES( "D.MM.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1026  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"kr\"", "_k_r", "\\ " ),
1027  NUMFMT_ENDTABLE()
1028 };
1029 
1031 const BuiltinFormat spBuiltinFormats_fa_IR[] =
1032 {
1033  NUMFMT_ALLDATETIMES( "YYYY/MM/DD", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
1035  NUMFMT_ENDTABLE()
1036 };
1037 
1039 const BuiltinFormat spBuiltinFormats_fi_FI[] =
1040 {
1041  // space character is group separator, literal spaces must be quoted
1042  NUMFMT_STRING( 9, "0\\ %" ),
1043  NUMFMT_STRING( 10, "0.00\\ %" ),
1044  NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1046  NUMFMT_ENDTABLE()
1047 };
1048 
1050 const BuiltinFormat spBuiltinFormats_fo_FO[] =
1051 {
1052  NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1054  NUMFMT_ENDTABLE()
1055 };
1056 
1058 const BuiltinFormat spBuiltinFormats_fr_BE[] =
1059 {
1060  NUMFMT_ALLDATETIMES( "D/MM/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1062  NUMFMT_ENDTABLE()
1063 };
1064 
1066 const BuiltinFormat spBuiltinFormats_fr_CA[] =
1067 {
1068  // space character is group separator, literal spaces must be quoted
1069  NUMFMT_ALLDATETIMES( "YYYY-MM-DD", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1071  NUMFMT_ENDTABLE()
1072 };
1073 
1075 const BuiltinFormat spBuiltinFormats_fr_CH[] =
1076 {
1077  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1078  NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"SFr.\"", " " ),
1079  NUMFMT_ENDTABLE()
1080 };
1081 
1083 const BuiltinFormat spBuiltinFormats_fr_FR[] =
1084 {
1085  // space character is group separator, literal spaces must be quoted
1086  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1088  NUMFMT_ENDTABLE()
1089 };
1090 
1092 const BuiltinFormat spBuiltinFormats_fr_LU[] =
1093 {
1094  // space character is group separator, literal spaces must be quoted
1095  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1097  NUMFMT_ENDTABLE()
1098 };
1099 
1101 const BuiltinFormat spBuiltinFormats_fr_MC[] =
1102 {
1103  // space character is group separator, literal spaces must be quoted
1104  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1106  NUMFMT_ENDTABLE()
1107 };
1108 
1110 const BuiltinFormat spBuiltinFormats_gl_ES[] =
1111 {
1112  NUMFMT_ALLDATETIMES( "DD/MM/YY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1114  NUMFMT_ENDTABLE()
1115 };
1116 
1118 const BuiltinFormat spBuiltinFormats_gu_IN[] =
1119 {
1120  NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1122  NUMFMT_ENDTABLE()
1123 };
1124 
1126 const BuiltinFormat spBuiltinFormats_he_IL[] =
1127 {
1128  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1130  NUMFMT_ENDTABLE()
1131 };
1132 
1134 const BuiltinFormat spBuiltinFormats_hi_IN[] =
1135 {
1136  NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1138  NUMFMT_ENDTABLE()
1139 };
1140 
1142 const BuiltinFormat spBuiltinFormats_hr_BA[] =
1143 {
1144  NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1145  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"KM\"", "_K_M", " " ),
1146  NUMFMT_ENDTABLE()
1147 };
1148 
1150 const BuiltinFormat spBuiltinFormats_hr_HR[] =
1151 {
1152  NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1153  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"kn\"", "_k_n", " " ),
1154  NUMFMT_ENDTABLE()
1155 };
1156 
1158 const BuiltinFormat spBuiltinFormats_hu_HU[] =
1159 {
1160  // space character is group separator, literal spaces must be quoted
1161  // MMM is rendered differently in Calc and Excel (see #i41488#)
1162  NUMFMT_ALLDATETIMES( "YYYY.MM.DD", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1163  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"Ft\"", "_F_t", "\\ " ),
1164  NUMFMT_ENDTABLE()
1165 };
1166 
1168 const BuiltinFormat spBuiltinFormats_hy_AM[] =
1169 {
1170  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1171  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"" UTF8_HY_DA_LC UTF8_HY_REH_LC ".\"", "_" UTF8_HY_DA_LC "_" UTF8_HY_REH_LC "_.", " " ),
1172  NUMFMT_ENDTABLE()
1173 };
1174 
1176 const BuiltinFormat spBuiltinFormats_id_ID[] =
1177 {
1178  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1180  NUMFMT_ENDTABLE()
1181 };
1182 
1184 const BuiltinFormat spBuiltinFormats_is_IS[] =
1185 {
1186  NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "hh" ),
1187  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"kr.\"", "_k_r_.", " " ),
1188  NUMFMT_ENDTABLE()
1189 };
1190 
1192 const BuiltinFormat spBuiltinFormats_it_CH[] =
1193 {
1194  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1195  NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"SFr.\"", " " ),
1196  NUMFMT_ENDTABLE()
1197 };
1198 
1200 const BuiltinFormat spBuiltinFormats_it_IT[] =
1201 {
1202  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1204  NUMFMT_ENDTABLE()
1205 };
1206 
1208 const BuiltinFormat spBuiltinFormats_ka_GE[] =
1209 {
1210  // space character is group separator, literal spaces must be quoted
1211  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1212  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"Lari\"", "_L_a_r_i", "\\ " ),
1213  NUMFMT_ENDTABLE()
1214 };
1215 
1217 const BuiltinFormat spBuiltinFormats_kk_KZ[] =
1218 {
1219  // space character is group separator, literal spaces must be quoted
1220  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1222  NUMFMT_ENDTABLE()
1223 };
1224 
1226 const BuiltinFormat spBuiltinFormats_kn_IN[] =
1227 {
1228  NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1230  NUMFMT_ENDTABLE()
1231 };
1232 
1234 const BuiltinFormat spBuiltinFormats_ky_KG[] =
1235 {
1236  // space character is group separator, literal spaces must be quoted
1237  NUMFMT_ALLDATETIMES( "DD.MM.YY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1239  NUMFMT_ENDTABLE()
1240 };
1241 
1243 const BuiltinFormat spBuiltinFormats_lt_LT[] =
1244 {
1245  NUMFMT_ALLDATETIMES( "YYYY.MM.DD", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1246  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"Lt\"", "_L_t", " " ),
1247  NUMFMT_ENDTABLE()
1248 };
1249 
1251 const BuiltinFormat spBuiltinFormats_lv_LV[] =
1252 {
1253  // space character is group separator, literal spaces must be quoted
1254  NUMFMT_ALLDATETIMES( "YYYY.MM.DD", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1255  NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "\"Ls\"", "\\ " ),
1256  NUMFMT_ENDTABLE()
1257 };
1258 
1260 const BuiltinFormat spBuiltinFormats_ml_IN[] =
1261 {
1262  NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1264  NUMFMT_ENDTABLE()
1265 };
1266 
1268 const BuiltinFormat spBuiltinFormats_mn_MN[] =
1269 {
1270  NUMFMT_ALLDATETIMES( "YY.MM.DD", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1272  NUMFMT_ENDTABLE()
1273 };
1274 
1276 const BuiltinFormat spBuiltinFormats_ms_BN[] =
1277 {
1278  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1280  NUMFMT_ENDTABLE()
1281 };
1282 
1284 const BuiltinFormat spBuiltinFormats_ms_MY[] =
1285 {
1286  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1288  NUMFMT_ENDTABLE()
1289 };
1290 
1292 const BuiltinFormat spBuiltinFormats_mt_MT[] =
1293 {
1294  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1296  NUMFMT_ENDTABLE()
1297 };
1298 
1300 const BuiltinFormat spBuiltinFormats_nl_BE[] =
1301 {
1302  // slashes must be quoted to prevent conversion to minus
1303  NUMFMT_ALLDATETIMES( "D\\/MM\\/YYYY", "D", "\\/", "MMM", "\\/", "YY", "h", "h" ),
1305  NUMFMT_ENDTABLE()
1306 };
1307 
1309 const BuiltinFormat spBuiltinFormats_nl_NL[] =
1310 {
1311  NUMFMT_ALLDATETIMES( "D-M-YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1313  NUMFMT_ENDTABLE()
1314 };
1315 
1317 const BuiltinFormat spBuiltinFormats_no_NO[] =
1318 {
1319  // space character is group separator, literal spaces must be quoted
1320  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1321  NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"kr\"", "\\ " ),
1322  NUMFMT_ENDTABLE()
1323 };
1324 
1326 const BuiltinFormat spBuiltinFormats_pa_IN[] =
1327 {
1328  NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
1330  NUMFMT_ENDTABLE()
1331 };
1332 
1334 const BuiltinFormat spBuiltinFormats_pl_PL[] =
1335 {
1336  // space character is group separator, literal spaces must be quoted
1337  // MMM is rendered differently in Calc and Excel (see #i72300#)
1338  NUMFMT_ALLDATETIMES( "YYYY-MM-DD", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1340  NUMFMT_ENDTABLE()
1341 };
1342 
1344 const BuiltinFormat spBuiltinFormats_pt_BR[] =
1345 {
1346  NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "/", "MMM", "/", "YY", "h", "hh" ),
1348  NUMFMT_ENDTABLE()
1349 };
1350 
1352 const BuiltinFormat spBuiltinFormats_pt_PT[] =
1353 {
1354  NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1356  NUMFMT_ENDTABLE()
1357 };
1358 
1360 const BuiltinFormat spBuiltinFormats_ro_RO[] =
1361 {
1362  // space character is group separator, literal spaces must be quoted (but see #i75367#)
1363  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1364  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"lei\"", "_l_e_i", "\\ " ),
1365  NUMFMT_ENDTABLE()
1366 };
1367 
1369 const BuiltinFormat spBuiltinFormats_ru_RU[] =
1370 {
1371  // space character is group separator, literal spaces must be quoted
1372  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1374  NUMFMT_ENDTABLE()
1375 };
1376 
1378 const BuiltinFormat spBuiltinFormats_sk_SK[] =
1379 {
1380  // space character is group separator, literal spaces must be quoted
1381  NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1382  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"Sk\"", "_S_k", "\\ " ),
1383  NUMFMT_ENDTABLE()
1384 };
1385 
1387 const BuiltinFormat spBuiltinFormats_sl_SI[] =
1388 {
1389  NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1390  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"SIT\"", "_S_I_T", " " ),
1391  NUMFMT_ENDTABLE()
1392 };
1393 
1395 const BuiltinFormat spBuiltinFormats_sv_FI[] =
1396 {
1397  // space character is group separator, literal spaces must be quoted
1398  NUMFMT_STRING( 9, "0\\ %" ),
1399  NUMFMT_STRING( 10, "0.00\\ %" ),
1400  NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "hh" ),
1402  NUMFMT_ENDTABLE()
1403 };
1404 
1406 const BuiltinFormat spBuiltinFormats_sv_SE[] =
1407 {
1408  // space character is group separator, literal spaces must be quoted
1409  NUMFMT_ALLDATETIMES( "YYYY-MM-DD", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1410  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"kr\"", "_k_r", "\\ " ),
1411  NUMFMT_ENDTABLE()
1412 };
1413 
1415 const BuiltinFormat spBuiltinFormats_sw_TZ[] =
1416 {
1417  NUMFMT_ALLDATETIMES( "M/D/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1419  NUMFMT_ENDTABLE()
1420 };
1421 
1423 const BuiltinFormat spBuiltinFormats_ta_IN[] =
1424 {
1425  NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1427  NUMFMT_ENDTABLE()
1428 };
1429 
1431 const BuiltinFormat spBuiltinFormats_te_IN[] =
1432 {
1433  NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1435  NUMFMT_ENDTABLE()
1436 };
1437 
1439 const BuiltinFormat spBuiltinFormats_th_TH[] =
1440 {
1441  NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1444  NUMFMT_STRING( 59, "t0" ),
1445  NUMFMT_STRING( 60, "t0.00" ),
1446  NUMFMT_STRING( 61, "t#,##0" ),
1447  NUMFMT_STRING( 62, "t#,##0.00" ),
1448  NUMFMT_STRING( 67, "t0%" ),
1449  NUMFMT_STRING( 68, "t0.00%" ),
1450  NUMFMT_STRING( 69, "t# ?/?" ),
1451  NUMFMT_STRING( 70, "t# ?\?/?\?" ),
1452  NUMFMT_STRING( 71, "tD/M/EE" ),
1453  NUMFMT_STRING( 72, "tD-MMM-E" ),
1454  NUMFMT_STRING( 73, "tD-MMM" ),
1455  NUMFMT_STRING( 74, "tMMM-E" ),
1456  NUMFMT_STRING( 75, "th:mm" ),
1457  NUMFMT_STRING( 76, "th:mm:ss" ),
1458  NUMFMT_STRING( 77, "tD/M/EE h:mm" ),
1459  NUMFMT_STRING( 78, "tmm:ss" ),
1460  NUMFMT_STRING( 79, "t[h]:mm:ss" ),
1461  NUMFMT_STRING( 80, "tmm:ss.0" ),
1462  NUMFMT_STRING( 81, "D/M/E" ),
1463  NUMFMT_ENDTABLE()
1464 };
1465 
1467 const BuiltinFormat spBuiltinFormats_tr_TR[] =
1468 {
1469  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1470  NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"TL\"", "_T_L", " " ),
1471  NUMFMT_ENDTABLE()
1472 };
1473 
1475 const BuiltinFormat spBuiltinFormats_tt_RU[] =
1476 {
1477  // space character is group separator, literal spaces must be quoted
1478  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1480  NUMFMT_ENDTABLE()
1481 };
1482 
1484 const BuiltinFormat spBuiltinFormats_uk_UA[] =
1485 {
1486  // space character is group separator, literal spaces must be quoted
1487  NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1489  NUMFMT_ENDTABLE()
1490 };
1491 
1493 const BuiltinFormat spBuiltinFormats_ur_PK[] =
1494 {
1495  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1497  NUMFMT_ENDTABLE()
1498 };
1499 
1501 const BuiltinFormat spBuiltinFormats_vi_VN[] =
1502 {
1503  NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1505  NUMFMT_ENDTABLE()
1506 };
1507 
1508 // CJK ------------------------------------------------------------------------
1509 
1511 const BuiltinFormat spBuiltinFormats_CJK[] =
1512 {
1513  NUMFMT_REUSE( 29, 28 ),
1514  NUMFMT_REUSE( 36, 27 ),
1515  NUMFMT_REUSE( 50, 27 ),
1516  NUMFMT_REUSE( 51, 28 ),
1517  NUMFMT_REUSE( 52, 34 ),
1518  NUMFMT_REUSE( 53, 35 ),
1519  NUMFMT_REUSE( 54, 28 ),
1520  NUMFMT_REUSE( 55, 34 ),
1521  NUMFMT_REUSE( 56, 35 ),
1522  NUMFMT_REUSE( 57, 27 ),
1523  NUMFMT_REUSE( 58, 28 ),
1524  NUMFMT_ENDTABLE()
1525 };
1526 
1528 const BuiltinFormat spBuiltinFormats_ja_JP[] =
1529 {
1530  NUMFMT_ALLDATETIMES( "YYYY/MM/DD", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1532  NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "$", "", "" ),
1533  NUMFMT_STRING( 27, "[$-411]GE.MM.DD" ),
1534  NUMFMT_STRING( 28, "[$-411]GGGE\"" UTF8_CJ_YEAR "\"MM\"" UTF8_CJ_MON "\"DD\"" UTF8_CJ_DAY "\"" ),
1535  NUMFMT_STRING( 30, "MM/DD/YY" ),
1536  NUMFMT_STRING( 31, "YYYY\"" UTF8_CJ_YEAR "\"MM\"" UTF8_CJ_MON "\"DD\"" UTF8_CJ_DAY "\"" ),
1538  NUMFMT_STRING( 34, "YYYY\"" UTF8_CJ_YEAR "\"MM\"" UTF8_CJ_MON "\"" ),
1539  NUMFMT_STRING( 35, "MM\"" UTF8_CJ_MON "\"DD\"" UTF8_CJ_DAY "\"" ),
1540  NUMFMT_ENDTABLE()
1541 };
1542 
1544 const BuiltinFormat spBuiltinFormats_ko_KR[] =
1545 {
1546  NUMFMT_ALLDATETIMES( "YYYY-MM-DD", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1548  NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "$", "", "" ),
1549  NUMFMT_STRING( 27, "YYYY" UTF8_CJ_YEAR " MM" UTF8_CJ_MON " DD" UTF8_CJ_DAY ),
1550  NUMFMT_STRING( 28, "MM-DD" ),
1551  NUMFMT_STRING( 30, "MM-DD-YY" ),
1552  NUMFMT_STRING( 31, "YYYY" UTF8_KO_YEAR " MM" UTF8_KO_MON " DD" UTF8_KO_DAY ),
1554  // slashes must be quoted to prevent conversion to minus
1555  NUMFMT_STRING( 34, "YYYY\\/MM\\/DD" ),
1556  NUMFMT_REUSE( 35, 14 ),
1557  NUMFMT_ENDTABLE()
1558 };
1559 
1561 const BuiltinFormat spBuiltinFormats_zh_CN[] =
1562 {
1563  NUMFMT_ALLDATETIMES( "YYYY-M-D", "D", "-", "MMM", "-", "YY", "h", "h" ),
1566  NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "$", "", "" ),
1567  NUMFMT_STRING( 27, "YYYY\"" UTF8_CS_YEAR "\"M\"" UTF8_CS_MON "\"" ),
1568  NUMFMT_STRING( 28, "M\"" UTF8_CS_MON "\"D\"" UTF8_CS_DAY "\"" ),
1569  NUMFMT_STRING( 30, "M-D-YY" ),
1570  NUMFMT_STRING( 31, "YYYY\"" UTF8_CS_YEAR "\"M\"" UTF8_CS_MON "\"D\"" UTF8_CS_DAY "\"" ),
1571  NUMFMT_REUSE( 52, 27 ),
1572  NUMFMT_REUSE( 53, 28 ),
1573  NUMFMT_ENDTABLE()
1574 };
1575 
1577 const BuiltinFormat spBuiltinFormats_zh_HK[] =
1578 {
1579  NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1582  NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "\"US$\"", "", "" ),
1583  NUMFMT_STRING( 27, "[$-404]D/M/E" ),
1584  NUMFMT_STRING( 28, "[$-404]D\"" UTF8_CJ_DAY "\"M\"" UTF8_CJ_MON "\"E\"" UTF8_CJ_YEAR "\"" ),
1585  NUMFMT_STRING( 30, "M/D/YY" ),
1586  NUMFMT_STRING( 31, "D\"" UTF8_CJ_DAY "\"M\"" UTF8_CJ_MON "\"YYYY\"" UTF8_CJ_YEAR "\"" ),
1587  NUMFMT_ENDTABLE()
1588 };
1589 
1591 const BuiltinFormat spBuiltinFormats_zh_MO[] =
1592 {
1593  NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1596  NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "\"US$\"", "", "" ),
1597  NUMFMT_STRING( 27, "[$-404]D/M/E" ),
1598  NUMFMT_STRING( 28, "[$-404]D\"" UTF8_CJ_DAY "\"M\"" UTF8_CJ_MON "\"E\"" UTF8_CJ_YEAR "\"" ),
1599  NUMFMT_STRING( 30, "M/D/YY" ),
1600  NUMFMT_STRING( 31, "D\"" UTF8_CJ_DAY "\"M\"" UTF8_CJ_MON "\"YYYY\"" UTF8_CJ_YEAR "\"" ),
1601  NUMFMT_ENDTABLE()
1602 };
1603 
1605 const BuiltinFormat spBuiltinFormats_zh_SG[] =
1606 {
1607  NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1610  NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "$", "", "" ),
1611  NUMFMT_STRING( 27, "YYYY\"" UTF8_CS_YEAR "\"M\"" UTF8_CS_MON "\"" ),
1612  NUMFMT_STRING( 28, "M\"" UTF8_CS_MON "\"D\"" UTF8_CS_DAY "\"" ),
1613  NUMFMT_STRING( 30, "M/D/YY" ),
1614  NUMFMT_STRING( 31, "D\"" UTF8_CS_DAY "\"M\"" UTF8_CS_MON "\"YYYY\"" UTF8_CS_YEAR "\"" ),
1615  NUMFMT_ENDTABLE()
1616 };
1617 
1619 const BuiltinFormat spBuiltinFormats_zh_TW[] =
1620 {
1621  NUMFMT_ALLDATETIMES( "YYYY/M/D", "D", "-", "MMM", "-", "YY", "hh", "hh" ),
1624  NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "\"US$\"", "", "" ),
1625  NUMFMT_STRING( 27, "[$-404]E/M/D" ),
1626  NUMFMT_STRING( 28, "[$-404]E\"" UTF8_CJ_YEAR "\"M\"" UTF8_CJ_MON "\"D\"" UTF8_CJ_DAY "\"" ),
1627  NUMFMT_STRING( 30, "M/D/YY" ),
1628  NUMFMT_STRING( 31, "YYYY\"" UTF8_CJ_YEAR "\"M\"" UTF8_CJ_MON "\"D\"" UTF8_CJ_DAY "\"" ),
1629  NUMFMT_ENDTABLE()
1630 };
1631 
1633 struct BuiltinFormatTable
1634 {
1635  const char* mpcLocale;
1636  const char* mpcParent;
1637  const BuiltinFormat* mpFormats;
1638 };
1639 
1640 const BuiltinFormatTable spBuiltinFormatTables[] =
1641 { // locale parent format table
1642  { "*", "", spBuiltinFormats_BASE }, // Base table
1643  { "af-ZA", "*", spBuiltinFormats_en_ZA }, // Afrikaans, South Africa
1644  { "ar-AE", "*", spBuiltinFormats_ar_AE }, // Arabic, U.A.E.
1645  { "ar-BH", "*", spBuiltinFormats_ar_BH }, // Arabic, Bahrain
1646  { "ar-DZ", "*", spBuiltinFormats_ar_DZ }, // Arabic, Algeria
1647  { "ar-EG", "*", spBuiltinFormats_ar_EG }, // Arabic, Egypt
1648  { "ar-IQ", "*", spBuiltinFormats_ar_IQ }, // Arabic, Iraq
1649  { "ar-JO", "*", spBuiltinFormats_ar_JO }, // Arabic, Jordan
1650  { "ar-KW", "*", spBuiltinFormats_ar_KW }, // Arabic, Kuwait
1651  { "ar-LB", "*", spBuiltinFormats_ar_LB }, // Arabic, Lebanon
1652  { "ar-LY", "*", spBuiltinFormats_ar_LY }, // Arabic, Libya
1653  { "ar-MA", "*", spBuiltinFormats_ar_MA }, // Arabic, Morocco
1654  { "ar-OM", "*", spBuiltinFormats_ar_OM }, // Arabic, Oman
1655  { "ar-QA", "*", spBuiltinFormats_ar_QA }, // Arabic, Qatar
1656  { "ar-SA", "*", spBuiltinFormats_ar_SA }, // Arabic, Saudi Arabia
1657  { "ar-SY", "*", spBuiltinFormats_ar_SY }, // Arabic, Syria
1658  { "ar-TN", "*", spBuiltinFormats_ar_TN }, // Arabic, Tunisia
1659  { "ar-YE", "*", spBuiltinFormats_ar_YE }, // Arabic, Yemen
1660  { "be-BY", "*", spBuiltinFormats_be_BY }, // Belarusian, Belarus
1661  { "bg-BG", "*", spBuiltinFormats_bg_BG }, // Bulgarian, Bulgaria
1662  { "bn-IN", "*", spBuiltinFormats_bn_IN }, // Bengali, India
1663  { "ca-ES", "*", spBuiltinFormats_es_ES }, // Catalan, Spain
1664  { "cs-CZ", "*", spBuiltinFormats_cs_CZ }, // Czech, Czech Republic
1665  { "cy-GB", "*", spBuiltinFormats_en_GB }, // Welsh, United Kingdom
1666  { "da-DK", "*", spBuiltinFormats_da_DK }, // Danish, Denmark
1667  { "de-AT", "*", spBuiltinFormats_de_AT }, // German, Austria
1668  { "de-CH", "*", spBuiltinFormats_de_CH }, // German, Switzerland
1669  { "de-DE", "*", spBuiltinFormats_de_DE }, // German, Germany
1670  { "de-LI", "*", spBuiltinFormats_de_LI }, // German, Liechtenstein
1671  { "de-LU", "*", spBuiltinFormats_de_LU }, // German, Luxembourg
1672  { "div-MV", "*", spBuiltinFormats_div_MV }, // Divehi, Maldives
1673  { "el-GR", "*", spBuiltinFormats_el_GR }, // Greek, Greece
1674  { "en-AU", "*", spBuiltinFormats_en_AU }, // English, Australia
1675  { "en-BZ", "*", spBuiltinFormats_en_BZ }, // English, Belize
1676  { "en-CA", "*", spBuiltinFormats_en_CA }, // English, Canada
1677  { "en-CB", "*", spBuiltinFormats_en_CB }, // English, Caribbean
1678  { "en-GB", "*", spBuiltinFormats_en_GB }, // English, United Kingdom
1679  { "en-IE", "*", spBuiltinFormats_en_IE }, // English, Ireland
1680  { "en-JM", "*", spBuiltinFormats_en_JM }, // English, Jamaica
1681  { "en-NZ", "*", spBuiltinFormats_en_NZ }, // English, New Zealand
1682  { "en-PH", "*", spBuiltinFormats_en_PH }, // English, Philippines
1683  { "en-TT", "*", spBuiltinFormats_en_TT }, // English, Trinidad and Tobago
1684  { "en-US", "*", spBuiltinFormats_en_US }, // English, USA
1685  { "en-ZA", "*", spBuiltinFormats_en_ZA }, // English, South Africa
1686  { "en-ZW", "*", spBuiltinFormats_en_ZW }, // English, Zimbabwe
1687  { "es-AR", "*", spBuiltinFormats_es_AR }, // Spanish, Argentina
1688  { "es-BO", "*", spBuiltinFormats_es_BO }, // Spanish, Bolivia
1689  { "es-CL", "*", spBuiltinFormats_es_CL }, // Spanish, Chile
1690  { "es-CO", "*", spBuiltinFormats_es_CO }, // Spanish, Colombia
1691  { "es-CR", "*", spBuiltinFormats_es_CR }, // Spanish, Costa Rica
1692  { "es-DO", "*", spBuiltinFormats_es_DO }, // Spanish, Dominican Republic
1693  { "es-EC", "*", spBuiltinFormats_es_EC }, // Spanish, Ecuador
1694  { "es-ES", "*", spBuiltinFormats_es_ES }, // Spanish, Spain
1695  { "es-GT", "*", spBuiltinFormats_es_GT }, // Spanish, Guatemala
1696  { "es-HN", "*", spBuiltinFormats_es_HN }, // Spanish, Honduras
1697  { "es-MX", "*", spBuiltinFormats_es_MX }, // Spanish, Mexico
1698  { "es-NI", "*", spBuiltinFormats_es_NI }, // Spanish, Nicaragua
1699  { "es-PA", "*", spBuiltinFormats_es_PA }, // Spanish, Panama
1700  { "es-PE", "*", spBuiltinFormats_es_PE }, // Spanish, Peru
1701  { "es-PR", "*", spBuiltinFormats_es_PR }, // Spanish, Puerto Rico
1702  { "es-PY", "*", spBuiltinFormats_es_PY }, // Spanish, Paraguay
1703  { "es-SV", "*", spBuiltinFormats_es_SV }, // Spanish, El Salvador
1704  { "es-UY", "*", spBuiltinFormats_es_UY }, // Spanish, Uruguay
1705  { "es-VE", "*", spBuiltinFormats_es_VE }, // Spanish, Venezuela
1706  { "et-EE", "*", spBuiltinFormats_et_EE }, // Estonian, Estonia
1707  { "fa-IR", "*", spBuiltinFormats_fa_IR }, // Farsi, Iran
1708  { "fi-FI", "*", spBuiltinFormats_fi_FI }, // Finnish, Finland
1709  { "fo-FO", "*", spBuiltinFormats_fo_FO }, // Faroese, Faroe Islands
1710  { "fr-BE", "*", spBuiltinFormats_fr_BE }, // French, Belgium
1711  { "fr-CA", "*", spBuiltinFormats_fr_CA }, // French, Canada
1712  { "fr-CH", "*", spBuiltinFormats_fr_CH }, // French, Switzerland
1713  { "fr-FR", "*", spBuiltinFormats_fr_FR }, // French, France
1714  { "fr-LU", "*", spBuiltinFormats_fr_LU }, // French, Luxembourg
1715  { "fr-MC", "*", spBuiltinFormats_fr_MC }, // French, Monaco
1716  { "gl-ES", "*", spBuiltinFormats_gl_ES }, // Galizian, Spain
1717  { "gu-IN", "*", spBuiltinFormats_gu_IN }, // Gujarati, India
1718  { "he-IL", "*", spBuiltinFormats_he_IL }, // Hebrew, Israel
1719  { "hi-IN", "*", spBuiltinFormats_hi_IN }, // Hindi, India
1720  { "hr-BA", "*", spBuiltinFormats_hr_BA }, // Croatian, Bosnia and Herzegowina
1721  { "hr-HR", "*", spBuiltinFormats_hr_HR }, // Croatian, Croatia
1722  { "hu-HU", "*", spBuiltinFormats_hu_HU }, // Hungarian, Hungary
1723  { "hy-AM", "*", spBuiltinFormats_hy_AM }, // Armenian, Armenia
1724  { "id-ID", "*", spBuiltinFormats_id_ID }, // Indonesian, Indonesia
1725  { "is-IS", "*", spBuiltinFormats_is_IS }, // Icelandic, Iceland
1726  { "it-CH", "*", spBuiltinFormats_it_CH }, // Italian, Switzerland
1727  { "it-IT", "*", spBuiltinFormats_it_IT }, // Italian, Italy
1728  { "ka-GE", "*", spBuiltinFormats_ka_GE }, // Georgian, Georgia
1729  { "kk-KZ", "*", spBuiltinFormats_kk_KZ }, // Kazakh, Kazakhstan
1730  { "kn-IN", "*", spBuiltinFormats_kn_IN }, // Kannada, India
1731  { "kok-IN", "*", spBuiltinFormats_hi_IN }, // Konkani, India
1732  { "ky-KG", "*", spBuiltinFormats_ky_KG }, // Kyrgyz, Kyrgyzstan
1733  { "lt-LT", "*", spBuiltinFormats_lt_LT }, // Lithuanian, Lithuania
1734  { "lv-LV", "*", spBuiltinFormats_lv_LV }, // Latvian, Latvia
1735  { "mi-NZ", "*", spBuiltinFormats_en_NZ }, // Maori, New Zealand
1736  { "ml-IN", "*", spBuiltinFormats_ml_IN }, // Malayalam, India
1737  { "mn-MN", "*", spBuiltinFormats_mn_MN }, // Mongolian, Mongolia
1738  { "mr-IN", "*", spBuiltinFormats_hi_IN }, // Marathi, India
1739  { "ms-BN", "*", spBuiltinFormats_ms_BN }, // Malay, Brunei Darussalam
1740  { "ms-MY", "*", spBuiltinFormats_ms_MY }, // Malay, Malaysia
1741  { "mt-MT", "*", spBuiltinFormats_mt_MT }, // Maltese, Malta
1742  { "nb-NO", "*", spBuiltinFormats_no_NO }, // Norwegian Bokmal, Norway
1743  { "nl-BE", "*", spBuiltinFormats_nl_BE }, // Dutch, Belgium
1744  { "nl-NL", "*", spBuiltinFormats_nl_NL }, // Dutch, Netherlands
1745  { "nn-NO", "*", spBuiltinFormats_no_NO }, // Norwegian Nynorsk, Norway
1746  { "nso-ZA", "*", spBuiltinFormats_en_ZA }, // Northern Sotho, South Africa
1747  { "pa-IN", "*", spBuiltinFormats_pa_IN }, // Punjabi, India
1748  { "pl-PL", "*", spBuiltinFormats_pl_PL }, // Polish, Poland
1749  { "pt-BR", "*", spBuiltinFormats_pt_BR }, // Portuguese, Brazil
1750  { "pt-PT", "*", spBuiltinFormats_pt_PT }, // Portuguese, Portugal
1751  { "qu-BO", "*", spBuiltinFormats_es_BO }, // Quechua, Bolivia
1752  { "qu-EC", "*", spBuiltinFormats_es_EC }, // Quechua, Ecuador
1753  { "qu-PE", "*", spBuiltinFormats_es_PE }, // Quechua, Peru
1754  { "ro-RO", "*", spBuiltinFormats_ro_RO }, // Romanian, Romania
1755  { "ru-RU", "*", spBuiltinFormats_ru_RU }, // Russian, Russian Federation
1756  { "sa-IN", "*", spBuiltinFormats_hi_IN }, // Sanskrit, India
1757  { "se-FI", "*", spBuiltinFormats_fi_FI }, // Sami, Finland
1758  { "se-NO", "*", spBuiltinFormats_no_NO }, // Sami, Norway
1759  { "se-SE", "*", spBuiltinFormats_sv_SE }, // Sami, Sweden
1760  { "sk-SK", "*", spBuiltinFormats_sk_SK }, // Slovak, Slovakia
1761  { "sl-SI", "*", spBuiltinFormats_sl_SI }, // Slovenian, Slovenia
1762  { "sv-FI", "*", spBuiltinFormats_sv_FI }, // Swedish, Finland
1763  { "sv-SE", "*", spBuiltinFormats_sv_SE }, // Swedish, Sweden
1764  { "sw-TZ", "*", spBuiltinFormats_sw_TZ }, // Swahili, Tanzania
1765  { "syr-SY", "*", spBuiltinFormats_ar_SY }, // Syriac, Syria
1766  { "syr-TR", "*", spBuiltinFormats_tr_TR }, // Syriac, Turkey
1767  { "ta-IN", "*", spBuiltinFormats_ta_IN }, // Tamil, India
1768  { "te-IN", "*", spBuiltinFormats_te_IN }, // Telugu, India
1769  { "th-TH", "*", spBuiltinFormats_th_TH }, // Thai, Thailand
1770  { "tn-ZA", "*", spBuiltinFormats_en_ZA }, // Tswana, South Africa
1771  { "tr-TR", "*", spBuiltinFormats_tr_TR }, // Turkish, Turkey
1772  { "tt-RU", "*", spBuiltinFormats_tt_RU }, // Tatar, Russian Federation
1773  { "uk-UA", "*", spBuiltinFormats_uk_UA }, // Ukrainian, Ukraine
1774  { "ur-PK", "*", spBuiltinFormats_ur_PK }, // Urdu, Pakistan
1775  { "vi-VN", "*", spBuiltinFormats_vi_VN }, // Vietnamese, Viet Nam
1776  { "xh-ZA", "*", spBuiltinFormats_en_ZA }, // Xhosa, South Africa
1777  { "zu-ZA", "*", spBuiltinFormats_en_ZA }, // Zulu, South Africa
1778 
1779  { "*CJK", "*", spBuiltinFormats_CJK }, // CJK base table
1780  { "ja-JP", "*CJK", spBuiltinFormats_ja_JP }, // Japanese, Japan
1781  { "ko-KR", "*CJK", spBuiltinFormats_ko_KR }, // Korean, South Korea
1782  { "zh-CN", "*CJK", spBuiltinFormats_zh_CN }, // Chinese, China
1783  { "zh-HK", "*CJK", spBuiltinFormats_zh_HK }, // Chinese, Hong Kong
1784  { "zh-MO", "*CJK", spBuiltinFormats_zh_MO }, // Chinese, Macau
1785  { "zh-SG", "*CJK", spBuiltinFormats_zh_SG }, // Chinese, Singapore
1786  { "zh-TW", "*CJK", spBuiltinFormats_zh_TW } // Chinese, Taiwan
1787 };
1788 
1789 } // namespace
1790 
1792  mnPredefId( -1 )
1793 {
1794 }
1795 
1797  mnIndex( 0 )
1798 {
1799 }
1800 
1801 namespace {
1802 
1803 sal_Int32 lclCreatePredefinedFormat( const Reference< XNumberFormats >& rxNumFmts,
1804  sal_Int16 nPredefId, const Locale& rToLocale )
1805 {
1806  sal_Int32 nIndex = 0;
1807  try
1808  {
1809  Reference< XNumberFormatTypes > xNumFmtTypes( rxNumFmts, UNO_QUERY_THROW );
1810  nIndex = (nPredefId >= 0) ?
1811  xNumFmtTypes->getFormatIndex( nPredefId, rToLocale ) :
1812  xNumFmtTypes->getStandardIndex( rToLocale );
1813  }
1814  catch( Exception& )
1815  {
1816  OSL_FAIL( OStringBuffer( "lclCreatePredefinedFormat - cannot create predefined number format " ).
1817  append( OString::number( nPredefId ) ).getStr() );
1818  }
1819  return nIndex;
1820 }
1821 
1822 sal_Int32 lclCreateFormat( const Reference< XNumberFormats >& rxNumFmts,
1823  const OUString& rFmtCode, const Locale& rToLocale, const Locale& rFromLocale )
1824 {
1825  sal_Int32 nIndex = 0;
1826  try
1827  {
1828  nIndex = rxNumFmts->addNewConverted( rFmtCode, rFromLocale, rToLocale );
1829  }
1830  catch( Exception& )
1831  {
1832  // BIFF2-BIFF4 stores standard format explicitly in stream
1833  if( rFmtCode.equalsIgnoreAsciiCase( "general" ) )
1834  {
1835  nIndex = lclCreatePredefinedFormat( rxNumFmts, 0, rToLocale );
1836  }
1837  else
1838  {
1839  // do not assert fractional number formats with fixed denominator
1840  OSL_ENSURE( rFmtCode.startsWith( "#\\ ?/" ) ||
1841  rFmtCode.startsWith( "#\\ ?\?/" ) ||
1842  rFmtCode.startsWith( "#\\ ?\?\?/" ),
1843  OStringBuffer( "lclCreateFormat - cannot create number format '" ).
1844  append( OUStringToOString( rFmtCode, osl_getThreadTextEncoding() ) ).
1845  append( '\'' ).getStr() );
1846  }
1847  }
1848  return nIndex;
1849 }
1850 
1852 class NumberFormatFinalizer
1853 {
1854 public:
1855  explicit NumberFormatFinalizer( const WorkbookHelper& rHelper );
1856 
1857  void operator()( NumberFormat& rNumFmt ) const
1858  { rNumFmt.finalizeImport( mxNumFmts, maEnUsLocale ); }
1859 
1860 private:
1861  Reference< XNumberFormats > mxNumFmts;
1863 };
1864 
1865 NumberFormatFinalizer::NumberFormatFinalizer( const WorkbookHelper& rHelper ) :
1866  maEnUsLocale( "en", "US", OUString() )
1867 {
1868  try
1869  {
1870  Reference< XNumberFormatsSupplier > xNumFmtsSupp( rHelper.getDocument(), UNO_QUERY_THROW );
1871  mxNumFmts = xNumFmtsSupp->getNumberFormats();
1872  }
1873  catch( Exception& )
1874  {
1875  }
1876  OSL_ENSURE( mxNumFmts.is(), "NumberFormatFinalizer::NumberFormatFinalizer - cannot get number formats" );
1877 }
1878 
1879 sal_Int32 lclPosToken ( const OUString& sFormat, std::u16string_view sSearch, sal_Int32 nStartPos )
1880 {
1881  sal_Int32 nLength = sFormat.getLength();
1882  for ( sal_Int32 i = nStartPos; i < nLength && i >= 0 ; i++ )
1883  {
1884  switch(sFormat[i])
1885  {
1886  case '\"' : // skip text
1887  i = sFormat.indexOf('\"',i+1);
1888  break;
1889  case '[' : // skip condition
1890  i = sFormat.indexOf(']',i+1);
1891  break;
1892  default :
1893  if ( sFormat.match(sSearch, i) )
1894  return i;
1895  break;
1896  }
1897  if ( i < 0 )
1898  i--;
1899  }
1900  return -2;
1901 }
1902 
1903 } // namespace
1904 
1905 NumberFormat::NumberFormat( const WorkbookHelper& rHelper ) :
1906  WorkbookHelper( rHelper )
1907 {
1908 }
1909 
1910 void NumberFormat::setFormatCode( const OUString& rFmtCode )
1911 {
1912  // Special case for fraction code '\ ?/?', it is passed to us in xml, the '\' is not
1913  // an escape character but merely should be telling the formatter to display the next
1914  // char in the format ( afaics it does that anyhow )
1915  sal_Int32 nPosEscape = 0;
1916  sal_Int32 nErase = 0;
1917  sal_Int32 nLastIndex = rFmtCode.getLength() - 1;
1918  OUStringBuffer sFormat = rFmtCode;
1919 
1920  while ( ( nPosEscape = lclPosToken( rFmtCode, u"\\ ", nPosEscape ) ) > 0 )
1921  {
1922  sal_Int32 nPos = nPosEscape + 2;
1923  while ( nPos < nLastIndex && ( rFmtCode[nPos] == '?' || rFmtCode[nPos] == '#' || rFmtCode[nPos] == '0' ) )
1924  nPos++;
1925  if ( nPos < nLastIndex && rFmtCode[nPos] == '/' )
1926  {
1927  sFormat.remove(nPosEscape - nErase, 1);
1928  nErase ++;
1929  } // tdf#81939 preserve other escape characters
1930  nPosEscape = lclPosToken( rFmtCode, u";", nPosEscape ); // skip to next format
1931  }
1932  maModel.maFmtCode = sFormat.makeStringAndClear();
1933 }
1934 
1935 void NumberFormat::setFormatCode( const Locale& rLocale, const char* pcFmtCode )
1936 {
1937  maModel.maLocale = rLocale;
1938  maModel.maFmtCode = OStringToOUString( std::string_view( pcFmtCode ), RTL_TEXTENCODING_UTF8 );
1939  maModel.mnPredefId = -1;
1940 }
1941 
1942 void NumberFormat::setPredefinedId( const Locale& rLocale, sal_Int16 nPredefId )
1943 {
1944  maModel.maLocale = rLocale;
1945  maModel.maFmtCode.clear();
1946  maModel.mnPredefId = nPredefId;
1947 }
1948 
1949 void NumberFormat::finalizeImport( const Reference< XNumberFormats >& rxNumFmts, const Locale& rFromLocale )
1950 {
1951  if( rxNumFmts.is() && !maModel.maFmtCode.isEmpty() )
1952  maApiData.mnIndex = lclCreateFormat( rxNumFmts, maModel.maFmtCode, maModel.maLocale, rFromLocale );
1953  else
1954  maApiData.mnIndex = lclCreatePredefinedFormat( rxNumFmts, maModel.mnPredefId, maModel.maLocale );
1955 }
1956 
1957 sal_uInt32 NumberFormat::fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs ) const
1958 {
1959  const ScDocument& rDoc = getScDocument();
1960  static sal_uInt32 nDflt = rDoc.GetFormatTable()->GetStandardIndex( ScGlobal::eLnge );
1961  sal_uInt32 nScNumFmt = nDflt;
1962  if ( maApiData.mnIndex )
1963  nScNumFmt = maApiData.mnIndex;
1964 
1965  ScfTools::PutItem( rItemSet, SfxUInt32Item( ATTR_VALUE_FORMAT, nScNumFmt ), bSkipPoolDefs );
1966  if( rItemSet.GetItemState( ATTR_VALUE_FORMAT, false ) == SfxItemState::SET )
1967  ScGlobal::AddLanguage( rItemSet, *(rDoc.GetFormatTable()) );
1968  else
1969  nScNumFmt = 0;
1970 
1971  return nScNumFmt;
1972 }
1973 
1975  : WorkbookHelper(rHelper)
1976  , mnHighestId(0)
1977 {
1978  // get the current locale
1979  // try user-defined locale setting
1980  maLocaleStr = officecfg::Setup::L10N::ooSetupSystemLocale::get();
1981  // if set to "use system", get locale from system
1982  if( maLocaleStr.isEmpty() )
1983  maLocaleStr = officecfg::System::L10N::Locale::get();
1984 
1985  // create built-in formats for current locale
1987 }
1988 
1989 NumberFormatRef NumberFormatsBuffer::createNumFmt( sal_uInt32 nNumFmtId, const OUString& rFmtCode )
1990 {
1991  NumberFormatRef xNumFmt;
1992  xNumFmt = std::make_shared<NumberFormat>( *this );
1993  maNumFmts[ nNumFmtId ] = xNumFmt;
1994  if ( nNumFmtId > mnHighestId )
1995  mnHighestId = nNumFmtId;
1996  xNumFmt->setFormatCode( rFmtCode );
1997  return xNumFmt;
1998 }
1999 
2001 {
2002  sal_Int32 nNumFmtId = rAttribs.getInteger( XML_numFmtId, -1 );
2003  OUString aFmtCode = rAttribs.getXString( XML_formatCode, OUString() );
2004  return createNumFmt( nNumFmtId, aFmtCode );
2005 }
2006 
2008 {
2009  sal_Int32 nNumFmtId = rStrm.readuInt16();
2010  OUString aFmtCode = BiffHelper::readString( rStrm );
2011  createNumFmt( nNumFmtId, aFmtCode );
2012 }
2013 
2015 {
2016  maNumFmts.forEach( NumberFormatFinalizer( *this ) );
2017 }
2018 
2019 sal_uInt32 NumberFormatsBuffer::fillToItemSet( SfxItemSet& rItemSet, sal_uInt32 nNumFmtId, bool bSkipPoolDefs ) const
2020 {
2021  const NumberFormat* pNumFmt = maNumFmts.get(nNumFmtId).get();
2022  if (!pNumFmt)
2023  return 0;
2024 
2025  return pNumFmt->fillToItemSet( rItemSet, bSkipPoolDefs);
2026 }
2027 
2029 {
2030  // build a map containing pointers to all tables
2031  typedef ::std::map< OUString, const BuiltinFormatTable* > BuiltinMap;
2032  BuiltinMap aBuiltinMap;
2033  for(auto const &rTable : spBuiltinFormatTables)
2034  aBuiltinMap[ OUString::createFromAscii(rTable.mpcLocale) ] = &rTable;
2035 
2036  // convert locale string to locale struct
2038 
2039  // build a list of table pointers for the current locale, with all parent tables
2040  typedef ::std::vector< const BuiltinFormatTable* > BuiltinVec;
2041  BuiltinVec aBuiltinVec;
2042  BuiltinMap::const_iterator aMIt = aBuiltinMap.find( maLocaleStr ), aMEnd = aBuiltinMap.end();
2043  OSL_ENSURE( aMIt != aMEnd,
2044  OStringBuffer( "NumberFormatsBuffer::insertBuiltinFormats - locale '" +
2045  OUStringToOString( maLocaleStr, RTL_TEXTENCODING_ASCII_US ) +
2046  "' not supported (#i29949#)" ).getStr() );
2047  // start with default table, if no table has been found
2048  if( aMIt == aMEnd )
2049  aMIt = aBuiltinMap.find( "*" );
2050  OSL_ENSURE( aMIt != aMEnd, "NumberFormatsBuffer::insertBuiltinFormats - default map not found" );
2051  // insert all tables into the vector
2052  for( ; aMIt != aMEnd; aMIt = aBuiltinMap.find( OUString::createFromAscii( aMIt->second->mpcParent ) ) )
2053  aBuiltinVec.push_back( aMIt->second );
2054 
2055  // insert the default formats in the format map (in reverse order from default table to system locale)
2056  std::map< sal_uInt32, sal_uInt32 > aReuseMap;
2057  for( BuiltinVec::reverse_iterator aVIt = aBuiltinVec.rbegin(), aVEnd = aBuiltinVec.rend(); aVIt != aVEnd; ++aVIt )
2058  {
2059  // do not put the current system locale for default table
2060  Locale aLocale;
2061  if( (*aVIt)->mpcParent[ 0 ] != '\0' && OUString::createFromAscii((*aVIt)->mpcLocale) != maLocaleStr )
2062  aLocale = aSysLocale;
2063  for( const BuiltinFormat* pBuiltin = (*aVIt)->mpFormats; pBuiltin && (pBuiltin->mnNumFmtId >= 0); ++pBuiltin )
2064  {
2065  NumberFormatRef& rxNumFmt = maNumFmts[ pBuiltin->mnNumFmtId ];
2066  rxNumFmt = std::make_shared<NumberFormat>( *this );
2067 
2068  bool bReuse = false;
2069  if( pBuiltin->mpcFmtCode )
2070  rxNumFmt->setFormatCode( aLocale, pBuiltin->mpcFmtCode );
2071  else if( pBuiltin->mnPredefId >= 0 )
2072  rxNumFmt->setPredefinedId( aLocale, pBuiltin->mnPredefId );
2073  else
2074  bReuse = pBuiltin->mnReuseId >= 0;
2075 
2076  if( bReuse )
2077  aReuseMap[ pBuiltin->mnNumFmtId ] = pBuiltin->mnReuseId;
2078  else
2079  aReuseMap.erase( pBuiltin->mnNumFmtId );
2080  }
2081  }
2082 
2083  // copy reused number formats
2084  for( const auto& [rNumFmtId, rReuseId] : aReuseMap )
2085  {
2086  maNumFmts[ rNumFmtId ] = maNumFmts[ rReuseId ];
2087  if ( rNumFmtId > mnHighestId )
2088  mnHighestId = rNumFmtId;
2089  }
2090 }
2091 
2092 } // namespace oox
2093 
2094 /* 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:955
Reference< XNumberFormats > mxNumFmts
std::shared_ptr< NumberFormat > NumberFormatRef
#define UTF8_HY_DA_LC
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Definition: documen2.cxx:441
#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:213
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:80
#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:553
#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)