22 #include <string_view>
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>
44 #include <oox/token/tokens.hxx>
46 #include <document.hxx>
67 #define NUMFMT_STRING( INDEX, FORMATCODE ) \
68 { INDEX, FORMATCODE, -1, -1 }
71 #define NUMFMT_PREDEF( INDEX, PREDEFINED ) \
72 { INDEX, nullptr, css::i18n::NumberFormatIndex::PREDEFINED, -1 }
75 #define NUMFMT_REUSE( INDEX, REUSED_INDEX ) \
76 { INDEX, nullptr, -1, REUSED_INDEX }
79 #define NUMFMT_ENDTABLE() \
80 { -1, nullptr, -1, -1 }
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" )
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 "\"" )
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 )
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" )
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 "* \"-\"?\?_ ;" "_ @_ " )
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 )
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-" )
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 "* \"-\"?\?_-;" "_-@_-" )
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 )
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 "-" )
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 "_-;_-@_-" )
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 )
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" )
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 "* \"-\"?\?_-;" "_-@_-" )
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 )
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 )
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 "_-;_-@_-" )
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 )
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)" )
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 "* \"-\"?\?_);" "_(@_)" )
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 )
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 ")" )
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 "_ ;_ @_ " )
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 )
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"
398 #define UTF8_CCARON_LC "\304\215"
399 #define UTF8_LSTROKE_LC "\305\202"
401 #define UTF8_HY_DA_LC "\325\244"
402 #define UTF8_HY_REH_LC "\326\200"
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"
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"
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"
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"
438 const BuiltinFormat spBuiltinFormats_BASE[] =
534 const BuiltinFormat spBuiltinFormats_ar_AE[] =
542 const BuiltinFormat spBuiltinFormats_ar_BH[] =
550 const BuiltinFormat spBuiltinFormats_ar_DZ[] =
558 const BuiltinFormat spBuiltinFormats_ar_EG[] =
566 const BuiltinFormat spBuiltinFormats_ar_IQ[] =
574 const BuiltinFormat spBuiltinFormats_ar_JO[] =
582 const BuiltinFormat spBuiltinFormats_ar_KW[] =
590 const BuiltinFormat spBuiltinFormats_ar_LB[] =
598 const BuiltinFormat spBuiltinFormats_ar_LY[] =
606 const BuiltinFormat spBuiltinFormats_ar_MA[] =
614 const BuiltinFormat spBuiltinFormats_ar_OM[] =
622 const BuiltinFormat spBuiltinFormats_ar_QA[] =
630 const BuiltinFormat spBuiltinFormats_ar_SA[] =
638 const BuiltinFormat spBuiltinFormats_ar_SY[] =
646 const BuiltinFormat spBuiltinFormats_ar_TN[] =
654 const BuiltinFormat spBuiltinFormats_ar_YE[] =
662 const BuiltinFormat spBuiltinFormats_be_BY[] =
671 const BuiltinFormat spBuiltinFormats_bg_BG[] =
680 const BuiltinFormat spBuiltinFormats_bn_IN[] =
688 const BuiltinFormat spBuiltinFormats_cs_CZ[] =
697 const BuiltinFormat spBuiltinFormats_da_DK[] =
705 const BuiltinFormat spBuiltinFormats_de_AT[] =
713 const BuiltinFormat spBuiltinFormats_de_CH[] =
721 const BuiltinFormat spBuiltinFormats_de_DE[] =
729 const BuiltinFormat spBuiltinFormats_de_LI[] =
737 const BuiltinFormat spBuiltinFormats_de_LU[] =
745 const BuiltinFormat spBuiltinFormats_div_MV[] =
753 const BuiltinFormat spBuiltinFormats_el_GR[] =
761 const BuiltinFormat spBuiltinFormats_en_AU[] =
769 const BuiltinFormat spBuiltinFormats_en_BZ[] =
777 const BuiltinFormat spBuiltinFormats_en_CA[] =
785 const BuiltinFormat spBuiltinFormats_en_CB[] =
793 const BuiltinFormat spBuiltinFormats_en_GB[] =
801 const BuiltinFormat spBuiltinFormats_en_IE[] =
809 const BuiltinFormat spBuiltinFormats_en_JM[] =
817 const BuiltinFormat spBuiltinFormats_en_NZ[] =
825 const BuiltinFormat spBuiltinFormats_en_PH[] =
833 const BuiltinFormat spBuiltinFormats_en_TT[] =
841 const BuiltinFormat spBuiltinFormats_en_US[] =
849 const BuiltinFormat spBuiltinFormats_en_ZA[] =
857 const BuiltinFormat spBuiltinFormats_en_ZW[] =
865 const BuiltinFormat spBuiltinFormats_es_AR[] =
873 const BuiltinFormat spBuiltinFormats_es_BO[] =
882 const BuiltinFormat spBuiltinFormats_es_CL[] =
890 const BuiltinFormat spBuiltinFormats_es_CO[] =
898 const BuiltinFormat spBuiltinFormats_es_CR[] =
906 const BuiltinFormat spBuiltinFormats_es_DO[] =
914 const BuiltinFormat spBuiltinFormats_es_EC[] =
922 const BuiltinFormat spBuiltinFormats_es_ES[] =
930 const BuiltinFormat spBuiltinFormats_es_GT[] =
938 const BuiltinFormat spBuiltinFormats_es_HN[] =
947 const BuiltinFormat spBuiltinFormats_es_MX[] =
955 const BuiltinFormat spBuiltinFormats_es_NI[] =
964 const BuiltinFormat spBuiltinFormats_es_PA[] =
972 const BuiltinFormat spBuiltinFormats_es_PE[] =
980 const BuiltinFormat spBuiltinFormats_es_PR[] =
989 const BuiltinFormat spBuiltinFormats_es_PY[] =
997 const BuiltinFormat spBuiltinFormats_es_SV[] =
1006 const BuiltinFormat spBuiltinFormats_es_UY[] =
1014 const BuiltinFormat spBuiltinFormats_es_VE[] =
1022 const BuiltinFormat spBuiltinFormats_et_EE[] =
1031 const BuiltinFormat spBuiltinFormats_fa_IR[] =
1039 const BuiltinFormat spBuiltinFormats_fi_FI[] =
1050 const BuiltinFormat spBuiltinFormats_fo_FO[] =
1058 const BuiltinFormat spBuiltinFormats_fr_BE[] =
1066 const BuiltinFormat spBuiltinFormats_fr_CA[] =
1075 const BuiltinFormat spBuiltinFormats_fr_CH[] =
1083 const BuiltinFormat spBuiltinFormats_fr_FR[] =
1092 const BuiltinFormat spBuiltinFormats_fr_LU[] =
1101 const BuiltinFormat spBuiltinFormats_fr_MC[] =
1110 const BuiltinFormat spBuiltinFormats_gl_ES[] =
1118 const BuiltinFormat spBuiltinFormats_gu_IN[] =
1126 const BuiltinFormat spBuiltinFormats_he_IL[] =
1134 const BuiltinFormat spBuiltinFormats_hi_IN[] =
1142 const BuiltinFormat spBuiltinFormats_hr_BA[] =
1150 const BuiltinFormat spBuiltinFormats_hr_HR[] =
1158 const BuiltinFormat spBuiltinFormats_hu_HU[] =
1168 const BuiltinFormat spBuiltinFormats_hy_AM[] =
1176 const BuiltinFormat spBuiltinFormats_id_ID[] =
1184 const BuiltinFormat spBuiltinFormats_is_IS[] =
1192 const BuiltinFormat spBuiltinFormats_it_CH[] =
1200 const BuiltinFormat spBuiltinFormats_it_IT[] =
1208 const BuiltinFormat spBuiltinFormats_ka_GE[] =
1217 const BuiltinFormat spBuiltinFormats_kk_KZ[] =
1226 const BuiltinFormat spBuiltinFormats_kn_IN[] =
1234 const BuiltinFormat spBuiltinFormats_ky_KG[] =
1243 const BuiltinFormat spBuiltinFormats_lt_LT[] =
1251 const BuiltinFormat spBuiltinFormats_lv_LV[] =
1260 const BuiltinFormat spBuiltinFormats_ml_IN[] =
1268 const BuiltinFormat spBuiltinFormats_mn_MN[] =
1276 const BuiltinFormat spBuiltinFormats_ms_BN[] =
1284 const BuiltinFormat spBuiltinFormats_ms_MY[] =
1292 const BuiltinFormat spBuiltinFormats_mt_MT[] =
1300 const BuiltinFormat spBuiltinFormats_nl_BE[] =
1309 const BuiltinFormat spBuiltinFormats_nl_NL[] =
1317 const BuiltinFormat spBuiltinFormats_no_NO[] =
1326 const BuiltinFormat spBuiltinFormats_pa_IN[] =
1334 const BuiltinFormat spBuiltinFormats_pl_PL[] =
1344 const BuiltinFormat spBuiltinFormats_pt_BR[] =
1352 const BuiltinFormat spBuiltinFormats_pt_PT[] =
1360 const BuiltinFormat spBuiltinFormats_ro_RO[] =
1369 const BuiltinFormat spBuiltinFormats_ru_RU[] =
1378 const BuiltinFormat spBuiltinFormats_sk_SK[] =
1387 const BuiltinFormat spBuiltinFormats_sl_SI[] =
1395 const BuiltinFormat spBuiltinFormats_sv_FI[] =
1406 const BuiltinFormat spBuiltinFormats_sv_SE[] =
1415 const BuiltinFormat spBuiltinFormats_sw_TZ[] =
1423 const BuiltinFormat spBuiltinFormats_ta_IN[] =
1431 const BuiltinFormat spBuiltinFormats_te_IN[] =
1439 const BuiltinFormat spBuiltinFormats_th_TH[] =
1467 const BuiltinFormat spBuiltinFormats_tr_TR[] =
1475 const BuiltinFormat spBuiltinFormats_tt_RU[] =
1484 const BuiltinFormat spBuiltinFormats_uk_UA[] =
1493 const BuiltinFormat spBuiltinFormats_ur_PK[] =
1501 const BuiltinFormat spBuiltinFormats_vi_VN[] =
1511 const BuiltinFormat spBuiltinFormats_CJK[] =
1528 const BuiltinFormat spBuiltinFormats_ja_JP[] =
1544 const BuiltinFormat spBuiltinFormats_ko_KR[] =
1561 const BuiltinFormat spBuiltinFormats_zh_CN[] =
1577 const BuiltinFormat spBuiltinFormats_zh_HK[] =
1591 const BuiltinFormat spBuiltinFormats_zh_MO[] =
1605 const BuiltinFormat spBuiltinFormats_zh_SG[] =
1619 const BuiltinFormat spBuiltinFormats_zh_TW[] =
1633 struct BuiltinFormatTable
1640 const BuiltinFormatTable spBuiltinFormatTables[] =
1642 {
"*",
"", spBuiltinFormats_BASE },
1643 {
"af-ZA",
"*", spBuiltinFormats_en_ZA },
1644 {
"ar-AE",
"*", spBuiltinFormats_ar_AE },
1645 {
"ar-BH",
"*", spBuiltinFormats_ar_BH },
1646 {
"ar-DZ",
"*", spBuiltinFormats_ar_DZ },
1647 {
"ar-EG",
"*", spBuiltinFormats_ar_EG },
1648 {
"ar-IQ",
"*", spBuiltinFormats_ar_IQ },
1649 {
"ar-JO",
"*", spBuiltinFormats_ar_JO },
1650 {
"ar-KW",
"*", spBuiltinFormats_ar_KW },
1651 {
"ar-LB",
"*", spBuiltinFormats_ar_LB },
1652 {
"ar-LY",
"*", spBuiltinFormats_ar_LY },
1653 {
"ar-MA",
"*", spBuiltinFormats_ar_MA },
1654 {
"ar-OM",
"*", spBuiltinFormats_ar_OM },
1655 {
"ar-QA",
"*", spBuiltinFormats_ar_QA },
1656 {
"ar-SA",
"*", spBuiltinFormats_ar_SA },
1657 {
"ar-SY",
"*", spBuiltinFormats_ar_SY },
1658 {
"ar-TN",
"*", spBuiltinFormats_ar_TN },
1659 {
"ar-YE",
"*", spBuiltinFormats_ar_YE },
1660 {
"be-BY",
"*", spBuiltinFormats_be_BY },
1661 {
"bg-BG",
"*", spBuiltinFormats_bg_BG },
1662 {
"bn-IN",
"*", spBuiltinFormats_bn_IN },
1663 {
"ca-ES",
"*", spBuiltinFormats_es_ES },
1664 {
"cs-CZ",
"*", spBuiltinFormats_cs_CZ },
1665 {
"cy-GB",
"*", spBuiltinFormats_en_GB },
1666 {
"da-DK",
"*", spBuiltinFormats_da_DK },
1667 {
"de-AT",
"*", spBuiltinFormats_de_AT },
1668 {
"de-CH",
"*", spBuiltinFormats_de_CH },
1669 {
"de-DE",
"*", spBuiltinFormats_de_DE },
1670 {
"de-LI",
"*", spBuiltinFormats_de_LI },
1671 {
"de-LU",
"*", spBuiltinFormats_de_LU },
1672 {
"div-MV",
"*", spBuiltinFormats_div_MV },
1673 {
"el-GR",
"*", spBuiltinFormats_el_GR },
1674 {
"en-AU",
"*", spBuiltinFormats_en_AU },
1675 {
"en-BZ",
"*", spBuiltinFormats_en_BZ },
1676 {
"en-CA",
"*", spBuiltinFormats_en_CA },
1677 {
"en-CB",
"*", spBuiltinFormats_en_CB },
1678 {
"en-GB",
"*", spBuiltinFormats_en_GB },
1679 {
"en-IE",
"*", spBuiltinFormats_en_IE },
1680 {
"en-JM",
"*", spBuiltinFormats_en_JM },
1681 {
"en-NZ",
"*", spBuiltinFormats_en_NZ },
1682 {
"en-PH",
"*", spBuiltinFormats_en_PH },
1683 {
"en-TT",
"*", spBuiltinFormats_en_TT },
1684 {
"en-US",
"*", spBuiltinFormats_en_US },
1685 {
"en-ZA",
"*", spBuiltinFormats_en_ZA },
1686 {
"en-ZW",
"*", spBuiltinFormats_en_ZW },
1687 {
"es-AR",
"*", spBuiltinFormats_es_AR },
1688 {
"es-BO",
"*", spBuiltinFormats_es_BO },
1689 {
"es-CL",
"*", spBuiltinFormats_es_CL },
1690 {
"es-CO",
"*", spBuiltinFormats_es_CO },
1691 {
"es-CR",
"*", spBuiltinFormats_es_CR },
1692 {
"es-DO",
"*", spBuiltinFormats_es_DO },
1693 {
"es-EC",
"*", spBuiltinFormats_es_EC },
1694 {
"es-ES",
"*", spBuiltinFormats_es_ES },
1695 {
"es-GT",
"*", spBuiltinFormats_es_GT },
1696 {
"es-HN",
"*", spBuiltinFormats_es_HN },
1697 {
"es-MX",
"*", spBuiltinFormats_es_MX },
1698 {
"es-NI",
"*", spBuiltinFormats_es_NI },
1699 {
"es-PA",
"*", spBuiltinFormats_es_PA },
1700 {
"es-PE",
"*", spBuiltinFormats_es_PE },
1701 {
"es-PR",
"*", spBuiltinFormats_es_PR },
1702 {
"es-PY",
"*", spBuiltinFormats_es_PY },
1703 {
"es-SV",
"*", spBuiltinFormats_es_SV },
1704 {
"es-UY",
"*", spBuiltinFormats_es_UY },
1705 {
"es-VE",
"*", spBuiltinFormats_es_VE },
1706 {
"et-EE",
"*", spBuiltinFormats_et_EE },
1707 {
"fa-IR",
"*", spBuiltinFormats_fa_IR },
1708 {
"fi-FI",
"*", spBuiltinFormats_fi_FI },
1709 {
"fo-FO",
"*", spBuiltinFormats_fo_FO },
1710 {
"fr-BE",
"*", spBuiltinFormats_fr_BE },
1711 {
"fr-CA",
"*", spBuiltinFormats_fr_CA },
1712 {
"fr-CH",
"*", spBuiltinFormats_fr_CH },
1713 {
"fr-FR",
"*", spBuiltinFormats_fr_FR },
1714 {
"fr-LU",
"*", spBuiltinFormats_fr_LU },
1715 {
"fr-MC",
"*", spBuiltinFormats_fr_MC },
1716 {
"gl-ES",
"*", spBuiltinFormats_gl_ES },
1717 {
"gu-IN",
"*", spBuiltinFormats_gu_IN },
1718 {
"he-IL",
"*", spBuiltinFormats_he_IL },
1719 {
"hi-IN",
"*", spBuiltinFormats_hi_IN },
1720 {
"hr-BA",
"*", spBuiltinFormats_hr_BA },
1721 {
"hr-HR",
"*", spBuiltinFormats_hr_HR },
1722 {
"hu-HU",
"*", spBuiltinFormats_hu_HU },
1723 {
"hy-AM",
"*", spBuiltinFormats_hy_AM },
1724 {
"id-ID",
"*", spBuiltinFormats_id_ID },
1725 {
"is-IS",
"*", spBuiltinFormats_is_IS },
1726 {
"it-CH",
"*", spBuiltinFormats_it_CH },
1727 {
"it-IT",
"*", spBuiltinFormats_it_IT },
1728 {
"ka-GE",
"*", spBuiltinFormats_ka_GE },
1729 {
"kk-KZ",
"*", spBuiltinFormats_kk_KZ },
1730 {
"kn-IN",
"*", spBuiltinFormats_kn_IN },
1731 {
"kok-IN",
"*", spBuiltinFormats_hi_IN },
1732 {
"ky-KG",
"*", spBuiltinFormats_ky_KG },
1733 {
"lt-LT",
"*", spBuiltinFormats_lt_LT },
1734 {
"lv-LV",
"*", spBuiltinFormats_lv_LV },
1735 {
"mi-NZ",
"*", spBuiltinFormats_en_NZ },
1736 {
"ml-IN",
"*", spBuiltinFormats_ml_IN },
1737 {
"mn-MN",
"*", spBuiltinFormats_mn_MN },
1738 {
"mr-IN",
"*", spBuiltinFormats_hi_IN },
1739 {
"ms-BN",
"*", spBuiltinFormats_ms_BN },
1740 {
"ms-MY",
"*", spBuiltinFormats_ms_MY },
1741 {
"mt-MT",
"*", spBuiltinFormats_mt_MT },
1742 {
"nb-NO",
"*", spBuiltinFormats_no_NO },
1743 {
"nl-BE",
"*", spBuiltinFormats_nl_BE },
1744 {
"nl-NL",
"*", spBuiltinFormats_nl_NL },
1745 {
"nn-NO",
"*", spBuiltinFormats_no_NO },
1746 {
"nso-ZA",
"*", spBuiltinFormats_en_ZA },
1747 {
"pa-IN",
"*", spBuiltinFormats_pa_IN },
1748 {
"pl-PL",
"*", spBuiltinFormats_pl_PL },
1749 {
"pt-BR",
"*", spBuiltinFormats_pt_BR },
1750 {
"pt-PT",
"*", spBuiltinFormats_pt_PT },
1751 {
"qu-BO",
"*", spBuiltinFormats_es_BO },
1752 {
"qu-EC",
"*", spBuiltinFormats_es_EC },
1753 {
"qu-PE",
"*", spBuiltinFormats_es_PE },
1754 {
"ro-RO",
"*", spBuiltinFormats_ro_RO },
1755 {
"ru-RU",
"*", spBuiltinFormats_ru_RU },
1756 {
"sa-IN",
"*", spBuiltinFormats_hi_IN },
1757 {
"se-FI",
"*", spBuiltinFormats_fi_FI },
1758 {
"se-NO",
"*", spBuiltinFormats_no_NO },
1759 {
"se-SE",
"*", spBuiltinFormats_sv_SE },
1760 {
"sk-SK",
"*", spBuiltinFormats_sk_SK },
1761 {
"sl-SI",
"*", spBuiltinFormats_sl_SI },
1762 {
"sv-FI",
"*", spBuiltinFormats_sv_FI },
1763 {
"sv-SE",
"*", spBuiltinFormats_sv_SE },
1764 {
"sw-TZ",
"*", spBuiltinFormats_sw_TZ },
1765 {
"syr-SY",
"*", spBuiltinFormats_ar_SY },
1766 {
"syr-TR",
"*", spBuiltinFormats_tr_TR },
1767 {
"ta-IN",
"*", spBuiltinFormats_ta_IN },
1768 {
"te-IN",
"*", spBuiltinFormats_te_IN },
1769 {
"th-TH",
"*", spBuiltinFormats_th_TH },
1770 {
"tn-ZA",
"*", spBuiltinFormats_en_ZA },
1771 {
"tr-TR",
"*", spBuiltinFormats_tr_TR },
1772 {
"tt-RU",
"*", spBuiltinFormats_tt_RU },
1773 {
"uk-UA",
"*", spBuiltinFormats_uk_UA },
1774 {
"ur-PK",
"*", spBuiltinFormats_ur_PK },
1775 {
"vi-VN",
"*", spBuiltinFormats_vi_VN },
1776 {
"xh-ZA",
"*", spBuiltinFormats_en_ZA },
1777 {
"zu-ZA",
"*", spBuiltinFormats_en_ZA },
1779 {
"*CJK",
"*", spBuiltinFormats_CJK },
1780 {
"ja-JP",
"*CJK", spBuiltinFormats_ja_JP },
1781 {
"ko-KR",
"*CJK", spBuiltinFormats_ko_KR },
1782 {
"zh-CN",
"*CJK", spBuiltinFormats_zh_CN },
1783 {
"zh-HK",
"*CJK", spBuiltinFormats_zh_HK },
1784 {
"zh-MO",
"*CJK", spBuiltinFormats_zh_MO },
1785 {
"zh-SG",
"*CJK", spBuiltinFormats_zh_SG },
1786 {
"zh-TW",
"*CJK", spBuiltinFormats_zh_TW }
1803 sal_Int32 lclCreatePredefinedFormat(
const Reference< XNumberFormats >& rxNumFmts,
1804 sal_Int16 nPredefId,
const Locale& rToLocale )
1809 Reference< XNumberFormatTypes > xNumFmtTypes( rxNumFmts, UNO_QUERY_THROW );
1810 nIndex = (nPredefId >= 0) ?
1811 xNumFmtTypes->getFormatIndex( nPredefId, rToLocale ) :
1812 xNumFmtTypes->getStandardIndex( rToLocale );
1816 OSL_FAIL( OStringBuffer(
"lclCreatePredefinedFormat - cannot create predefined number format " ).
1817 append( OString::number( nPredefId ) ).getStr() );
1822 sal_Int32 lclCreateFormat(
const Reference< XNumberFormats >& rxNumFmts,
1823 const OUString& rFmtCode,
const Locale& rToLocale,
const Locale& rFromLocale )
1825 sal_Int32 nIndex = 0;
1828 nIndex = rxNumFmts->addNewConverted( rFmtCode, rFromLocale, rToLocale );
1833 if( rFmtCode.equalsIgnoreAsciiCase(
"general" ) )
1835 nIndex = lclCreatePredefinedFormat( rxNumFmts, 0, rToLocale );
1840 OSL_ENSURE( rFmtCode.startsWith(
"#\\ ?/" ) ||
1841 rFmtCode.startsWith(
"#\\ ?\?/" ) ||
1842 rFmtCode.startsWith(
"#\\ ?\?\?/" ),
1843 OStringBuffer(
"lclCreateFormat - cannot create number format '" ).
1845 append(
'\'' ).getStr() );
1852 class NumberFormatFinalizer
1855 explicit NumberFormatFinalizer(
const WorkbookHelper& rHelper );
1857 void operator()( NumberFormat& rNumFmt )
const
1865 NumberFormatFinalizer::NumberFormatFinalizer(
const WorkbookHelper& rHelper ) :
1870 Reference< XNumberFormatsSupplier > xNumFmtsSupp( rHelper.getDocument(), UNO_QUERY_THROW );
1871 mxNumFmts = xNumFmtsSupp->getNumberFormats();
1876 OSL_ENSURE(
mxNumFmts.is(),
"NumberFormatFinalizer::NumberFormatFinalizer - cannot get number formats" );
1879 sal_Int32 lclPosToken (
const OUString& sFormat, std::u16string_view sSearch, sal_Int32 nStartPos )
1881 sal_Int32
nLength = sFormat.getLength();
1882 for ( sal_Int32 i = nStartPos; i < nLength && i >= 0 ;
i++ )
1887 i = sFormat.indexOf(
'\"',i+1);
1890 i = sFormat.indexOf(
']',i+1);
1893 if ( sFormat.match(sSearch, i) )
1915 sal_Int32 nPosEscape = 0;
1916 sal_Int32 nErase = 0;
1917 sal_Int32 nLastIndex = rFmtCode.getLength() - 1;
1918 OUStringBuffer sFormat(rFmtCode);
1920 while ( ( nPosEscape = lclPosToken( rFmtCode,
u"\\ ", nPosEscape ) ) > 0 )
1922 sal_Int32
nPos = nPosEscape + 2;
1923 while ( nPos < nLastIndex && ( rFmtCode[nPos] ==
'?' || rFmtCode[nPos] ==
'#' || rFmtCode[nPos] ==
'0' ) )
1925 if ( nPos < nLastIndex && rFmtCode[nPos] ==
'/' )
1927 sFormat.remove(nPosEscape - nErase, 1);
1930 nPosEscape = lclPosToken( rFmtCode,
u";", nPosEscape );
1938 maModel.
maFmtCode = OStringToOUString( std::string_view( pcFmtCode ), RTL_TEXTENCODING_UTF8 );
1961 sal_uInt32 nScNumFmt = nDflt;
1980 maLocaleStr = officecfg::Setup::L10N::ooSetupSystemLocale::get();
1983 maLocaleStr = officecfg::System::L10N::Locale::get();
1992 xNumFmt = std::make_shared<NumberFormat>( *this );
1996 xNumFmt->setFormatCode( rFmtCode );
2002 sal_Int32 nNumFmtId = rAttribs.
getInteger( XML_numFmtId, -1 );
2003 OUString aFmtCode = rAttribs.
getXString( XML_formatCode, OUString() );
2031 typedef ::std::map< OUString, const BuiltinFormatTable* > BuiltinMap;
2032 BuiltinMap aBuiltinMap;
2033 for(
auto const &rTable : spBuiltinFormatTables)
2034 aBuiltinMap[ OUString::createFromAscii(rTable.mpcLocale) ] = &rTable;
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 '" +
2046 "' not supported (#i29949#)" ).getStr() );
2049 aMIt = aBuiltinMap.find(
"*" );
2050 OSL_ENSURE( aMIt != aMEnd,
"NumberFormatsBuffer::insertBuiltinFormats - default map not found" );
2052 for( ; aMIt != aMEnd; aMIt = aBuiltinMap.find( OUString::createFromAscii( aMIt->second->mpcParent ) ) )
2053 aBuiltinVec.push_back( aMIt->second );
2056 std::map< sal_uInt32, sal_uInt32 > aReuseMap;
2057 for( BuiltinVec::reverse_iterator aVIt = aBuiltinVec.rbegin(), aVEnd = aBuiltinVec.rend(); aVIt != aVEnd; ++aVIt )
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 )
2066 rxNumFmt = std::make_shared<NumberFormat>( *this );
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 );
2074 bReuse = pBuiltin->mnReuseId >= 0;
2077 aReuseMap[ pBuiltin->mnNumFmtId ] = pBuiltin->mnReuseId;
2079 aReuseMap.erase( pBuiltin->mnNumFmtId );
2084 for(
const auto& [rNumFmtId, rReuseId] : aReuseMap )
Helper class to provide access to global workbook data.
OptValue< OUString > getXString(sal_Int32 nAttrToken) const
OptValue< sal_Int32 > getInteger(sal_Int32 nAttrToken) const
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
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...
std::shared_ptr< NumberFormat > NumberFormatRef
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
static OUString readString(SequenceInputStream &rStrm, bool b32BitLen=true)
Reads a BIFF12 string with leading 16-bit or 32-bit length field.
ScDocument & getScDocument()
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
static SC_DLLPUBLIC LanguageType eLnge
css::lang::Locale maLocale
mapped_type get(key_type nKey) const
void forEach(const FunctorType &rFunctor) const
ApiNumFmtData()
API number format index.
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)