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
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 <o3tl/string_view.hxx>
37#include <osl/diagnose.h>
38#include <osl/thread.h>
39#include <rtl/ustrbuf.hxx>
40#include <svl/intitem.hxx>
41#include <svl/itemset.hxx>
42#include <svl/numformat.hxx>
45#include <oox/token/tokens.hxx>
46#include <scitems.hxx>
47#include <document.hxx>
48#include <ftools.hxx>
49
50namespace oox::xls {
51
52using namespace ::com::sun::star::lang;
53using namespace ::com::sun::star::uno;
54using namespace ::com::sun::star::util;
55
56namespace {
57
59struct BuiltinFormat
60{
61 sal_Int32 mnNumFmtId;
62 const char* mpcFmtCode;
63 sal_Int16 mnPredefId;
64 sal_Int32 mnReuseId;
65};
66
68#define NUMFMT_STRING( INDEX, FORMATCODE ) \
69 { INDEX, FORMATCODE, -1, -1 }
70
72#define NUMFMT_PREDEF( INDEX, PREDEFINED ) \
73 { INDEX, nullptr, css::i18n::NumberFormatIndex::PREDEFINED, -1 }
74
76#define NUMFMT_REUSE( INDEX, REUSED_INDEX ) \
77 { INDEX, nullptr, -1, REUSED_INDEX }
78
80#define NUMFMT_ENDTABLE() \
81 { -1, nullptr, -1, -1 }
82
92#define NUMFMT_ALLDATETIMES( SYSTEMDATE, DAY, DAYSEP, MONTH, MONTHSEP, YEAR, HOUR12, HOUR24 ) \
93 NUMFMT_STRING( 14, SYSTEMDATE ), \
94 NUMFMT_STRING( 15, DAY DAYSEP MONTH MONTHSEP YEAR ), \
95 NUMFMT_STRING( 16, DAY DAYSEP MONTH ), \
96 NUMFMT_STRING( 17, MONTH MONTHSEP YEAR ), \
97 NUMFMT_STRING( 18, HOUR12 ":mm AM/PM" ), \
98 NUMFMT_STRING( 19, HOUR12 ":mm:ss AM/PM" ), \
99 NUMFMT_STRING( 20, HOUR24 ":mm" ), \
100 NUMFMT_STRING( 21, HOUR24 ":mm:ss" ), \
101 NUMFMT_STRING( 22, SYSTEMDATE " " HOUR24 ":mm" )
102
109#define NUMFMT_TIME_CJK( INDEX, HOURFORMAT, HOUR, MINUTE, SECOND ) \
110 NUMFMT_STRING( INDEX + 0, HOURFORMAT "\"" HOUR "\"mm\"" MINUTE "\"" ), \
111 NUMFMT_STRING( INDEX + 1, HOURFORMAT "\"" HOUR "\"mm\"" MINUTE "\"ss\"" SECOND "\"" )
112
119#define NUMFMT_ALLTIMES_CJK( HOUR12, HOUR24, HOUR, MINUTE, SECOND ) \
120 NUMFMT_TIME_CJK( 32, HOUR24, HOUR, MINUTE, SECOND ), \
121 NUMFMT_TIME_CJK( 34, "AM/PM" HOUR12, HOUR, MINUTE, SECOND )
122
129#define NUMFMT_CURRENCY_SYMBOL_MINUS_NUMBER( INDEX, SYMBOL, SPACE, MODIF ) \
130 NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0;" MODIF SYMBOL SPACE "-#,##0" ), \
131 NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0;" "[RED]" MODIF SYMBOL SPACE "-#,##0" ), \
132 NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00;" MODIF SYMBOL SPACE "-#,##0.00" ), \
133 NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00;" "[RED]" MODIF SYMBOL SPACE "-#,##0.00" )
134
140#define NUMFMT_ACCOUNTING_SYMBOL_MINUS_NUMBER( INDEX, SYMBOL, SPACE ) \
141 NUMFMT_STRING( INDEX + 0, "_ " "* #,##0_ ;" "_ " "* -#,##0_ ;" "_ " "* \"-\"_ ;" "_ @_ " ), \
142 NUMFMT_STRING( INDEX + 1, "_ " SYMBOL SPACE "* #,##0_ ;" "_ " SYMBOL SPACE "* -#,##0_ ;" "_ " SYMBOL SPACE "* \"-\"_ ;" "_ @_ " ), \
143 NUMFMT_STRING( INDEX + 2, "_ " "* #,##0.00_ ;" "_ " "* -#,##0.00_ ;" "_ " "* \"-\"?\?_ ;" "_ @_ " ), \
144 NUMFMT_STRING( INDEX + 3, "_ " SYMBOL SPACE "* #,##0.00_ ;" "_ " SYMBOL SPACE "* -#,##0.00_ ;" "_ " SYMBOL SPACE "* \"-\"?\?_ ;" "_ @_ " )
145
151#define NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( SYMBOL, SPACE ) \
152 NUMFMT_CURRENCY_SYMBOL_MINUS_NUMBER( 5, SYMBOL, SPACE, "" ), \
153 NUMFMT_CURRENCY_SYMBOL_MINUS_NUMBER( 37, "", "", "" ), \
154 NUMFMT_ACCOUNTING_SYMBOL_MINUS_NUMBER( 41, SYMBOL, SPACE )
155
162#define NUMFMT_CURRENCY_SYMBOL_NUMBER_MINUS( INDEX, SYMBOL, SPACE, MODIF ) \
163 NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0_-;" MODIF SYMBOL SPACE "#,##0-" ), \
164 NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0_-;" "[RED]" MODIF SYMBOL SPACE "#,##0-" ), \
165 NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00_-;" MODIF SYMBOL SPACE "#,##0.00-" ), \
166 NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00_-;" "[RED]" MODIF SYMBOL SPACE "#,##0.00-" )
167
173#define NUMFMT_ACCOUNTING_SYMBOL_NUMBER_MINUS( INDEX, SYMBOL, SPACE ) \
174 NUMFMT_STRING( INDEX + 0, "_-" "* #,##0_-;" "_-" "* #,##0-;" "_-" "* \"-\"_-;" "_-@_-" ), \
175 NUMFMT_STRING( INDEX + 1, "_-" SYMBOL SPACE "* #,##0_-;" "_-" SYMBOL SPACE "* #,##0-;" "_-" SYMBOL SPACE "* \"-\"_-;" "_-@_-" ), \
176 NUMFMT_STRING( INDEX + 2, "_-" "* #,##0.00_-;" "_-" "* #,##0.00-;" "_-" "* \"-\"?\?_-;" "_-@_-" ), \
177 NUMFMT_STRING( INDEX + 3, "_-" SYMBOL SPACE "* #,##0.00_-;" "_-" SYMBOL SPACE "* #,##0.00-;" "_-" SYMBOL SPACE "* \"-\"?\?_-;" "_-@_-" )
178
184#define NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( SYMBOL, SPACE ) \
185 NUMFMT_CURRENCY_SYMBOL_NUMBER_MINUS( 5, SYMBOL, SPACE, "" ), \
186 NUMFMT_CURRENCY_SYMBOL_NUMBER_MINUS( 37, "", "", "" ), \
187 NUMFMT_ACCOUNTING_SYMBOL_NUMBER_MINUS( 41, SYMBOL, SPACE )
188
195#define NUMFMT_CURRENCY_NUMBER_SYMBOL_MINUS( INDEX, SYMBOL, SPACE, MODIF ) \
196 NUMFMT_STRING( INDEX + 0, MODIF "#,##0" SPACE SYMBOL "_-;" MODIF "#,##0" SPACE SYMBOL "-" ), \
197 NUMFMT_STRING( INDEX + 1, MODIF "#,##0" SPACE SYMBOL "_-;" "[RED]" MODIF "#,##0" SPACE SYMBOL "-" ), \
198 NUMFMT_STRING( INDEX + 2, MODIF "#,##0.00" SPACE SYMBOL "_-;" MODIF "#,##0.00" SPACE SYMBOL "-" ), \
199 NUMFMT_STRING( INDEX + 3, MODIF "#,##0.00" SPACE SYMBOL "_-;" "[RED]" MODIF "#,##0.00" SPACE SYMBOL "-" )
200
207#define NUMFMT_ACCOUNTING_NUMBER_SYMBOL_MINUS( INDEX, SYMBOL, BLINDS, SPACE ) \
208 NUMFMT_STRING( INDEX + 0, "_-* #,##0" SPACE BLINDS "_-;_-* #,##0" SPACE BLINDS "-;_-* \"-\"" SPACE BLINDS "_-;_-@_-" ), \
209 NUMFMT_STRING( INDEX + 1, "_-* #,##0" SPACE SYMBOL "_-;_-* #,##0" SPACE SYMBOL "-;_-* \"-\"" SPACE SYMBOL "_-;_-@_-" ), \
210 NUMFMT_STRING( INDEX + 2, "_-* #,##0.00" SPACE BLINDS "_-;_-* #,##0.00" SPACE BLINDS "-;_-* \"-\"?\?" SPACE BLINDS "_-;_-@_-" ), \
211 NUMFMT_STRING( INDEX + 3, "_-* #,##0.00" SPACE SYMBOL "_-;_-* #,##0.00" SPACE SYMBOL "-;_-* \"-\"?\?" SPACE SYMBOL "_-;_-@_-" )
212
219#define NUMFMT_ALLCURRENCIES_NUMBER_SYMBOL_MINUS( SYMBOL, BLINDS, SPACE ) \
220 NUMFMT_CURRENCY_NUMBER_SYMBOL_MINUS( 5, SYMBOL, SPACE, "" ), \
221 NUMFMT_CURRENCY_NUMBER_SYMBOL_MINUS( 37, BLINDS, SPACE, "" ), \
222 NUMFMT_ACCOUNTING_NUMBER_SYMBOL_MINUS( 41, SYMBOL, BLINDS, SPACE )
223
230#define NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( INDEX, SYMBOL, SPACE, MODIF ) \
231 NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0;" MODIF "-" SYMBOL SPACE "#,##0" ), \
232 NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0;" "[RED]" MODIF "-" SYMBOL SPACE "#,##0" ), \
233 NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00;" MODIF "-" SYMBOL SPACE "#,##0.00" ), \
234 NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00;" "[RED]" MODIF "-" SYMBOL SPACE "#,##0.00" )
235
241#define NUMFMT_ACCOUNTING_MINUS_SYMBOL_NUMBER( INDEX, SYMBOL, SPACE ) \
242 NUMFMT_STRING( INDEX + 0, "_-" "* #,##0_-;" "-" "* #,##0_-;" "_-" "* \"-\"_-;" "_-@_-" ), \
243 NUMFMT_STRING( INDEX + 1, "_-" SYMBOL SPACE "* #,##0_-;" "-" SYMBOL SPACE "* #,##0_-;" "_-" SYMBOL SPACE "* \"-\"_-;" "_-@_-" ), \
244 NUMFMT_STRING( INDEX + 2, "_-" "* #,##0.00_-;" "-" "* #,##0.00_-;" "_-" "* \"-\"?\?_-;" "_-@_-" ), \
245 NUMFMT_STRING( INDEX + 3, "_-" SYMBOL SPACE "* #,##0.00_-;" "-" SYMBOL SPACE "* #,##0.00_-;" "_-" SYMBOL SPACE "* \"-\"?\?_-;" "_-@_-" )
246
252#define NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( SYMBOL, SPACE ) \
253 NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( 5, SYMBOL, SPACE, "" ), \
254 NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( 37, "", "", "" ), \
255 NUMFMT_ACCOUNTING_MINUS_SYMBOL_NUMBER( 41, SYMBOL, SPACE )
256
263#define NUMFMT_CURRENCY_MINUS_NUMBER_SYMBOL( INDEX, SYMBOL, SPACE, MODIF ) \
264 NUMFMT_STRING( INDEX + 0, MODIF "#,##0" SPACE SYMBOL ";" MODIF "-#,##0" SPACE SYMBOL ), \
265 NUMFMT_STRING( INDEX + 1, MODIF "#,##0" SPACE SYMBOL ";" "[RED]" MODIF "-#,##0" SPACE SYMBOL ), \
266 NUMFMT_STRING( INDEX + 2, MODIF "#,##0.00" SPACE SYMBOL ";" MODIF "-#,##0.00" SPACE SYMBOL ), \
267 NUMFMT_STRING( INDEX + 3, MODIF "#,##0.00" SPACE SYMBOL ";" "[RED]" MODIF "-#,##0.00" SPACE SYMBOL )
268
275#define NUMFMT_ACCOUNTING_MINUS_NUMBER_SYMBOL( INDEX, SYMBOL, BLINDS, SPACE ) \
276 NUMFMT_STRING( INDEX + 0, "_-* #,##0" SPACE BLINDS "_-;-* #,##0" SPACE BLINDS "_-;_-* \"-\"" SPACE BLINDS "_-;_-@_-" ), \
277 NUMFMT_STRING( INDEX + 1, "_-* #,##0" SPACE SYMBOL "_-;-* #,##0" SPACE SYMBOL "_-;_-* \"-\"" SPACE SYMBOL "_-;_-@_-" ), \
278 NUMFMT_STRING( INDEX + 2, "_-* #,##0.00" SPACE BLINDS "_-;-* #,##0.00" SPACE BLINDS "_-;_-* \"-\"?\?" SPACE BLINDS "_-;_-@_-" ), \
279 NUMFMT_STRING( INDEX + 3, "_-* #,##0.00" SPACE SYMBOL "_-;-* #,##0.00" SPACE SYMBOL "_-;_-* \"-\"?\?" SPACE SYMBOL "_-;_-@_-" )
280
287#define NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( SYMBOL, BLINDS, SPACE ) \
288 NUMFMT_CURRENCY_MINUS_NUMBER_SYMBOL( 5, SYMBOL, SPACE, "" ), \
289 NUMFMT_CURRENCY_MINUS_NUMBER_SYMBOL( 37, BLINDS, SPACE, "" ), \
290 NUMFMT_ACCOUNTING_MINUS_NUMBER_SYMBOL( 41, SYMBOL, BLINDS, SPACE )
291
298#define NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( INDEX, SYMBOL, SPACE, MODIF ) \
299 NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0_);" MODIF "(" SYMBOL SPACE "#,##0)" ), \
300 NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0_);" "[RED]" MODIF "(" SYMBOL SPACE "#,##0)" ), \
301 NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00_);" MODIF "(" SYMBOL SPACE "#,##0.00)" ), \
302 NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00_);" "[RED]" MODIF "(" SYMBOL SPACE "#,##0.00)" )
303
309#define NUMFMT_ACCOUNTING_OPEN_SYMBOL_NUMBER_CLOSE( INDEX, SYMBOL, SPACE ) \
310 NUMFMT_STRING( INDEX + 0, "_(" "* #,##0_);" "_(" "* (#,##0);" "_(" "* \"-\"_);" "_(@_)" ), \
311 NUMFMT_STRING( INDEX + 1, "_(" SYMBOL SPACE "* #,##0_);" "_(" SYMBOL SPACE "* (#,##0);" "_(" SYMBOL SPACE "* \"-\"_);" "_(@_)" ), \
312 NUMFMT_STRING( INDEX + 2, "_(" "* #,##0.00_);" "_(" "* (#,##0.00);" "_(" "* \"-\"?\?_);" "_(@_)" ), \
313 NUMFMT_STRING( INDEX + 3, "_(" SYMBOL SPACE "* #,##0.00_);" "_(" SYMBOL SPACE "* (#,##0.00);" "_(" SYMBOL SPACE "* \"-\"?\?_);" "_(@_)" )
314
320#define NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( SYMBOL, SPACE ) \
321 NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 5, SYMBOL, SPACE, "" ), \
322 NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 37, "", "", "" ), \
323 NUMFMT_ACCOUNTING_OPEN_SYMBOL_NUMBER_CLOSE( 41, SYMBOL, SPACE )
324
331#define NUMFMT_CURRENCY_OPEN_NUMBER_SYMBOL_CLOSE( INDEX, SYMBOL, SPACE, MODIF ) \
332 NUMFMT_STRING( INDEX + 0, MODIF "#,##0" SPACE SYMBOL "_);" MODIF "(#,##0" SPACE SYMBOL ")" ), \
333 NUMFMT_STRING( INDEX + 1, MODIF "#,##0" SPACE SYMBOL "_);" "[RED]" MODIF "(#,##0" SPACE SYMBOL ")" ), \
334 NUMFMT_STRING( INDEX + 2, MODIF "#,##0.00" SPACE SYMBOL "_);" MODIF "(#,##0.00" SPACE SYMBOL ")" ), \
335 NUMFMT_STRING( INDEX + 3, MODIF "#,##0.00" SPACE SYMBOL "_);" "[RED]" MODIF "(#,##0.00" SPACE SYMBOL ")" )
336
343#define NUMFMT_ACCOUNTING_OPEN_NUMBER_SYMBOL_CLOSE( INDEX, SYMBOL, BLINDS, SPACE ) \
344 NUMFMT_STRING( INDEX + 0, "_ * #,##0_)" SPACE BLINDS "_ ;_ * (#,##0)" SPACE BLINDS "_ ;_ * \"-\"_)" SPACE BLINDS "_ ;_ @_ " ), \
345 NUMFMT_STRING( INDEX + 1, "_ * #,##0_)" SPACE SYMBOL "_ ;_ * (#,##0)" SPACE SYMBOL "_ ;_ * \"-\"_)" SPACE SYMBOL "_ ;_ @_ " ), \
346 NUMFMT_STRING( INDEX + 2, "_ * #,##0.00_)" SPACE BLINDS "_ ;_ * (#,##0.00)" SPACE BLINDS "_ ;_ * \"-\"?\?_)" SPACE BLINDS "_ ;_ @_ " ), \
347 NUMFMT_STRING( INDEX + 3, "_ * #,##0.00_)" SPACE SYMBOL "_ ;_ * (#,##0.00)" SPACE SYMBOL "_ ;_ * \"-\"?\?_)" SPACE SYMBOL "_ ;_ @_ " )
348
355#define NUMFMT_ALLCURRENCIES_OPEN_NUMBER_SYMBOL_CLOSE( SYMBOL, BLINDS, SPACE ) \
356 NUMFMT_CURRENCY_OPEN_NUMBER_SYMBOL_CLOSE( 5, SYMBOL, SPACE, "" ), \
357 NUMFMT_CURRENCY_OPEN_NUMBER_SYMBOL_CLOSE( 37, BLINDS, SPACE, "" ), \
358 NUMFMT_ACCOUNTING_OPEN_NUMBER_SYMBOL_CLOSE( 41, SYMBOL, BLINDS, SPACE )
359
360// currency unit characters
361#define UTF8_BAHT "\340\270\277"
362#define UTF8_COLON "\342\202\241"
363#define UTF8_CURR_AR_AE "\330\257.\330\245."
364#define UTF8_CURR_AR_BH "\330\257.\330\250."
365#define UTF8_CURR_AR_DZ "\330\257.\330\254."
366#define UTF8_CURR_AR_EG "\330\254.\331\205."
367#define UTF8_CURR_AR_IQ "\330\257.\330\271."
368#define UTF8_CURR_AR_JO "\330\257.\330\247."
369#define UTF8_CURR_AR_KW "\330\257.\331\203."
370#define UTF8_CURR_AR_LB "\331\204.\331\204."
371#define UTF8_CURR_AR_LY "\330\257.\331\204."
372#define UTF8_CURR_AR_MA "\330\257.\331\205."
373#define UTF8_CURR_AR_OM "\330\261.\330\271."
374#define UTF8_CURR_AR_QA "\330\261.\331\202."
375#define UTF8_CURR_AR_SA "\330\261.\330\263."
376#define UTF8_CURR_AR_SY "\331\204.\330\263."
377#define UTF8_CURR_AR_TN "\330\257.\330\252."
378#define UTF8_CURR_AR_YE "\330\261.\331\212."
379#define UTF8_CURR_BN_IN "\340\246\237\340\246\276"
380#define UTF8_CURR_FA_IR "\330\261\331\212\330\247\331\204"
381#define UTF8_CURR_GU_IN "\340\252\260\340\253\202"
382#define UTF8_CURR_HI_IN "\340\244\260\340\245\201"
383#define UTF8_CURR_KN_IN "\340\262\260\340\263\202"
384#define UTF8_CURR_ML_IN "\340\264\225"
385#define UTF8_CURR_PA_IN "\340\250\260\340\251\201"
386#define UTF8_CURR_TA_IN "\340\256\260\340\257\202"
387#define UTF8_CURR_TE_IN "\340\260\260\340\261\202"
388#define UTF8_DONG "\342\202\253"
389#define UTF8_EURO "\342\202\254"
390#define UTF8_POUND_GB "\302\243"
391#define UTF8_RUFIYAA "\336\203"
392#define UTF8_SHEQEL "\342\202\252"
393#define UTF8_TUGRUG "\342\202\256"
394#define UTF8_WON "\342\202\251"
395#define UTF8_YEN_CN "\357\277\245"
396#define UTF8_YEN_JP "\302\245"
397
398// Unicode characters for currency units
399#define UTF8_CCARON_LC "\304\215"
400#define UTF8_LSTROKE_LC "\305\202"
401// Armenian
402#define UTF8_HY_DA_LC "\325\244"
403#define UTF8_HY_REH_LC "\326\200"
404// Cyrillic
405#define UTF8_CYR_G_LC "\320\263"
406#define UTF8_CYR_L_LC "\320\273"
407#define UTF8_CYR_M_LC "\320\274"
408#define UTF8_CYR_N_LC "\320\275"
409#define UTF8_CYR_O_LC "\320\276"
410#define UTF8_CYR_R_LC "\321\200"
411#define UTF8_CYR_S_LC "\321\201"
412#define UTF8_CYR_W_LC "\320\262"
413
414// Japanese/Chinese date/time characters
415#define UTF8_CJ_YEAR "\345\271\264"
416#define UTF8_CJ_MON "\346\234\210"
417#define UTF8_CJ_DAY "\346\227\245"
418#define UTF8_CJ_HOUR "\346\231\202"
419#define UTF8_CJ_MIN "\345\210\206"
420#define UTF8_CJ_SEC "\347\247\222"
421
422// Chinese Simplified date/time characters
423#define UTF8_CS_YEAR "\345\271\264"
424#define UTF8_CS_MON "\346\234\210"
425#define UTF8_CS_DAY "\346\227\245"
426#define UTF8_CS_HOUR "\346\227\266"
427#define UTF8_CS_MIN "\345\210\206"
428#define UTF8_CS_SEC "\347\247\222"
429
430// Korean date/time characters
431#define UTF8_KO_YEAR "\353\205\204"
432#define UTF8_KO_MON "\354\233\224"
433#define UTF8_KO_DAY "\354\235\274"
434#define UTF8_KO_HOUR "\354\213\234"
435#define UTF8_KO_MIN "\353\266\204"
436#define UTF8_KO_SEC "\354\264\210"
437
439const BuiltinFormat spBuiltinFormats_BASE[] =
440{
441 // 0..13 numeric and currency formats
442 NUMFMT_PREDEF( 0, NUMBER_STANDARD ), // General
443 NUMFMT_PREDEF( 1, NUMBER_INT ), // 0
444 NUMFMT_PREDEF( 2, NUMBER_DEC2 ), // 0.00
445 NUMFMT_PREDEF( 3, NUMBER_1000INT ), // #,##0
446 NUMFMT_PREDEF( 4, NUMBER_1000DEC2 ), // #,##0.00
447 NUMFMT_PREDEF( 5, CURRENCY_1000INT ), // #,##0[symbol]
448 NUMFMT_PREDEF( 6, CURRENCY_1000INT_RED ), // #,##0[symbol];[RED]-#,##0[symbol]
449 NUMFMT_PREDEF( 7, CURRENCY_1000DEC2 ), // #,##0.00[symbol]
450 NUMFMT_PREDEF( 8, CURRENCY_1000DEC2_RED ), // #,##0.00[symbol];[RED]-#,##0.00[symbol]
451 NUMFMT_PREDEF( 9, PERCENT_INT ), // 0%
452 NUMFMT_PREDEF( 10, PERCENT_DEC2 ), // 0.00%
453 NUMFMT_PREDEF( 11, SCIENTIFIC_000E00 ), // 0.00E+00
454 NUMFMT_PREDEF( 12, FRACTION_1 ), // # ?/?
455 NUMFMT_PREDEF( 13, FRACTION_2 ), // # ??/??
456
457 // 14...22 date and time formats
458 NUMFMT_PREDEF( 14, DATE_SYS_DDMMYYYY ),
459 NUMFMT_PREDEF( 15, DATE_SYS_DMMMYY ),
460 NUMFMT_PREDEF( 16, DATE_SYS_DDMMM ),
461 NUMFMT_PREDEF( 17, DATE_SYS_MMYY ),
462 NUMFMT_PREDEF( 18, TIME_HHMMAMPM ),
463 NUMFMT_PREDEF( 19, TIME_HHMMSSAMPM ),
464 NUMFMT_PREDEF( 20, TIME_HHMM ),
465 NUMFMT_PREDEF( 21, TIME_HHMMSS ),
466 NUMFMT_PREDEF( 22, DATETIME_SYSTEM_SHORT_HHMM ),
467
468 // 23...36 international formats
469 NUMFMT_REUSE( 23, 0 ),
470 NUMFMT_REUSE( 24, 0 ),
471 NUMFMT_REUSE( 25, 0 ),
472 NUMFMT_REUSE( 26, 0 ),
473 NUMFMT_REUSE( 27, 14 ),
474 NUMFMT_REUSE( 28, 14 ),
475 NUMFMT_REUSE( 29, 14 ),
476 NUMFMT_REUSE( 30, 14 ),
477 NUMFMT_REUSE( 31, 14 ),
478 NUMFMT_REUSE( 32, 21 ),
479 NUMFMT_REUSE( 33, 21 ),
480 NUMFMT_REUSE( 34, 21 ),
481 NUMFMT_REUSE( 35, 21 ),
482 NUMFMT_REUSE( 36, 14 ),
483
484 // 37...44 accounting formats, defaults without currency symbol here
485 NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( 37, "", "", "" ),
487
488 // 45...49 more special formats
489 NUMFMT_STRING( 45, "mm:ss" ),
490 NUMFMT_STRING( 46, "[h]:mm:ss" ),
491 NUMFMT_STRING( 47, "mm:ss.0" ),
492 NUMFMT_STRING( 48, "##0.0E+0" ),
493 NUMFMT_PREDEF( 49, TEXT ),
494
495 // 50...81 international formats
496 NUMFMT_REUSE( 50, 14 ),
497 NUMFMT_REUSE( 51, 14 ),
498 NUMFMT_REUSE( 52, 14 ),
499 NUMFMT_REUSE( 53, 14 ),
500 NUMFMT_REUSE( 54, 14 ),
501 NUMFMT_REUSE( 55, 14 ),
502 NUMFMT_REUSE( 56, 14 ),
503 NUMFMT_REUSE( 57, 14 ),
504 NUMFMT_REUSE( 58, 14 ),
505 NUMFMT_REUSE( 59, 1 ),
506 NUMFMT_REUSE( 60, 2 ),
507 NUMFMT_REUSE( 61, 3 ),
508 NUMFMT_REUSE( 62, 4 ),
509 NUMFMT_REUSE( 63, 5 ),
510 NUMFMT_REUSE( 64, 6 ),
511 NUMFMT_REUSE( 65, 7 ),
512 NUMFMT_REUSE( 66, 8 ),
513 NUMFMT_REUSE( 67, 9 ),
514 NUMFMT_REUSE( 68, 10 ),
515 NUMFMT_REUSE( 69, 12 ),
516 NUMFMT_REUSE( 70, 13 ),
517 NUMFMT_REUSE( 71, 14 ),
518 NUMFMT_REUSE( 72, 14 ),
519 NUMFMT_REUSE( 73, 15 ),
520 NUMFMT_REUSE( 74, 16 ),
521 NUMFMT_REUSE( 75, 17 ),
522 NUMFMT_REUSE( 76, 20 ),
523 NUMFMT_REUSE( 77, 21 ),
524 NUMFMT_REUSE( 78, 22 ),
525 NUMFMT_REUSE( 79, 45 ),
526 NUMFMT_REUSE( 80, 46 ),
527 NUMFMT_REUSE( 81, 47 ),
528
529 // 82...163 not used, must not occur in a file (Excel may crash)
530
532};
533
535const BuiltinFormat spBuiltinFormats_ar_AE[] =
536{
537 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
540};
541
543const BuiltinFormat spBuiltinFormats_ar_BH[] =
544{
545 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
548};
549
551const BuiltinFormat spBuiltinFormats_ar_DZ[] =
552{
553 NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
556};
557
559const BuiltinFormat spBuiltinFormats_ar_EG[] =
560{
561 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
564};
565
567const BuiltinFormat spBuiltinFormats_ar_IQ[] =
568{
569 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
572};
573
575const BuiltinFormat spBuiltinFormats_ar_JO[] =
576{
577 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
580};
581
583const BuiltinFormat spBuiltinFormats_ar_KW[] =
584{
585 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
588};
589
591const BuiltinFormat spBuiltinFormats_ar_LB[] =
592{
593 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
596};
597
599const BuiltinFormat spBuiltinFormats_ar_LY[] =
600{
601 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
604};
605
607const BuiltinFormat spBuiltinFormats_ar_MA[] =
608{
609 NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
612};
613
615const BuiltinFormat spBuiltinFormats_ar_OM[] =
616{
617 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
620};
621
623const BuiltinFormat spBuiltinFormats_ar_QA[] =
624{
625 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
628};
629
631const BuiltinFormat spBuiltinFormats_ar_SA[] =
632{
633 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
636};
637
639const BuiltinFormat spBuiltinFormats_ar_SY[] =
640{
641 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
644};
645
647const BuiltinFormat spBuiltinFormats_ar_TN[] =
648{
649 NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
652};
653
655const BuiltinFormat spBuiltinFormats_ar_YE[] =
656{
657 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
660};
661
663const BuiltinFormat spBuiltinFormats_be_BY[] =
664{
665 // space character is group separator, literal spaces must be quoted
666 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
669};
670
672const BuiltinFormat spBuiltinFormats_bg_BG[] =
673{
674 // space character is group separator, literal spaces must be quoted
675 NUMFMT_ALLDATETIMES( "DD.M.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
678};
679
681const BuiltinFormat spBuiltinFormats_bn_IN[] =
682{
683 NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
686};
687
689const BuiltinFormat spBuiltinFormats_cs_CZ[] =
690{
691 // space character is group separator, literal spaces must be quoted
692 NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
695};
696
698const BuiltinFormat spBuiltinFormats_da_DK[] =
699{
700 NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
703};
704
706const BuiltinFormat spBuiltinFormats_de_AT[] =
707{
708 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
711};
712
714const BuiltinFormat spBuiltinFormats_de_CH[] =
715{
716 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ". ", "MMM", " ", "YY", "h", "hh" ),
719};
720
722const BuiltinFormat spBuiltinFormats_de_DE[] =
723{
724 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ". ", "MMM", " ", "YY", "h", "hh" ),
727};
728
730const BuiltinFormat spBuiltinFormats_de_LI[] =
731{
732 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ". ", "MMM", " ", "YY", "h", "hh" ),
735};
736
738const BuiltinFormat spBuiltinFormats_de_LU[] =
739{
740 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
743};
744
746const BuiltinFormat spBuiltinFormats_div_MV[] =
747{
748 NUMFMT_ALLDATETIMES( "DD/MM/YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
751};
752
754const BuiltinFormat spBuiltinFormats_el_GR[] =
755{
756 NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
759};
760
762const BuiltinFormat spBuiltinFormats_en_AU[] =
763{
764 NUMFMT_ALLDATETIMES( "D/MM/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
767};
768
770const BuiltinFormat spBuiltinFormats_en_BZ[] =
771{
772 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
775};
776
778const BuiltinFormat spBuiltinFormats_en_CA[] =
779{
780 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
783};
784
786const BuiltinFormat spBuiltinFormats_en_CB[] =
787{
788 NUMFMT_ALLDATETIMES( "MM/DD/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
791};
792
794const BuiltinFormat spBuiltinFormats_en_GB[] =
795{
796 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
799};
800
802const BuiltinFormat spBuiltinFormats_en_IE[] =
803{
804 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
807};
808
810const BuiltinFormat spBuiltinFormats_en_JM[] =
811{
812 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
815};
816
818const BuiltinFormat spBuiltinFormats_en_NZ[] =
819{
820 NUMFMT_ALLDATETIMES( "D/MM/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
823};
824
826const BuiltinFormat spBuiltinFormats_en_PH[] =
827{
828 NUMFMT_ALLDATETIMES( "M/D/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
831};
832
834const BuiltinFormat spBuiltinFormats_en_TT[] =
835{
836 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
839};
840
842const BuiltinFormat spBuiltinFormats_en_US[] =
843{
844 NUMFMT_ALLDATETIMES( "M/D/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
847};
848
850const BuiltinFormat spBuiltinFormats_en_ZA[] =
851{
852 NUMFMT_ALLDATETIMES( "YYYY/MM/DD", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
855};
856
858const BuiltinFormat spBuiltinFormats_en_ZW[] =
859{
860 NUMFMT_ALLDATETIMES( "M/D/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
863};
864
866const BuiltinFormat spBuiltinFormats_es_AR[] =
867{
868 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
871};
872
874const BuiltinFormat spBuiltinFormats_es_BO[] =
875{
876 // slashes must be quoted to prevent conversion to minus
877 NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
880};
881
883const BuiltinFormat spBuiltinFormats_es_CL[] =
884{
885 NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
888};
889
891const BuiltinFormat spBuiltinFormats_es_CO[] =
892{
893 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
896};
897
899const BuiltinFormat spBuiltinFormats_es_CR[] =
900{
901 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
904};
905
907const BuiltinFormat spBuiltinFormats_es_DO[] =
908{
909 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
912};
913
915const BuiltinFormat spBuiltinFormats_es_EC[] =
916{
917 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
920};
921
923const BuiltinFormat spBuiltinFormats_es_ES[] =
924{
925 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
928};
929
931const BuiltinFormat spBuiltinFormats_es_GT[] =
932{
933 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
936};
937
939const BuiltinFormat spBuiltinFormats_es_HN[] =
940{
941 // slashes must be quoted to prevent conversion to minus
942 NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
945};
946
948const BuiltinFormat spBuiltinFormats_es_MX[] =
949{
950 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
953};
954
956const BuiltinFormat spBuiltinFormats_es_NI[] =
957{
958 // slashes must be quoted to prevent conversion to minus
959 NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
962};
963
965const BuiltinFormat spBuiltinFormats_es_PA[] =
966{
967 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
970};
971
973const BuiltinFormat spBuiltinFormats_es_PE[] =
974{
975 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
978};
979
981const BuiltinFormat spBuiltinFormats_es_PR[] =
982{
983 // slashes must be quoted to prevent conversion to minus
984 NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
987};
988
990const BuiltinFormat spBuiltinFormats_es_PY[] =
991{
992 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
995};
996
998const BuiltinFormat spBuiltinFormats_es_SV[] =
999{
1000 // slashes must be quoted to prevent conversion to minus
1001 NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
1004};
1005
1007const BuiltinFormat spBuiltinFormats_es_UY[] =
1008{
1009 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
1012};
1013
1015const BuiltinFormat spBuiltinFormats_es_VE[] =
1016{
1017 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
1020};
1021
1023const BuiltinFormat spBuiltinFormats_et_EE[] =
1024{
1025 // space character is group separator, literal spaces must be quoted
1026 NUMFMT_ALLDATETIMES( "D.MM.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1027 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"kr\"", "_k_r", "\\ " ),
1029};
1030
1032const BuiltinFormat spBuiltinFormats_fa_IR[] =
1033{
1034 NUMFMT_ALLDATETIMES( "YYYY/MM/DD", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
1037};
1038
1040const BuiltinFormat spBuiltinFormats_fi_FI[] =
1041{
1042 // space character is group separator, literal spaces must be quoted
1043 NUMFMT_STRING( 9, "0\\ %" ),
1044 NUMFMT_STRING( 10, "0.00\\ %" ),
1045 NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1048};
1049
1051const BuiltinFormat spBuiltinFormats_fo_FO[] =
1052{
1053 NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1056};
1057
1059const BuiltinFormat spBuiltinFormats_fr_BE[] =
1060{
1061 NUMFMT_ALLDATETIMES( "D/MM/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1064};
1065
1067const BuiltinFormat spBuiltinFormats_fr_CA[] =
1068{
1069 // space character is group separator, literal spaces must be quoted
1070 NUMFMT_ALLDATETIMES( "YYYY-MM-DD", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1073};
1074
1076const BuiltinFormat spBuiltinFormats_fr_CH[] =
1077{
1078 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1081};
1082
1084const BuiltinFormat spBuiltinFormats_fr_FR[] =
1085{
1086 // space character is group separator, literal spaces must be quoted
1087 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1090};
1091
1093const BuiltinFormat spBuiltinFormats_fr_LU[] =
1094{
1095 // space character is group separator, literal spaces must be quoted
1096 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1099};
1100
1102const BuiltinFormat spBuiltinFormats_fr_MC[] =
1103{
1104 // space character is group separator, literal spaces must be quoted
1105 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1108};
1109
1111const BuiltinFormat spBuiltinFormats_gl_ES[] =
1112{
1113 NUMFMT_ALLDATETIMES( "DD/MM/YY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1116};
1117
1119const BuiltinFormat spBuiltinFormats_gu_IN[] =
1120{
1121 NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1124};
1125
1127const BuiltinFormat spBuiltinFormats_he_IL[] =
1128{
1129 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1132};
1133
1135const BuiltinFormat spBuiltinFormats_hi_IN[] =
1136{
1137 NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1140};
1141
1143const BuiltinFormat spBuiltinFormats_hr_BA[] =
1144{
1145 NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1146 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"KM\"", "_K_M", " " ),
1148};
1149
1151const BuiltinFormat spBuiltinFormats_hr_HR[] =
1152{
1153 NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1154 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"kn\"", "_k_n", " " ),
1156};
1157
1159const BuiltinFormat spBuiltinFormats_hu_HU[] =
1160{
1161 // space character is group separator, literal spaces must be quoted
1162 // MMM is rendered differently in Calc and Excel (see #i41488#)
1163 NUMFMT_ALLDATETIMES( "YYYY.MM.DD", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1164 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"Ft\"", "_F_t", "\\ " ),
1166};
1167
1169const BuiltinFormat spBuiltinFormats_hy_AM[] =
1170{
1171 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1174};
1175
1177const BuiltinFormat spBuiltinFormats_id_ID[] =
1178{
1179 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1182};
1183
1185const BuiltinFormat spBuiltinFormats_is_IS[] =
1186{
1187 NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "hh" ),
1188 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"kr.\"", "_k_r_.", " " ),
1190};
1191
1193const BuiltinFormat spBuiltinFormats_it_CH[] =
1194{
1195 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1198};
1199
1201const BuiltinFormat spBuiltinFormats_it_IT[] =
1202{
1203 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1206};
1207
1209const BuiltinFormat spBuiltinFormats_ka_GE[] =
1210{
1211 // space character is group separator, literal spaces must be quoted
1212 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1213 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"Lari\"", "_L_a_r_i", "\\ " ),
1215};
1216
1218const BuiltinFormat spBuiltinFormats_kk_KZ[] =
1219{
1220 // space character is group separator, literal spaces must be quoted
1221 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1224};
1225
1227const BuiltinFormat spBuiltinFormats_kn_IN[] =
1228{
1229 NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1232};
1233
1235const BuiltinFormat spBuiltinFormats_ky_KG[] =
1236{
1237 // space character is group separator, literal spaces must be quoted
1238 NUMFMT_ALLDATETIMES( "DD.MM.YY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1241};
1242
1244const BuiltinFormat spBuiltinFormats_lt_LT[] =
1245{
1246 NUMFMT_ALLDATETIMES( "YYYY.MM.DD", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1247 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"Lt\"", "_L_t", " " ),
1249};
1250
1252const BuiltinFormat spBuiltinFormats_lv_LV[] =
1253{
1254 // space character is group separator, literal spaces must be quoted
1255 NUMFMT_ALLDATETIMES( "YYYY.MM.DD", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1258};
1259
1261const BuiltinFormat spBuiltinFormats_ml_IN[] =
1262{
1263 NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1266};
1267
1269const BuiltinFormat spBuiltinFormats_mn_MN[] =
1270{
1271 NUMFMT_ALLDATETIMES( "YY.MM.DD", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1274};
1275
1277const BuiltinFormat spBuiltinFormats_ms_BN[] =
1278{
1279 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1282};
1283
1285const BuiltinFormat spBuiltinFormats_ms_MY[] =
1286{
1287 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1290};
1291
1293const BuiltinFormat spBuiltinFormats_mt_MT[] =
1294{
1295 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1298};
1299
1301const BuiltinFormat spBuiltinFormats_nl_BE[] =
1302{
1303 // slashes must be quoted to prevent conversion to minus
1304 NUMFMT_ALLDATETIMES( "D\\/MM\\/YYYY", "D", "\\/", "MMM", "\\/", "YY", "h", "h" ),
1307};
1308
1310const BuiltinFormat spBuiltinFormats_nl_NL[] =
1311{
1312 NUMFMT_ALLDATETIMES( "D-M-YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1315};
1316
1318const BuiltinFormat spBuiltinFormats_no_NO[] =
1319{
1320 // space character is group separator, literal spaces must be quoted
1321 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1324};
1325
1327const BuiltinFormat spBuiltinFormats_pa_IN[] =
1328{
1329 NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
1332};
1333
1335const BuiltinFormat spBuiltinFormats_pl_PL[] =
1336{
1337 // space character is group separator, literal spaces must be quoted
1338 // MMM is rendered differently in Calc and Excel (see #i72300#)
1339 NUMFMT_ALLDATETIMES( "YYYY-MM-DD", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1342};
1343
1345const BuiltinFormat spBuiltinFormats_pt_BR[] =
1346{
1347 NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "/", "MMM", "/", "YY", "h", "hh" ),
1350};
1351
1353const BuiltinFormat spBuiltinFormats_pt_PT[] =
1354{
1355 NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1358};
1359
1361const BuiltinFormat spBuiltinFormats_ro_RO[] =
1362{
1363 // space character is group separator, literal spaces must be quoted (but see #i75367#)
1364 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1365 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"lei\"", "_l_e_i", "\\ " ),
1367};
1368
1370const BuiltinFormat spBuiltinFormats_ru_RU[] =
1371{
1372 // space character is group separator, literal spaces must be quoted
1373 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1376};
1377
1379const BuiltinFormat spBuiltinFormats_sk_SK[] =
1380{
1381 // space character is group separator, literal spaces must be quoted
1382 NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1383 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"Sk\"", "_S_k", "\\ " ),
1385};
1386
1388const BuiltinFormat spBuiltinFormats_sl_SI[] =
1389{
1390 NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1391 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"SIT\"", "_S_I_T", " " ),
1393};
1394
1396const BuiltinFormat spBuiltinFormats_sv_FI[] =
1397{
1398 // space character is group separator, literal spaces must be quoted
1399 NUMFMT_STRING( 9, "0\\ %" ),
1400 NUMFMT_STRING( 10, "0.00\\ %" ),
1401 NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "hh" ),
1404};
1405
1407const BuiltinFormat spBuiltinFormats_sv_SE[] =
1408{
1409 // space character is group separator, literal spaces must be quoted
1410 NUMFMT_ALLDATETIMES( "YYYY-MM-DD", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1411 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"kr\"", "_k_r", "\\ " ),
1413};
1414
1416const BuiltinFormat spBuiltinFormats_sw_TZ[] =
1417{
1418 NUMFMT_ALLDATETIMES( "M/D/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1421};
1422
1424const BuiltinFormat spBuiltinFormats_ta_IN[] =
1425{
1426 NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1429};
1430
1432const BuiltinFormat spBuiltinFormats_te_IN[] =
1433{
1434 NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1437};
1438
1440const BuiltinFormat spBuiltinFormats_th_TH[] =
1441{
1442 NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1445 NUMFMT_STRING( 59, "t0" ),
1446 NUMFMT_STRING( 60, "t0.00" ),
1447 NUMFMT_STRING( 61, "t#,##0" ),
1448 NUMFMT_STRING( 62, "t#,##0.00" ),
1449 NUMFMT_STRING( 67, "t0%" ),
1450 NUMFMT_STRING( 68, "t0.00%" ),
1451 NUMFMT_STRING( 69, "t# ?/?" ),
1452 NUMFMT_STRING( 70, "t# ?\?/?\?" ),
1453 NUMFMT_STRING( 71, "tD/M/EE" ),
1454 NUMFMT_STRING( 72, "tD-MMM-E" ),
1455 NUMFMT_STRING( 73, "tD-MMM" ),
1456 NUMFMT_STRING( 74, "tMMM-E" ),
1457 NUMFMT_STRING( 75, "th:mm" ),
1458 NUMFMT_STRING( 76, "th:mm:ss" ),
1459 NUMFMT_STRING( 77, "tD/M/EE h:mm" ),
1460 NUMFMT_STRING( 78, "tmm:ss" ),
1461 NUMFMT_STRING( 79, "t[h]:mm:ss" ),
1462 NUMFMT_STRING( 80, "tmm:ss.0" ),
1463 NUMFMT_STRING( 81, "D/M/E" ),
1465};
1466
1468const BuiltinFormat spBuiltinFormats_tr_TR[] =
1469{
1470 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1471 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"TL\"", "_T_L", " " ),
1473};
1474
1476const BuiltinFormat spBuiltinFormats_tt_RU[] =
1477{
1478 // space character is group separator, literal spaces must be quoted
1479 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1482};
1483
1485const BuiltinFormat spBuiltinFormats_uk_UA[] =
1486{
1487 // space character is group separator, literal spaces must be quoted
1488 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1491};
1492
1494const BuiltinFormat spBuiltinFormats_ur_PK[] =
1495{
1496 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1499};
1500
1502const BuiltinFormat spBuiltinFormats_vi_VN[] =
1503{
1504 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1507};
1508
1509// CJK ------------------------------------------------------------------------
1510
1512const BuiltinFormat spBuiltinFormats_CJK[] =
1513{
1514 NUMFMT_REUSE( 29, 28 ),
1515 NUMFMT_REUSE( 36, 27 ),
1516 NUMFMT_REUSE( 50, 27 ),
1517 NUMFMT_REUSE( 51, 28 ),
1518 NUMFMT_REUSE( 52, 34 ),
1519 NUMFMT_REUSE( 53, 35 ),
1520 NUMFMT_REUSE( 54, 28 ),
1521 NUMFMT_REUSE( 55, 34 ),
1522 NUMFMT_REUSE( 56, 35 ),
1523 NUMFMT_REUSE( 57, 27 ),
1524 NUMFMT_REUSE( 58, 28 ),
1526};
1527
1529const BuiltinFormat spBuiltinFormats_ja_JP[] =
1530{
1531 NUMFMT_ALLDATETIMES( "YYYY/MM/DD", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1534 NUMFMT_STRING( 27, "[$-411]GE.MM.DD" ),
1535 NUMFMT_STRING( 28, "[$-411]GGGE\"" UTF8_CJ_YEAR "\"MM\"" UTF8_CJ_MON "\"DD\"" UTF8_CJ_DAY "\"" ),
1536 NUMFMT_STRING( 30, "MM/DD/YY" ),
1537 NUMFMT_STRING( 31, "YYYY\"" UTF8_CJ_YEAR "\"MM\"" UTF8_CJ_MON "\"DD\"" UTF8_CJ_DAY "\"" ),
1539 NUMFMT_STRING( 34, "YYYY\"" UTF8_CJ_YEAR "\"MM\"" UTF8_CJ_MON "\"" ),
1540 NUMFMT_STRING( 35, "MM\"" UTF8_CJ_MON "\"DD\"" UTF8_CJ_DAY "\"" ),
1542};
1543
1545const BuiltinFormat spBuiltinFormats_ko_KR[] =
1546{
1547 NUMFMT_ALLDATETIMES( "YYYY-MM-DD", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1550 NUMFMT_STRING( 27, "YYYY" UTF8_CJ_YEAR " MM" UTF8_CJ_MON " DD" UTF8_CJ_DAY ),
1551 NUMFMT_STRING( 28, "MM-DD" ),
1552 NUMFMT_STRING( 30, "MM-DD-YY" ),
1553 NUMFMT_STRING( 31, "YYYY" UTF8_KO_YEAR " MM" UTF8_KO_MON " DD" UTF8_KO_DAY ),
1555 // slashes must be quoted to prevent conversion to minus
1556 NUMFMT_STRING( 34, "YYYY\\/MM\\/DD" ),
1557 NUMFMT_REUSE( 35, 14 ),
1559};
1560
1562const BuiltinFormat spBuiltinFormats_zh_CN[] =
1563{
1564 NUMFMT_ALLDATETIMES( "YYYY-M-D", "D", "-", "MMM", "-", "YY", "h", "h" ),
1568 NUMFMT_STRING( 27, "YYYY\"" UTF8_CS_YEAR "\"M\"" UTF8_CS_MON "\"" ),
1569 NUMFMT_STRING( 28, "M\"" UTF8_CS_MON "\"D\"" UTF8_CS_DAY "\"" ),
1570 NUMFMT_STRING( 30, "M-D-YY" ),
1571 NUMFMT_STRING( 31, "YYYY\"" UTF8_CS_YEAR "\"M\"" UTF8_CS_MON "\"D\"" UTF8_CS_DAY "\"" ),
1572 NUMFMT_REUSE( 52, 27 ),
1573 NUMFMT_REUSE( 53, 28 ),
1575};
1576
1578const BuiltinFormat spBuiltinFormats_zh_HK[] =
1579{
1580 NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1583 NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "\"US$\"", "", "" ),
1584 NUMFMT_STRING( 27, "[$-404]D/M/E" ),
1585 NUMFMT_STRING( 28, "[$-404]D\"" UTF8_CJ_DAY "\"M\"" UTF8_CJ_MON "\"E\"" UTF8_CJ_YEAR "\"" ),
1586 NUMFMT_STRING( 30, "M/D/YY" ),
1587 NUMFMT_STRING( 31, "D\"" UTF8_CJ_DAY "\"M\"" UTF8_CJ_MON "\"YYYY\"" UTF8_CJ_YEAR "\"" ),
1589};
1590
1592const BuiltinFormat spBuiltinFormats_zh_MO[] =
1593{
1594 NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1597 NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "\"US$\"", "", "" ),
1598 NUMFMT_STRING( 27, "[$-404]D/M/E" ),
1599 NUMFMT_STRING( 28, "[$-404]D\"" UTF8_CJ_DAY "\"M\"" UTF8_CJ_MON "\"E\"" UTF8_CJ_YEAR "\"" ),
1600 NUMFMT_STRING( 30, "M/D/YY" ),
1601 NUMFMT_STRING( 31, "D\"" UTF8_CJ_DAY "\"M\"" UTF8_CJ_MON "\"YYYY\"" UTF8_CJ_YEAR "\"" ),
1603};
1604
1606const BuiltinFormat spBuiltinFormats_zh_SG[] =
1607{
1608 NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1612 NUMFMT_STRING( 27, "YYYY\"" UTF8_CS_YEAR "\"M\"" UTF8_CS_MON "\"" ),
1613 NUMFMT_STRING( 28, "M\"" UTF8_CS_MON "\"D\"" UTF8_CS_DAY "\"" ),
1614 NUMFMT_STRING( 30, "M/D/YY" ),
1615 NUMFMT_STRING( 31, "D\"" UTF8_CS_DAY "\"M\"" UTF8_CS_MON "\"YYYY\"" UTF8_CS_YEAR "\"" ),
1617};
1618
1620const BuiltinFormat spBuiltinFormats_zh_TW[] =
1621{
1622 NUMFMT_ALLDATETIMES( "YYYY/M/D", "D", "-", "MMM", "-", "YY", "hh", "hh" ),
1625 NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "\"US$\"", "", "" ),
1626 NUMFMT_STRING( 27, "[$-404]E/M/D" ),
1627 NUMFMT_STRING( 28, "[$-404]E\"" UTF8_CJ_YEAR "\"M\"" UTF8_CJ_MON "\"D\"" UTF8_CJ_DAY "\"" ),
1628 NUMFMT_STRING( 30, "M/D/YY" ),
1629 NUMFMT_STRING( 31, "YYYY\"" UTF8_CJ_YEAR "\"M\"" UTF8_CJ_MON "\"D\"" UTF8_CJ_DAY "\"" ),
1631};
1632
1634struct BuiltinFormatTable
1635{
1636 const char* mpcLocale;
1637 const char* mpcParent;
1638 const BuiltinFormat* mpFormats;
1639};
1640
1641const BuiltinFormatTable spBuiltinFormatTables[] =
1642{ // locale parent format table
1643 { "*", "", spBuiltinFormats_BASE }, // Base table
1644 { "af-ZA", "*", spBuiltinFormats_en_ZA }, // Afrikaans, South Africa
1645 { "ar-AE", "*", spBuiltinFormats_ar_AE }, // Arabic, U.A.E.
1646 { "ar-BH", "*", spBuiltinFormats_ar_BH }, // Arabic, Bahrain
1647 { "ar-DZ", "*", spBuiltinFormats_ar_DZ }, // Arabic, Algeria
1648 { "ar-EG", "*", spBuiltinFormats_ar_EG }, // Arabic, Egypt
1649 { "ar-IQ", "*", spBuiltinFormats_ar_IQ }, // Arabic, Iraq
1650 { "ar-JO", "*", spBuiltinFormats_ar_JO }, // Arabic, Jordan
1651 { "ar-KW", "*", spBuiltinFormats_ar_KW }, // Arabic, Kuwait
1652 { "ar-LB", "*", spBuiltinFormats_ar_LB }, // Arabic, Lebanon
1653 { "ar-LY", "*", spBuiltinFormats_ar_LY }, // Arabic, Libya
1654 { "ar-MA", "*", spBuiltinFormats_ar_MA }, // Arabic, Morocco
1655 { "ar-OM", "*", spBuiltinFormats_ar_OM }, // Arabic, Oman
1656 { "ar-QA", "*", spBuiltinFormats_ar_QA }, // Arabic, Qatar
1657 { "ar-SA", "*", spBuiltinFormats_ar_SA }, // Arabic, Saudi Arabia
1658 { "ar-SY", "*", spBuiltinFormats_ar_SY }, // Arabic, Syria
1659 { "ar-TN", "*", spBuiltinFormats_ar_TN }, // Arabic, Tunisia
1660 { "ar-YE", "*", spBuiltinFormats_ar_YE }, // Arabic, Yemen
1661 { "be-BY", "*", spBuiltinFormats_be_BY }, // Belarusian, Belarus
1662 { "bg-BG", "*", spBuiltinFormats_bg_BG }, // Bulgarian, Bulgaria
1663 { "bn-IN", "*", spBuiltinFormats_bn_IN }, // Bengali, India
1664 { "ca-ES", "*", spBuiltinFormats_es_ES }, // Catalan, Spain
1665 { "cs-CZ", "*", spBuiltinFormats_cs_CZ }, // Czech, Czech Republic
1666 { "cy-GB", "*", spBuiltinFormats_en_GB }, // Welsh, United Kingdom
1667 { "da-DK", "*", spBuiltinFormats_da_DK }, // Danish, Denmark
1668 { "de-AT", "*", spBuiltinFormats_de_AT }, // German, Austria
1669 { "de-CH", "*", spBuiltinFormats_de_CH }, // German, Switzerland
1670 { "de-DE", "*", spBuiltinFormats_de_DE }, // German, Germany
1671 { "de-LI", "*", spBuiltinFormats_de_LI }, // German, Liechtenstein
1672 { "de-LU", "*", spBuiltinFormats_de_LU }, // German, Luxembourg
1673 { "div-MV", "*", spBuiltinFormats_div_MV }, // Divehi, Maldives
1674 { "el-GR", "*", spBuiltinFormats_el_GR }, // Greek, Greece
1675 { "en-AU", "*", spBuiltinFormats_en_AU }, // English, Australia
1676 { "en-BZ", "*", spBuiltinFormats_en_BZ }, // English, Belize
1677 { "en-CA", "*", spBuiltinFormats_en_CA }, // English, Canada
1678 { "en-CB", "*", spBuiltinFormats_en_CB }, // English, Caribbean
1679 { "en-GB", "*", spBuiltinFormats_en_GB }, // English, United Kingdom
1680 { "en-IE", "*", spBuiltinFormats_en_IE }, // English, Ireland
1681 { "en-JM", "*", spBuiltinFormats_en_JM }, // English, Jamaica
1682 { "en-NZ", "*", spBuiltinFormats_en_NZ }, // English, New Zealand
1683 { "en-PH", "*", spBuiltinFormats_en_PH }, // English, Philippines
1684 { "en-TT", "*", spBuiltinFormats_en_TT }, // English, Trinidad and Tobago
1685 { "en-US", "*", spBuiltinFormats_en_US }, // English, USA
1686 { "en-ZA", "*", spBuiltinFormats_en_ZA }, // English, South Africa
1687 { "en-ZW", "*", spBuiltinFormats_en_ZW }, // English, Zimbabwe
1688 { "es-AR", "*", spBuiltinFormats_es_AR }, // Spanish, Argentina
1689 { "es-BO", "*", spBuiltinFormats_es_BO }, // Spanish, Bolivia
1690 { "es-CL", "*", spBuiltinFormats_es_CL }, // Spanish, Chile
1691 { "es-CO", "*", spBuiltinFormats_es_CO }, // Spanish, Colombia
1692 { "es-CR", "*", spBuiltinFormats_es_CR }, // Spanish, Costa Rica
1693 { "es-DO", "*", spBuiltinFormats_es_DO }, // Spanish, Dominican Republic
1694 { "es-EC", "*", spBuiltinFormats_es_EC }, // Spanish, Ecuador
1695 { "es-ES", "*", spBuiltinFormats_es_ES }, // Spanish, Spain
1696 { "es-GT", "*", spBuiltinFormats_es_GT }, // Spanish, Guatemala
1697 { "es-HN", "*", spBuiltinFormats_es_HN }, // Spanish, Honduras
1698 { "es-MX", "*", spBuiltinFormats_es_MX }, // Spanish, Mexico
1699 { "es-NI", "*", spBuiltinFormats_es_NI }, // Spanish, Nicaragua
1700 { "es-PA", "*", spBuiltinFormats_es_PA }, // Spanish, Panama
1701 { "es-PE", "*", spBuiltinFormats_es_PE }, // Spanish, Peru
1702 { "es-PR", "*", spBuiltinFormats_es_PR }, // Spanish, Puerto Rico
1703 { "es-PY", "*", spBuiltinFormats_es_PY }, // Spanish, Paraguay
1704 { "es-SV", "*", spBuiltinFormats_es_SV }, // Spanish, El Salvador
1705 { "es-UY", "*", spBuiltinFormats_es_UY }, // Spanish, Uruguay
1706 { "es-VE", "*", spBuiltinFormats_es_VE }, // Spanish, Venezuela
1707 { "et-EE", "*", spBuiltinFormats_et_EE }, // Estonian, Estonia
1708 { "fa-IR", "*", spBuiltinFormats_fa_IR }, // Farsi, Iran
1709 { "fi-FI", "*", spBuiltinFormats_fi_FI }, // Finnish, Finland
1710 { "fo-FO", "*", spBuiltinFormats_fo_FO }, // Faroese, Faroe Islands
1711 { "fr-BE", "*", spBuiltinFormats_fr_BE }, // French, Belgium
1712 { "fr-CA", "*", spBuiltinFormats_fr_CA }, // French, Canada
1713 { "fr-CH", "*", spBuiltinFormats_fr_CH }, // French, Switzerland
1714 { "fr-FR", "*", spBuiltinFormats_fr_FR }, // French, France
1715 { "fr-LU", "*", spBuiltinFormats_fr_LU }, // French, Luxembourg
1716 { "fr-MC", "*", spBuiltinFormats_fr_MC }, // French, Monaco
1717 { "gl-ES", "*", spBuiltinFormats_gl_ES }, // Galizian, Spain
1718 { "gu-IN", "*", spBuiltinFormats_gu_IN }, // Gujarati, India
1719 { "he-IL", "*", spBuiltinFormats_he_IL }, // Hebrew, Israel
1720 { "hi-IN", "*", spBuiltinFormats_hi_IN }, // Hindi, India
1721 { "hr-BA", "*", spBuiltinFormats_hr_BA }, // Croatian, Bosnia and Herzegowina
1722 { "hr-HR", "*", spBuiltinFormats_hr_HR }, // Croatian, Croatia
1723 { "hu-HU", "*", spBuiltinFormats_hu_HU }, // Hungarian, Hungary
1724 { "hy-AM", "*", spBuiltinFormats_hy_AM }, // Armenian, Armenia
1725 { "id-ID", "*", spBuiltinFormats_id_ID }, // Indonesian, Indonesia
1726 { "is-IS", "*", spBuiltinFormats_is_IS }, // Icelandic, Iceland
1727 { "it-CH", "*", spBuiltinFormats_it_CH }, // Italian, Switzerland
1728 { "it-IT", "*", spBuiltinFormats_it_IT }, // Italian, Italy
1729 { "ka-GE", "*", spBuiltinFormats_ka_GE }, // Georgian, Georgia
1730 { "kk-KZ", "*", spBuiltinFormats_kk_KZ }, // Kazakh, Kazakhstan
1731 { "kn-IN", "*", spBuiltinFormats_kn_IN }, // Kannada, India
1732 { "kok-IN", "*", spBuiltinFormats_hi_IN }, // Konkani, India
1733 { "ky-KG", "*", spBuiltinFormats_ky_KG }, // Kyrgyz, Kyrgyzstan
1734 { "lt-LT", "*", spBuiltinFormats_lt_LT }, // Lithuanian, Lithuania
1735 { "lv-LV", "*", spBuiltinFormats_lv_LV }, // Latvian, Latvia
1736 { "mi-NZ", "*", spBuiltinFormats_en_NZ }, // Maori, New Zealand
1737 { "ml-IN", "*", spBuiltinFormats_ml_IN }, // Malayalam, India
1738 { "mn-MN", "*", spBuiltinFormats_mn_MN }, // Mongolian, Mongolia
1739 { "mr-IN", "*", spBuiltinFormats_hi_IN }, // Marathi, India
1740 { "ms-BN", "*", spBuiltinFormats_ms_BN }, // Malay, Brunei Darussalam
1741 { "ms-MY", "*", spBuiltinFormats_ms_MY }, // Malay, Malaysia
1742 { "mt-MT", "*", spBuiltinFormats_mt_MT }, // Maltese, Malta
1743 { "nb-NO", "*", spBuiltinFormats_no_NO }, // Norwegian Bokmal, Norway
1744 { "nl-BE", "*", spBuiltinFormats_nl_BE }, // Dutch, Belgium
1745 { "nl-NL", "*", spBuiltinFormats_nl_NL }, // Dutch, Netherlands
1746 { "nn-NO", "*", spBuiltinFormats_no_NO }, // Norwegian Nynorsk, Norway
1747 { "nso-ZA", "*", spBuiltinFormats_en_ZA }, // Northern Sotho, South Africa
1748 { "pa-IN", "*", spBuiltinFormats_pa_IN }, // Punjabi, India
1749 { "pl-PL", "*", spBuiltinFormats_pl_PL }, // Polish, Poland
1750 { "pt-BR", "*", spBuiltinFormats_pt_BR }, // Portuguese, Brazil
1751 { "pt-PT", "*", spBuiltinFormats_pt_PT }, // Portuguese, Portugal
1752 { "qu-BO", "*", spBuiltinFormats_es_BO }, // Quechua, Bolivia
1753 { "qu-EC", "*", spBuiltinFormats_es_EC }, // Quechua, Ecuador
1754 { "qu-PE", "*", spBuiltinFormats_es_PE }, // Quechua, Peru
1755 { "ro-RO", "*", spBuiltinFormats_ro_RO }, // Romanian, Romania
1756 { "ru-RU", "*", spBuiltinFormats_ru_RU }, // Russian, Russian Federation
1757 { "sa-IN", "*", spBuiltinFormats_hi_IN }, // Sanskrit, India
1758 { "se-FI", "*", spBuiltinFormats_fi_FI }, // Sami, Finland
1759 { "se-NO", "*", spBuiltinFormats_no_NO }, // Sami, Norway
1760 { "se-SE", "*", spBuiltinFormats_sv_SE }, // Sami, Sweden
1761 { "sk-SK", "*", spBuiltinFormats_sk_SK }, // Slovak, Slovakia
1762 { "sl-SI", "*", spBuiltinFormats_sl_SI }, // Slovenian, Slovenia
1763 { "sv-FI", "*", spBuiltinFormats_sv_FI }, // Swedish, Finland
1764 { "sv-SE", "*", spBuiltinFormats_sv_SE }, // Swedish, Sweden
1765 { "sw-TZ", "*", spBuiltinFormats_sw_TZ }, // Swahili, Tanzania
1766 { "syr-SY", "*", spBuiltinFormats_ar_SY }, // Syriac, Syria
1767 { "syr-TR", "*", spBuiltinFormats_tr_TR }, // Syriac, Turkey
1768 { "ta-IN", "*", spBuiltinFormats_ta_IN }, // Tamil, India
1769 { "te-IN", "*", spBuiltinFormats_te_IN }, // Telugu, India
1770 { "th-TH", "*", spBuiltinFormats_th_TH }, // Thai, Thailand
1771 { "tn-ZA", "*", spBuiltinFormats_en_ZA }, // Tswana, South Africa
1772 { "tr-TR", "*", spBuiltinFormats_tr_TR }, // Turkish, Turkey
1773 { "tt-RU", "*", spBuiltinFormats_tt_RU }, // Tatar, Russian Federation
1774 { "uk-UA", "*", spBuiltinFormats_uk_UA }, // Ukrainian, Ukraine
1775 { "ur-PK", "*", spBuiltinFormats_ur_PK }, // Urdu, Pakistan
1776 { "vi-VN", "*", spBuiltinFormats_vi_VN }, // Vietnamese, Viet Nam
1777 { "xh-ZA", "*", spBuiltinFormats_en_ZA }, // Xhosa, South Africa
1778 { "zu-ZA", "*", spBuiltinFormats_en_ZA }, // Zulu, South Africa
1779
1780 { "*CJK", "*", spBuiltinFormats_CJK }, // CJK base table
1781 { "ja-JP", "*CJK", spBuiltinFormats_ja_JP }, // Japanese, Japan
1782 { "ko-KR", "*CJK", spBuiltinFormats_ko_KR }, // Korean, South Korea
1783 { "zh-CN", "*CJK", spBuiltinFormats_zh_CN }, // Chinese, China
1784 { "zh-HK", "*CJK", spBuiltinFormats_zh_HK }, // Chinese, Hong Kong
1785 { "zh-MO", "*CJK", spBuiltinFormats_zh_MO }, // Chinese, Macau
1786 { "zh-SG", "*CJK", spBuiltinFormats_zh_SG }, // Chinese, Singapore
1787 { "zh-TW", "*CJK", spBuiltinFormats_zh_TW } // Chinese, Taiwan
1788};
1789
1790} // namespace
1791
1793 mnPredefId( -1 )
1794{
1795}
1796
1798 mnIndex( 0 )
1799{
1800}
1801
1802namespace {
1803
1804sal_Int32 lclCreatePredefinedFormat( const Reference< XNumberFormats >& rxNumFmts,
1805 sal_Int16 nPredefId, const Locale& rToLocale )
1806{
1807 sal_Int32 nIndex = 0;
1808 try
1809 {
1810 Reference< XNumberFormatTypes > xNumFmtTypes( rxNumFmts, UNO_QUERY_THROW );
1811 nIndex = (nPredefId >= 0) ?
1812 xNumFmtTypes->getFormatIndex( nPredefId, rToLocale ) :
1813 xNumFmtTypes->getStandardIndex( rToLocale );
1814 }
1815 catch( Exception& )
1816 {
1817 OSL_FAIL( OStringBuffer( "lclCreatePredefinedFormat - cannot create predefined number format " ).
1818 append( OString::number( nPredefId ) ).getStr() );
1819 }
1820 return nIndex;
1821}
1822
1823sal_Int32 lclCreateFormat( const Reference< XNumberFormats >& rxNumFmts,
1824 const OUString& rFmtCode, const Locale& rToLocale, const Locale& rFromLocale )
1825{
1826 sal_Int32 nIndex = 0;
1827 try
1828 {
1829 nIndex = rxNumFmts->addNewConverted( rFmtCode, rFromLocale, rToLocale );
1830 }
1831 catch( Exception& )
1832 {
1833 // BIFF2-BIFF4 stores standard format explicitly in stream
1834 if( rFmtCode.equalsIgnoreAsciiCase( "general" ) )
1835 {
1836 nIndex = lclCreatePredefinedFormat( rxNumFmts, 0, rToLocale );
1837 }
1838 else
1839 {
1840 // do not assert fractional number formats with fixed denominator
1841 OSL_ENSURE( rFmtCode.startsWith( "#\\ ?/" ) ||
1842 rFmtCode.startsWith( "#\\ ?\?/" ) ||
1843 rFmtCode.startsWith( "#\\ ?\?\?/" ),
1844 OStringBuffer( "lclCreateFormat - cannot create number format '"
1845 + OUStringToOString( rFmtCode, osl_getThreadTextEncoding() )
1846 + "\'" ).getStr() );
1847 }
1848 }
1849 return nIndex;
1850}
1851
1853class NumberFormatFinalizer
1854{
1855public:
1856 explicit NumberFormatFinalizer( const WorkbookHelper& rHelper );
1857
1858 void operator()( NumberFormat& rNumFmt ) const
1859 { rNumFmt.finalizeImport( mxNumFmts, maEnUsLocale ); }
1860
1861private:
1862 Reference< XNumberFormats > mxNumFmts;
1864};
1865
1866NumberFormatFinalizer::NumberFormatFinalizer( const WorkbookHelper& rHelper ) :
1867 maEnUsLocale( "en", "US", OUString() )
1868{
1869 try
1870 {
1871 Reference< XNumberFormatsSupplier > xNumFmtsSupp( rHelper.getDocument(), UNO_QUERY_THROW );
1872 mxNumFmts = xNumFmtsSupp->getNumberFormats();
1873 }
1874 catch( Exception& )
1875 {
1876 }
1877 OSL_ENSURE( mxNumFmts.is(), "NumberFormatFinalizer::NumberFormatFinalizer - cannot get number formats" );
1878}
1879
1880sal_Int32 lclPosToken ( std::u16string_view sFormat, std::u16string_view sSearch, sal_Int32 nStartPos )
1881{
1882 sal_Int32 nLength = sFormat.size();
1883 for ( sal_Int32 i = nStartPos; i < nLength && i >= 0 ; i++ )
1884 {
1885 size_t nFind = i;
1886 switch(sFormat[i])
1887 {
1888 case '\"' : // skip text
1889 nFind = sFormat.find('\"',i+1);
1890 break;
1891 case '[' : // skip condition
1892 nFind = sFormat.find(']',i+1);
1893 break;
1894 default :
1895 if ( o3tl::starts_with(sFormat.substr(i), sSearch) )
1896 return i;
1897 break;
1898 }
1899 if ( nFind == std::u16string_view::npos )
1900 return -2;
1901 i = nFind;
1902 }
1903 return -2;
1904}
1905
1906} // namespace
1907
1908NumberFormat::NumberFormat( const WorkbookHelper& rHelper ) :
1909 WorkbookHelper( rHelper )
1910{
1911}
1912
1913void NumberFormat::setFormatCode( std::u16string_view aFmtCode )
1914{
1915 // Special case for fraction code '\ ?/?', it is passed to us in xml, the '\' is not
1916 // an escape character but merely should be telling the formatter to display the next
1917 // char in the format ( afaics it does that anyhow )
1918 sal_Int32 nPosEscape = 0;
1919 sal_Int32 nErase = 0;
1920 sal_Int32 nLastIndex = sal_Int32(aFmtCode.size()) - 1;
1921 OUStringBuffer sFormat(aFmtCode);
1922
1923 while ( ( nPosEscape = lclPosToken( aFmtCode, u"\\ ", nPosEscape ) ) > 0 )
1924 {
1925 sal_Int32 nPos = nPosEscape + 2;
1926 while ( nPos < nLastIndex && ( aFmtCode[nPos] == '?' || aFmtCode[nPos] == '#' || aFmtCode[nPos] == '0' ) )
1927 nPos++;
1928 if ( nPos < nLastIndex && aFmtCode[nPos] == '/' )
1929 {
1930 sFormat.remove(nPosEscape - nErase, 1);
1931 nErase ++;
1932 } // tdf#81939 preserve other escape characters
1933 nPosEscape = lclPosToken( aFmtCode, u";", nPosEscape ); // skip to next format
1934 }
1935 maModel.maFmtCode = sFormat.makeStringAndClear();
1936}
1937
1938void NumberFormat::setFormatCode( const Locale& rLocale, const char* pcFmtCode )
1939{
1940 maModel.maLocale = rLocale;
1941 maModel.maFmtCode = OStringToOUString( std::string_view( pcFmtCode ), RTL_TEXTENCODING_UTF8 );
1942 maModel.mnPredefId = -1;
1943}
1944
1945void NumberFormat::setPredefinedId( const Locale& rLocale, sal_Int16 nPredefId )
1946{
1947 maModel.maLocale = rLocale;
1948 maModel.maFmtCode.clear();
1949 maModel.mnPredefId = nPredefId;
1950}
1951
1952void NumberFormat::finalizeImport( const Reference< XNumberFormats >& rxNumFmts, const Locale& rFromLocale )
1953{
1954 if( rxNumFmts.is() && !maModel.maFmtCode.isEmpty() )
1955 maApiData.mnIndex = lclCreateFormat( rxNumFmts, maModel.maFmtCode, maModel.maLocale, rFromLocale );
1956 else
1957 maApiData.mnIndex = lclCreatePredefinedFormat( rxNumFmts, maModel.mnPredefId, maModel.maLocale );
1958}
1959
1960sal_uInt32 NumberFormat::fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs ) const
1961{
1962 const ScDocument& rDoc = getScDocument();
1963 static sal_uInt32 nDflt = rDoc.GetFormatTable()->GetStandardIndex( ScGlobal::eLnge );
1964 sal_uInt32 nScNumFmt = nDflt;
1965 if ( maApiData.mnIndex )
1966 nScNumFmt = maApiData.mnIndex;
1967
1968 ScfTools::PutItem( rItemSet, SfxUInt32Item( ATTR_VALUE_FORMAT, nScNumFmt ), bSkipPoolDefs );
1969 if( rItemSet.GetItemState( ATTR_VALUE_FORMAT, false ) == SfxItemState::SET )
1970 ScGlobal::AddLanguage( rItemSet, *(rDoc.GetFormatTable()) );
1971 else
1972 nScNumFmt = 0;
1973
1974 return nScNumFmt;
1975}
1976
1978 : WorkbookHelper(rHelper)
1979 , mnHighestId(0)
1980{
1981 // get the current locale
1982 // try user-defined locale setting
1983 maLocaleStr = officecfg::Setup::L10N::ooSetupSystemLocale::get();
1984 // if set to "use system", get locale from system
1985 if( maLocaleStr.isEmpty() )
1986 maLocaleStr = officecfg::System::L10N::Locale::get();
1987
1988 // create built-in formats for current locale
1990}
1991
1992NumberFormatRef NumberFormatsBuffer::createNumFmt( sal_uInt32 nNumFmtId, std::u16string_view aFmtCode )
1993{
1994 NumberFormatRef xNumFmt;
1995 xNumFmt = std::make_shared<NumberFormat>( *this );
1996 maNumFmts[ nNumFmtId ] = xNumFmt;
1997 if ( nNumFmtId > mnHighestId )
1998 mnHighestId = nNumFmtId;
1999 xNumFmt->setFormatCode( aFmtCode );
2000 return xNumFmt;
2001}
2002
2004{
2005 sal_Int32 nNumFmtId = rAttribs.getInteger( XML_numFmtId, -1 );
2006 OUString aFmtCode = rAttribs.getXString( XML_formatCode, OUString() );
2007 return createNumFmt( nNumFmtId, aFmtCode );
2008}
2009
2011{
2012 sal_Int32 nNumFmtId = rStrm.readuInt16();
2013 OUString aFmtCode = BiffHelper::readString( rStrm );
2014 createNumFmt( nNumFmtId, aFmtCode );
2015}
2016
2018{
2019 maNumFmts.forEach( NumberFormatFinalizer( *this ) );
2020}
2021
2022sal_uInt32 NumberFormatsBuffer::fillToItemSet( SfxItemSet& rItemSet, sal_uInt32 nNumFmtId, bool bSkipPoolDefs ) const
2023{
2024 const NumberFormat* pNumFmt = maNumFmts.get(nNumFmtId).get();
2025 if (!pNumFmt)
2026 return 0;
2027
2028 return pNumFmt->fillToItemSet( rItemSet, bSkipPoolDefs);
2029}
2030
2032{
2033 // build a map containing pointers to all tables
2034 typedef ::std::map< OUString, const BuiltinFormatTable* > BuiltinMap;
2035 BuiltinMap aBuiltinMap;
2036 for(auto const &rTable : spBuiltinFormatTables)
2037 aBuiltinMap[ OUString::createFromAscii(rTable.mpcLocale) ] = &rTable;
2038
2039 // convert locale string to locale struct
2041
2042 // build a list of table pointers for the current locale, with all parent tables
2043 typedef ::std::vector< const BuiltinFormatTable* > BuiltinVec;
2044 BuiltinVec aBuiltinVec;
2045 BuiltinMap::const_iterator aMIt = aBuiltinMap.find( maLocaleStr ), aMEnd = aBuiltinMap.end();
2046 OSL_ENSURE( aMIt != aMEnd,
2047 OStringBuffer( "NumberFormatsBuffer::insertBuiltinFormats - locale '" +
2048 OUStringToOString( maLocaleStr, RTL_TEXTENCODING_ASCII_US ) +
2049 "' not supported (#i29949#)" ).getStr() );
2050 // start with default table, if no table has been found
2051 if( aMIt == aMEnd )
2052 aMIt = aBuiltinMap.find( "*" );
2053 OSL_ENSURE( aMIt != aMEnd, "NumberFormatsBuffer::insertBuiltinFormats - default map not found" );
2054 // insert all tables into the vector
2055 for( ; aMIt != aMEnd; aMIt = aBuiltinMap.find( OUString::createFromAscii( aMIt->second->mpcParent ) ) )
2056 aBuiltinVec.push_back( aMIt->second );
2057
2058 // insert the default formats in the format map (in reverse order from default table to system locale)
2059 std::map< sal_uInt32, sal_uInt32 > aReuseMap;
2060 for( BuiltinVec::reverse_iterator aVIt = aBuiltinVec.rbegin(), aVEnd = aBuiltinVec.rend(); aVIt != aVEnd; ++aVIt )
2061 {
2062 // do not put the current system locale for default table
2063 Locale aLocale;
2064 if( (*aVIt)->mpcParent[ 0 ] != '\0' && OUString::createFromAscii((*aVIt)->mpcLocale) != maLocaleStr )
2065 aLocale = aSysLocale;
2066 for( const BuiltinFormat* pBuiltin = (*aVIt)->mpFormats; pBuiltin && (pBuiltin->mnNumFmtId >= 0); ++pBuiltin )
2067 {
2068 NumberFormatRef& rxNumFmt = maNumFmts[ pBuiltin->mnNumFmtId ];
2069 rxNumFmt = std::make_shared<NumberFormat>( *this );
2070
2071 bool bReuse = false;
2072 if( pBuiltin->mpcFmtCode )
2073 rxNumFmt->setFormatCode( aLocale, pBuiltin->mpcFmtCode );
2074 else if( pBuiltin->mnPredefId >= 0 )
2075 rxNumFmt->setPredefinedId( aLocale, pBuiltin->mnPredefId );
2076 else
2077 bReuse = pBuiltin->mnReuseId >= 0;
2078
2079 if( bReuse )
2080 aReuseMap[ pBuiltin->mnNumFmtId ] = pBuiltin->mnReuseId;
2081 else
2082 aReuseMap.erase( pBuiltin->mnNumFmtId );
2083 }
2084 }
2085
2086 // copy reused number formats
2087 for( const auto& [rNumFmtId, rReuseId] : aReuseMap )
2088 {
2089 maNumFmts[ rNumFmtId ] = maNumFmts[ rReuseId ];
2090 if ( rNumFmtId > mnHighestId )
2091 mnHighestId = rNumFmtId;
2092 }
2093}
2094
2095} // namespace oox
2096
2097/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Definition: documen2.cxx:467
static SC_DLLPUBLIC LanguageType eLnge
Definition: global.hxx:560
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:1003
static void PutItem(SfxItemSet &rItemSet, const SfxPoolItem &rItem, sal_uInt16 nWhichId, bool bSkipPoolDef)
Puts the item into the passed item set.
Definition: ftools.cxx:214
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
sal_uInt32 GetStandardIndex(LanguageType eLnge=LANGUAGE_DONTKNOW)
std::optional< OUString > getXString(sal_Int32 nAttrToken) const
std::optional< sal_Int32 > getInteger(sal_Int32 nAttrToken) const
mapped_type get(key_type nKey) const
void forEach(const FunctorType &rFunctor) 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:79
Contains all data for a number format code.
void setFormatCode(std::u16string_view aFmtCode)
Sets the passed format code.
void finalizeImport(const css::uno::Reference< css::util::XNumberFormats > &rxNumFmts, const css::lang::Locale &rFromLocale)
Final processing after import of all style settings.
sal_uInt32 fillToItemSet(SfxItemSet &rItemSet, bool bSkipPoolDefs=false) const
void setPredefinedId(const css::lang::Locale &rLocale, sal_Int16 nPredefId)
Sets the passed predefined format code identifier.
NumberFormatRef createNumFmt(sal_uInt32 nNumFmtId, std::u16string_view aFmtCode)
Inserts a new number format.
NumberFormatRef importNumFmt(const AttributeList &rAttribs)
Inserts a new number format code.
OUString maLocaleStr
List of number formats.
NumberFormatsBuffer(const WorkbookHelper &rHelper)
sal_uInt32 mnHighestId
Current office locale.
void insertBuiltinFormats()
Inserts built-in number formats for the current system language.
sal_uInt32 fillToItemSet(SfxItemSet &rItemSet, sal_uInt32 nNumFmtId, bool bSkipPoolDefs) const
void finalizeImport()
Final processing after import of all style settings.
Helper class to provide access to global workbook data.
float u
sal_Int32 nIndex
sal_uInt16 nPos
int i
void SvStream & rStrm
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
std::shared_ptr< NumberFormat > NumberFormatRef
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
#define UTF8_HY_DA_LC
#define UTF8_CYR_N_LC
#define UTF8_CURR_AR_IQ
#define NUMFMT_STRING(INDEX, FORMATCODE)
Defines a literal built-in number format.
#define UTF8_CYR_M_LC
#define UTF8_CCARON_LC
#define UTF8_CS_HOUR
#define NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER(INDEX, SYMBOL, SPACE, MODIF)
Defines builtin currency formats INDEX...INDEX+3 in the following format: "[minus],...
const char * mpcParent
The locale for this table.
#define UTF8_CJ_YEAR
#define UTF8_CURR_AR_AE
Locale maEnUsLocale
#define UTF8_YEN_CN
#define UTF8_CURR_AR_TN
#define UTF8_CS_YEAR
#define UTF8_CJ_MIN
#define UTF8_EURO
#define UTF8_CURR_KN_IN
const char * mpcLocale
#define UTF8_KO_HOUR
#define NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER(SYMBOL, SPACE)
Defines builtin currency formats 5...8 (with currency symbol), 37...40 (blind currency symbol),...
#define UTF8_CURR_TA_IN
#define UTF8_CURR_AR_OM
#define UTF8_CS_SEC
sal_Int32 mnReuseId
Predefined format index, if mpcFmtCode is 0.
#define NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER(SYMBOL, SPACE)
Defines builtin currency formats 5...8 (with currency symbol), 37...40 (blind currency symbol),...
#define UTF8_KO_SEC
#define NUMFMT_ACCOUNTING_MINUS_SYMBOL_NUMBER(INDEX, SYMBOL, SPACE)
Defines builtin accounting formats INDEX...INDEX+3 in the following order: "[minus],...
#define UTF8_CS_DAY
#define UTF8_CYR_O_LC
#define UTF8_CURR_AR_SY
#define UTF8_CURR_AR_YE
#define UTF8_CYR_W_LC
#define UTF8_CS_MIN
#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_CURR_PA_IN
const BuiltinFormat * mpFormats
The locale of the parent table.
#define UTF8_CYR_R_LC
sal_Int16 mnPredefId
Format string, UTF-8, may be 0 (mnPredefId is used then).
#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_OPEN_SYMBOL_NUMBER_CLOSE(SYMBOL, SPACE)
Defines builtin currency formats 5...8 (with currency symbol), 37...40 (blind currency symbol),...
#define UTF8_CURR_AR_DZ
#define UTF8_CURR_AR_LB
#define UTF8_KO_YEAR
#define UTF8_WON
#define UTF8_RUFIYAA
#define UTF8_CURR_AR_QA
#define UTF8_CJ_MON
#define UTF8_CURR_AR_MA
#define UTF8_CURR_AR_LY
#define NUMFMT_ALLCURRENCIES_NUMBER_SYMBOL_MINUS(SYMBOL, BLINDS, SPACE)
Defines builtin currency formats 5...8 (with currency symbol), 37...40 (blind currency symbol),...
#define UTF8_CJ_DAY
#define NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL(SYMBOL, BLINDS, SPACE)
Defines builtin currency formats 5...8 (with currency symbol), 37...40 (blind currency symbol),...
#define UTF8_CURR_AR_JO
#define UTF8_BAHT
#define UTF8_TUGRUG
#define NUMFMT_REUSE(INDEX, REUSED_INDEX)
Defines a built-in number format that is the same as the specified in nReuseId.
#define UTF8_CYR_L_LC
#define UTF8_CJ_SEC
const char * mpcFmtCode
Built-in number format index.
sal_Int32 mnNumFmtId
#define UTF8_YEN_JP
#define NUMFMT_ALLTIMES_CJK(HOUR12, HOUR24, HOUR, MINUTE, SECOND)
Defines builtin time formats 32...35 for CJK locales.
#define UTF8_POUND_GB
#define UTF8_COLON
#define UTF8_CURR_FA_IR
#define UTF8_CURR_AR_BH
#define NUMFMT_PREDEF(INDEX, PREDEFINED)
Defines a built-in number format that maps to an own predefined format.
#define UTF8_CURR_AR_EG
#define UTF8_CURR_AR_SA
#define UTF8_CURR_TE_IN
#define UTF8_CURR_GU_IN
#define UTF8_CURR_ML_IN
#define UTF8_KO_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_DONG
#define UTF8_CYR_G_LC
#define NUMFMT_TIME_CJK(INDEX, HOURFORMAT, HOUR, MINUTE, SECOND)
Defines builtin time formats INDEX and INDEX+1 for CJK locales.
#define UTF8_SHEQEL
#define UTF8_CURR_AR_KW
#define UTF8_HY_REH_LC
#define UTF8_CYR_S_LC
#define UTF8_CS_MON
#define NUMFMT_ENDTABLE()
Terminates a built-in number format table.
#define UTF8_KO_MON
#define NUMFMT_ALLDATETIMES(SYSTEMDATE, DAY, DAYSEP, MONTH, MONTHSEP, YEAR, HOUR12, HOUR24)
Defines builtin date and time formats 14...22.
#define UTF8_CURR_BN_IN
#define UTF8_LSTROKE_LC
#define UTF8_CJ_HOUR
Reference< XNumberFormats > mxNumFmts
#define UTF8_CURR_HI_IN
#define UTF8_KO_DAY
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
ApiNumFmtData()
API number format index.
css::lang::Locale maLocale
sal_uInt32 mnIndex
TEXT
sal_Int32 nLength