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>
43 #include <oox/token/tokens.hxx>
45 #include <document.hxx>
66 #define NUMFMT_STRING( INDEX, FORMATCODE ) \
67 { INDEX, FORMATCODE, -1, -1 }
70 #define NUMFMT_PREDEF( INDEX, PREDEFINED ) \
71 { INDEX, nullptr, css::i18n::NumberFormatIndex::PREDEFINED, -1 }
74 #define NUMFMT_REUSE( INDEX, REUSED_INDEX ) \
75 { INDEX, nullptr, -1, REUSED_INDEX }
78 #define NUMFMT_ENDTABLE() \
79 { -1, nullptr, -1, -1 }
90 #define NUMFMT_ALLDATETIMES( SYSTEMDATE, DAY, DAYSEP, MONTH, MONTHSEP, YEAR, HOUR12, HOUR24 ) \
91 NUMFMT_STRING( 14, SYSTEMDATE ), \
92 NUMFMT_STRING( 15, DAY DAYSEP MONTH MONTHSEP YEAR ), \
93 NUMFMT_STRING( 16, DAY DAYSEP MONTH ), \
94 NUMFMT_STRING( 17, MONTH MONTHSEP YEAR ), \
95 NUMFMT_STRING( 18, HOUR12 ":mm AM/PM" ), \
96 NUMFMT_STRING( 19, HOUR12 ":mm:ss AM/PM" ), \
97 NUMFMT_STRING( 20, HOUR24 ":mm" ), \
98 NUMFMT_STRING( 21, HOUR24 ":mm:ss" ), \
99 NUMFMT_STRING( 22, SYSTEMDATE " " HOUR24 ":mm" )
107 #define NUMFMT_TIME_CJK( INDEX, HOURFORMAT, HOUR, MINUTE, SECOND ) \
108 NUMFMT_STRING( INDEX + 0, HOURFORMAT "\"" HOUR "\"mm\"" MINUTE "\"" ), \
109 NUMFMT_STRING( INDEX + 1, HOURFORMAT "\"" HOUR "\"mm\"" MINUTE "\"ss\"" SECOND "\"" )
117 #define NUMFMT_ALLTIMES_CJK( HOUR12, HOUR24, HOUR, MINUTE, SECOND ) \
118 NUMFMT_TIME_CJK( 32, HOUR24, HOUR, MINUTE, SECOND ), \
119 NUMFMT_TIME_CJK( 34, "AM/PM" HOUR12, HOUR, MINUTE, SECOND )
127 #define NUMFMT_CURRENCY_SYMBOL_MINUS_NUMBER( INDEX, SYMBOL, SPACE, MODIF ) \
128 NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0;" MODIF SYMBOL SPACE "-#,##0" ), \
129 NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0;" "[RED]" MODIF SYMBOL SPACE "-#,##0" ), \
130 NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00;" MODIF SYMBOL SPACE "-#,##0.00" ), \
131 NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00;" "[RED]" MODIF SYMBOL SPACE "-#,##0.00" )
138 #define NUMFMT_ACCOUNTING_SYMBOL_MINUS_NUMBER( INDEX, SYMBOL, SPACE ) \
139 NUMFMT_STRING( INDEX + 0, "_ " "* #,##0_ ;" "_ " "* -#,##0_ ;" "_ " "* \"-\"_ ;" "_ @_ " ), \
140 NUMFMT_STRING( INDEX + 1, "_ " SYMBOL SPACE "* #,##0_ ;" "_ " SYMBOL SPACE "* -#,##0_ ;" "_ " SYMBOL SPACE "* \"-\"_ ;" "_ @_ " ), \
141 NUMFMT_STRING( INDEX + 2, "_ " "* #,##0.00_ ;" "_ " "* -#,##0.00_ ;" "_ " "* \"-\"?\?_ ;" "_ @_ " ), \
142 NUMFMT_STRING( INDEX + 3, "_ " SYMBOL SPACE "* #,##0.00_ ;" "_ " SYMBOL SPACE "* -#,##0.00_ ;" "_ " SYMBOL SPACE "* \"-\"?\?_ ;" "_ @_ " )
149 #define NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( SYMBOL, SPACE ) \
150 NUMFMT_CURRENCY_SYMBOL_MINUS_NUMBER( 5, SYMBOL, SPACE, "" ), \
151 NUMFMT_CURRENCY_SYMBOL_MINUS_NUMBER( 37, "", "", "" ), \
152 NUMFMT_ACCOUNTING_SYMBOL_MINUS_NUMBER( 41, SYMBOL, SPACE )
160 #define NUMFMT_CURRENCY_SYMBOL_NUMBER_MINUS( INDEX, SYMBOL, SPACE, MODIF ) \
161 NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0_-;" MODIF SYMBOL SPACE "#,##0-" ), \
162 NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0_-;" "[RED]" MODIF SYMBOL SPACE "#,##0-" ), \
163 NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00_-;" MODIF SYMBOL SPACE "#,##0.00-" ), \
164 NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00_-;" "[RED]" MODIF SYMBOL SPACE "#,##0.00-" )
171 #define NUMFMT_ACCOUNTING_SYMBOL_NUMBER_MINUS( INDEX, SYMBOL, SPACE ) \
172 NUMFMT_STRING( INDEX + 0, "_-" "* #,##0_-;" "_-" "* #,##0-;" "_-" "* \"-\"_-;" "_-@_-" ), \
173 NUMFMT_STRING( INDEX + 1, "_-" SYMBOL SPACE "* #,##0_-;" "_-" SYMBOL SPACE "* #,##0-;" "_-" SYMBOL SPACE "* \"-\"_-;" "_-@_-" ), \
174 NUMFMT_STRING( INDEX + 2, "_-" "* #,##0.00_-;" "_-" "* #,##0.00-;" "_-" "* \"-\"?\?_-;" "_-@_-" ), \
175 NUMFMT_STRING( INDEX + 3, "_-" SYMBOL SPACE "* #,##0.00_-;" "_-" SYMBOL SPACE "* #,##0.00-;" "_-" SYMBOL SPACE "* \"-\"?\?_-;" "_-@_-" )
182 #define NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( SYMBOL, SPACE ) \
183 NUMFMT_CURRENCY_SYMBOL_NUMBER_MINUS( 5, SYMBOL, SPACE, "" ), \
184 NUMFMT_CURRENCY_SYMBOL_NUMBER_MINUS( 37, "", "", "" ), \
185 NUMFMT_ACCOUNTING_SYMBOL_NUMBER_MINUS( 41, SYMBOL, SPACE )
193 #define NUMFMT_CURRENCY_NUMBER_SYMBOL_MINUS( INDEX, SYMBOL, SPACE, MODIF ) \
194 NUMFMT_STRING( INDEX + 0, MODIF "#,##0" SPACE SYMBOL "_-;" MODIF "#,##0" SPACE SYMBOL "-" ), \
195 NUMFMT_STRING( INDEX + 1, MODIF "#,##0" SPACE SYMBOL "_-;" "[RED]" MODIF "#,##0" SPACE SYMBOL "-" ), \
196 NUMFMT_STRING( INDEX + 2, MODIF "#,##0.00" SPACE SYMBOL "_-;" MODIF "#,##0.00" SPACE SYMBOL "-" ), \
197 NUMFMT_STRING( INDEX + 3, MODIF "#,##0.00" SPACE SYMBOL "_-;" "[RED]" MODIF "#,##0.00" SPACE SYMBOL "-" )
205 #define NUMFMT_ACCOUNTING_NUMBER_SYMBOL_MINUS( INDEX, SYMBOL, BLINDS, SPACE ) \
206 NUMFMT_STRING( INDEX + 0, "_-* #,##0" SPACE BLINDS "_-;_-* #,##0" SPACE BLINDS "-;_-* \"-\"" SPACE BLINDS "_-;_-@_-" ), \
207 NUMFMT_STRING( INDEX + 1, "_-* #,##0" SPACE SYMBOL "_-;_-* #,##0" SPACE SYMBOL "-;_-* \"-\"" SPACE SYMBOL "_-;_-@_-" ), \
208 NUMFMT_STRING( INDEX + 2, "_-* #,##0.00" SPACE BLINDS "_-;_-* #,##0.00" SPACE BLINDS "-;_-* \"-\"?\?" SPACE BLINDS "_-;_-@_-" ), \
209 NUMFMT_STRING( INDEX + 3, "_-* #,##0.00" SPACE SYMBOL "_-;_-* #,##0.00" SPACE SYMBOL "-;_-* \"-\"?\?" SPACE SYMBOL "_-;_-@_-" )
217 #define NUMFMT_ALLCURRENCIES_NUMBER_SYMBOL_MINUS( SYMBOL, BLINDS, SPACE ) \
218 NUMFMT_CURRENCY_NUMBER_SYMBOL_MINUS( 5, SYMBOL, SPACE, "" ), \
219 NUMFMT_CURRENCY_NUMBER_SYMBOL_MINUS( 37, BLINDS, SPACE, "" ), \
220 NUMFMT_ACCOUNTING_NUMBER_SYMBOL_MINUS( 41, SYMBOL, BLINDS, SPACE )
228 #define NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( INDEX, SYMBOL, SPACE, MODIF ) \
229 NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0;" MODIF "-" SYMBOL SPACE "#,##0" ), \
230 NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0;" "[RED]" MODIF "-" SYMBOL SPACE "#,##0" ), \
231 NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00;" MODIF "-" SYMBOL SPACE "#,##0.00" ), \
232 NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00;" "[RED]" MODIF "-" SYMBOL SPACE "#,##0.00" )
239 #define NUMFMT_ACCOUNTING_MINUS_SYMBOL_NUMBER( INDEX, SYMBOL, SPACE ) \
240 NUMFMT_STRING( INDEX + 0, "_-" "* #,##0_-;" "-" "* #,##0_-;" "_-" "* \"-\"_-;" "_-@_-" ), \
241 NUMFMT_STRING( INDEX + 1, "_-" SYMBOL SPACE "* #,##0_-;" "-" SYMBOL SPACE "* #,##0_-;" "_-" SYMBOL SPACE "* \"-\"_-;" "_-@_-" ), \
242 NUMFMT_STRING( INDEX + 2, "_-" "* #,##0.00_-;" "-" "* #,##0.00_-;" "_-" "* \"-\"?\?_-;" "_-@_-" ), \
243 NUMFMT_STRING( INDEX + 3, "_-" SYMBOL SPACE "* #,##0.00_-;" "-" SYMBOL SPACE "* #,##0.00_-;" "_-" SYMBOL SPACE "* \"-\"?\?_-;" "_-@_-" )
250 #define NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( SYMBOL, SPACE ) \
251 NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( 5, SYMBOL, SPACE, "" ), \
252 NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( 37, "", "", "" ), \
253 NUMFMT_ACCOUNTING_MINUS_SYMBOL_NUMBER( 41, SYMBOL, SPACE )
261 #define NUMFMT_CURRENCY_MINUS_NUMBER_SYMBOL( INDEX, SYMBOL, SPACE, MODIF ) \
262 NUMFMT_STRING( INDEX + 0, MODIF "#,##0" SPACE SYMBOL ";" MODIF "-#,##0" SPACE SYMBOL ), \
263 NUMFMT_STRING( INDEX + 1, MODIF "#,##0" SPACE SYMBOL ";" "[RED]" MODIF "-#,##0" SPACE SYMBOL ), \
264 NUMFMT_STRING( INDEX + 2, MODIF "#,##0.00" SPACE SYMBOL ";" MODIF "-#,##0.00" SPACE SYMBOL ), \
265 NUMFMT_STRING( INDEX + 3, MODIF "#,##0.00" SPACE SYMBOL ";" "[RED]" MODIF "-#,##0.00" SPACE SYMBOL )
273 #define NUMFMT_ACCOUNTING_MINUS_NUMBER_SYMBOL( INDEX, SYMBOL, BLINDS, SPACE ) \
274 NUMFMT_STRING( INDEX + 0, "_-* #,##0" SPACE BLINDS "_-;-* #,##0" SPACE BLINDS "_-;_-* \"-\"" SPACE BLINDS "_-;_-@_-" ), \
275 NUMFMT_STRING( INDEX + 1, "_-* #,##0" SPACE SYMBOL "_-;-* #,##0" SPACE SYMBOL "_-;_-* \"-\"" SPACE SYMBOL "_-;_-@_-" ), \
276 NUMFMT_STRING( INDEX + 2, "_-* #,##0.00" SPACE BLINDS "_-;-* #,##0.00" SPACE BLINDS "_-;_-* \"-\"?\?" SPACE BLINDS "_-;_-@_-" ), \
277 NUMFMT_STRING( INDEX + 3, "_-* #,##0.00" SPACE SYMBOL "_-;-* #,##0.00" SPACE SYMBOL "_-;_-* \"-\"?\?" SPACE SYMBOL "_-;_-@_-" )
285 #define NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( SYMBOL, BLINDS, SPACE ) \
286 NUMFMT_CURRENCY_MINUS_NUMBER_SYMBOL( 5, SYMBOL, SPACE, "" ), \
287 NUMFMT_CURRENCY_MINUS_NUMBER_SYMBOL( 37, BLINDS, SPACE, "" ), \
288 NUMFMT_ACCOUNTING_MINUS_NUMBER_SYMBOL( 41, SYMBOL, BLINDS, SPACE )
296 #define NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( INDEX, SYMBOL, SPACE, MODIF ) \
297 NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0_);" MODIF "(" SYMBOL SPACE "#,##0)" ), \
298 NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0_);" "[RED]" MODIF "(" SYMBOL SPACE "#,##0)" ), \
299 NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00_);" MODIF "(" SYMBOL SPACE "#,##0.00)" ), \
300 NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00_);" "[RED]" MODIF "(" SYMBOL SPACE "#,##0.00)" )
307 #define NUMFMT_ACCOUNTING_OPEN_SYMBOL_NUMBER_CLOSE( INDEX, SYMBOL, SPACE ) \
308 NUMFMT_STRING( INDEX + 0, "_(" "* #,##0_);" "_(" "* (#,##0);" "_(" "* \"-\"_);" "_(@_)" ), \
309 NUMFMT_STRING( INDEX + 1, "_(" SYMBOL SPACE "* #,##0_);" "_(" SYMBOL SPACE "* (#,##0);" "_(" SYMBOL SPACE "* \"-\"_);" "_(@_)" ), \
310 NUMFMT_STRING( INDEX + 2, "_(" "* #,##0.00_);" "_(" "* (#,##0.00);" "_(" "* \"-\"?\?_);" "_(@_)" ), \
311 NUMFMT_STRING( INDEX + 3, "_(" SYMBOL SPACE "* #,##0.00_);" "_(" SYMBOL SPACE "* (#,##0.00);" "_(" SYMBOL SPACE "* \"-\"?\?_);" "_(@_)" )
318 #define NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( SYMBOL, SPACE ) \
319 NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 5, SYMBOL, SPACE, "" ), \
320 NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 37, "", "", "" ), \
321 NUMFMT_ACCOUNTING_OPEN_SYMBOL_NUMBER_CLOSE( 41, SYMBOL, SPACE )
329 #define NUMFMT_CURRENCY_OPEN_NUMBER_SYMBOL_CLOSE( INDEX, SYMBOL, SPACE, MODIF ) \
330 NUMFMT_STRING( INDEX + 0, MODIF "#,##0" SPACE SYMBOL "_);" MODIF "(#,##0" SPACE SYMBOL ")" ), \
331 NUMFMT_STRING( INDEX + 1, MODIF "#,##0" SPACE SYMBOL "_);" "[RED]" MODIF "(#,##0" SPACE SYMBOL ")" ), \
332 NUMFMT_STRING( INDEX + 2, MODIF "#,##0.00" SPACE SYMBOL "_);" MODIF "(#,##0.00" SPACE SYMBOL ")" ), \
333 NUMFMT_STRING( INDEX + 3, MODIF "#,##0.00" SPACE SYMBOL "_);" "[RED]" MODIF "(#,##0.00" SPACE SYMBOL ")" )
341 #define NUMFMT_ACCOUNTING_OPEN_NUMBER_SYMBOL_CLOSE( INDEX, SYMBOL, BLINDS, SPACE ) \
342 NUMFMT_STRING( INDEX + 0, "_ * #,##0_)" SPACE BLINDS "_ ;_ * (#,##0)" SPACE BLINDS "_ ;_ * \"-\"_)" SPACE BLINDS "_ ;_ @_ " ), \
343 NUMFMT_STRING( INDEX + 1, "_ * #,##0_)" SPACE SYMBOL "_ ;_ * (#,##0)" SPACE SYMBOL "_ ;_ * \"-\"_)" SPACE SYMBOL "_ ;_ @_ " ), \
344 NUMFMT_STRING( INDEX + 2, "_ * #,##0.00_)" SPACE BLINDS "_ ;_ * (#,##0.00)" SPACE BLINDS "_ ;_ * \"-\"?\?_)" SPACE BLINDS "_ ;_ @_ " ), \
345 NUMFMT_STRING( INDEX + 3, "_ * #,##0.00_)" SPACE SYMBOL "_ ;_ * (#,##0.00)" SPACE SYMBOL "_ ;_ * \"-\"?\?_)" SPACE SYMBOL "_ ;_ @_ " )
353 #define NUMFMT_ALLCURRENCIES_OPEN_NUMBER_SYMBOL_CLOSE( SYMBOL, BLINDS, SPACE ) \
354 NUMFMT_CURRENCY_OPEN_NUMBER_SYMBOL_CLOSE( 5, SYMBOL, SPACE, "" ), \
355 NUMFMT_CURRENCY_OPEN_NUMBER_SYMBOL_CLOSE( 37, BLINDS, SPACE, "" ), \
356 NUMFMT_ACCOUNTING_OPEN_NUMBER_SYMBOL_CLOSE( 41, SYMBOL, BLINDS, SPACE )
359 #define UTF8_BAHT "\340\270\277"
360 #define UTF8_COLON "\342\202\241"
361 #define UTF8_CURR_AR_AE "\330\257.\330\245."
362 #define UTF8_CURR_AR_BH "\330\257.\330\250."
363 #define UTF8_CURR_AR_DZ "\330\257.\330\254."
364 #define UTF8_CURR_AR_EG "\330\254.\331\205."
365 #define UTF8_CURR_AR_IQ "\330\257.\330\271."
366 #define UTF8_CURR_AR_JO "\330\257.\330\247."
367 #define UTF8_CURR_AR_KW "\330\257.\331\203."
368 #define UTF8_CURR_AR_LB "\331\204.\331\204."
369 #define UTF8_CURR_AR_LY "\330\257.\331\204."
370 #define UTF8_CURR_AR_MA "\330\257.\331\205."
371 #define UTF8_CURR_AR_OM "\330\261.\330\271."
372 #define UTF8_CURR_AR_QA "\330\261.\331\202."
373 #define UTF8_CURR_AR_SA "\330\261.\330\263."
374 #define UTF8_CURR_AR_SY "\331\204.\330\263."
375 #define UTF8_CURR_AR_TN "\330\257.\330\252."
376 #define UTF8_CURR_AR_YE "\330\261.\331\212."
377 #define UTF8_CURR_BN_IN "\340\246\237\340\246\276"
378 #define UTF8_CURR_FA_IR "\330\261\331\212\330\247\331\204"
379 #define UTF8_CURR_GU_IN "\340\252\260\340\253\202"
380 #define UTF8_CURR_HI_IN "\340\244\260\340\245\201"
381 #define UTF8_CURR_KN_IN "\340\262\260\340\263\202"
382 #define UTF8_CURR_ML_IN "\340\264\225"
383 #define UTF8_CURR_PA_IN "\340\250\260\340\251\201"
384 #define UTF8_CURR_TA_IN "\340\256\260\340\257\202"
385 #define UTF8_CURR_TE_IN "\340\260\260\340\261\202"
386 #define UTF8_DONG "\342\202\253"
387 #define UTF8_EURO "\342\202\254"
388 #define UTF8_POUND_GB "\302\243"
389 #define UTF8_RUFIYAA "\336\203"
390 #define UTF8_SHEQEL "\342\202\252"
391 #define UTF8_TUGRUG "\342\202\256"
392 #define UTF8_WON "\342\202\251"
393 #define UTF8_YEN_CN "\357\277\245"
394 #define UTF8_YEN_JP "\302\245"
397 #define UTF8_CCARON_LC "\304\215"
398 #define UTF8_LSTROKE_LC "\305\202"
400 #define UTF8_HY_DA_LC "\325\244"
401 #define UTF8_HY_REH_LC "\326\200"
403 #define UTF8_CYR_G_LC "\320\263"
404 #define UTF8_CYR_L_LC "\320\273"
405 #define UTF8_CYR_M_LC "\320\274"
406 #define UTF8_CYR_N_LC "\320\275"
407 #define UTF8_CYR_O_LC "\320\276"
408 #define UTF8_CYR_R_LC "\321\200"
409 #define UTF8_CYR_S_LC "\321\201"
410 #define UTF8_CYR_W_LC "\320\262"
413 #define UTF8_CJ_YEAR "\345\271\264"
414 #define UTF8_CJ_MON "\346\234\210"
415 #define UTF8_CJ_DAY "\346\227\245"
416 #define UTF8_CJ_HOUR "\346\231\202"
417 #define UTF8_CJ_MIN "\345\210\206"
418 #define UTF8_CJ_SEC "\347\247\222"
421 #define UTF8_CS_YEAR "\345\271\264"
422 #define UTF8_CS_MON "\346\234\210"
423 #define UTF8_CS_DAY "\346\227\245"
424 #define UTF8_CS_HOUR "\346\227\266"
425 #define UTF8_CS_MIN "\345\210\206"
426 #define UTF8_CS_SEC "\347\247\222"
429 #define UTF8_KO_YEAR "\353\205\204"
430 #define UTF8_KO_MON "\354\233\224"
431 #define UTF8_KO_DAY "\354\235\274"
432 #define UTF8_KO_HOUR "\354\213\234"
433 #define UTF8_KO_MIN "\353\266\204"
434 #define UTF8_KO_SEC "\354\264\210"
437 const BuiltinFormat spBuiltinFormats_BASE[] =
533 const BuiltinFormat spBuiltinFormats_ar_AE[] =
541 const BuiltinFormat spBuiltinFormats_ar_BH[] =
549 const BuiltinFormat spBuiltinFormats_ar_DZ[] =
557 const BuiltinFormat spBuiltinFormats_ar_EG[] =
565 const BuiltinFormat spBuiltinFormats_ar_IQ[] =
573 const BuiltinFormat spBuiltinFormats_ar_JO[] =
581 const BuiltinFormat spBuiltinFormats_ar_KW[] =
589 const BuiltinFormat spBuiltinFormats_ar_LB[] =
597 const BuiltinFormat spBuiltinFormats_ar_LY[] =
605 const BuiltinFormat spBuiltinFormats_ar_MA[] =
613 const BuiltinFormat spBuiltinFormats_ar_OM[] =
621 const BuiltinFormat spBuiltinFormats_ar_QA[] =
629 const BuiltinFormat spBuiltinFormats_ar_SA[] =
637 const BuiltinFormat spBuiltinFormats_ar_SY[] =
645 const BuiltinFormat spBuiltinFormats_ar_TN[] =
653 const BuiltinFormat spBuiltinFormats_ar_YE[] =
661 const BuiltinFormat spBuiltinFormats_be_BY[] =
670 const BuiltinFormat spBuiltinFormats_bg_BG[] =
679 const BuiltinFormat spBuiltinFormats_bn_IN[] =
687 const BuiltinFormat spBuiltinFormats_cs_CZ[] =
696 const BuiltinFormat spBuiltinFormats_da_DK[] =
704 const BuiltinFormat spBuiltinFormats_de_AT[] =
712 const BuiltinFormat spBuiltinFormats_de_CH[] =
720 const BuiltinFormat spBuiltinFormats_de_DE[] =
728 const BuiltinFormat spBuiltinFormats_de_LI[] =
736 const BuiltinFormat spBuiltinFormats_de_LU[] =
744 const BuiltinFormat spBuiltinFormats_div_MV[] =
752 const BuiltinFormat spBuiltinFormats_el_GR[] =
760 const BuiltinFormat spBuiltinFormats_en_AU[] =
768 const BuiltinFormat spBuiltinFormats_en_BZ[] =
776 const BuiltinFormat spBuiltinFormats_en_CA[] =
784 const BuiltinFormat spBuiltinFormats_en_CB[] =
792 const BuiltinFormat spBuiltinFormats_en_GB[] =
800 const BuiltinFormat spBuiltinFormats_en_IE[] =
808 const BuiltinFormat spBuiltinFormats_en_JM[] =
816 const BuiltinFormat spBuiltinFormats_en_NZ[] =
824 const BuiltinFormat spBuiltinFormats_en_PH[] =
832 const BuiltinFormat spBuiltinFormats_en_TT[] =
840 const BuiltinFormat spBuiltinFormats_en_US[] =
848 const BuiltinFormat spBuiltinFormats_en_ZA[] =
856 const BuiltinFormat spBuiltinFormats_en_ZW[] =
864 const BuiltinFormat spBuiltinFormats_es_AR[] =
872 const BuiltinFormat spBuiltinFormats_es_BO[] =
881 const BuiltinFormat spBuiltinFormats_es_CL[] =
889 const BuiltinFormat spBuiltinFormats_es_CO[] =
897 const BuiltinFormat spBuiltinFormats_es_CR[] =
905 const BuiltinFormat spBuiltinFormats_es_DO[] =
913 const BuiltinFormat spBuiltinFormats_es_EC[] =
921 const BuiltinFormat spBuiltinFormats_es_ES[] =
929 const BuiltinFormat spBuiltinFormats_es_GT[] =
937 const BuiltinFormat spBuiltinFormats_es_HN[] =
946 const BuiltinFormat spBuiltinFormats_es_MX[] =
954 const BuiltinFormat spBuiltinFormats_es_NI[] =
963 const BuiltinFormat spBuiltinFormats_es_PA[] =
971 const BuiltinFormat spBuiltinFormats_es_PE[] =
979 const BuiltinFormat spBuiltinFormats_es_PR[] =
988 const BuiltinFormat spBuiltinFormats_es_PY[] =
996 const BuiltinFormat spBuiltinFormats_es_SV[] =
1005 const BuiltinFormat spBuiltinFormats_es_UY[] =
1013 const BuiltinFormat spBuiltinFormats_es_VE[] =
1021 const BuiltinFormat spBuiltinFormats_et_EE[] =
1030 const BuiltinFormat spBuiltinFormats_fa_IR[] =
1038 const BuiltinFormat spBuiltinFormats_fi_FI[] =
1049 const BuiltinFormat spBuiltinFormats_fo_FO[] =
1057 const BuiltinFormat spBuiltinFormats_fr_BE[] =
1065 const BuiltinFormat spBuiltinFormats_fr_CA[] =
1074 const BuiltinFormat spBuiltinFormats_fr_CH[] =
1082 const BuiltinFormat spBuiltinFormats_fr_FR[] =
1091 const BuiltinFormat spBuiltinFormats_fr_LU[] =
1100 const BuiltinFormat spBuiltinFormats_fr_MC[] =
1109 const BuiltinFormat spBuiltinFormats_gl_ES[] =
1117 const BuiltinFormat spBuiltinFormats_gu_IN[] =
1125 const BuiltinFormat spBuiltinFormats_he_IL[] =
1133 const BuiltinFormat spBuiltinFormats_hi_IN[] =
1141 const BuiltinFormat spBuiltinFormats_hr_BA[] =
1149 const BuiltinFormat spBuiltinFormats_hr_HR[] =
1157 const BuiltinFormat spBuiltinFormats_hu_HU[] =
1167 const BuiltinFormat spBuiltinFormats_hy_AM[] =
1175 const BuiltinFormat spBuiltinFormats_id_ID[] =
1183 const BuiltinFormat spBuiltinFormats_is_IS[] =
1191 const BuiltinFormat spBuiltinFormats_it_CH[] =
1199 const BuiltinFormat spBuiltinFormats_it_IT[] =
1207 const BuiltinFormat spBuiltinFormats_ka_GE[] =
1216 const BuiltinFormat spBuiltinFormats_kk_KZ[] =
1225 const BuiltinFormat spBuiltinFormats_kn_IN[] =
1233 const BuiltinFormat spBuiltinFormats_ky_KG[] =
1242 const BuiltinFormat spBuiltinFormats_lt_LT[] =
1250 const BuiltinFormat spBuiltinFormats_lv_LV[] =
1259 const BuiltinFormat spBuiltinFormats_ml_IN[] =
1267 const BuiltinFormat spBuiltinFormats_mn_MN[] =
1275 const BuiltinFormat spBuiltinFormats_ms_BN[] =
1283 const BuiltinFormat spBuiltinFormats_ms_MY[] =
1291 const BuiltinFormat spBuiltinFormats_mt_MT[] =
1299 const BuiltinFormat spBuiltinFormats_nl_BE[] =
1308 const BuiltinFormat spBuiltinFormats_nl_NL[] =
1316 const BuiltinFormat spBuiltinFormats_no_NO[] =
1325 const BuiltinFormat spBuiltinFormats_pa_IN[] =
1333 const BuiltinFormat spBuiltinFormats_pl_PL[] =
1343 const BuiltinFormat spBuiltinFormats_pt_BR[] =
1351 const BuiltinFormat spBuiltinFormats_pt_PT[] =
1359 const BuiltinFormat spBuiltinFormats_ro_RO[] =
1368 const BuiltinFormat spBuiltinFormats_ru_RU[] =
1377 const BuiltinFormat spBuiltinFormats_sk_SK[] =
1386 const BuiltinFormat spBuiltinFormats_sl_SI[] =
1394 const BuiltinFormat spBuiltinFormats_sv_FI[] =
1405 const BuiltinFormat spBuiltinFormats_sv_SE[] =
1414 const BuiltinFormat spBuiltinFormats_sw_TZ[] =
1422 const BuiltinFormat spBuiltinFormats_ta_IN[] =
1430 const BuiltinFormat spBuiltinFormats_te_IN[] =
1438 const BuiltinFormat spBuiltinFormats_th_TH[] =
1466 const BuiltinFormat spBuiltinFormats_tr_TR[] =
1474 const BuiltinFormat spBuiltinFormats_tt_RU[] =
1483 const BuiltinFormat spBuiltinFormats_uk_UA[] =
1492 const BuiltinFormat spBuiltinFormats_ur_PK[] =
1500 const BuiltinFormat spBuiltinFormats_vi_VN[] =
1510 const BuiltinFormat spBuiltinFormats_CJK[] =
1527 const BuiltinFormat spBuiltinFormats_ja_JP[] =
1543 const BuiltinFormat spBuiltinFormats_ko_KR[] =
1560 const BuiltinFormat spBuiltinFormats_zh_CN[] =
1576 const BuiltinFormat spBuiltinFormats_zh_HK[] =
1590 const BuiltinFormat spBuiltinFormats_zh_MO[] =
1604 const BuiltinFormat spBuiltinFormats_zh_SG[] =
1618 const BuiltinFormat spBuiltinFormats_zh_TW[] =
1632 struct BuiltinFormatTable
1639 const BuiltinFormatTable spBuiltinFormatTables[] =
1641 {
"*",
"", spBuiltinFormats_BASE },
1642 {
"af-ZA",
"*", spBuiltinFormats_en_ZA },
1643 {
"ar-AE",
"*", spBuiltinFormats_ar_AE },
1644 {
"ar-BH",
"*", spBuiltinFormats_ar_BH },
1645 {
"ar-DZ",
"*", spBuiltinFormats_ar_DZ },
1646 {
"ar-EG",
"*", spBuiltinFormats_ar_EG },
1647 {
"ar-IQ",
"*", spBuiltinFormats_ar_IQ },
1648 {
"ar-JO",
"*", spBuiltinFormats_ar_JO },
1649 {
"ar-KW",
"*", spBuiltinFormats_ar_KW },
1650 {
"ar-LB",
"*", spBuiltinFormats_ar_LB },
1651 {
"ar-LY",
"*", spBuiltinFormats_ar_LY },
1652 {
"ar-MA",
"*", spBuiltinFormats_ar_MA },
1653 {
"ar-OM",
"*", spBuiltinFormats_ar_OM },
1654 {
"ar-QA",
"*", spBuiltinFormats_ar_QA },
1655 {
"ar-SA",
"*", spBuiltinFormats_ar_SA },
1656 {
"ar-SY",
"*", spBuiltinFormats_ar_SY },
1657 {
"ar-TN",
"*", spBuiltinFormats_ar_TN },
1658 {
"ar-YE",
"*", spBuiltinFormats_ar_YE },
1659 {
"be-BY",
"*", spBuiltinFormats_be_BY },
1660 {
"bg-BG",
"*", spBuiltinFormats_bg_BG },
1661 {
"bn-IN",
"*", spBuiltinFormats_bn_IN },
1662 {
"ca-ES",
"*", spBuiltinFormats_es_ES },
1663 {
"cs-CZ",
"*", spBuiltinFormats_cs_CZ },
1664 {
"cy-GB",
"*", spBuiltinFormats_en_GB },
1665 {
"da-DK",
"*", spBuiltinFormats_da_DK },
1666 {
"de-AT",
"*", spBuiltinFormats_de_AT },
1667 {
"de-CH",
"*", spBuiltinFormats_de_CH },
1668 {
"de-DE",
"*", spBuiltinFormats_de_DE },
1669 {
"de-LI",
"*", spBuiltinFormats_de_LI },
1670 {
"de-LU",
"*", spBuiltinFormats_de_LU },
1671 {
"div-MV",
"*", spBuiltinFormats_div_MV },
1672 {
"el-GR",
"*", spBuiltinFormats_el_GR },
1673 {
"en-AU",
"*", spBuiltinFormats_en_AU },
1674 {
"en-BZ",
"*", spBuiltinFormats_en_BZ },
1675 {
"en-CA",
"*", spBuiltinFormats_en_CA },
1676 {
"en-CB",
"*", spBuiltinFormats_en_CB },
1677 {
"en-GB",
"*", spBuiltinFormats_en_GB },
1678 {
"en-IE",
"*", spBuiltinFormats_en_IE },
1679 {
"en-JM",
"*", spBuiltinFormats_en_JM },
1680 {
"en-NZ",
"*", spBuiltinFormats_en_NZ },
1681 {
"en-PH",
"*", spBuiltinFormats_en_PH },
1682 {
"en-TT",
"*", spBuiltinFormats_en_TT },
1683 {
"en-US",
"*", spBuiltinFormats_en_US },
1684 {
"en-ZA",
"*", spBuiltinFormats_en_ZA },
1685 {
"en-ZW",
"*", spBuiltinFormats_en_ZW },
1686 {
"es-AR",
"*", spBuiltinFormats_es_AR },
1687 {
"es-BO",
"*", spBuiltinFormats_es_BO },
1688 {
"es-CL",
"*", spBuiltinFormats_es_CL },
1689 {
"es-CO",
"*", spBuiltinFormats_es_CO },
1690 {
"es-CR",
"*", spBuiltinFormats_es_CR },
1691 {
"es-DO",
"*", spBuiltinFormats_es_DO },
1692 {
"es-EC",
"*", spBuiltinFormats_es_EC },
1693 {
"es-ES",
"*", spBuiltinFormats_es_ES },
1694 {
"es-GT",
"*", spBuiltinFormats_es_GT },
1695 {
"es-HN",
"*", spBuiltinFormats_es_HN },
1696 {
"es-MX",
"*", spBuiltinFormats_es_MX },
1697 {
"es-NI",
"*", spBuiltinFormats_es_NI },
1698 {
"es-PA",
"*", spBuiltinFormats_es_PA },
1699 {
"es-PE",
"*", spBuiltinFormats_es_PE },
1700 {
"es-PR",
"*", spBuiltinFormats_es_PR },
1701 {
"es-PY",
"*", spBuiltinFormats_es_PY },
1702 {
"es-SV",
"*", spBuiltinFormats_es_SV },
1703 {
"es-UY",
"*", spBuiltinFormats_es_UY },
1704 {
"es-VE",
"*", spBuiltinFormats_es_VE },
1705 {
"et-EE",
"*", spBuiltinFormats_et_EE },
1706 {
"fa-IR",
"*", spBuiltinFormats_fa_IR },
1707 {
"fi-FI",
"*", spBuiltinFormats_fi_FI },
1708 {
"fo-FO",
"*", spBuiltinFormats_fo_FO },
1709 {
"fr-BE",
"*", spBuiltinFormats_fr_BE },
1710 {
"fr-CA",
"*", spBuiltinFormats_fr_CA },
1711 {
"fr-CH",
"*", spBuiltinFormats_fr_CH },
1712 {
"fr-FR",
"*", spBuiltinFormats_fr_FR },
1713 {
"fr-LU",
"*", spBuiltinFormats_fr_LU },
1714 {
"fr-MC",
"*", spBuiltinFormats_fr_MC },
1715 {
"gl-ES",
"*", spBuiltinFormats_gl_ES },
1716 {
"gu-IN",
"*", spBuiltinFormats_gu_IN },
1717 {
"he-IL",
"*", spBuiltinFormats_he_IL },
1718 {
"hi-IN",
"*", spBuiltinFormats_hi_IN },
1719 {
"hr-BA",
"*", spBuiltinFormats_hr_BA },
1720 {
"hr-HR",
"*", spBuiltinFormats_hr_HR },
1721 {
"hu-HU",
"*", spBuiltinFormats_hu_HU },
1722 {
"hy-AM",
"*", spBuiltinFormats_hy_AM },
1723 {
"id-ID",
"*", spBuiltinFormats_id_ID },
1724 {
"is-IS",
"*", spBuiltinFormats_is_IS },
1725 {
"it-CH",
"*", spBuiltinFormats_it_CH },
1726 {
"it-IT",
"*", spBuiltinFormats_it_IT },
1727 {
"ka-GE",
"*", spBuiltinFormats_ka_GE },
1728 {
"kk-KZ",
"*", spBuiltinFormats_kk_KZ },
1729 {
"kn-IN",
"*", spBuiltinFormats_kn_IN },
1730 {
"kok-IN",
"*", spBuiltinFormats_hi_IN },
1731 {
"ky-KG",
"*", spBuiltinFormats_ky_KG },
1732 {
"lt-LT",
"*", spBuiltinFormats_lt_LT },
1733 {
"lv-LV",
"*", spBuiltinFormats_lv_LV },
1734 {
"mi-NZ",
"*", spBuiltinFormats_en_NZ },
1735 {
"ml-IN",
"*", spBuiltinFormats_ml_IN },
1736 {
"mn-MN",
"*", spBuiltinFormats_mn_MN },
1737 {
"mr-IN",
"*", spBuiltinFormats_hi_IN },
1738 {
"ms-BN",
"*", spBuiltinFormats_ms_BN },
1739 {
"ms-MY",
"*", spBuiltinFormats_ms_MY },
1740 {
"mt-MT",
"*", spBuiltinFormats_mt_MT },
1741 {
"nb-NO",
"*", spBuiltinFormats_no_NO },
1742 {
"nl-BE",
"*", spBuiltinFormats_nl_BE },
1743 {
"nl-NL",
"*", spBuiltinFormats_nl_NL },
1744 {
"nn-NO",
"*", spBuiltinFormats_no_NO },
1745 {
"nso-ZA",
"*", spBuiltinFormats_en_ZA },
1746 {
"pa-IN",
"*", spBuiltinFormats_pa_IN },
1747 {
"pl-PL",
"*", spBuiltinFormats_pl_PL },
1748 {
"pt-BR",
"*", spBuiltinFormats_pt_BR },
1749 {
"pt-PT",
"*", spBuiltinFormats_pt_PT },
1750 {
"qu-BO",
"*", spBuiltinFormats_es_BO },
1751 {
"qu-EC",
"*", spBuiltinFormats_es_EC },
1752 {
"qu-PE",
"*", spBuiltinFormats_es_PE },
1753 {
"ro-RO",
"*", spBuiltinFormats_ro_RO },
1754 {
"ru-RU",
"*", spBuiltinFormats_ru_RU },
1755 {
"sa-IN",
"*", spBuiltinFormats_hi_IN },
1756 {
"se-FI",
"*", spBuiltinFormats_fi_FI },
1757 {
"se-NO",
"*", spBuiltinFormats_no_NO },
1758 {
"se-SE",
"*", spBuiltinFormats_sv_SE },
1759 {
"sk-SK",
"*", spBuiltinFormats_sk_SK },
1760 {
"sl-SI",
"*", spBuiltinFormats_sl_SI },
1761 {
"sv-FI",
"*", spBuiltinFormats_sv_FI },
1762 {
"sv-SE",
"*", spBuiltinFormats_sv_SE },
1763 {
"sw-TZ",
"*", spBuiltinFormats_sw_TZ },
1764 {
"syr-SY",
"*", spBuiltinFormats_ar_SY },
1765 {
"syr-TR",
"*", spBuiltinFormats_tr_TR },
1766 {
"ta-IN",
"*", spBuiltinFormats_ta_IN },
1767 {
"te-IN",
"*", spBuiltinFormats_te_IN },
1768 {
"th-TH",
"*", spBuiltinFormats_th_TH },
1769 {
"tn-ZA",
"*", spBuiltinFormats_en_ZA },
1770 {
"tr-TR",
"*", spBuiltinFormats_tr_TR },
1771 {
"tt-RU",
"*", spBuiltinFormats_tt_RU },
1772 {
"uk-UA",
"*", spBuiltinFormats_uk_UA },
1773 {
"ur-PK",
"*", spBuiltinFormats_ur_PK },
1774 {
"vi-VN",
"*", spBuiltinFormats_vi_VN },
1775 {
"xh-ZA",
"*", spBuiltinFormats_en_ZA },
1776 {
"zu-ZA",
"*", spBuiltinFormats_en_ZA },
1778 {
"*CJK",
"*", spBuiltinFormats_CJK },
1779 {
"ja-JP",
"*CJK", spBuiltinFormats_ja_JP },
1780 {
"ko-KR",
"*CJK", spBuiltinFormats_ko_KR },
1781 {
"zh-CN",
"*CJK", spBuiltinFormats_zh_CN },
1782 {
"zh-HK",
"*CJK", spBuiltinFormats_zh_HK },
1783 {
"zh-MO",
"*CJK", spBuiltinFormats_zh_MO },
1784 {
"zh-SG",
"*CJK", spBuiltinFormats_zh_SG },
1785 {
"zh-TW",
"*CJK", spBuiltinFormats_zh_TW }
1802 sal_Int32 lclCreatePredefinedFormat(
const Reference< XNumberFormats >& rxNumFmts,
1803 sal_Int16 nPredefId,
const Locale& rToLocale )
1808 Reference< XNumberFormatTypes > xNumFmtTypes( rxNumFmts, UNO_QUERY_THROW );
1809 nIndex = (nPredefId >= 0) ?
1810 xNumFmtTypes->getFormatIndex( nPredefId, rToLocale ) :
1811 xNumFmtTypes->getStandardIndex( rToLocale );
1815 OSL_FAIL( OStringBuffer(
"lclCreatePredefinedFormat - cannot create predefined number format " ).
1816 append( OString::number( nPredefId ) ).getStr() );
1821 sal_Int32 lclCreateFormat(
const Reference< XNumberFormats >& rxNumFmts,
1822 const OUString& rFmtCode,
const Locale& rToLocale,
const Locale& rFromLocale )
1824 sal_Int32 nIndex = 0;
1827 nIndex = rxNumFmts->addNewConverted( rFmtCode, rFromLocale, rToLocale );
1832 if( rFmtCode.equalsIgnoreAsciiCase(
"general" ) )
1834 nIndex = lclCreatePredefinedFormat( rxNumFmts, 0, rToLocale );
1839 OSL_ENSURE( rFmtCode.startsWith(
"#\\ ?/" ) ||
1840 rFmtCode.startsWith(
"#\\ ?\?/" ) ||
1841 rFmtCode.startsWith(
"#\\ ?\?\?/" ),
1842 OStringBuffer(
"lclCreateFormat - cannot create number format '" ).
1844 append(
'\'' ).getStr() );
1851 class NumberFormatFinalizer
1854 explicit NumberFormatFinalizer(
const WorkbookHelper& rHelper );
1856 void operator()( NumberFormat& rNumFmt )
const
1864 NumberFormatFinalizer::NumberFormatFinalizer(
const WorkbookHelper& rHelper ) :
1869 Reference< XNumberFormatsSupplier > xNumFmtsSupp( rHelper.getDocument(), UNO_QUERY_THROW );
1870 mxNumFmts = xNumFmtsSupp->getNumberFormats();
1875 OSL_ENSURE(
mxNumFmts.is(),
"NumberFormatFinalizer::NumberFormatFinalizer - cannot get number formats" );
1878 sal_Int32 lclPosToken (
const OUString& sFormat, std::u16string_view sSearch, sal_Int32 nStartPos )
1880 sal_Int32
nLength = sFormat.getLength();
1881 for ( sal_Int32 i = nStartPos; i < nLength && i >= 0 ;
i++ )
1886 i = sFormat.indexOf(
'\"',i+1);
1889 i = sFormat.indexOf(
']',i+1);
1892 if ( sFormat.match(sSearch, i) )
1914 sal_Int32 nPosEscape = 0;
1915 sal_Int32 nErase = 0;
1916 sal_Int32 nLastIndex = rFmtCode.getLength() - 1;
1917 OUStringBuffer sFormat = rFmtCode;
1919 while ( ( nPosEscape = lclPosToken( rFmtCode,
u"\\ ", nPosEscape ) ) > 0 )
1921 sal_Int32
nPos = nPosEscape + 2;
1922 while ( nPos < nLastIndex && ( rFmtCode[nPos] ==
'?' || rFmtCode[nPos] ==
'#' || rFmtCode[nPos] ==
'0' ) )
1924 if ( nPos < nLastIndex && rFmtCode[nPos] ==
'/' )
1926 sFormat.remove(nPosEscape - nErase, 1);
1929 nPosEscape = lclPosToken( rFmtCode,
u";", nPosEscape );
1937 maModel.
maFmtCode = OStringToOUString( std::string_view( pcFmtCode ), RTL_TEXTENCODING_UTF8 );
1960 sal_uInt32 nScNumFmt = nDflt;
1979 maLocaleStr = officecfg::Setup::L10N::ooSetupSystemLocale::get();
1982 maLocaleStr = officecfg::System::L10N::Locale::get();
1991 xNumFmt = std::make_shared<NumberFormat>( *this );
1995 xNumFmt->setFormatCode( rFmtCode );
2001 sal_Int32 nNumFmtId = rAttribs.
getInteger( XML_numFmtId, -1 );
2002 OUString aFmtCode = rAttribs.
getXString( XML_formatCode, OUString() );
2030 typedef ::std::map< OUString, const BuiltinFormatTable* > BuiltinMap;
2031 BuiltinMap aBuiltinMap;
2032 for(
auto const &rTable : spBuiltinFormatTables)
2033 aBuiltinMap[ OUString::createFromAscii(rTable.mpcLocale) ] = &rTable;
2039 typedef ::std::vector< const BuiltinFormatTable* > BuiltinVec;
2040 BuiltinVec aBuiltinVec;
2041 BuiltinMap::const_iterator aMIt = aBuiltinMap.find(
maLocaleStr ), aMEnd = aBuiltinMap.end();
2042 OSL_ENSURE( aMIt != aMEnd,
2043 OStringBuffer(
"NumberFormatsBuffer::insertBuiltinFormats - locale '" ).
2045 append(
"' not supported (#i29949#)" ).getStr() );
2048 aMIt = aBuiltinMap.find(
"*" );
2049 OSL_ENSURE( aMIt != aMEnd,
"NumberFormatsBuffer::insertBuiltinFormats - default map not found" );
2051 for( ; aMIt != aMEnd; aMIt = aBuiltinMap.find( OUString::createFromAscii( aMIt->second->mpcParent ) ) )
2052 aBuiltinVec.push_back( aMIt->second );
2055 std::map< sal_uInt32, sal_uInt32 > aReuseMap;
2056 for( BuiltinVec::reverse_iterator aVIt = aBuiltinVec.rbegin(), aVEnd = aBuiltinVec.rend(); aVIt != aVEnd; ++aVIt )
2060 if( (*aVIt)->mpcParent[ 0 ] !=
'\0' && OUString::createFromAscii((*aVIt)->mpcLocale) !=
maLocaleStr )
2061 aLocale = aSysLocale;
2062 for(
const BuiltinFormat* pBuiltin = (*aVIt)->mpFormats; pBuiltin && (pBuiltin->mnNumFmtId >= 0); ++pBuiltin )
2065 rxNumFmt = std::make_shared<NumberFormat>( *this );
2067 bool bReuse =
false;
2068 if( pBuiltin->mpcFmtCode )
2069 rxNumFmt->setFormatCode( aLocale, pBuiltin->mpcFmtCode );
2070 else if( pBuiltin->mnPredefId >= 0 )
2071 rxNumFmt->setPredefinedId( aLocale, pBuiltin->mnPredefId );
2073 bReuse = pBuiltin->mnReuseId >= 0;
2076 aReuseMap[ pBuiltin->mnNumFmtId ] = pBuiltin->mnReuseId;
2078 aReuseMap.erase( pBuiltin->mnNumFmtId );
2083 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)