Update ooo320-m1
[ooovba.git] / oox / source / xls / numberformatsbuffer.cxx
blobaafc600c9030c8e45d428588f0cca02cafeb998c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: numberformatsbuffer.cxx,v $
10 * $Revision: 1.5.6.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "oox/xls/numberformatsbuffer.hxx"
32 #include <com/sun/star/container/XNameAccess.hpp>
33 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
35 #include <com/sun/star/util/XNumberFormats.hpp>
36 #include <com/sun/star/util/XNumberFormatTypes.hpp>
37 #include <com/sun/star/i18n/NumberFormatIndex.hpp>
38 #include <osl/thread.h>
39 #include <rtl/string.hxx>
40 #include <rtl/strbuf.hxx>
41 #include <rtl/ustrbuf.hxx>
42 #include "properties.hxx"
43 #include "oox/helper/attributelist.hxx"
44 #include "oox/helper/propertymap.hxx"
45 #include "oox/helper/recordinputstream.hxx"
46 #include "oox/core/filterbase.hxx"
47 #include "oox/xls/biffinputstream.hxx"
49 using ::rtl::OString;
50 using ::rtl::OStringBuffer;
51 using ::rtl::OUString;
52 using ::rtl::OUStringBuffer;
53 using ::rtl::OStringToOUString;
54 using ::com::sun::star::uno::Any;
55 using ::com::sun::star::uno::Reference;
56 using ::com::sun::star::uno::Sequence;
57 using ::com::sun::star::uno::Exception;
58 using ::com::sun::star::uno::UNO_QUERY;
59 using ::com::sun::star::uno::UNO_QUERY_THROW;
60 using ::com::sun::star::container::XNameAccess;
61 using ::com::sun::star::lang::Locale;
62 using ::com::sun::star::lang::XMultiServiceFactory;
63 using ::com::sun::star::util::XNumberFormatsSupplier;
64 using ::com::sun::star::util::XNumberFormats;
65 using ::com::sun::star::util::XNumberFormatTypes;
67 namespace oox {
68 namespace xls {
70 // ============================================================================
72 namespace {
74 /** Stores the number format used in Calc for an Excel built-in number format. */
75 struct BuiltinFormat
77 sal_Int32 mnNumFmtId; /// Built-in number format index.
78 const sal_Char* mpcFmtCode; /// Format string, UTF-8, may be 0 (mnPredefId is used then).
79 sal_Int16 mnPredefId; /// Predefined format index, if mpcFmtCode is 0.
80 sal_Int32 mnReuseId; /// Use this format, if mpcFmtCode is 0 and mnPredefId is -1.
83 /** Defines a literal built-in number format. */
84 #define NUMFMT_STRING( INDEX, FORMATCODE ) \
85 { INDEX, FORMATCODE, -1, -1 }
87 /** Defines a built-in number format that maps to an own predefined format. */
88 #define NUMFMT_PREDEF( INDEX, PREDEFINED ) \
89 { INDEX, 0, ::com::sun::star::i18n::NumberFormatIndex::PREDEFINED, -1 }
91 /** Defines a built-in number format that is the same as the specified in nReuseId. */
92 #define NUMFMT_REUSE( INDEX, REUSED_INDEX ) \
93 { INDEX, 0, -1, REUSED_INDEX }
95 /** Terminates a built-in number format table. */
96 #define NUMFMT_ENDTABLE() \
97 { -1, 0, -1, -1 }
99 /** Defines builtin date and time formats 14...22.
100 @param SYSTEMDATE Complete short system date (for formats 14 and 22).
101 @param DAY Day format (for formats 15 and 16).
102 @param DAYSEP Separator between day and month (for formats 15 and 16).
103 @param MONTH Month format (for formats 15...17).
104 @param MONTHSEP Separator between month and year (for formats 15 and 17).
105 @param YEAR Year format (for formats 15 and 17).
106 @param HOUR12 Hour format for 12-hour AM/PM formats (formats 18 and 19).
107 @param HOUR24 Hour format for 24-hour formats (formats 20...22). */
108 #define NUMFMT_ALLDATETIMES( SYSTEMDATE, DAY, DAYSEP, MONTH, MONTHSEP, YEAR, HOUR12, HOUR24 ) \
109 NUMFMT_STRING( 14, SYSTEMDATE ), \
110 NUMFMT_STRING( 15, DAY DAYSEP MONTH MONTHSEP YEAR ), \
111 NUMFMT_STRING( 16, DAY DAYSEP MONTH ), \
112 NUMFMT_STRING( 17, MONTH MONTHSEP YEAR ), \
113 NUMFMT_STRING( 18, HOUR12 ":mm AM/PM" ), \
114 NUMFMT_STRING( 19, HOUR12 ":mm:ss AM/PM" ), \
115 NUMFMT_STRING( 20, HOUR24 ":mm" ), \
116 NUMFMT_STRING( 21, HOUR24 ":mm:ss" ), \
117 NUMFMT_STRING( 22, SYSTEMDATE " " HOUR24 ":mm" )
119 /** Defines builtin time formats INDEX and INDEX+1 for CJK locales.
120 @param INDEX First number format index.
121 @param HOURFORMAT Hour format.
122 @param HOUR Hour symbol.
123 @param MINUTE Minute symbol.
124 @param SECOND Second symbol. */
125 #define NUMFMT_TIME_CJK( INDEX, HOURFORMAT, HOUR, MINUTE, SECOND ) \
126 NUMFMT_STRING( INDEX + 0, HOURFORMAT "\"" HOUR "\"mm\"" MINUTE "\"" ), \
127 NUMFMT_STRING( INDEX + 1, HOURFORMAT "\"" HOUR "\"mm\"" MINUTE "\"ss\"" SECOND "\"" )
129 /** Defines builtin time formats 32...35 for CJK locales.
130 @param HOUR12 Hour format for 12-hour AM/PM formats (formats 34 and 35).
131 @param HOUR24 Hour format for 24-hour formats (formats 32 and 33).
132 @param HOUR Hour symbol.
133 @param MINUTE Minute symbol.
134 @param SECOND Second symbol. */
135 #define NUMFMT_ALLTIMES_CJK( HOUR12, HOUR24, HOUR, MINUTE, SECOND ) \
136 NUMFMT_TIME_CJK( 32, HOUR24, HOUR, MINUTE, SECOND ), \
137 NUMFMT_TIME_CJK( 34, "AM/PM" HOUR12, HOUR, MINUTE, SECOND )
139 /** Defines builtin currency formats INDEX...INDEX+3 in the following format:
140 "symbol, [minus], number".
141 @param INDEX First number format index.
142 @param SYMBOL Currency symbol.
143 @param SPACE Space character(s) between currency symbol and number.
144 @param MODIF Leading modifier for each portion (e.g. "t" for Thai formats). */
145 #define NUMFMT_CURRENCY_SYMBOL_MINUS_NUMBER( INDEX, SYMBOL, SPACE, MODIF ) \
146 NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0;" MODIF SYMBOL SPACE "-#,##0" ), \
147 NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0;" "[RED]" MODIF SYMBOL SPACE "-#,##0" ), \
148 NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00;" MODIF SYMBOL SPACE "-#,##0.00" ), \
149 NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00;" "[RED]" MODIF SYMBOL SPACE "-#,##0.00" )
151 /** Defines builtin accounting formats INDEX...INDEX+3 in the following format:
152 "symbol, [minus], number".
153 @param INDEX First number format index.
154 @param SYMBOL Currency symbol.
155 @param SPACE Space character(s) between currency symbol and number. */
156 #define NUMFMT_ACCOUNTING_SYMBOL_MINUS_NUMBER( INDEX, SYMBOL, SPACE ) \
157 NUMFMT_STRING( INDEX + 0, "_ " "* #,##0_ ;" "_ " "* -#,##0_ ;" "_ " "* \"-\"_ ;" "_ @_ " ), \
158 NUMFMT_STRING( INDEX + 1, "_ " SYMBOL SPACE "* #,##0_ ;" "_ " SYMBOL SPACE "* -#,##0_ ;" "_ " SYMBOL SPACE "* \"-\"_ ;" "_ @_ " ), \
159 NUMFMT_STRING( INDEX + 2, "_ " "* #,##0.00_ ;" "_ " "* -#,##0.00_ ;" "_ " "* \"-\"?\?_ ;" "_ @_ " ), \
160 NUMFMT_STRING( INDEX + 3, "_ " SYMBOL SPACE "* #,##0.00_ ;" "_ " SYMBOL SPACE "* -#,##0.00_ ;" "_ " SYMBOL SPACE "* \"-\"?\?_ ;" "_ @_ " )
162 /** Defines builtin currency formats 5...8 (with currency symbol), 37...40
163 (blind currency symbol), and 41...44 (accounting), in the following format:
164 "symbol, [minus], number".
165 @param SYMBOL Currency symbol.
166 @param SPACE Space character(s) between currency symbol and number. */
167 #define NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( SYMBOL, SPACE ) \
168 NUMFMT_CURRENCY_SYMBOL_MINUS_NUMBER( 5, SYMBOL, SPACE, "" ), \
169 NUMFMT_CURRENCY_SYMBOL_MINUS_NUMBER( 37, "", "", "" ), \
170 NUMFMT_ACCOUNTING_SYMBOL_MINUS_NUMBER( 41, SYMBOL, SPACE )
172 /** Defines builtin currency formats INDEX...INDEX+3 in the following format:
173 "symbol, number, [minus]".
174 @param INDEX First number format index.
175 @param SYMBOL Currency symbol.
176 @param SPACE Space character(s) between currency symbol and number.
177 @param MODIF Leading modifier for each portion (e.g. "t" for Thai formats). */
178 #define NUMFMT_CURRENCY_SYMBOL_NUMBER_MINUS( INDEX, SYMBOL, SPACE, MODIF ) \
179 NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0_-;" MODIF SYMBOL SPACE "#,##0-" ), \
180 NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0_-;" "[RED]" MODIF SYMBOL SPACE "#,##0-" ), \
181 NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00_-;" MODIF SYMBOL SPACE "#,##0.00-" ), \
182 NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00_-;" "[RED]" MODIF SYMBOL SPACE "#,##0.00-" )
184 /** Defines builtin accounting formats INDEX...INDEX+3 in the following format:
185 "symbol, number, [minus]".
186 @param INDEX First number format index.
187 @param SYMBOL Currency symbol.
188 @param SPACE Space character(s) between currency symbol and number. */
189 #define NUMFMT_ACCOUNTING_SYMBOL_NUMBER_MINUS( INDEX, SYMBOL, SPACE ) \
190 NUMFMT_STRING( INDEX + 0, "_-" "* #,##0_-;" "_-" "* #,##0-;" "_-" "* \"-\"_-;" "_-@_-" ), \
191 NUMFMT_STRING( INDEX + 1, "_-" SYMBOL SPACE "* #,##0_-;" "_-" SYMBOL SPACE "* #,##0-;" "_-" SYMBOL SPACE "* \"-\"_-;" "_-@_-" ), \
192 NUMFMT_STRING( INDEX + 2, "_-" "* #,##0.00_-;" "_-" "* #,##0.00-;" "_-" "* \"-\"?\?_-;" "_-@_-" ), \
193 NUMFMT_STRING( INDEX + 3, "_-" SYMBOL SPACE "* #,##0.00_-;" "_-" SYMBOL SPACE "* #,##0.00-;" "_-" SYMBOL SPACE "* \"-\"?\?_-;" "_-@_-" )
195 /** Defines builtin currency formats 5...8 (with currency symbol), 37...40
196 (blind currency symbol), and 41...44 (accounting), in the following format:
197 "symbol, number, [minus]".
198 @param SYMBOL Currency symbol.
199 @param SPACE Space character(s) between currency symbol and number. */
200 #define NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( SYMBOL, SPACE ) \
201 NUMFMT_CURRENCY_SYMBOL_NUMBER_MINUS( 5, SYMBOL, SPACE, "" ), \
202 NUMFMT_CURRENCY_SYMBOL_NUMBER_MINUS( 37, "", "", "" ), \
203 NUMFMT_ACCOUNTING_SYMBOL_NUMBER_MINUS( 41, SYMBOL, SPACE )
205 /** Defines builtin currency formats INDEX...INDEX+3 in the following format:
206 "number, symbol, [minus]".
207 @param INDEX First number format index.
208 @param SYMBOL Currency symbol.
209 @param SPACE Space character(s) between number and currency symbol.
210 @param MODIF Leading modifier for each portion (e.g. "t" for Thai formats). */
211 #define NUMFMT_CURRENCY_NUMBER_SYMBOL_MINUS( INDEX, SYMBOL, SPACE, MODIF ) \
212 NUMFMT_STRING( INDEX + 0, MODIF "#,##0" SPACE SYMBOL "_-;" MODIF "#,##0" SPACE SYMBOL "-" ), \
213 NUMFMT_STRING( INDEX + 1, MODIF "#,##0" SPACE SYMBOL "_-;" "[RED]" MODIF "#,##0" SPACE SYMBOL "-" ), \
214 NUMFMT_STRING( INDEX + 2, MODIF "#,##0.00" SPACE SYMBOL "_-;" MODIF "#,##0.00" SPACE SYMBOL "-" ), \
215 NUMFMT_STRING( INDEX + 3, MODIF "#,##0.00" SPACE SYMBOL "_-;" "[RED]" MODIF "#,##0.00" SPACE SYMBOL "-" )
217 /** Defines builtin accounting formats INDEX...INDEX+3 in the following format:
218 "number, symbol, [minus]".
219 @param INDEX First number format index.
220 @param SYMBOL Currency symbol.
221 @param BLINDS Blind currency symbol.
222 @param SPACE Space character(s) between number and currency symbol. */
223 #define NUMFMT_ACCOUNTING_NUMBER_SYMBOL_MINUS( INDEX, SYMBOL, BLINDS, SPACE ) \
224 NUMFMT_STRING( INDEX + 0, "_-* #,##0" SPACE BLINDS "_-;_-* #,##0" SPACE BLINDS "-;_-* \"-\"" SPACE BLINDS "_-;_-@_-" ), \
225 NUMFMT_STRING( INDEX + 1, "_-* #,##0" SPACE SYMBOL "_-;_-* #,##0" SPACE SYMBOL "-;_-* \"-\"" SPACE SYMBOL "_-;_-@_-" ), \
226 NUMFMT_STRING( INDEX + 2, "_-* #,##0.00" SPACE BLINDS "_-;_-* #,##0.00" SPACE BLINDS "-;_-* \"-\"?\?" SPACE BLINDS "_-;_-@_-" ), \
227 NUMFMT_STRING( INDEX + 3, "_-* #,##0.00" SPACE SYMBOL "_-;_-* #,##0.00" SPACE SYMBOL "-;_-* \"-\"?\?" SPACE SYMBOL "_-;_-@_-" )
229 /** Defines builtin currency formats 5...8 (with currency symbol), 37...40
230 (blind currency symbol), and 41...44 (accounting), in the following format:
231 "number, symbol, [minus]".
232 @param SYMBOL Currency symbol.
233 @param BLINDS Blind currency symbol.
234 @param SPACE Space character(s) between number and currency symbol. */
235 #define NUMFMT_ALLCURRENCIES_NUMBER_SYMBOL_MINUS( SYMBOL, BLINDS, SPACE ) \
236 NUMFMT_CURRENCY_NUMBER_SYMBOL_MINUS( 5, SYMBOL, SPACE, "" ), \
237 NUMFMT_CURRENCY_NUMBER_SYMBOL_MINUS( 37, BLINDS, SPACE, "" ), \
238 NUMFMT_ACCOUNTING_NUMBER_SYMBOL_MINUS( 41, SYMBOL, BLINDS, SPACE )
240 /** Defines builtin currency formats INDEX...INDEX+3 in the following format:
241 "[minus], symbol, number".
242 @param INDEX First number format index.
243 @param SYMBOL Currency symbol.
244 @param SPACE Space character(s) between currency symbol and number.
245 @param MODIF Leading modifier for each portion (e.g. "t" for Thai formats). */
246 #define NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( INDEX, SYMBOL, SPACE, MODIF ) \
247 NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0;" MODIF "-" SYMBOL SPACE "#,##0" ), \
248 NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0;" "[RED]" MODIF "-" SYMBOL SPACE "#,##0" ), \
249 NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00;" MODIF "-" SYMBOL SPACE "#,##0.00" ), \
250 NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00;" "[RED]" MODIF "-" SYMBOL SPACE "#,##0.00" )
252 /** Defines builtin accounting formats INDEX...INDEX+3 in the following order:
253 "[minus], symbol, number".
254 @param INDEX First number format index.
255 @param SYMBOL Currency symbol.
256 @param SPACE Space character(s) between currency symbol and number. */
257 #define NUMFMT_ACCOUNTING_MINUS_SYMBOL_NUMBER( INDEX, SYMBOL, SPACE ) \
258 NUMFMT_STRING( INDEX + 0, "_-" "* #,##0_-;" "-" "* #,##0_-;" "_-" "* \"-\"_-;" "_-@_-" ), \
259 NUMFMT_STRING( INDEX + 1, "_-" SYMBOL SPACE "* #,##0_-;" "-" SYMBOL SPACE "* #,##0_-;" "_-" SYMBOL SPACE "* \"-\"_-;" "_-@_-" ), \
260 NUMFMT_STRING( INDEX + 2, "_-" "* #,##0.00_-;" "-" "* #,##0.00_-;" "_-" "* \"-\"?\?_-;" "_-@_-" ), \
261 NUMFMT_STRING( INDEX + 3, "_-" SYMBOL SPACE "* #,##0.00_-;" "-" SYMBOL SPACE "* #,##0.00_-;" "_-" SYMBOL SPACE "* \"-\"?\?_-;" "_-@_-" )
263 /** Defines builtin currency formats 5...8 (with currency symbol), 37...40
264 (blind currency symbol), and 41...44 (accounting), in the following order:
265 "[minus], symbol, number".
266 @param SYMBOL Currency symbol.
267 @param SPACE Space character(s) between currency symbol and number. */
268 #define NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( SYMBOL, SPACE ) \
269 NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( 5, SYMBOL, SPACE, "" ), \
270 NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( 37, "", "", "" ), \
271 NUMFMT_ACCOUNTING_MINUS_SYMBOL_NUMBER( 41, SYMBOL, SPACE )
273 /** Defines builtin currency formats INDEX...INDEX+3 in the following format:
274 "[minus], number, symbol".
275 @param INDEX First number format index.
276 @param SYMBOL Currency symbol.
277 @param SPACE Space character(s) between number and currency symbol.
278 @param MODIF Leading modifier for each portion (e.g. "t" for Thai formats). */
279 #define NUMFMT_CURRENCY_MINUS_NUMBER_SYMBOL( INDEX, SYMBOL, SPACE, MODIF ) \
280 NUMFMT_STRING( INDEX + 0, MODIF "#,##0" SPACE SYMBOL ";" MODIF "-#,##0" SPACE SYMBOL ), \
281 NUMFMT_STRING( INDEX + 1, MODIF "#,##0" SPACE SYMBOL ";" "[RED]" MODIF "-#,##0" SPACE SYMBOL ), \
282 NUMFMT_STRING( INDEX + 2, MODIF "#,##0.00" SPACE SYMBOL ";" MODIF "-#,##0.00" SPACE SYMBOL ), \
283 NUMFMT_STRING( INDEX + 3, MODIF "#,##0.00" SPACE SYMBOL ";" "[RED]" MODIF "-#,##0.00" SPACE SYMBOL )
285 /** Defines builtin accounting formats INDEX...INDEX+3 in the following format:
286 "[minus], number, symbol".
287 @param INDEX First number format index.
288 @param SYMBOL Currency symbol.
289 @param BLINDS Blind currency symbol.
290 @param SPACE Space character(s) between number and currency symbol. */
291 #define NUMFMT_ACCOUNTING_MINUS_NUMBER_SYMBOL( INDEX, SYMBOL, BLINDS, SPACE ) \
292 NUMFMT_STRING( INDEX + 0, "_-* #,##0" SPACE BLINDS "_-;-* #,##0" SPACE BLINDS "_-;_-* \"-\"" SPACE BLINDS "_-;_-@_-" ), \
293 NUMFMT_STRING( INDEX + 1, "_-* #,##0" SPACE SYMBOL "_-;-* #,##0" SPACE SYMBOL "_-;_-* \"-\"" SPACE SYMBOL "_-;_-@_-" ), \
294 NUMFMT_STRING( INDEX + 2, "_-* #,##0.00" SPACE BLINDS "_-;-* #,##0.00" SPACE BLINDS "_-;_-* \"-\"?\?" SPACE BLINDS "_-;_-@_-" ), \
295 NUMFMT_STRING( INDEX + 3, "_-* #,##0.00" SPACE SYMBOL "_-;-* #,##0.00" SPACE SYMBOL "_-;_-* \"-\"?\?" SPACE SYMBOL "_-;_-@_-" )
297 /** Defines builtin currency formats 5...8 (with currency symbol), 37...40
298 (blind currency symbol), and 41...44 (accounting), in the following format:
299 "[minus], number, symbol".
300 @param SYMBOL Currency symbol.
301 @param BLINDS Blind currency symbol.
302 @param SPACE Space character(s) between number and currency symbol. */
303 #define NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( SYMBOL, BLINDS, SPACE ) \
304 NUMFMT_CURRENCY_MINUS_NUMBER_SYMBOL( 5, SYMBOL, SPACE, "" ), \
305 NUMFMT_CURRENCY_MINUS_NUMBER_SYMBOL( 37, BLINDS, SPACE, "" ), \
306 NUMFMT_ACCOUNTING_MINUS_NUMBER_SYMBOL( 41, SYMBOL, BLINDS, SPACE )
308 /** Defines builtin currency formats INDEX...INDEX+3 in the following format:
309 "[opening parenthesis], symbol, number, [closing parenthesis].".
310 @param INDEX First number format index.
311 @param SYMBOL Currency symbol.
312 @param SPACE Space character(s) between currency symbol and number.
313 @param MODIF Leading modifier for each portion (e.g. "t" for Thai formats). */
314 #define NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( INDEX, SYMBOL, SPACE, MODIF ) \
315 NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0_);" MODIF "(" SYMBOL SPACE "#,##0)" ), \
316 NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0_);" "[RED]" MODIF "(" SYMBOL SPACE "#,##0)" ), \
317 NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00_);" MODIF "(" SYMBOL SPACE "#,##0.00)" ), \
318 NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00_);" "[RED]" MODIF "(" SYMBOL SPACE "#,##0.00)" )
320 /** Defines builtin accounting formats INDEX...INDEX+3 in the following format:
321 "[opening parenthesis], symbol, number, [closing parenthesis].".
322 @param INDEX First number format index.
323 @param SYMBOL Currency symbol.
324 @param SPACE Space character(s) between currency symbol and number. */
325 #define NUMFMT_ACCOUNTING_OPEN_SYMBOL_NUMBER_CLOSE( INDEX, SYMBOL, SPACE ) \
326 NUMFMT_STRING( INDEX + 0, "_(" "* #,##0_);" "_(" "* (#,##0);" "_(" "* \"-\"_);" "_(@_)" ), \
327 NUMFMT_STRING( INDEX + 1, "_(" SYMBOL SPACE "* #,##0_);" "_(" SYMBOL SPACE "* (#,##0);" "_(" SYMBOL SPACE "* \"-\"_);" "_(@_)" ), \
328 NUMFMT_STRING( INDEX + 2, "_(" "* #,##0.00_);" "_(" "* (#,##0.00);" "_(" "* \"-\"?\?_);" "_(@_)" ), \
329 NUMFMT_STRING( INDEX + 3, "_(" SYMBOL SPACE "* #,##0.00_);" "_(" SYMBOL SPACE "* (#,##0.00);" "_(" SYMBOL SPACE "* \"-\"?\?_);" "_(@_)" )
331 /** Defines builtin currency formats 5...8 (with currency symbol), 37...40
332 (blind currency symbol), and 41...44 (accounting), in the following format:
333 "[opening parenthesis], symbol, number, [closing parenthesis].".
334 @param SYMBOL Currency symbol.
335 @param SPACE Space character(s) between currency symbol and number. */
336 #define NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( SYMBOL, SPACE ) \
337 NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 5, SYMBOL, SPACE, "" ), \
338 NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 37, "", "", "" ), \
339 NUMFMT_ACCOUNTING_OPEN_SYMBOL_NUMBER_CLOSE( 41, SYMBOL, SPACE )
341 /** Defines builtin currency formats INDEX...INDEX+3 in the following format:
342 "[opening parenthesis], number, symbol, [closing parenthesis].".
343 @param INDEX First number format index.
344 @param SYMBOL Currency symbol.
345 @param SPACE Space character(s) between number and currency symbol.
346 @param MODIF Leading modifier for each portion (e.g. "t" for Thai formats). */
347 #define NUMFMT_CURRENCY_OPEN_NUMBER_SYMBOL_CLOSE( INDEX, SYMBOL, SPACE, MODIF ) \
348 NUMFMT_STRING( INDEX + 0, MODIF "#,##0" SPACE SYMBOL "_);" MODIF "(#,##0" SPACE SYMBOL ")" ), \
349 NUMFMT_STRING( INDEX + 1, MODIF "#,##0" SPACE SYMBOL "_);" "[RED]" MODIF "(#,##0" SPACE SYMBOL ")" ), \
350 NUMFMT_STRING( INDEX + 2, MODIF "#,##0.00" SPACE SYMBOL "_);" MODIF "(#,##0.00" SPACE SYMBOL ")" ), \
351 NUMFMT_STRING( INDEX + 3, MODIF "#,##0.00" SPACE SYMBOL "_);" "[RED]" MODIF "(#,##0.00" SPACE SYMBOL ")" )
353 /** Defines builtin accounting formats INDEX...INDEX+3 in the following format:
354 "[opening parenthesis], number, symbol, [closing parenthesis].".
355 @param INDEX First number format index.
356 @param SYMBOL Currency symbol.
357 @param BLINDS Blind currency symbol.
358 @param SPACE Space character(s) between number and currency symbol. */
359 #define NUMFMT_ACCOUNTING_OPEN_NUMBER_SYMBOL_CLOSE( INDEX, SYMBOL, BLINDS, SPACE ) \
360 NUMFMT_STRING( INDEX + 0, "_ * #,##0_)" SPACE BLINDS "_ ;_ * (#,##0)" SPACE BLINDS "_ ;_ * \"-\"_)" SPACE BLINDS "_ ;_ @_ " ), \
361 NUMFMT_STRING( INDEX + 1, "_ * #,##0_)" SPACE SYMBOL "_ ;_ * (#,##0)" SPACE SYMBOL "_ ;_ * \"-\"_)" SPACE SYMBOL "_ ;_ @_ " ), \
362 NUMFMT_STRING( INDEX + 2, "_ * #,##0.00_)" SPACE BLINDS "_ ;_ * (#,##0.00)" SPACE BLINDS "_ ;_ * \"-\"?\?_)" SPACE BLINDS "_ ;_ @_ " ), \
363 NUMFMT_STRING( INDEX + 3, "_ * #,##0.00_)" SPACE SYMBOL "_ ;_ * (#,##0.00)" SPACE SYMBOL "_ ;_ * \"-\"?\?_)" SPACE SYMBOL "_ ;_ @_ " )
365 /** Defines builtin currency formats 5...8 (with currency symbol), 37...40
366 (blind currency symbol), and 41...44 (accounting), in the following format:
367 "[opening parenthesis], number, symbol, [closing parenthesis].".
368 @param SYMBOL Currency symbol.
369 @param BLINDS Blind currency symbol.
370 @param SPACE Space character(s) between number and currency symbol. */
371 #define NUMFMT_ALLCURRENCIES_OPEN_NUMBER_SYMBOL_CLOSE( SYMBOL, BLINDS, SPACE ) \
372 NUMFMT_CURRENCY_OPEN_NUMBER_SYMBOL_CLOSE( 5, SYMBOL, SPACE, "" ), \
373 NUMFMT_CURRENCY_OPEN_NUMBER_SYMBOL_CLOSE( 37, BLINDS, SPACE, "" ), \
374 NUMFMT_ACCOUNTING_OPEN_NUMBER_SYMBOL_CLOSE( 41, SYMBOL, BLINDS, SPACE )
376 // currency unit characters
377 #define UTF8_BAHT "\340\270\277"
378 #define UTF8_COLON "\342\202\241"
379 #define UTF8_CURR_AR_AE "\330\257.\330\245."
380 #define UTF8_CURR_AR_BH "\330\257.\330\250."
381 #define UTF8_CURR_AR_DZ "\330\257.\330\254."
382 #define UTF8_CURR_AR_EG "\330\254.\331\205."
383 #define UTF8_CURR_AR_IQ "\330\257.\330\271."
384 #define UTF8_CURR_AR_JO "\330\257.\330\247."
385 #define UTF8_CURR_AR_KW "\330\257.\331\203."
386 #define UTF8_CURR_AR_LB "\331\204.\331\204."
387 #define UTF8_CURR_AR_LY "\330\257.\331\204."
388 #define UTF8_CURR_AR_MA "\330\257.\331\205."
389 #define UTF8_CURR_AR_OM "\330\261.\330\271."
390 #define UTF8_CURR_AR_QA "\330\261.\331\202."
391 #define UTF8_CURR_AR_SA "\330\261.\330\263."
392 #define UTF8_CURR_AR_SY "\331\204.\330\263."
393 #define UTF8_CURR_AR_TN "\330\257.\330\252."
394 #define UTF8_CURR_AR_YE "\330\261.\331\212."
395 #define UTF8_CURR_BN_IN "\340\246\237\340\246\276"
396 #define UTF8_CURR_FA_IR "\330\261\331\212\330\247\331\204"
397 #define UTF8_CURR_GU_IN "\340\252\260\340\253\202"
398 #define UTF8_CURR_HI_IN "\340\244\260\340\245\201"
399 #define UTF8_CURR_KN_IN "\340\262\260\340\263\202"
400 #define UTF8_CURR_ML_IN "\340\264\225"
401 #define UTF8_CURR_PA_IN "\340\250\260\340\251\201"
402 #define UTF8_CURR_TA_IN "\340\256\260\340\257\202"
403 #define UTF8_CURR_TE_IN "\340\260\260\340\261\202"
404 #define UTF8_DONG "\342\202\253"
405 #define UTF8_EURO "\342\202\254"
406 #define UTF8_POUND_GB "\302\243"
407 #define UTF8_RUFIYAA "\336\203"
408 #define UTF8_SHEQEL "\342\202\252"
409 #define UTF8_TUGRUG "\342\202\256"
410 #define UTF8_WON "\342\202\251"
411 #define UTF8_YEN_CN "\357\277\245"
412 #define UTF8_YEN_JP "\302\245"
414 // Unicode characters for currency units
415 #define UTF8_CCARON_LC "\304\215"
416 #define UTF8_LSTROKE_LC "\305\202"
417 // Armenian
418 #define UTF8_HY_DA_LC "\325\244"
419 #define UTF8_HY_REH_LC "\326\200"
420 // Cyrillic
421 #define UTF8_CYR_G_LC "\320\263"
422 #define UTF8_CYR_L_LC "\320\273"
423 #define UTF8_CYR_M_LC "\320\274"
424 #define UTF8_CYR_N_LC "\320\275"
425 #define UTF8_CYR_O_LC "\320\276"
426 #define UTF8_CYR_R_LC "\321\200"
427 #define UTF8_CYR_S_LC "\321\201"
428 #define UTF8_CYR_W_LC "\320\262"
430 // Japanese/Chinese date/time characters
431 #define UTF8_CJ_YEAR "\345\271\264"
432 #define UTF8_CJ_MON "\346\234\210"
433 #define UTF8_CJ_DAY "\346\227\245"
434 #define UTF8_CJ_HOUR "\346\231\202"
435 #define UTF8_CJ_MIN "\345\210\206"
436 #define UTF8_CJ_SEC "\347\247\222"
438 // Chinese Simplified date/time characters
439 #define UTF8_CS_YEAR "\345\271\264"
440 #define UTF8_CS_MON "\346\234\210"
441 #define UTF8_CS_DAY "\346\227\245"
442 #define UTF8_CS_HOUR "\346\227\266"
443 #define UTF8_CS_MIN "\345\210\206"
444 #define UTF8_CS_SEC "\347\247\222"
446 // Korean date/time characters
447 #define UTF8_KO_YEAR "\353\205\204"
448 #define UTF8_KO_MON "\354\233\224"
449 #define UTF8_KO_DAY "\354\235\274"
450 #define UTF8_KO_HOUR "\354\213\234"
451 #define UTF8_KO_MIN "\353\266\204"
452 #define UTF8_KO_SEC "\354\264\210"
454 // ----------------------------------------------------------------------------
456 /** Default number format table. Last parent of all other tables, used for unknown locales. */
457 static const BuiltinFormat spBuiltinFormats_BASE[] =
459 // 0..13 numeric and currency formats
460 NUMFMT_PREDEF( 0, NUMBER_STANDARD ), // General
461 NUMFMT_PREDEF( 1, NUMBER_INT ), // 0
462 NUMFMT_PREDEF( 2, NUMBER_DEC2 ), // 0.00
463 NUMFMT_PREDEF( 3, NUMBER_1000INT ), // #,##0
464 NUMFMT_PREDEF( 4, NUMBER_1000DEC2 ), // #,##0.00
465 NUMFMT_PREDEF( 5, CURRENCY_1000INT ), // #,##0[symbol]
466 NUMFMT_PREDEF( 6, CURRENCY_1000INT_RED ), // #,##0[symbol];[RED]-#,##0[symbol]
467 NUMFMT_PREDEF( 7, CURRENCY_1000DEC2 ), // #,##0.00[symbol]
468 NUMFMT_PREDEF( 8, CURRENCY_1000DEC2_RED ), // #,##0.00[symbol];[RED]-#,##0.00[symbol]
469 NUMFMT_PREDEF( 9, PERCENT_INT ), // 0%
470 NUMFMT_PREDEF( 10, PERCENT_DEC2 ), // 0.00%
471 NUMFMT_PREDEF( 11, SCIENTIFIC_000E00 ), // 0.00E+00
472 NUMFMT_PREDEF( 12, FRACTION_1 ), // # ?/?
473 NUMFMT_PREDEF( 13, FRACTION_2 ), // # ??/??
475 // 14...22 date and time formats
476 NUMFMT_PREDEF( 14, DATE_SYS_DDMMYYYY ),
477 NUMFMT_PREDEF( 15, DATE_SYS_DMMMYY ),
478 NUMFMT_PREDEF( 16, DATE_SYS_DDMMM ),
479 NUMFMT_PREDEF( 17, DATE_SYS_MMYY ),
480 NUMFMT_PREDEF( 18, TIME_HHMMAMPM ),
481 NUMFMT_PREDEF( 19, TIME_HHMMSSAMPM ),
482 NUMFMT_PREDEF( 20, TIME_HHMM ),
483 NUMFMT_PREDEF( 21, TIME_HHMMSS ),
484 NUMFMT_PREDEF( 22, DATETIME_SYSTEM_SHORT_HHMM ),
486 // 23...36 international formats
487 NUMFMT_REUSE( 23, 0 ),
488 NUMFMT_REUSE( 24, 0 ),
489 NUMFMT_REUSE( 25, 0 ),
490 NUMFMT_REUSE( 26, 0 ),
491 NUMFMT_REUSE( 27, 14 ),
492 NUMFMT_REUSE( 28, 14 ),
493 NUMFMT_REUSE( 29, 14 ),
494 NUMFMT_REUSE( 30, 14 ),
495 NUMFMT_REUSE( 31, 14 ),
496 NUMFMT_REUSE( 32, 21 ),
497 NUMFMT_REUSE( 33, 21 ),
498 NUMFMT_REUSE( 34, 21 ),
499 NUMFMT_REUSE( 35, 21 ),
500 NUMFMT_REUSE( 36, 14 ),
502 // 37...44 accounting formats, defaults without currency symbol here
503 NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( 37, "", "", "" ),
504 NUMFMT_ACCOUNTING_MINUS_SYMBOL_NUMBER( 41, "", "" ),
506 // 45...49 more special formats
507 NUMFMT_STRING( 45, "mm:ss" ),
508 NUMFMT_STRING( 46, "[h]:mm:ss" ),
509 NUMFMT_STRING( 47, "mm:ss.0" ),
510 NUMFMT_STRING( 48, "##0.0E+0" ),
511 NUMFMT_PREDEF( 49, TEXT ),
513 // 50...81 international formats
514 NUMFMT_REUSE( 50, 14 ),
515 NUMFMT_REUSE( 51, 14 ),
516 NUMFMT_REUSE( 52, 14 ),
517 NUMFMT_REUSE( 53, 14 ),
518 NUMFMT_REUSE( 54, 14 ),
519 NUMFMT_REUSE( 55, 14 ),
520 NUMFMT_REUSE( 56, 14 ),
521 NUMFMT_REUSE( 57, 14 ),
522 NUMFMT_REUSE( 58, 14 ),
523 NUMFMT_REUSE( 59, 1 ),
524 NUMFMT_REUSE( 60, 2 ),
525 NUMFMT_REUSE( 61, 3 ),
526 NUMFMT_REUSE( 62, 4 ),
527 NUMFMT_REUSE( 63, 5 ),
528 NUMFMT_REUSE( 64, 6 ),
529 NUMFMT_REUSE( 65, 7 ),
530 NUMFMT_REUSE( 66, 8 ),
531 NUMFMT_REUSE( 67, 9 ),
532 NUMFMT_REUSE( 68, 10 ),
533 NUMFMT_REUSE( 69, 12 ),
534 NUMFMT_REUSE( 70, 13 ),
535 NUMFMT_REUSE( 71, 14 ),
536 NUMFMT_REUSE( 72, 14 ),
537 NUMFMT_REUSE( 73, 15 ),
538 NUMFMT_REUSE( 74, 16 ),
539 NUMFMT_REUSE( 75, 17 ),
540 NUMFMT_REUSE( 76, 20 ),
541 NUMFMT_REUSE( 77, 21 ),
542 NUMFMT_REUSE( 78, 22 ),
543 NUMFMT_REUSE( 79, 45 ),
544 NUMFMT_REUSE( 80, 46 ),
545 NUMFMT_REUSE( 81, 47 ),
547 // 82...163 not used, must not occur in a file (Excel may crash)
549 NUMFMT_ENDTABLE()
552 // ----------------------------------------------------------------------------
554 /** Arabic, U.A.E. */
555 static const BuiltinFormat spBuiltinFormats_ar_AE[] =
557 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
558 NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_AE "\"", " " ),
559 NUMFMT_ENDTABLE()
562 /** Arabic, Bahrain. */
563 static const BuiltinFormat spBuiltinFormats_ar_BH[] =
565 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
566 NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_BH "\"", " " ),
567 NUMFMT_ENDTABLE()
570 /** Arabic, Algeria. */
571 static const BuiltinFormat spBuiltinFormats_ar_DZ[] =
573 NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
574 NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_DZ "\"", " " ),
575 NUMFMT_ENDTABLE()
578 /** Arabic, Egypt. */
579 static const BuiltinFormat spBuiltinFormats_ar_EG[] =
581 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
582 NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_EG "\"", " " ),
583 NUMFMT_ENDTABLE()
586 /** Arabic, Iraq. */
587 static const BuiltinFormat spBuiltinFormats_ar_IQ[] =
589 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
590 NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_IQ "\"", " " ),
591 NUMFMT_ENDTABLE()
594 /** Arabic, Jordan. */
595 static const BuiltinFormat spBuiltinFormats_ar_JO[] =
597 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
598 NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_JO "\"", " " ),
599 NUMFMT_ENDTABLE()
602 /** Arabic, Kuwait. */
603 static const BuiltinFormat spBuiltinFormats_ar_KW[] =
605 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
606 NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_KW "\"", " " ),
607 NUMFMT_ENDTABLE()
610 /** Arabic, Lebanon. */
611 static const BuiltinFormat spBuiltinFormats_ar_LB[] =
613 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
614 NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_LB "\"", " " ),
615 NUMFMT_ENDTABLE()
618 /** Arabic, Libya. */
619 static const BuiltinFormat spBuiltinFormats_ar_LY[] =
621 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
622 NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_LY "\"", " " ),
623 NUMFMT_ENDTABLE()
626 /** Arabic, Morocco. */
627 static const BuiltinFormat spBuiltinFormats_ar_MA[] =
629 NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
630 NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_MA "\"", " " ),
631 NUMFMT_ENDTABLE()
634 /** Arabic, Oman. */
635 static const BuiltinFormat spBuiltinFormats_ar_OM[] =
637 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
638 NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_OM "\"", " " ),
639 NUMFMT_ENDTABLE()
642 /** Arabic, Qatar. */
643 static const BuiltinFormat spBuiltinFormats_ar_QA[] =
645 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
646 NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_QA "\"", " " ),
647 NUMFMT_ENDTABLE()
650 /** Arabic, Saudi Arabia. */
651 static const BuiltinFormat spBuiltinFormats_ar_SA[] =
653 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
654 NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_SA "\"", " " ),
655 NUMFMT_ENDTABLE()
658 /** Arabic, Syria. */
659 static const BuiltinFormat spBuiltinFormats_ar_SY[] =
661 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
662 NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_SY "\"", " " ),
663 NUMFMT_ENDTABLE()
666 /** Arabic, Tunisia. */
667 static const BuiltinFormat spBuiltinFormats_ar_TN[] =
669 NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
670 NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_TN "\"", " " ),
671 NUMFMT_ENDTABLE()
674 /** Arabic, Yemen. */
675 static const BuiltinFormat spBuiltinFormats_ar_YE[] =
677 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
678 NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_YE "\"", " " ),
679 NUMFMT_ENDTABLE()
682 /** Belarusian, Belarus. */
683 static const BuiltinFormat spBuiltinFormats_be_BY[] =
685 // space character is group separator, literal spaces must be quoted
686 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
687 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"" UTF8_CYR_R_LC ".\"", "_" UTF8_CYR_R_LC "_.", "\\ " ),
688 NUMFMT_ENDTABLE()
691 /** Bulgarian, Bulgaria. */
692 static const BuiltinFormat spBuiltinFormats_bg_BG[] =
694 // space character is group separator, literal spaces must be quoted
695 NUMFMT_ALLDATETIMES( "DD.M.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
696 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"" UTF8_CYR_L_LC UTF8_CYR_W_LC "\"", "_" UTF8_CYR_L_LC "_" UTF8_CYR_W_LC, "\\ " ),
697 NUMFMT_ENDTABLE()
700 /** Bengali, India. */
701 static const BuiltinFormat spBuiltinFormats_bn_IN[] =
703 NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
704 NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"" UTF8_CURR_BN_IN "\"", " " ),
705 NUMFMT_ENDTABLE()
708 /** Czech, Czech Republic. */
709 static const BuiltinFormat spBuiltinFormats_cs_CZ[] =
711 // space character is group separator, literal spaces must be quoted
712 NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
713 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"K" UTF8_CCARON_LC "\"", "_K_" UTF8_CCARON_LC, "\\ " ),
714 NUMFMT_ENDTABLE()
717 /** Danish, Denmark. */
718 static const BuiltinFormat spBuiltinFormats_da_DK[] =
720 NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
721 NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"kr\"", " " ),
722 NUMFMT_ENDTABLE()
725 /** German, Austria. */
726 static const BuiltinFormat spBuiltinFormats_de_AT[] =
728 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
729 NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( UTF8_EURO, " " ),
730 NUMFMT_ENDTABLE()
733 /** German, Switzerland. */
734 static const BuiltinFormat spBuiltinFormats_de_CH[] =
736 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ". ", "MMM", " ", "YY", "h", "hh" ),
737 NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"SFr.\"", " " ),
738 NUMFMT_ENDTABLE()
741 /** German, Germany. */
742 static const BuiltinFormat spBuiltinFormats_de_DE[] =
744 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ". ", "MMM", " ", "YY", "h", "hh" ),
745 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, " " ),
746 NUMFMT_ENDTABLE()
749 /** German, Liechtenstein. */
750 static const BuiltinFormat spBuiltinFormats_de_LI[] =
752 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ". ", "MMM", " ", "YY", "h", "hh" ),
753 NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"CHF\"", " " ),
754 NUMFMT_ENDTABLE()
757 /** German, Luxembourg. */
758 static const BuiltinFormat spBuiltinFormats_de_LU[] =
760 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
761 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, " " ),
762 NUMFMT_ENDTABLE()
765 /** Divehi, Maldives. */
766 static const BuiltinFormat spBuiltinFormats_div_MV[] =
768 NUMFMT_ALLDATETIMES( "DD/MM/YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
769 NUMFMT_ALLCURRENCIES_NUMBER_SYMBOL_MINUS( "\"" UTF8_RUFIYAA ".\"", "_" UTF8_RUFIYAA "_.", " " ),
770 NUMFMT_ENDTABLE()
773 /** Greek, Greece. */
774 static const BuiltinFormat spBuiltinFormats_el_GR[] =
776 NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
777 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, " " ),
778 NUMFMT_ENDTABLE()
781 /** English, Australia. */
782 static const BuiltinFormat spBuiltinFormats_en_AU[] =
784 NUMFMT_ALLDATETIMES( "D/MM/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
785 NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "$", "" ),
786 NUMFMT_ENDTABLE()
789 /** English, Belize. */
790 static const BuiltinFormat spBuiltinFormats_en_BZ[] =
792 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
793 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"BZ$\"", "" ),
794 NUMFMT_ENDTABLE()
797 /** English, Canada. */
798 static const BuiltinFormat spBuiltinFormats_en_CA[] =
800 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
801 NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "$", "" ),
802 NUMFMT_ENDTABLE()
805 /** English, Caribbean. */
806 static const BuiltinFormat spBuiltinFormats_en_CB[] =
808 NUMFMT_ALLDATETIMES( "MM/DD/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
809 NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "$", "" ),
810 NUMFMT_ENDTABLE()
813 /** English, United Kingdom. */
814 static const BuiltinFormat spBuiltinFormats_en_GB[] =
816 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
817 NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( UTF8_POUND_GB, "" ),
818 NUMFMT_ENDTABLE()
821 /** English, Ireland. */
822 static const BuiltinFormat spBuiltinFormats_en_IE[] =
824 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
825 NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( UTF8_EURO, "" ),
826 NUMFMT_ENDTABLE()
829 /** English, Jamaica. */
830 static const BuiltinFormat spBuiltinFormats_en_JM[] =
832 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
833 NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "\"J$\"", "" ),
834 NUMFMT_ENDTABLE()
837 /** English, New Zealand. */
838 static const BuiltinFormat spBuiltinFormats_en_NZ[] =
840 NUMFMT_ALLDATETIMES( "D/MM/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
841 NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "$", "" ),
842 NUMFMT_ENDTABLE()
845 /** English, Philippines. */
846 static const BuiltinFormat spBuiltinFormats_en_PH[] =
848 NUMFMT_ALLDATETIMES( "M/D/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
849 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"Php\"", "" ),
850 NUMFMT_ENDTABLE()
853 /** English, Trinidad and Tobago. */
854 static const BuiltinFormat spBuiltinFormats_en_TT[] =
856 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
857 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"TT$\"", "" ),
858 NUMFMT_ENDTABLE()
861 /** English, USA. */
862 static const BuiltinFormat spBuiltinFormats_en_US[] =
864 NUMFMT_ALLDATETIMES( "M/D/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
865 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "$", "" ),
866 NUMFMT_ENDTABLE()
869 /** English, South Africa. */
870 static const BuiltinFormat spBuiltinFormats_en_ZA[] =
872 NUMFMT_ALLDATETIMES( "YYYY/MM/DD", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
873 NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\\R", " " ),
874 NUMFMT_ENDTABLE()
877 /** English, Zimbabwe. */
878 static const BuiltinFormat spBuiltinFormats_en_ZW[] =
880 NUMFMT_ALLDATETIMES( "M/D/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
881 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"Z$\"", "" ),
882 NUMFMT_ENDTABLE()
885 /** Spanish, Argentina. */
886 static const BuiltinFormat spBuiltinFormats_es_AR[] =
888 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
889 NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "$", " " ),
890 NUMFMT_ENDTABLE()
893 /** Spanish, Bolivia. */
894 static const BuiltinFormat spBuiltinFormats_es_BO[] =
896 // slashes must be quoted to prevent conversion to minus
897 NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
898 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"$b\"", " " ),
899 NUMFMT_ENDTABLE()
902 /** Spanish, Chile. */
903 static const BuiltinFormat spBuiltinFormats_es_CL[] =
905 NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
906 NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "$", " " ),
907 NUMFMT_ENDTABLE()
910 /** Spanish, Colombia. */
911 static const BuiltinFormat spBuiltinFormats_es_CO[] =
913 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
914 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "$", " " ),
915 NUMFMT_ENDTABLE()
918 /** Spanish, Costa Rica. */
919 static const BuiltinFormat spBuiltinFormats_es_CR[] =
921 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
922 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( UTF8_COLON, "" ),
923 NUMFMT_ENDTABLE()
926 /** Spanish, Dominican Republic. */
927 static const BuiltinFormat spBuiltinFormats_es_DO[] =
929 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
930 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"RD$\"", "" ),
931 NUMFMT_ENDTABLE()
934 /** Spanish, Ecuador. */
935 static const BuiltinFormat spBuiltinFormats_es_EC[] =
937 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
938 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "$", " " ),
939 NUMFMT_ENDTABLE()
942 /** Spanish, Spain. */
943 static const BuiltinFormat spBuiltinFormats_es_ES[] =
945 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
946 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, " " ),
947 NUMFMT_ENDTABLE()
950 /** Spanish, Guatemala. */
951 static const BuiltinFormat spBuiltinFormats_es_GT[] =
953 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
954 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\\Q", "" ),
955 NUMFMT_ENDTABLE()
958 /** Spanish, Honduras. */
959 static const BuiltinFormat spBuiltinFormats_es_HN[] =
961 // slashes must be quoted to prevent conversion to minus
962 NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
963 NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"L.\"", " " ),
964 NUMFMT_ENDTABLE()
967 /** Spanish, Mexico. */
968 static const BuiltinFormat spBuiltinFormats_es_MX[] =
970 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
971 NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "$", "" ),
972 NUMFMT_ENDTABLE()
975 /** Spanish, Nicaragua. */
976 static const BuiltinFormat spBuiltinFormats_es_NI[] =
978 // slashes must be quoted to prevent conversion to minus
979 NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
980 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"C$\"", " " ),
981 NUMFMT_ENDTABLE()
984 /** Spanish, Panama. */
985 static const BuiltinFormat spBuiltinFormats_es_PA[] =
987 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
988 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"B/.\"", " " ),
989 NUMFMT_ENDTABLE()
992 /** Spanish, Peru. */
993 static const BuiltinFormat spBuiltinFormats_es_PE[] =
995 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
996 NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"S/.\"", " " ),
997 NUMFMT_ENDTABLE()
1000 /** Spanish, Puerto Rico. */
1001 static const BuiltinFormat spBuiltinFormats_es_PR[] =
1003 // slashes must be quoted to prevent conversion to minus
1004 NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
1005 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "$", " " ),
1006 NUMFMT_ENDTABLE()
1009 /** Spanish, Paraguay. */
1010 static const BuiltinFormat spBuiltinFormats_es_PY[] =
1012 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
1013 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"Gs\"", " " ),
1014 NUMFMT_ENDTABLE()
1017 /** Spanish, El Salvador. */
1018 static const BuiltinFormat spBuiltinFormats_es_SV[] =
1020 // slashes must be quoted to prevent conversion to minus
1021 NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
1022 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "$", "" ),
1023 NUMFMT_ENDTABLE()
1026 /** Spanish, Uruguay. */
1027 static const BuiltinFormat spBuiltinFormats_es_UY[] =
1029 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
1030 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"$U\"", " " ),
1031 NUMFMT_ENDTABLE()
1034 /** Spanish, Venezuela. */
1035 static const BuiltinFormat spBuiltinFormats_es_VE[] =
1037 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
1038 NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "Bs", " " ),
1039 NUMFMT_ENDTABLE()
1042 /** Estonian, Estonia. */
1043 static const BuiltinFormat spBuiltinFormats_et_EE[] =
1045 // space character is group separator, literal spaces must be quoted
1046 NUMFMT_ALLDATETIMES( "D.MM.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1047 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"kr\"", "_k_r", "\\ " ),
1048 NUMFMT_ENDTABLE()
1051 /** Farsi, Iran. */
1052 static const BuiltinFormat spBuiltinFormats_fa_IR[] =
1054 NUMFMT_ALLDATETIMES( "YYYY/MM/DD", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
1055 NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_FA_IR "\"", " " ),
1056 NUMFMT_ENDTABLE()
1059 /** Finnish, Finland. */
1060 static const BuiltinFormat spBuiltinFormats_fi_FI[] =
1062 // space character is group separator, literal spaces must be quoted
1063 NUMFMT_STRING( 9, "0\\ %" ),
1064 NUMFMT_STRING( 10, "0.00\\ %" ),
1065 NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1066 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, "\\ " ),
1067 NUMFMT_ENDTABLE()
1070 /** Faroese, Faroe Islands. */
1071 static const BuiltinFormat spBuiltinFormats_fo_FO[] =
1073 NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1074 NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"kr\"", " " ),
1075 NUMFMT_ENDTABLE()
1078 /** French, Belgium. */
1079 static const BuiltinFormat spBuiltinFormats_fr_BE[] =
1081 NUMFMT_ALLDATETIMES( "D/MM/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1082 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, " " ),
1083 NUMFMT_ENDTABLE()
1086 /** French, Canada. */
1087 static const BuiltinFormat spBuiltinFormats_fr_CA[] =
1089 // space character is group separator, literal spaces must be quoted
1090 NUMFMT_ALLDATETIMES( "YYYY-MM-DD", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1091 NUMFMT_ALLCURRENCIES_OPEN_NUMBER_SYMBOL_CLOSE( "$", "_$", "\\ " ),
1092 NUMFMT_ENDTABLE()
1095 /** French, Switzerland. */
1096 static const BuiltinFormat spBuiltinFormats_fr_CH[] =
1098 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1099 NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"SFr.\"", " " ),
1100 NUMFMT_ENDTABLE()
1103 /** French, France. */
1104 static const BuiltinFormat spBuiltinFormats_fr_FR[] =
1106 // space character is group separator, literal spaces must be quoted
1107 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1108 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, "\\ " ),
1109 NUMFMT_ENDTABLE()
1112 /** French, Luxembourg. */
1113 static const BuiltinFormat spBuiltinFormats_fr_LU[] =
1115 // space character is group separator, literal spaces must be quoted
1116 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1117 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, "\\ " ),
1118 NUMFMT_ENDTABLE()
1121 /** French, Monaco. */
1122 static const BuiltinFormat spBuiltinFormats_fr_MC[] =
1124 // space character is group separator, literal spaces must be quoted
1125 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1126 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, "\\ " ),
1127 NUMFMT_ENDTABLE()
1130 /** Galizian, Spain. */
1131 static const BuiltinFormat spBuiltinFormats_gl_ES[] =
1133 NUMFMT_ALLDATETIMES( "DD/MM/YY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1134 NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( UTF8_EURO, " " ),
1135 NUMFMT_ENDTABLE()
1138 /** Gujarati, India. */
1139 static const BuiltinFormat spBuiltinFormats_gu_IN[] =
1141 NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1142 NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"" UTF8_CURR_GU_IN "\"", " " ),
1143 NUMFMT_ENDTABLE()
1146 /** Hebrew, Israel. */
1147 static const BuiltinFormat spBuiltinFormats_he_IL[] =
1149 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1150 NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( UTF8_SHEQEL, " " ),
1151 NUMFMT_ENDTABLE()
1154 /** Hindi, India. */
1155 static const BuiltinFormat spBuiltinFormats_hi_IN[] =
1157 NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1158 NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"" UTF8_CURR_HI_IN "\"", " " ),
1159 NUMFMT_ENDTABLE()
1162 /** Croatian, Bosnia and Herzegowina. */
1163 static const BuiltinFormat spBuiltinFormats_hr_BA[] =
1165 NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1166 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"KM\"", "_K_M", " " ),
1167 NUMFMT_ENDTABLE()
1170 /** Croatian, Croatia. */
1171 static const BuiltinFormat spBuiltinFormats_hr_HR[] =
1173 NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1174 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"kn\"", "_k_n", " " ),
1175 NUMFMT_ENDTABLE()
1178 /** Hungarian, Hungary. */
1179 static const BuiltinFormat spBuiltinFormats_hu_HU[] =
1181 // space character is group separator, literal spaces must be quoted
1182 // MMM is rendered differently in Calc and Excel (see #i41488#)
1183 NUMFMT_ALLDATETIMES( "YYYY.MM.DD", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1184 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"Ft\"", "_F_t", "\\ " ),
1185 NUMFMT_ENDTABLE()
1188 /** Armenian, Armenia. */
1189 static const BuiltinFormat spBuiltinFormats_hy_AM[] =
1191 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1192 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"" UTF8_HY_DA_LC UTF8_HY_REH_LC ".\"", "_" UTF8_HY_DA_LC "_" UTF8_HY_REH_LC "_.", " " ),
1193 NUMFMT_ENDTABLE()
1196 /** Indonesian, Indonesia. */
1197 static const BuiltinFormat spBuiltinFormats_id_ID[] =
1199 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1200 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"Rp\"", "" ),
1201 NUMFMT_ENDTABLE()
1204 /** Icelandic, Iceland. */
1205 static const BuiltinFormat spBuiltinFormats_is_IS[] =
1207 NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "hh" ),
1208 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"kr.\"", "_k_r_.", " " ),
1209 NUMFMT_ENDTABLE()
1212 /** Italian, Switzerland. */
1213 static const BuiltinFormat spBuiltinFormats_it_CH[] =
1215 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1216 NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"SFr.\"", " " ),
1217 NUMFMT_ENDTABLE()
1220 /** Italian, Italy. */
1221 static const BuiltinFormat spBuiltinFormats_it_IT[] =
1223 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1224 NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( UTF8_EURO, " " ),
1225 NUMFMT_ENDTABLE()
1228 /** Georgian, Georgia. */
1229 static const BuiltinFormat spBuiltinFormats_ka_GE[] =
1231 // space character is group separator, literal spaces must be quoted
1232 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1233 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"Lari\"", "_L_a_r_i", "\\ " ),
1234 NUMFMT_ENDTABLE()
1237 /** Kazakh, Kazakhstan. */
1238 static const BuiltinFormat spBuiltinFormats_kk_KZ[] =
1240 // space character is group separator, literal spaces must be quoted
1241 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1242 NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "\\T", "" ),
1243 NUMFMT_ENDTABLE()
1246 /** Kannada, India. */
1247 static const BuiltinFormat spBuiltinFormats_kn_IN[] =
1249 NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1250 NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"" UTF8_CURR_KN_IN "\"", " " ),
1251 NUMFMT_ENDTABLE()
1254 /** Kyrgyz, Kyrgyzstan. */
1255 static const BuiltinFormat spBuiltinFormats_ky_KG[] =
1257 // space character is group separator, literal spaces must be quoted
1258 NUMFMT_ALLDATETIMES( "DD.MM.YY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1259 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"" UTF8_CYR_S_LC UTF8_CYR_O_LC UTF8_CYR_M_LC "\"", "_" UTF8_CYR_S_LC "_" UTF8_CYR_O_LC "_" UTF8_CYR_M_LC, "\\ " ),
1260 NUMFMT_ENDTABLE()
1263 /** Lithuanian, Lithuania. */
1264 static const BuiltinFormat spBuiltinFormats_lt_LT[] =
1266 NUMFMT_ALLDATETIMES( "YYYY.MM.DD", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1267 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"Lt\"", "_L_t", " " ),
1268 NUMFMT_ENDTABLE()
1271 /** Latvian, Latvia. */
1272 static const BuiltinFormat spBuiltinFormats_lv_LV[] =
1274 // space character is group separator, literal spaces must be quoted
1275 NUMFMT_ALLDATETIMES( "YYYY.MM.DD", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1276 NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "\"Ls\"", "\\ " ),
1277 NUMFMT_ENDTABLE()
1280 /** Malayalam, India. */
1281 static const BuiltinFormat spBuiltinFormats_ml_IN[] =
1283 NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1284 NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"" UTF8_CURR_ML_IN "\"", " " ),
1285 NUMFMT_ENDTABLE()
1288 /** Mongolian, Mongolia. */
1289 static const BuiltinFormat spBuiltinFormats_mn_MN[] =
1291 NUMFMT_ALLDATETIMES( "YY.MM.DD", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1292 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_TUGRUG, "_" UTF8_TUGRUG, "" ),
1293 NUMFMT_ENDTABLE()
1296 /** Malay, Brunei Darussalam. */
1297 static const BuiltinFormat spBuiltinFormats_ms_BN[] =
1299 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1300 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "$", "" ),
1301 NUMFMT_ENDTABLE()
1304 /** Malay, Malaysia. */
1305 static const BuiltinFormat spBuiltinFormats_ms_MY[] =
1307 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1308 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\\R", "" ),
1309 NUMFMT_ENDTABLE()
1312 /** Maltese, Malta. */
1313 static const BuiltinFormat spBuiltinFormats_mt_MT[] =
1315 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1316 NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "\"Lm\"", "" ),
1317 NUMFMT_ENDTABLE()
1320 /** Dutch, Belgium. */
1321 static const BuiltinFormat spBuiltinFormats_nl_BE[] =
1323 // slashes must be quoted to prevent conversion to minus
1324 NUMFMT_ALLDATETIMES( "D\\/MM\\/YYYY", "D", "\\/", "MMM", "\\/", "YY", "h", "h" ),
1325 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, " " ),
1326 NUMFMT_ENDTABLE()
1329 /** Dutch, Netherlands. */
1330 static const BuiltinFormat spBuiltinFormats_nl_NL[] =
1332 NUMFMT_ALLDATETIMES( "D-M-YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1333 NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( UTF8_EURO, " " ),
1334 NUMFMT_ENDTABLE()
1337 /** Norwegian (Bokmal and Nynorsk), Norway. */
1338 static const BuiltinFormat spBuiltinFormats_no_NO[] =
1340 // space character is group separator, literal spaces must be quoted
1341 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1342 NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"kr\"", "\\ " ),
1343 NUMFMT_ENDTABLE()
1346 /** Punjabi, India. */
1347 static const BuiltinFormat spBuiltinFormats_pa_IN[] =
1349 NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
1350 NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"" UTF8_CURR_PA_IN "\"", " " ),
1351 NUMFMT_ENDTABLE()
1354 /** Polish, Poland. */
1355 static const BuiltinFormat spBuiltinFormats_pl_PL[] =
1357 // space character is group separator, literal spaces must be quoted
1358 // MMM is rendered differently in Calc and Excel (see #i72300#)
1359 NUMFMT_ALLDATETIMES( "YYYY-MM-DD", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1360 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"z" UTF8_LSTROKE_LC "\"", "_z_" UTF8_LSTROKE_LC, "\\ " ),
1361 NUMFMT_ENDTABLE()
1364 /** Portugese, Brazil. */
1365 static const BuiltinFormat spBuiltinFormats_pt_BR[] =
1367 NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "/", "MMM", "/", "YY", "h", "hh" ),
1368 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"R$\"", " " ),
1369 NUMFMT_ENDTABLE()
1372 /** Portugese, Portugal. */
1373 static const BuiltinFormat spBuiltinFormats_pt_PT[] =
1375 NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1376 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, " " ),
1377 NUMFMT_ENDTABLE()
1380 /** Romanian, Romania. */
1381 static const BuiltinFormat spBuiltinFormats_ro_RO[] =
1383 // space character is group separator, literal spaces must be quoted (but see #i75367#)
1384 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1385 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"lei\"", "_l_e_i", "\\ " ),
1386 NUMFMT_ENDTABLE()
1389 /** Russian, Russian Federation. */
1390 static const BuiltinFormat spBuiltinFormats_ru_RU[] =
1392 // space character is group separator, literal spaces must be quoted
1393 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1394 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"" UTF8_CYR_R_LC ".\"", "_" UTF8_CYR_R_LC "_.", "" ),
1395 NUMFMT_ENDTABLE()
1398 /** Slovak, Slovakia. */
1399 static const BuiltinFormat spBuiltinFormats_sk_SK[] =
1401 // space character is group separator, literal spaces must be quoted
1402 NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1403 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"Sk\"", "_S_k", "\\ " ),
1404 NUMFMT_ENDTABLE()
1407 /** Slovenian, Slovenia. */
1408 static const BuiltinFormat spBuiltinFormats_sl_SI[] =
1410 NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
1411 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"SIT\"", "_S_I_T", " " ),
1412 NUMFMT_ENDTABLE()
1415 /** Swedish, Finland. */
1416 static const BuiltinFormat spBuiltinFormats_sv_FI[] =
1418 // space character is group separator, literal spaces must be quoted
1419 NUMFMT_STRING( 9, "0\\ %" ),
1420 NUMFMT_STRING( 10, "0.00\\ %" ),
1421 NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "hh" ),
1422 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, "\\ " ),
1423 NUMFMT_ENDTABLE()
1426 /** Swedish, Sweden. */
1427 static const BuiltinFormat spBuiltinFormats_sv_SE[] =
1429 // space character is group separator, literal spaces must be quoted
1430 NUMFMT_ALLDATETIMES( "YYYY-MM-DD", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1431 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"kr\"", "_k_r", "\\ " ),
1432 NUMFMT_ENDTABLE()
1435 /** Swahili, Tanzania. */
1436 static const BuiltinFormat spBuiltinFormats_sw_TZ[] =
1438 NUMFMT_ALLDATETIMES( "M/D/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1439 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\\S", "" ),
1440 NUMFMT_ENDTABLE()
1443 /** Tamil, India. */
1444 static const BuiltinFormat spBuiltinFormats_ta_IN[] =
1446 NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1447 NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"" UTF8_CURR_TA_IN "\"", " " ),
1448 NUMFMT_ENDTABLE()
1451 /** Telugu, India. */
1452 static const BuiltinFormat spBuiltinFormats_te_IN[] =
1454 NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
1455 NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"" UTF8_CURR_TE_IN "\"", " " ),
1456 NUMFMT_ENDTABLE()
1459 /** Thai, Thailand. */
1460 static const BuiltinFormat spBuiltinFormats_th_TH[] =
1462 NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1463 NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( UTF8_BAHT, "" ),
1464 NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 63, UTF8_BAHT, "", "t" ),
1465 NUMFMT_STRING( 59, "t0" ),
1466 NUMFMT_STRING( 60, "t0.00" ),
1467 NUMFMT_STRING( 61, "t#,##0" ),
1468 NUMFMT_STRING( 62, "t#,##0.00" ),
1469 NUMFMT_STRING( 67, "t0%" ),
1470 NUMFMT_STRING( 68, "t0.00%" ),
1471 NUMFMT_STRING( 69, "t# ?/?" ),
1472 NUMFMT_STRING( 70, "t# ?\?/?\?" ),
1473 NUMFMT_STRING( 71, "tD/M/EE" ),
1474 NUMFMT_STRING( 72, "tD-MMM-E" ),
1475 NUMFMT_STRING( 73, "tD-MMM" ),
1476 NUMFMT_STRING( 74, "tMMM-E" ),
1477 NUMFMT_STRING( 75, "th:mm" ),
1478 NUMFMT_STRING( 76, "th:mm:ss" ),
1479 NUMFMT_STRING( 77, "tD/M/EE h:mm" ),
1480 NUMFMT_STRING( 78, "tmm:ss" ),
1481 NUMFMT_STRING( 79, "t[h]:mm:ss" ),
1482 NUMFMT_STRING( 80, "tmm:ss.0" ),
1483 NUMFMT_STRING( 81, "D/M/E" ),
1484 NUMFMT_ENDTABLE()
1487 /** Turkish, Turkey. */
1488 static const BuiltinFormat spBuiltinFormats_tr_TR[] =
1490 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
1491 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"TL\"", "_T_L", " " ),
1492 NUMFMT_ENDTABLE()
1495 /** Tatar, Russian Federation. */
1496 static const BuiltinFormat spBuiltinFormats_tt_RU[] =
1498 // space character is group separator, literal spaces must be quoted
1499 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1500 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"" UTF8_CYR_R_LC ".\"", "_" UTF8_CYR_R_LC "_.", "\\ " ),
1501 NUMFMT_ENDTABLE()
1504 /** Ukrainian, Ukraine. */
1505 static const BuiltinFormat spBuiltinFormats_uk_UA[] =
1507 // space character is group separator, literal spaces must be quoted
1508 NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
1509 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"" UTF8_CYR_G_LC UTF8_CYR_R_LC UTF8_CYR_N_LC ".\"", "_" UTF8_CYR_G_LC "_" UTF8_CYR_R_LC "_" UTF8_CYR_N_LC "_.", "\\ " ),
1510 NUMFMT_ENDTABLE()
1513 /** Urdu, Pakistan. */
1514 static const BuiltinFormat spBuiltinFormats_ur_PK[] =
1516 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1517 NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"Rs\"", "" ),
1518 NUMFMT_ENDTABLE()
1521 /** Vietnamese, Viet Nam. */
1522 static const BuiltinFormat spBuiltinFormats_vi_VN[] =
1524 NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1525 NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_DONG, "_" UTF8_DONG, " " ),
1526 NUMFMT_ENDTABLE()
1529 // CJK ------------------------------------------------------------------------
1531 /** Base table for CJK locales. */
1532 static const BuiltinFormat spBuiltinFormats_CJK[] =
1534 NUMFMT_REUSE( 29, 28 ),
1535 NUMFMT_REUSE( 36, 27 ),
1536 NUMFMT_REUSE( 50, 27 ),
1537 NUMFMT_REUSE( 51, 28 ),
1538 NUMFMT_REUSE( 52, 34 ),
1539 NUMFMT_REUSE( 53, 35 ),
1540 NUMFMT_REUSE( 54, 28 ),
1541 NUMFMT_REUSE( 55, 34 ),
1542 NUMFMT_REUSE( 56, 35 ),
1543 NUMFMT_REUSE( 57, 27 ),
1544 NUMFMT_REUSE( 58, 28 ),
1545 NUMFMT_ENDTABLE()
1548 /** Japanese, Japan. */
1549 static const BuiltinFormat spBuiltinFormats_ja_JP[] =
1551 NUMFMT_ALLDATETIMES( "YYYY/MM/DD", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1552 NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( UTF8_YEN_JP, "" ),
1553 NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "$", "", "" ),
1554 NUMFMT_STRING( 27, "[$-411]GE.MM.DD" ),
1555 NUMFMT_STRING( 28, "[$-411]GGGE\"" UTF8_CJ_YEAR "\"MM\"" UTF8_CJ_MON "\"DD\"" UTF8_CJ_DAY "\"" ),
1556 NUMFMT_STRING( 30, "MM/DD/YY" ),
1557 NUMFMT_STRING( 31, "YYYY\"" UTF8_CJ_YEAR "\"MM\"" UTF8_CJ_MON "\"DD\"" UTF8_CJ_DAY "\"" ),
1558 NUMFMT_TIME_CJK( 32, "h", UTF8_CJ_HOUR, UTF8_CJ_MIN, UTF8_CJ_SEC ),
1559 NUMFMT_STRING( 34, "YYYY\"" UTF8_CJ_YEAR "\"MM\"" UTF8_CJ_MON "\"" ),
1560 NUMFMT_STRING( 35, "MM\"" UTF8_CJ_MON "\"DD\"" UTF8_CJ_DAY "\"" ),
1561 NUMFMT_ENDTABLE()
1564 /** Korean, South Korea. */
1565 static const BuiltinFormat spBuiltinFormats_ko_KR[] =
1567 NUMFMT_ALLDATETIMES( "YYYY-MM-DD", "DD", "-", "MMM", "-", "YY", "h", "h" ),
1568 NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( UTF8_WON, "" ),
1569 NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "$", "", "" ),
1570 NUMFMT_STRING( 27, "YYYY" UTF8_CJ_YEAR " MM" UTF8_CJ_MON " DD" UTF8_CJ_DAY ),
1571 NUMFMT_STRING( 28, "MM-DD" ),
1572 NUMFMT_STRING( 30, "MM-DD-YY" ),
1573 NUMFMT_STRING( 31, "YYYY" UTF8_KO_YEAR " MM" UTF8_KO_MON " DD" UTF8_KO_DAY ),
1574 NUMFMT_TIME_CJK( 32, "h", UTF8_KO_HOUR, UTF8_KO_MIN, UTF8_KO_SEC ),
1575 // slashes must be quoted to prevent conversion to minus
1576 NUMFMT_STRING( 34, "YYYY\\/MM\\/DD" ),
1577 NUMFMT_REUSE( 35, 14 ),
1578 NUMFMT_ENDTABLE()
1581 /** Chinese, China. */
1582 static const BuiltinFormat spBuiltinFormats_zh_CN[] =
1584 NUMFMT_ALLDATETIMES( "YYYY-M-D", "D", "-", "MMM", "-", "YY", "h", "h" ),
1585 NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( UTF8_YEN_CN, "" ),
1586 NUMFMT_ALLTIMES_CJK( "h", "h", UTF8_CS_HOUR, UTF8_CS_MIN, UTF8_CS_SEC ),
1587 NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "$", "", "" ),
1588 NUMFMT_STRING( 27, "YYYY\"" UTF8_CS_YEAR "\"M\"" UTF8_CS_MON "\"" ),
1589 NUMFMT_STRING( 28, "M\"" UTF8_CS_MON "\"D\"" UTF8_CS_DAY "\"" ),
1590 NUMFMT_STRING( 30, "M-D-YY" ),
1591 NUMFMT_STRING( 31, "YYYY\"" UTF8_CS_YEAR "\"M\"" UTF8_CS_MON "\"D\"" UTF8_CS_DAY "\"" ),
1592 NUMFMT_REUSE( 52, 27 ),
1593 NUMFMT_REUSE( 53, 28 ),
1594 NUMFMT_ENDTABLE()
1597 /** Chinese, Hong Kong. */
1598 static const BuiltinFormat spBuiltinFormats_zh_HK[] =
1600 NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1601 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"HK$\"", "" ),
1602 NUMFMT_ALLTIMES_CJK( "h", "h", UTF8_CJ_HOUR, UTF8_CJ_MIN, UTF8_CJ_SEC ),
1603 NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "\"US$\"", "", "" ),
1604 NUMFMT_STRING( 27, "[$-404]D/M/E" ),
1605 NUMFMT_STRING( 28, "[$-404]D\"" UTF8_CJ_DAY "\"M\"" UTF8_CJ_MON "\"E\"" UTF8_CJ_YEAR "\"" ),
1606 NUMFMT_STRING( 30, "M/D/YY" ),
1607 NUMFMT_STRING( 31, "D\"" UTF8_CJ_DAY "\"M\"" UTF8_CJ_MON "\"YYYY\"" UTF8_CJ_YEAR "\"" ),
1608 NUMFMT_ENDTABLE()
1611 /** Chinese, Macau. */
1612 static const BuiltinFormat spBuiltinFormats_zh_MO[] =
1614 NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1615 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\\P", "" ),
1616 NUMFMT_ALLTIMES_CJK( "h", "h", UTF8_CJ_HOUR, UTF8_CJ_MIN, UTF8_CJ_SEC ),
1617 NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "\"US$\"", "", "" ),
1618 NUMFMT_STRING( 27, "[$-404]D/M/E" ),
1619 NUMFMT_STRING( 28, "[$-404]D\"" UTF8_CJ_DAY "\"M\"" UTF8_CJ_MON "\"E\"" UTF8_CJ_YEAR "\"" ),
1620 NUMFMT_STRING( 30, "M/D/YY" ),
1621 NUMFMT_STRING( 31, "D\"" UTF8_CJ_DAY "\"M\"" UTF8_CJ_MON "\"YYYY\"" UTF8_CJ_YEAR "\"" ),
1622 NUMFMT_ENDTABLE()
1625 /** Chinese, Singapore. */
1626 static const BuiltinFormat spBuiltinFormats_zh_SG[] =
1628 NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
1629 NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "$", "" ),
1630 NUMFMT_ALLTIMES_CJK( "h", "h", UTF8_CS_HOUR, UTF8_CS_MIN, UTF8_CS_SEC ),
1631 NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "$", "", "" ),
1632 NUMFMT_STRING( 27, "YYYY\"" UTF8_CS_YEAR "\"M\"" UTF8_CS_MON "\"" ),
1633 NUMFMT_STRING( 28, "M\"" UTF8_CS_MON "\"D\"" UTF8_CS_DAY "\"" ),
1634 NUMFMT_STRING( 30, "M/D/YY" ),
1635 NUMFMT_STRING( 31, "D\"" UTF8_CS_DAY "\"M\"" UTF8_CS_MON "\"YYYY\"" UTF8_CS_YEAR "\"" ),
1636 NUMFMT_ENDTABLE()
1639 /** Chinese, Taiwan. */
1640 static const BuiltinFormat spBuiltinFormats_zh_TW[] =
1642 NUMFMT_ALLDATETIMES( "YYYY/M/D", "D", "-", "MMM", "-", "YY", "hh", "hh" ),
1643 NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "$", "" ),
1644 NUMFMT_ALLTIMES_CJK( "hh", "hh", UTF8_CJ_HOUR, UTF8_CJ_MIN, UTF8_CJ_SEC ),
1645 NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "\"US$\"", "", "" ),
1646 NUMFMT_STRING( 27, "[$-404]E/M/D" ),
1647 NUMFMT_STRING( 28, "[$-404]E\"" UTF8_CJ_YEAR "\"M\"" UTF8_CJ_MON "\"D\"" UTF8_CJ_DAY "\"" ),
1648 NUMFMT_STRING( 30, "M/D/YY" ),
1649 NUMFMT_STRING( 31, "YYYY\"" UTF8_CJ_YEAR "\"M\"" UTF8_CJ_MON "\"D\"" UTF8_CJ_DAY "\"" ),
1650 NUMFMT_ENDTABLE()
1653 // ----------------------------------------------------------------------------
1655 /** Specifies a built-in number format table for a specific locale. */
1656 struct BuiltinFormatTable
1658 const sal_Char* mpcLocale; /// The locale for this table.
1659 const sal_Char* mpcParent; /// The locale of the parent table.
1660 const BuiltinFormat* mpFormats; /// The number format table (may be 0, if equal to parent).
1663 static const BuiltinFormatTable spBuiltinFormatTables[] =
1664 { // locale parent format table
1665 { "*", "", spBuiltinFormats_BASE }, // Base table
1666 { "af-ZA", "*", spBuiltinFormats_en_ZA }, // Afrikaans, South Africa
1667 { "ar-AE", "*", spBuiltinFormats_ar_AE }, // Arabic, U.A.E.
1668 { "ar-BH", "*", spBuiltinFormats_ar_BH }, // Arabic, Bahrain
1669 { "ar-DZ", "*", spBuiltinFormats_ar_DZ }, // Arabic, Algeria
1670 { "ar-EG", "*", spBuiltinFormats_ar_EG }, // Arabic, Egypt
1671 { "ar-IQ", "*", spBuiltinFormats_ar_IQ }, // Arabic, Iraq
1672 { "ar-JO", "*", spBuiltinFormats_ar_JO }, // Arabic, Jordan
1673 { "ar-KW", "*", spBuiltinFormats_ar_KW }, // Arabic, Kuwait
1674 { "ar-LB", "*", spBuiltinFormats_ar_LB }, // Arabic, Lebanon
1675 { "ar-LY", "*", spBuiltinFormats_ar_LY }, // Arabic, Libya
1676 { "ar-MA", "*", spBuiltinFormats_ar_MA }, // Arabic, Morocco
1677 { "ar-OM", "*", spBuiltinFormats_ar_OM }, // Arabic, Oman
1678 { "ar-QA", "*", spBuiltinFormats_ar_QA }, // Arabic, Qatar
1679 { "ar-SA", "*", spBuiltinFormats_ar_SA }, // Arabic, Saudi Arabia
1680 { "ar-SY", "*", spBuiltinFormats_ar_SY }, // Arabic, Syria
1681 { "ar-TN", "*", spBuiltinFormats_ar_TN }, // Arabic, Tunisia
1682 { "ar-YE", "*", spBuiltinFormats_ar_YE }, // Arabic, Yemen
1683 { "be-BY", "*", spBuiltinFormats_be_BY }, // Belarusian, Belarus
1684 { "bg-BG", "*", spBuiltinFormats_bg_BG }, // Bulgarian, Bulgaria
1685 { "bn-IN", "*", spBuiltinFormats_bn_IN }, // Bengali, India
1686 { "ca-ES", "*", spBuiltinFormats_es_ES }, // Catalan, Spain
1687 { "cs-CZ", "*", spBuiltinFormats_cs_CZ }, // Czech, Czech Republic
1688 { "cy-GB", "*", spBuiltinFormats_en_GB }, // Welsh, United Kingdom
1689 { "da-DK", "*", spBuiltinFormats_da_DK }, // Danish, Denmark
1690 { "de-AT", "*", spBuiltinFormats_de_AT }, // German, Austria
1691 { "de-CH", "*", spBuiltinFormats_de_CH }, // German, Switzerland
1692 { "de-DE", "*", spBuiltinFormats_de_DE }, // German, Germany
1693 { "de-LI", "*", spBuiltinFormats_de_LI }, // German, Liechtenstein
1694 { "de-LU", "*", spBuiltinFormats_de_LU }, // German, Luxembourg
1695 { "div-MV", "*", spBuiltinFormats_div_MV }, // Divehi, Maldives
1696 { "el-GR", "*", spBuiltinFormats_el_GR }, // Greek, Greece
1697 { "en-AU", "*", spBuiltinFormats_en_AU }, // English, Australia
1698 { "en-BZ", "*", spBuiltinFormats_en_BZ }, // English, Belize
1699 { "en-CA", "*", spBuiltinFormats_en_CA }, // English, Canada
1700 { "en-CB", "*", spBuiltinFormats_en_CB }, // English, Caribbean
1701 { "en-GB", "*", spBuiltinFormats_en_GB }, // English, United Kingdom
1702 { "en-IE", "*", spBuiltinFormats_en_IE }, // English, Ireland
1703 { "en-JM", "*", spBuiltinFormats_en_JM }, // English, Jamaica
1704 { "en-NZ", "*", spBuiltinFormats_en_NZ }, // English, New Zealand
1705 { "en-PH", "*", spBuiltinFormats_en_PH }, // English, Philippines
1706 { "en-TT", "*", spBuiltinFormats_en_TT }, // English, Trinidad and Tobago
1707 { "en-US", "*", spBuiltinFormats_en_US }, // English, USA
1708 { "en-ZA", "*", spBuiltinFormats_en_ZA }, // English, South Africa
1709 { "en-ZW", "*", spBuiltinFormats_en_ZW }, // English, Zimbabwe
1710 { "es-AR", "*", spBuiltinFormats_es_AR }, // Spanish, Argentina
1711 { "es-BO", "*", spBuiltinFormats_es_BO }, // Spanish, Bolivia
1712 { "es-CL", "*", spBuiltinFormats_es_CL }, // Spanish, Chile
1713 { "es-CO", "*", spBuiltinFormats_es_CO }, // Spanish, Colombia
1714 { "es-CR", "*", spBuiltinFormats_es_CR }, // Spanish, Costa Rica
1715 { "es-DO", "*", spBuiltinFormats_es_DO }, // Spanish, Dominican Republic
1716 { "es-EC", "*", spBuiltinFormats_es_EC }, // Spanish, Ecuador
1717 { "es-ES", "*", spBuiltinFormats_es_ES }, // Spanish, Spain
1718 { "es-GT", "*", spBuiltinFormats_es_GT }, // Spanish, Guatemala
1719 { "es-HN", "*", spBuiltinFormats_es_HN }, // Spanish, Honduras
1720 { "es-MX", "*", spBuiltinFormats_es_MX }, // Spanish, Mexico
1721 { "es-NI", "*", spBuiltinFormats_es_NI }, // Spanish, Nicaragua
1722 { "es-PA", "*", spBuiltinFormats_es_PA }, // Spanish, Panama
1723 { "es-PE", "*", spBuiltinFormats_es_PE }, // Spanish, Peru
1724 { "es-PR", "*", spBuiltinFormats_es_PR }, // Spanish, Puerto Rico
1725 { "es-PY", "*", spBuiltinFormats_es_PY }, // Spanish, Paraguay
1726 { "es-SV", "*", spBuiltinFormats_es_SV }, // Spanish, El Salvador
1727 { "es-UY", "*", spBuiltinFormats_es_UY }, // Spanish, Uruguay
1728 { "es-VE", "*", spBuiltinFormats_es_VE }, // Spanish, Venezuela
1729 { "et-EE", "*", spBuiltinFormats_et_EE }, // Estonian, Estonia
1730 { "fa-IR", "*", spBuiltinFormats_fa_IR }, // Farsi, Iran
1731 { "fi-FI", "*", spBuiltinFormats_fi_FI }, // Finnish, Finland
1732 { "fo-FO", "*", spBuiltinFormats_fo_FO }, // Faroese, Faroe Islands
1733 { "fr-BE", "*", spBuiltinFormats_fr_BE }, // French, Belgium
1734 { "fr-CA", "*", spBuiltinFormats_fr_CA }, // French, Canada
1735 { "fr-CH", "*", spBuiltinFormats_fr_CH }, // French, Switzerland
1736 { "fr-FR", "*", spBuiltinFormats_fr_FR }, // French, France
1737 { "fr-LU", "*", spBuiltinFormats_fr_LU }, // French, Luxembourg
1738 { "fr-MC", "*", spBuiltinFormats_fr_MC }, // French, Monaco
1739 { "gl-ES", "*", spBuiltinFormats_gl_ES }, // Galizian, Spain
1740 { "gu-IN", "*", spBuiltinFormats_gu_IN }, // Gujarati, India
1741 { "he-IL", "*", spBuiltinFormats_he_IL }, // Hebrew, Israel
1742 { "hi-IN", "*", spBuiltinFormats_hi_IN }, // Hindi, India
1743 { "hr-BA", "*", spBuiltinFormats_hr_BA }, // Croatian, Bosnia and Herzegowina
1744 { "hr-HR", "*", spBuiltinFormats_hr_HR }, // Croatian, Croatia
1745 { "hu-HU", "*", spBuiltinFormats_hu_HU }, // Hungarian, Hungary
1746 { "hy-AM", "*", spBuiltinFormats_hy_AM }, // Armenian, Armenia
1747 { "id-ID", "*", spBuiltinFormats_id_ID }, // Indonesian, Indonesia
1748 { "is-IS", "*", spBuiltinFormats_is_IS }, // Icelandic, Iceland
1749 { "it-CH", "*", spBuiltinFormats_it_CH }, // Italian, Switzerland
1750 { "it-IT", "*", spBuiltinFormats_it_IT }, // Italian, Italy
1751 { "ka-GE", "*", spBuiltinFormats_ka_GE }, // Georgian, Georgia
1752 { "kk-KZ", "*", spBuiltinFormats_kk_KZ }, // Kazakh, Kazakhstan
1753 { "kn-IN", "*", spBuiltinFormats_kn_IN }, // Kannada, India
1754 { "kok-IN", "*", spBuiltinFormats_hi_IN }, // Konkani, India
1755 { "ky-KG", "*", spBuiltinFormats_ky_KG }, // Kyrgyz, Kyrgyzstan
1756 { "lt-LT", "*", spBuiltinFormats_lt_LT }, // Lithuanian, Lithuania
1757 { "lv-LV", "*", spBuiltinFormats_lv_LV }, // Latvian, Latvia
1758 { "mi-NZ", "*", spBuiltinFormats_en_NZ }, // Maori, New Zealand
1759 { "ml-IN", "*", spBuiltinFormats_ml_IN }, // Malayalam, India
1760 { "mn-MN", "*", spBuiltinFormats_mn_MN }, // Mongolian, Mongolia
1761 { "mr-IN", "*", spBuiltinFormats_hi_IN }, // Marathi, India
1762 { "ms-BN", "*", spBuiltinFormats_ms_BN }, // Malay, Brunei Darussalam
1763 { "ms-MY", "*", spBuiltinFormats_ms_MY }, // Malay, Malaysia
1764 { "mt-MT", "*", spBuiltinFormats_mt_MT }, // Maltese, Malta
1765 { "nb-NO", "*", spBuiltinFormats_no_NO }, // Norwegian Bokmal, Norway
1766 { "nl-BE", "*", spBuiltinFormats_nl_BE }, // Dutch, Belgium
1767 { "nl-NL", "*", spBuiltinFormats_nl_NL }, // Dutch, Netherlands
1768 { "nn-NO", "*", spBuiltinFormats_no_NO }, // Norwegian Nynorsk, Norway
1769 { "nso-ZA", "*", spBuiltinFormats_en_ZA }, // Northern Sotho, South Africa
1770 { "pa-IN", "*", spBuiltinFormats_pa_IN }, // Punjabi, India
1771 { "pl-PL", "*", spBuiltinFormats_pl_PL }, // Polish, Poland
1772 { "pt-BR", "*", spBuiltinFormats_pt_BR }, // Portugese, Brazil
1773 { "pt-PT", "*", spBuiltinFormats_pt_PT }, // Portugese, Portugal
1774 { "qu-BO", "*", spBuiltinFormats_es_BO }, // Quechua, Bolivia
1775 { "qu-EC", "*", spBuiltinFormats_es_EC }, // Quechua, Ecuador
1776 { "qu-PE", "*", spBuiltinFormats_es_PE }, // Quechua, Peru
1777 { "ro-RO", "*", spBuiltinFormats_ro_RO }, // Romanian, Romania
1778 { "ru-RU", "*", spBuiltinFormats_ru_RU }, // Russian, Russian Federation
1779 { "sa-IN", "*", spBuiltinFormats_hi_IN }, // Sanskrit, India
1780 { "se-FI", "*", spBuiltinFormats_fi_FI }, // Sami, Finland
1781 { "se-NO", "*", spBuiltinFormats_no_NO }, // Sami, Norway
1782 { "se-SE", "*", spBuiltinFormats_sv_SE }, // Sami, Sweden
1783 { "sk-SK", "*", spBuiltinFormats_sk_SK }, // Slovak, Slovakia
1784 { "sl-SI", "*", spBuiltinFormats_sl_SI }, // Slovenian, Slovenia
1785 { "sv-FI", "*", spBuiltinFormats_sv_FI }, // Swedish, Finland
1786 { "sv-SE", "*", spBuiltinFormats_sv_SE }, // Swedish, Sweden
1787 { "sw-TZ", "*", spBuiltinFormats_sw_TZ }, // Swahili, Tanzania
1788 { "syr-SY", "*", spBuiltinFormats_ar_SY }, // Syriac, Syria
1789 { "syr-TR", "*", spBuiltinFormats_tr_TR }, // Syriac, Turkey
1790 { "ta-IN", "*", spBuiltinFormats_ta_IN }, // Tamil, India
1791 { "te-IN", "*", spBuiltinFormats_te_IN }, // Telugu, India
1792 { "th-TH", "*", spBuiltinFormats_th_TH }, // Thai, Thailand
1793 { "tn-ZA", "*", spBuiltinFormats_en_ZA }, // Tswana, South Africa
1794 { "tr-TR", "*", spBuiltinFormats_tr_TR }, // Turkish, Turkey
1795 { "tt-RU", "*", spBuiltinFormats_tt_RU }, // Tatar, Russian Federation
1796 { "uk-UA", "*", spBuiltinFormats_uk_UA }, // Ukrainian, Ukraine
1797 { "ur-PK", "*", spBuiltinFormats_ur_PK }, // Urdu, Pakistan
1798 { "vi-VN", "*", spBuiltinFormats_vi_VN }, // Vietnamese, Viet Nam
1799 { "xh-ZA", "*", spBuiltinFormats_en_ZA }, // Xhosa, South Africa
1800 { "zu-ZA", "*", spBuiltinFormats_en_ZA }, // Zulu, South Africa
1802 { "*CJK", "*", spBuiltinFormats_CJK }, // CJK base table
1803 { "ja-JP", "*CJK", spBuiltinFormats_ja_JP }, // Japanese, Japan
1804 { "ko-KR", "*CJK", spBuiltinFormats_ko_KR }, // Korean, South Korea
1805 { "zh-CN", "*CJK", spBuiltinFormats_zh_CN }, // Chinese, China
1806 { "zh-HK", "*CJK", spBuiltinFormats_zh_HK }, // Chinese, Hong Kong
1807 { "zh-MO", "*CJK", spBuiltinFormats_zh_MO }, // Chinese, Macau
1808 { "zh-SG", "*CJK", spBuiltinFormats_zh_SG }, // Chinese, Singapore
1809 { "zh-TW", "*CJK", spBuiltinFormats_zh_TW } // Chinese, Taiwan
1812 } // namespace
1814 // ============================================================================
1816 NumFmtModel::NumFmtModel() :
1817 mnPredefId( -1 )
1821 // ----------------------------------------------------------------------------
1823 ApiNumFmtData::ApiNumFmtData() :
1824 mnIndex( 0 )
1828 // ----------------------------------------------------------------------------
1830 namespace {
1832 sal_Int32 lclCreatePredefinedFormat( const Reference< XNumberFormats >& rxNumFmts,
1833 sal_Int16 nPredefId, const Locale& rToLocale )
1835 sal_Int32 nIndex = 0;
1838 Reference< XNumberFormatTypes > xNumFmtTypes( rxNumFmts, UNO_QUERY_THROW );
1839 nIndex = (nPredefId >= 0) ?
1840 xNumFmtTypes->getFormatIndex( nPredefId, rToLocale ) :
1841 xNumFmtTypes->getStandardIndex( rToLocale );
1843 catch( Exception& )
1845 OSL_ENSURE( false,
1846 OStringBuffer( "lclCreatePredefinedFormat - cannot create predefined number format " ).
1847 append( OString::valueOf( static_cast< sal_Int32 >( nPredefId ) ) ).getStr() );
1849 return nIndex;
1852 sal_Int32 lclCreateFormat( const Reference< XNumberFormats >& rxNumFmts,
1853 const OUString& rFmtCode, const Locale& rToLocale, const Locale& rFromLocale )
1855 sal_Int32 nIndex = 0;
1858 nIndex = rxNumFmts->addNewConverted( rFmtCode, rFromLocale, rToLocale );
1860 catch( Exception& )
1862 // BIFF2-BIFF4 stores standard format explicitly in stream
1863 static const OUString saGeneral = CREATE_OUSTRING( "general" );
1864 if( rFmtCode.equalsIgnoreAsciiCase( saGeneral ) )
1866 nIndex = lclCreatePredefinedFormat( rxNumFmts, 0, rToLocale );
1868 else
1870 OSL_ENSURE( false,
1871 OStringBuffer( "lclCreateFormat - cannot create number format '" ).
1872 append( OUStringToOString( rFmtCode, osl_getThreadTextEncoding() ) ).
1873 append( '\'' ).getStr() );
1876 return nIndex;
1879 // ----------------------------------------------------------------------------
1881 /** Functor for converting an XML number format to an API number format index. */
1882 class NumberFormatFinalizer
1884 public:
1885 explicit NumberFormatFinalizer( const WorkbookHelper& rHelper );
1887 inline bool is() const { return mxNumFmts.is(); }
1889 inline void operator()( NumberFormat& rNumFmt ) const
1890 { rNumFmt.finalizeImport( mxNumFmts, maEnUsLocale ); }
1892 private:
1893 Reference< XNumberFormats > mxNumFmts;
1894 Locale maEnUsLocale;
1897 NumberFormatFinalizer::NumberFormatFinalizer( const WorkbookHelper& rHelper ) :
1898 maEnUsLocale( CREATE_OUSTRING( "en" ), CREATE_OUSTRING( "US" ), OUString() )
1902 Reference< XNumberFormatsSupplier > xNumFmtsSupp( rHelper.getDocument(), UNO_QUERY_THROW );
1903 mxNumFmts = xNumFmtsSupp->getNumberFormats();
1905 catch( Exception& )
1908 OSL_ENSURE( mxNumFmts.is(), "NumberFormatFinalizer::NumberFormatFinalizer - cannot get number formats" );
1911 } // namespace
1913 // ----------------------------------------------------------------------------
1915 NumberFormat::NumberFormat( const WorkbookHelper& rHelper ) :
1916 WorkbookHelper( rHelper )
1920 void NumberFormat::setFormatCode( const OUString& rFmtCode )
1922 maModel.maFmtCode = rFmtCode;
1925 void NumberFormat::setFormatCode( const Locale& rLocale, const sal_Char* pcFmtCode )
1927 maModel.maLocale = rLocale;
1928 maModel.maFmtCode = OStringToOUString( OString( pcFmtCode ), RTL_TEXTENCODING_UTF8 );
1929 maModel.mnPredefId = -1;
1932 void NumberFormat::setPredefinedId( const Locale& rLocale, sal_Int16 nPredefId )
1934 maModel.maLocale = rLocale;
1935 maModel.maFmtCode = OUString();
1936 maModel.mnPredefId = nPredefId;
1939 sal_Int32 NumberFormat::finalizeImport( const Reference< XNumberFormats >& rxNumFmts, const Locale& rFromLocale )
1941 if( rxNumFmts.is() && (maModel.maFmtCode.getLength() > 0) )
1942 maApiData.mnIndex = lclCreateFormat( rxNumFmts, maModel.maFmtCode, maModel.maLocale, rFromLocale );
1943 else
1944 maApiData.mnIndex = lclCreatePredefinedFormat( rxNumFmts, maModel.mnPredefId, maModel.maLocale );
1945 return maApiData.mnIndex;
1948 void NumberFormat::writeToPropertyMap( PropertyMap& rPropMap ) const
1950 rPropMap[ PROP_NumberFormat ] <<= maApiData.mnIndex;
1953 // ============================================================================
1955 NumberFormatsBuffer::NumberFormatsBuffer( const WorkbookHelper& rHelper ) :
1956 WorkbookHelper( rHelper ),
1957 mnNextBiffIndex( 0 )
1959 // get the current locale
1962 Reference< XMultiServiceFactory > xConfigProv( getGlobalFactory()->createInstance(
1963 CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationProvider" ) ), UNO_QUERY_THROW );
1965 // try user-defined locale setting
1966 Sequence< Any > aArgs( 1 );
1967 aArgs[ 0 ] <<= CREATE_OUSTRING( "org.openoffice.Setup/L10N/" );
1968 Reference< XNameAccess > xConfigNA( xConfigProv->createInstanceWithArguments(
1969 CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationAccess" ), aArgs ), UNO_QUERY_THROW );
1970 xConfigNA->getByName( CREATE_OUSTRING( "ooSetupSystemLocale" ) ) >>= maLocaleStr;
1972 // if set to "use system", get locale from system
1973 if( maLocaleStr.getLength() == 0 )
1975 aArgs[ 0 ] <<= CREATE_OUSTRING( "org.openoffice.System/L10N/" );
1976 xConfigNA.set( xConfigProv->createInstanceWithArguments(
1977 CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationAccess" ), aArgs ), UNO_QUERY_THROW );
1978 xConfigNA->getByName( CREATE_OUSTRING( "Locale" ) ) >>= maLocaleStr;
1981 catch( Exception& )
1983 OSL_ENSURE( false, "NumberFormatsBuffer::NumberFormatsBuffer - cannot get system locale" );
1986 // create built-in formats for current locale
1987 insertBuiltinFormats();
1990 NumberFormatRef NumberFormatsBuffer::createNumFmt( sal_Int32 nNumFmtId, const OUString& rFmtCode )
1992 NumberFormatRef xNumFmt;
1993 if( nNumFmtId >= 0 )
1995 xNumFmt.reset( new NumberFormat( *this ) );
1996 maNumFmts[ nNumFmtId ] = xNumFmt;
1997 xNumFmt->setFormatCode( rFmtCode );
1999 return xNumFmt;
2002 NumberFormatRef NumberFormatsBuffer::importNumFmt( const AttributeList& rAttribs )
2004 sal_Int32 nNumFmtId = rAttribs.getInteger( XML_numFmtId, -1 );
2005 OUString aFmtCode = rAttribs.getXString( XML_formatCode, OUString() );
2006 return createNumFmt( nNumFmtId, aFmtCode );
2009 void NumberFormatsBuffer::importNumFmt( RecordInputStream& rStrm )
2011 sal_Int32 nNumFmtId = rStrm.readuInt16();
2012 OUString aFmtCode = rStrm.readString();
2013 createNumFmt( nNumFmtId, aFmtCode );
2016 void NumberFormatsBuffer::importFormat( BiffInputStream& rStrm )
2018 OUString aFmtCode;
2019 switch( getBiff() )
2021 case BIFF2:
2022 case BIFF3:
2023 aFmtCode = rStrm.readByteStringUC( false, getTextEncoding() );
2024 break;
2025 case BIFF4:
2026 rStrm.skip( 2 ); // in BIFF4 the index field exists, but is undefined
2027 aFmtCode = rStrm.readByteStringUC( false, getTextEncoding() );
2028 break;
2029 case BIFF5:
2030 mnNextBiffIndex = rStrm.readuInt16();
2031 aFmtCode = rStrm.readByteStringUC( false, getTextEncoding() );
2032 break;
2033 case BIFF8:
2034 mnNextBiffIndex = rStrm.readuInt16();
2035 aFmtCode = rStrm.readUniString();
2036 break;
2037 case BIFF_UNKNOWN: break;
2040 createNumFmt( mnNextBiffIndex, aFmtCode );
2041 ++mnNextBiffIndex;
2044 void NumberFormatsBuffer::finalizeImport()
2046 maNumFmts.forEach( NumberFormatFinalizer( *this ) );
2049 void NumberFormatsBuffer::writeToPropertyMap( PropertyMap& rPropMap, sal_Int32 nNumFmtId ) const
2051 if( const NumberFormat* pNumFmt = maNumFmts.get( nNumFmtId ).get() )
2052 pNumFmt->writeToPropertyMap( rPropMap );
2055 void NumberFormatsBuffer::insertBuiltinFormats()
2057 // build a map containing pointers to all tables
2058 typedef ::std::map< OUString, const BuiltinFormatTable* > BuiltinMap;
2059 BuiltinMap aBuiltinMap;
2060 for( const BuiltinFormatTable* pTable = spBuiltinFormatTables;
2061 pTable != STATIC_ARRAY_END( spBuiltinFormatTables ); ++pTable )
2062 aBuiltinMap[ OUString::createFromAscii( pTable->mpcLocale ) ] = pTable;
2064 // convert locale string to locale struct
2065 Locale aSysLocale;
2066 sal_Int32 nDashPos = maLocaleStr.indexOf( '-' );
2067 if( nDashPos < 0 ) nDashPos = maLocaleStr.getLength();
2068 aSysLocale.Language = maLocaleStr.copy( 0, nDashPos );
2069 if( nDashPos + 1 < maLocaleStr.getLength() )
2070 aSysLocale.Country = maLocaleStr.copy( nDashPos + 1 );
2072 // build a list of table pointers for the current locale, with all parent tables
2073 typedef ::std::vector< const BuiltinFormatTable* > BuiltinVec;
2074 BuiltinVec aBuiltinVec;
2075 BuiltinMap::const_iterator aMIt = aBuiltinMap.find( maLocaleStr ), aMEnd = aBuiltinMap.end();
2076 OSL_ENSURE( aMIt != aMEnd,
2077 OStringBuffer( "NumberFormatsBuffer::insertBuiltinFormats - locale '" ).
2078 append( OUStringToOString( maLocaleStr, RTL_TEXTENCODING_ASCII_US ) ).
2079 append( "' not supported (#i29949#)" ).getStr() );
2080 // start with default table, if no table has been found
2081 if( aMIt == aMEnd )
2082 aMIt = aBuiltinMap.find( CREATE_OUSTRING( "*" ) );
2083 OSL_ENSURE( aMIt != aMEnd, "NumberFormatsBuffer::insertBuiltinFormats - default map not found" );
2084 // insert all tables into the vector
2085 for( ; aMIt != aMEnd; aMIt = aBuiltinMap.find( OUString::createFromAscii( aMIt->second->mpcParent ) ) )
2086 aBuiltinVec.push_back( aMIt->second );
2088 // insert the default formats in the format map (in reverse order from default table to system locale)
2089 typedef ::std::map< sal_Int32, sal_Int32 > ReuseMap;
2090 ReuseMap aReuseMap;
2091 for( BuiltinVec::reverse_iterator aVIt = aBuiltinVec.rbegin(), aVEnd = aBuiltinVec.rend(); aVIt != aVEnd; ++aVIt )
2093 // do not put the current system locale for default table
2094 Locale aLocale;
2095 if( (*aVIt)->mpcLocale[ 0 ] != '\0' )
2096 aLocale = aSysLocale;
2097 for( const BuiltinFormat* pBuiltin = (*aVIt)->mpFormats; pBuiltin && (pBuiltin->mnNumFmtId >= 0); ++pBuiltin )
2099 NumberFormatRef& rxNumFmt = maNumFmts[ pBuiltin->mnNumFmtId ];
2100 rxNumFmt.reset( new NumberFormat( *this ) );
2102 bool bReuse = false;
2103 if( pBuiltin->mpcFmtCode )
2104 rxNumFmt->setFormatCode( aLocale, pBuiltin->mpcFmtCode );
2105 else if( pBuiltin->mnPredefId >= 0 )
2106 rxNumFmt->setPredefinedId( aLocale, pBuiltin->mnPredefId );
2107 else
2108 bReuse = pBuiltin->mnReuseId >= 0;
2110 if( bReuse )
2111 aReuseMap[ pBuiltin->mnNumFmtId ] = pBuiltin->mnReuseId;
2112 else
2113 aReuseMap.erase( pBuiltin->mnNumFmtId );
2117 // copy reused number formats
2118 for( ReuseMap::const_iterator aRIt = aReuseMap.begin(), aREnd = aReuseMap.end(); aRIt != aREnd; ++aRIt )
2119 maNumFmts[ aRIt->first ] = maNumFmts[ aRIt->second ];
2122 // ============================================================================
2124 } // namespace xls
2125 } // namespace oox