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>
37#include <osl/diagnose.h>
38#include <osl/thread.h>
39#include <rtl/ustrbuf.hxx>
45#include <oox/token/tokens.hxx>
47#include <document.hxx>
68#define NUMFMT_STRING( INDEX, FORMATCODE ) \
69 { INDEX, FORMATCODE, -1, -1 }
72#define NUMFMT_PREDEF( INDEX, PREDEFINED ) \
73 { INDEX, nullptr, css::i18n::NumberFormatIndex::PREDEFINED, -1 }
76#define NUMFMT_REUSE( INDEX, REUSED_INDEX ) \
77 { INDEX, nullptr, -1, REUSED_INDEX }
80#define NUMFMT_ENDTABLE() \
81 { -1, nullptr, -1, -1 }
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" )
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 "\"" )
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 )
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" )
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 "* \"-\"?\?_ ;" "_ @_ " )
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 )
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-" )
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 "* \"-\"?\?_-;" "_-@_-" )
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 )
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 "-" )
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 "_-;_-@_-" )
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 )
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" )
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 "* \"-\"?\?_-;" "_-@_-" )
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 )
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 )
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 "_-;_-@_-" )
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 )
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)" )
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 "* \"-\"?\?_);" "_(@_)" )
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 )
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 ")" )
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 "_ ;_ @_ " )
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 )
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"
399#define UTF8_CCARON_LC "\304\215"
400#define UTF8_LSTROKE_LC "\305\202"
402#define UTF8_HY_DA_LC "\325\244"
403#define UTF8_HY_REH_LC "\326\200"
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"
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"
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"
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"
439const BuiltinFormat spBuiltinFormats_BASE[] =
535const BuiltinFormat spBuiltinFormats_ar_AE[] =
543const BuiltinFormat spBuiltinFormats_ar_BH[] =
551const BuiltinFormat spBuiltinFormats_ar_DZ[] =
559const BuiltinFormat spBuiltinFormats_ar_EG[] =
567const BuiltinFormat spBuiltinFormats_ar_IQ[] =
575const BuiltinFormat spBuiltinFormats_ar_JO[] =
583const BuiltinFormat spBuiltinFormats_ar_KW[] =
591const BuiltinFormat spBuiltinFormats_ar_LB[] =
599const BuiltinFormat spBuiltinFormats_ar_LY[] =
607const BuiltinFormat spBuiltinFormats_ar_MA[] =
615const BuiltinFormat spBuiltinFormats_ar_OM[] =
623const BuiltinFormat spBuiltinFormats_ar_QA[] =
631const BuiltinFormat spBuiltinFormats_ar_SA[] =
639const BuiltinFormat spBuiltinFormats_ar_SY[] =
647const BuiltinFormat spBuiltinFormats_ar_TN[] =
655const BuiltinFormat spBuiltinFormats_ar_YE[] =
663const BuiltinFormat spBuiltinFormats_be_BY[] =
672const BuiltinFormat spBuiltinFormats_bg_BG[] =
681const BuiltinFormat spBuiltinFormats_bn_IN[] =
689const BuiltinFormat spBuiltinFormats_cs_CZ[] =
698const BuiltinFormat spBuiltinFormats_da_DK[] =
706const BuiltinFormat spBuiltinFormats_de_AT[] =
714const BuiltinFormat spBuiltinFormats_de_CH[] =
722const BuiltinFormat spBuiltinFormats_de_DE[] =
730const BuiltinFormat spBuiltinFormats_de_LI[] =
738const BuiltinFormat spBuiltinFormats_de_LU[] =
746const BuiltinFormat spBuiltinFormats_div_MV[] =
754const BuiltinFormat spBuiltinFormats_el_GR[] =
762const BuiltinFormat spBuiltinFormats_en_AU[] =
770const BuiltinFormat spBuiltinFormats_en_BZ[] =
778const BuiltinFormat spBuiltinFormats_en_CA[] =
786const BuiltinFormat spBuiltinFormats_en_CB[] =
794const BuiltinFormat spBuiltinFormats_en_GB[] =
802const BuiltinFormat spBuiltinFormats_en_IE[] =
810const BuiltinFormat spBuiltinFormats_en_JM[] =
818const BuiltinFormat spBuiltinFormats_en_NZ[] =
826const BuiltinFormat spBuiltinFormats_en_PH[] =
834const BuiltinFormat spBuiltinFormats_en_TT[] =
842const BuiltinFormat spBuiltinFormats_en_US[] =
850const BuiltinFormat spBuiltinFormats_en_ZA[] =
858const BuiltinFormat spBuiltinFormats_en_ZW[] =
866const BuiltinFormat spBuiltinFormats_es_AR[] =
874const BuiltinFormat spBuiltinFormats_es_BO[] =
883const BuiltinFormat spBuiltinFormats_es_CL[] =
891const BuiltinFormat spBuiltinFormats_es_CO[] =
899const BuiltinFormat spBuiltinFormats_es_CR[] =
907const BuiltinFormat spBuiltinFormats_es_DO[] =
915const BuiltinFormat spBuiltinFormats_es_EC[] =
923const BuiltinFormat spBuiltinFormats_es_ES[] =
931const BuiltinFormat spBuiltinFormats_es_GT[] =
939const BuiltinFormat spBuiltinFormats_es_HN[] =
948const BuiltinFormat spBuiltinFormats_es_MX[] =
956const BuiltinFormat spBuiltinFormats_es_NI[] =
965const BuiltinFormat spBuiltinFormats_es_PA[] =
973const BuiltinFormat spBuiltinFormats_es_PE[] =
981const BuiltinFormat spBuiltinFormats_es_PR[] =
990const BuiltinFormat spBuiltinFormats_es_PY[] =
998const BuiltinFormat spBuiltinFormats_es_SV[] =
1007const BuiltinFormat spBuiltinFormats_es_UY[] =
1015const BuiltinFormat spBuiltinFormats_es_VE[] =
1023const BuiltinFormat spBuiltinFormats_et_EE[] =
1032const BuiltinFormat spBuiltinFormats_fa_IR[] =
1040const BuiltinFormat spBuiltinFormats_fi_FI[] =
1051const BuiltinFormat spBuiltinFormats_fo_FO[] =
1059const BuiltinFormat spBuiltinFormats_fr_BE[] =
1067const BuiltinFormat spBuiltinFormats_fr_CA[] =
1076const BuiltinFormat spBuiltinFormats_fr_CH[] =
1084const BuiltinFormat spBuiltinFormats_fr_FR[] =
1093const BuiltinFormat spBuiltinFormats_fr_LU[] =
1102const BuiltinFormat spBuiltinFormats_fr_MC[] =
1111const BuiltinFormat spBuiltinFormats_gl_ES[] =
1119const BuiltinFormat spBuiltinFormats_gu_IN[] =
1127const BuiltinFormat spBuiltinFormats_he_IL[] =
1135const BuiltinFormat spBuiltinFormats_hi_IN[] =
1143const BuiltinFormat spBuiltinFormats_hr_BA[] =
1151const BuiltinFormat spBuiltinFormats_hr_HR[] =
1159const BuiltinFormat spBuiltinFormats_hu_HU[] =
1169const BuiltinFormat spBuiltinFormats_hy_AM[] =
1177const BuiltinFormat spBuiltinFormats_id_ID[] =
1185const BuiltinFormat spBuiltinFormats_is_IS[] =
1193const BuiltinFormat spBuiltinFormats_it_CH[] =
1201const BuiltinFormat spBuiltinFormats_it_IT[] =
1209const BuiltinFormat spBuiltinFormats_ka_GE[] =
1218const BuiltinFormat spBuiltinFormats_kk_KZ[] =
1227const BuiltinFormat spBuiltinFormats_kn_IN[] =
1235const BuiltinFormat spBuiltinFormats_ky_KG[] =
1244const BuiltinFormat spBuiltinFormats_lt_LT[] =
1252const BuiltinFormat spBuiltinFormats_lv_LV[] =
1261const BuiltinFormat spBuiltinFormats_ml_IN[] =
1269const BuiltinFormat spBuiltinFormats_mn_MN[] =
1277const BuiltinFormat spBuiltinFormats_ms_BN[] =
1285const BuiltinFormat spBuiltinFormats_ms_MY[] =
1293const BuiltinFormat spBuiltinFormats_mt_MT[] =
1301const BuiltinFormat spBuiltinFormats_nl_BE[] =
1310const BuiltinFormat spBuiltinFormats_nl_NL[] =
1318const BuiltinFormat spBuiltinFormats_no_NO[] =
1327const BuiltinFormat spBuiltinFormats_pa_IN[] =
1335const BuiltinFormat spBuiltinFormats_pl_PL[] =
1345const BuiltinFormat spBuiltinFormats_pt_BR[] =
1353const BuiltinFormat spBuiltinFormats_pt_PT[] =
1361const BuiltinFormat spBuiltinFormats_ro_RO[] =
1370const BuiltinFormat spBuiltinFormats_ru_RU[] =
1379const BuiltinFormat spBuiltinFormats_sk_SK[] =
1388const BuiltinFormat spBuiltinFormats_sl_SI[] =
1396const BuiltinFormat spBuiltinFormats_sv_FI[] =
1407const BuiltinFormat spBuiltinFormats_sv_SE[] =
1416const BuiltinFormat spBuiltinFormats_sw_TZ[] =
1424const BuiltinFormat spBuiltinFormats_ta_IN[] =
1432const BuiltinFormat spBuiltinFormats_te_IN[] =
1440const BuiltinFormat spBuiltinFormats_th_TH[] =
1468const BuiltinFormat spBuiltinFormats_tr_TR[] =
1476const BuiltinFormat spBuiltinFormats_tt_RU[] =
1485const BuiltinFormat spBuiltinFormats_uk_UA[] =
1494const BuiltinFormat spBuiltinFormats_ur_PK[] =
1502const BuiltinFormat spBuiltinFormats_vi_VN[] =
1512const BuiltinFormat spBuiltinFormats_CJK[] =
1529const BuiltinFormat spBuiltinFormats_ja_JP[] =
1545const BuiltinFormat spBuiltinFormats_ko_KR[] =
1562const BuiltinFormat spBuiltinFormats_zh_CN[] =
1578const BuiltinFormat spBuiltinFormats_zh_HK[] =
1592const BuiltinFormat spBuiltinFormats_zh_MO[] =
1606const BuiltinFormat spBuiltinFormats_zh_SG[] =
1620const BuiltinFormat spBuiltinFormats_zh_TW[] =
1634struct BuiltinFormatTable
1641const BuiltinFormatTable spBuiltinFormatTables[] =
1643 {
"*",
"", spBuiltinFormats_BASE },
1644 {
"af-ZA",
"*", spBuiltinFormats_en_ZA },
1645 {
"ar-AE",
"*", spBuiltinFormats_ar_AE },
1646 {
"ar-BH",
"*", spBuiltinFormats_ar_BH },
1647 {
"ar-DZ",
"*", spBuiltinFormats_ar_DZ },
1648 {
"ar-EG",
"*", spBuiltinFormats_ar_EG },
1649 {
"ar-IQ",
"*", spBuiltinFormats_ar_IQ },
1650 {
"ar-JO",
"*", spBuiltinFormats_ar_JO },
1651 {
"ar-KW",
"*", spBuiltinFormats_ar_KW },
1652 {
"ar-LB",
"*", spBuiltinFormats_ar_LB },
1653 {
"ar-LY",
"*", spBuiltinFormats_ar_LY },
1654 {
"ar-MA",
"*", spBuiltinFormats_ar_MA },
1655 {
"ar-OM",
"*", spBuiltinFormats_ar_OM },
1656 {
"ar-QA",
"*", spBuiltinFormats_ar_QA },
1657 {
"ar-SA",
"*", spBuiltinFormats_ar_SA },
1658 {
"ar-SY",
"*", spBuiltinFormats_ar_SY },
1659 {
"ar-TN",
"*", spBuiltinFormats_ar_TN },
1660 {
"ar-YE",
"*", spBuiltinFormats_ar_YE },
1661 {
"be-BY",
"*", spBuiltinFormats_be_BY },
1662 {
"bg-BG",
"*", spBuiltinFormats_bg_BG },
1663 {
"bn-IN",
"*", spBuiltinFormats_bn_IN },
1664 {
"ca-ES",
"*", spBuiltinFormats_es_ES },
1665 {
"cs-CZ",
"*", spBuiltinFormats_cs_CZ },
1666 {
"cy-GB",
"*", spBuiltinFormats_en_GB },
1667 {
"da-DK",
"*", spBuiltinFormats_da_DK },
1668 {
"de-AT",
"*", spBuiltinFormats_de_AT },
1669 {
"de-CH",
"*", spBuiltinFormats_de_CH },
1670 {
"de-DE",
"*", spBuiltinFormats_de_DE },
1671 {
"de-LI",
"*", spBuiltinFormats_de_LI },
1672 {
"de-LU",
"*", spBuiltinFormats_de_LU },
1673 {
"div-MV",
"*", spBuiltinFormats_div_MV },
1674 {
"el-GR",
"*", spBuiltinFormats_el_GR },
1675 {
"en-AU",
"*", spBuiltinFormats_en_AU },
1676 {
"en-BZ",
"*", spBuiltinFormats_en_BZ },
1677 {
"en-CA",
"*", spBuiltinFormats_en_CA },
1678 {
"en-CB",
"*", spBuiltinFormats_en_CB },
1679 {
"en-GB",
"*", spBuiltinFormats_en_GB },
1680 {
"en-IE",
"*", spBuiltinFormats_en_IE },
1681 {
"en-JM",
"*", spBuiltinFormats_en_JM },
1682 {
"en-NZ",
"*", spBuiltinFormats_en_NZ },
1683 {
"en-PH",
"*", spBuiltinFormats_en_PH },
1684 {
"en-TT",
"*", spBuiltinFormats_en_TT },
1685 {
"en-US",
"*", spBuiltinFormats_en_US },
1686 {
"en-ZA",
"*", spBuiltinFormats_en_ZA },
1687 {
"en-ZW",
"*", spBuiltinFormats_en_ZW },
1688 {
"es-AR",
"*", spBuiltinFormats_es_AR },
1689 {
"es-BO",
"*", spBuiltinFormats_es_BO },
1690 {
"es-CL",
"*", spBuiltinFormats_es_CL },
1691 {
"es-CO",
"*", spBuiltinFormats_es_CO },
1692 {
"es-CR",
"*", spBuiltinFormats_es_CR },
1693 {
"es-DO",
"*", spBuiltinFormats_es_DO },
1694 {
"es-EC",
"*", spBuiltinFormats_es_EC },
1695 {
"es-ES",
"*", spBuiltinFormats_es_ES },
1696 {
"es-GT",
"*", spBuiltinFormats_es_GT },
1697 {
"es-HN",
"*", spBuiltinFormats_es_HN },
1698 {
"es-MX",
"*", spBuiltinFormats_es_MX },
1699 {
"es-NI",
"*", spBuiltinFormats_es_NI },
1700 {
"es-PA",
"*", spBuiltinFormats_es_PA },
1701 {
"es-PE",
"*", spBuiltinFormats_es_PE },
1702 {
"es-PR",
"*", spBuiltinFormats_es_PR },
1703 {
"es-PY",
"*", spBuiltinFormats_es_PY },
1704 {
"es-SV",
"*", spBuiltinFormats_es_SV },
1705 {
"es-UY",
"*", spBuiltinFormats_es_UY },
1706 {
"es-VE",
"*", spBuiltinFormats_es_VE },
1707 {
"et-EE",
"*", spBuiltinFormats_et_EE },
1708 {
"fa-IR",
"*", spBuiltinFormats_fa_IR },
1709 {
"fi-FI",
"*", spBuiltinFormats_fi_FI },
1710 {
"fo-FO",
"*", spBuiltinFormats_fo_FO },
1711 {
"fr-BE",
"*", spBuiltinFormats_fr_BE },
1712 {
"fr-CA",
"*", spBuiltinFormats_fr_CA },
1713 {
"fr-CH",
"*", spBuiltinFormats_fr_CH },
1714 {
"fr-FR",
"*", spBuiltinFormats_fr_FR },
1715 {
"fr-LU",
"*", spBuiltinFormats_fr_LU },
1716 {
"fr-MC",
"*", spBuiltinFormats_fr_MC },
1717 {
"gl-ES",
"*", spBuiltinFormats_gl_ES },
1718 {
"gu-IN",
"*", spBuiltinFormats_gu_IN },
1719 {
"he-IL",
"*", spBuiltinFormats_he_IL },
1720 {
"hi-IN",
"*", spBuiltinFormats_hi_IN },
1721 {
"hr-BA",
"*", spBuiltinFormats_hr_BA },
1722 {
"hr-HR",
"*", spBuiltinFormats_hr_HR },
1723 {
"hu-HU",
"*", spBuiltinFormats_hu_HU },
1724 {
"hy-AM",
"*", spBuiltinFormats_hy_AM },
1725 {
"id-ID",
"*", spBuiltinFormats_id_ID },
1726 {
"is-IS",
"*", spBuiltinFormats_is_IS },
1727 {
"it-CH",
"*", spBuiltinFormats_it_CH },
1728 {
"it-IT",
"*", spBuiltinFormats_it_IT },
1729 {
"ka-GE",
"*", spBuiltinFormats_ka_GE },
1730 {
"kk-KZ",
"*", spBuiltinFormats_kk_KZ },
1731 {
"kn-IN",
"*", spBuiltinFormats_kn_IN },
1732 {
"kok-IN",
"*", spBuiltinFormats_hi_IN },
1733 {
"ky-KG",
"*", spBuiltinFormats_ky_KG },
1734 {
"lt-LT",
"*", spBuiltinFormats_lt_LT },
1735 {
"lv-LV",
"*", spBuiltinFormats_lv_LV },
1736 {
"mi-NZ",
"*", spBuiltinFormats_en_NZ },
1737 {
"ml-IN",
"*", spBuiltinFormats_ml_IN },
1738 {
"mn-MN",
"*", spBuiltinFormats_mn_MN },
1739 {
"mr-IN",
"*", spBuiltinFormats_hi_IN },
1740 {
"ms-BN",
"*", spBuiltinFormats_ms_BN },
1741 {
"ms-MY",
"*", spBuiltinFormats_ms_MY },
1742 {
"mt-MT",
"*", spBuiltinFormats_mt_MT },
1743 {
"nb-NO",
"*", spBuiltinFormats_no_NO },
1744 {
"nl-BE",
"*", spBuiltinFormats_nl_BE },
1745 {
"nl-NL",
"*", spBuiltinFormats_nl_NL },
1746 {
"nn-NO",
"*", spBuiltinFormats_no_NO },
1747 {
"nso-ZA",
"*", spBuiltinFormats_en_ZA },
1748 {
"pa-IN",
"*", spBuiltinFormats_pa_IN },
1749 {
"pl-PL",
"*", spBuiltinFormats_pl_PL },
1750 {
"pt-BR",
"*", spBuiltinFormats_pt_BR },
1751 {
"pt-PT",
"*", spBuiltinFormats_pt_PT },
1752 {
"qu-BO",
"*", spBuiltinFormats_es_BO },
1753 {
"qu-EC",
"*", spBuiltinFormats_es_EC },
1754 {
"qu-PE",
"*", spBuiltinFormats_es_PE },
1755 {
"ro-RO",
"*", spBuiltinFormats_ro_RO },
1756 {
"ru-RU",
"*", spBuiltinFormats_ru_RU },
1757 {
"sa-IN",
"*", spBuiltinFormats_hi_IN },
1758 {
"se-FI",
"*", spBuiltinFormats_fi_FI },
1759 {
"se-NO",
"*", spBuiltinFormats_no_NO },
1760 {
"se-SE",
"*", spBuiltinFormats_sv_SE },
1761 {
"sk-SK",
"*", spBuiltinFormats_sk_SK },
1762 {
"sl-SI",
"*", spBuiltinFormats_sl_SI },
1763 {
"sv-FI",
"*", spBuiltinFormats_sv_FI },
1764 {
"sv-SE",
"*", spBuiltinFormats_sv_SE },
1765 {
"sw-TZ",
"*", spBuiltinFormats_sw_TZ },
1766 {
"syr-SY",
"*", spBuiltinFormats_ar_SY },
1767 {
"syr-TR",
"*", spBuiltinFormats_tr_TR },
1768 {
"ta-IN",
"*", spBuiltinFormats_ta_IN },
1769 {
"te-IN",
"*", spBuiltinFormats_te_IN },
1770 {
"th-TH",
"*", spBuiltinFormats_th_TH },
1771 {
"tn-ZA",
"*", spBuiltinFormats_en_ZA },
1772 {
"tr-TR",
"*", spBuiltinFormats_tr_TR },
1773 {
"tt-RU",
"*", spBuiltinFormats_tt_RU },
1774 {
"uk-UA",
"*", spBuiltinFormats_uk_UA },
1775 {
"ur-PK",
"*", spBuiltinFormats_ur_PK },
1776 {
"vi-VN",
"*", spBuiltinFormats_vi_VN },
1777 {
"xh-ZA",
"*", spBuiltinFormats_en_ZA },
1778 {
"zu-ZA",
"*", spBuiltinFormats_en_ZA },
1780 {
"*CJK",
"*", spBuiltinFormats_CJK },
1781 {
"ja-JP",
"*CJK", spBuiltinFormats_ja_JP },
1782 {
"ko-KR",
"*CJK", spBuiltinFormats_ko_KR },
1783 {
"zh-CN",
"*CJK", spBuiltinFormats_zh_CN },
1784 {
"zh-HK",
"*CJK", spBuiltinFormats_zh_HK },
1785 {
"zh-MO",
"*CJK", spBuiltinFormats_zh_MO },
1786 {
"zh-SG",
"*CJK", spBuiltinFormats_zh_SG },
1787 {
"zh-TW",
"*CJK", spBuiltinFormats_zh_TW }
1804sal_Int32 lclCreatePredefinedFormat(
const Reference< XNumberFormats >& rxNumFmts,
1805 sal_Int16 nPredefId,
const Locale& rToLocale )
1810 Reference< XNumberFormatTypes > xNumFmtTypes( rxNumFmts, UNO_QUERY_THROW );
1811 nIndex = (nPredefId >= 0) ?
1812 xNumFmtTypes->getFormatIndex( nPredefId, rToLocale ) :
1813 xNumFmtTypes->getStandardIndex( rToLocale );
1817 OSL_FAIL( OStringBuffer(
"lclCreatePredefinedFormat - cannot create predefined number format " ).
1818 append( OString::number( nPredefId ) ).getStr() );
1823sal_Int32 lclCreateFormat(
const Reference< XNumberFormats >& rxNumFmts,
1824 const OUString& rFmtCode,
const Locale& rToLocale,
const Locale& rFromLocale )
1829 nIndex = rxNumFmts->addNewConverted( rFmtCode, rFromLocale, rToLocale );
1834 if( rFmtCode.equalsIgnoreAsciiCase(
"general" ) )
1836 nIndex = lclCreatePredefinedFormat( rxNumFmts, 0, rToLocale );
1841 OSL_ENSURE( rFmtCode.startsWith(
"#\\ ?/" ) ||
1842 rFmtCode.startsWith(
"#\\ ?\?/" ) ||
1843 rFmtCode.startsWith(
"#\\ ?\?\?/" ),
1844 OStringBuffer(
"lclCreateFormat - cannot create number format '"
1846 +
"\'" ).getStr() );
1853class NumberFormatFinalizer
1856 explicit NumberFormatFinalizer(
const WorkbookHelper& rHelper );
1858 void operator()( NumberFormat& rNumFmt )
const
1866NumberFormatFinalizer::NumberFormatFinalizer(
const WorkbookHelper& rHelper ) :
1871 Reference< XNumberFormatsSupplier > xNumFmtsSupp( rHelper.getDocument(), UNO_QUERY_THROW );
1872 mxNumFmts = xNumFmtsSupp->getNumberFormats();
1877 OSL_ENSURE(
mxNumFmts.is(),
"NumberFormatFinalizer::NumberFormatFinalizer - cannot get number formats" );
1880sal_Int32 lclPosToken ( std::u16string_view sFormat, std::u16string_view sSearch, sal_Int32 nStartPos )
1882 sal_Int32
nLength = sFormat.size();
1883 for ( sal_Int32 i = nStartPos; i < nLength && i >= 0 ;
i++ )
1889 nFind = sFormat.find(
'\"',i+1);
1892 nFind = sFormat.find(
']',i+1);
1899 if ( nFind == std::u16string_view::npos )
1918 sal_Int32 nPosEscape = 0;
1919 sal_Int32 nErase = 0;
1920 sal_Int32 nLastIndex = sal_Int32(aFmtCode.size()) - 1;
1921 OUStringBuffer sFormat(aFmtCode);
1923 while ( ( nPosEscape = lclPosToken( aFmtCode,
u"\\ ", nPosEscape ) ) > 0 )
1925 sal_Int32
nPos = nPosEscape + 2;
1926 while (
nPos < nLastIndex && ( aFmtCode[
nPos] ==
'?' || aFmtCode[
nPos] ==
'#' || aFmtCode[
nPos] ==
'0' ) )
1928 if (
nPos < nLastIndex && aFmtCode[
nPos] ==
'/' )
1930 sFormat.remove(nPosEscape - nErase, 1);
1933 nPosEscape = lclPosToken( aFmtCode,
u";", nPosEscape );
1941 maModel.
maFmtCode = OStringToOUString( std::string_view( pcFmtCode ), RTL_TEXTENCODING_UTF8 );
1964 sal_uInt32 nScNumFmt = nDflt;
1983 maLocaleStr = officecfg::Setup::L10N::ooSetupSystemLocale::get();
1986 maLocaleStr = officecfg::System::L10N::Locale::get();
1995 xNumFmt = std::make_shared<NumberFormat>( *
this );
1999 xNumFmt->setFormatCode( aFmtCode );
2005 sal_Int32 nNumFmtId = rAttribs.
getInteger( XML_numFmtId, -1 );
2006 OUString aFmtCode = rAttribs.
getXString( XML_formatCode, OUString() );
2012 sal_Int32 nNumFmtId =
rStrm.readuInt16();
2034 typedef ::std::map< OUString, const BuiltinFormatTable* > BuiltinMap;
2035 BuiltinMap aBuiltinMap;
2036 for(
auto const &rTable : spBuiltinFormatTables)
2037 aBuiltinMap[ OUString::createFromAscii(rTable.mpcLocale) ] = &rTable;
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 '" +
2049 "' not supported (#i29949#)" ).getStr() );
2052 aMIt = aBuiltinMap.find(
"*" );
2053 OSL_ENSURE( aMIt != aMEnd,
"NumberFormatsBuffer::insertBuiltinFormats - default map not found" );
2055 for( ; aMIt != aMEnd; aMIt = aBuiltinMap.find( OUString::createFromAscii( aMIt->second->mpcParent ) ) )
2056 aBuiltinVec.push_back( aMIt->second );
2059 std::map< sal_uInt32, sal_uInt32 > aReuseMap;
2060 for( BuiltinVec::reverse_iterator aVIt = aBuiltinVec.rbegin(), aVEnd = aBuiltinVec.rend(); aVIt != aVEnd; ++aVIt )
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 )
2069 rxNumFmt = std::make_shared<NumberFormat>( *
this );
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 );
2077 bReuse = pBuiltin->mnReuseId >= 0;
2080 aReuseMap[ pBuiltin->mnNumFmtId ] = pBuiltin->mnReuseId;
2082 aReuseMap.erase( pBuiltin->mnNumFmtId );
2087 for(
const auto& [rNumFmtId, rReuseId] : aReuseMap )
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
static SC_DLLPUBLIC LanguageType eLnge
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...
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
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.
Helper class to provide access to global workbook data.
ScDocument & getScDocument()
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)
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
ApiNumFmtData()
API number format index.
css::lang::Locale maLocale