LCOV - code coverage report
Current view: top level - libreoffice/sc/source/filter/oox - numberformatsbuffer.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 132 140 94.3 %
Date: 2012-12-27 Functions: 24 25 96.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "numberformatsbuffer.hxx"
      21             : 
      22             : #include <com/sun/star/container/XNameAccess.hpp>
      23             : #include <com/sun/star/i18n/NumberFormatIndex.hpp>
      24             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      25             : #include <com/sun/star/util/XNumberFormatTypes.hpp>
      26             : #include <com/sun/star/util/XNumberFormats.hpp>
      27             : #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
      28             : #include <officecfg/Setup.hxx>
      29             : #include <officecfg/System.hxx>
      30             : #include <rtl/strbuf.hxx>
      31             : #include <rtl/string.hxx>
      32             : #include <osl/thread.h>
      33             : #include <rtl/ustrbuf.hxx>
      34             : #include <svl/intitem.hxx>
      35             : #include "oox/core/filterbase.hxx"
      36             : #include "oox/helper/attributelist.hxx"
      37             : #include "oox/helper/propertymap.hxx"
      38             : #include "biffinputstream.hxx"
      39             : #include "scitems.hxx"
      40             : #include "document.hxx"
      41             : #include "ftools.hxx"
      42             : 
      43             : namespace oox {
      44             : namespace xls {
      45             : 
      46             : // ============================================================================
      47             : 
      48             : using namespace ::com::sun::star::container;
      49             : using namespace ::com::sun::star::lang;
      50             : using namespace ::com::sun::star::uno;
      51             : using namespace ::com::sun::star::util;
      52             : 
      53             : using ::rtl::OString;
      54             : using ::rtl::OStringBuffer;
      55             : using ::rtl::OStringToOUString;
      56             : using ::rtl::OUString;
      57             : using ::rtl::OUStringBuffer;
      58             : 
      59             : // ============================================================================
      60             : 
      61             : namespace {
      62             : 
      63             : /** Stores the number format used in Calc for an Excel built-in number format. */
      64             : struct BuiltinFormat
      65             : {
      66             :     sal_Int32           mnNumFmtId;         /// Built-in number format index.
      67             :     const sal_Char*     mpcFmtCode;         /// Format string, UTF-8, may be 0 (mnPredefId is used then).
      68             :     sal_Int16           mnPredefId;         /// Predefined format index, if mpcFmtCode is 0.
      69             :     sal_Int32           mnReuseId;          /// Use this format, if mpcFmtCode is 0 and mnPredefId is -1.
      70             : };
      71             : 
      72             : /** Defines a literal built-in number format. */
      73             : #define NUMFMT_STRING( INDEX, FORMATCODE ) \
      74             :     { INDEX, FORMATCODE, -1, -1 }
      75             : 
      76             : /** Defines a built-in number format that maps to an own predefined format. */
      77             : #define NUMFMT_PREDEF( INDEX, PREDEFINED ) \
      78             :     { INDEX, 0, ::com::sun::star::i18n::NumberFormatIndex::PREDEFINED, -1 }
      79             : 
      80             : /** Defines a built-in number format that is the same as the specified in nReuseId. */
      81             : #define NUMFMT_REUSE( INDEX, REUSED_INDEX ) \
      82             :     { INDEX, 0, -1, REUSED_INDEX }
      83             : 
      84             : /** Terminates a built-in number format table. */
      85             : #define NUMFMT_ENDTABLE() \
      86             :     { -1, 0, -1, -1 }
      87             : 
      88             : /** Defines builtin date and time formats 14...22.
      89             :     @param SYSTEMDATE  Complete short system date (for formats 14 and 22).
      90             :     @param DAY  Day format (for formats 15 and 16).
      91             :     @param DAYSEP  Separator between day and month (for formats 15 and 16).
      92             :     @param MONTH  Month format (for formats 15...17).
      93             :     @param MONTHSEP  Separator between month and year (for formats 15 and 17).
      94             :     @param YEAR  Year format (for formats 15 and 17).
      95             :     @param HOUR12  Hour format for 12-hour AM/PM formats (formats 18 and 19).
      96             :     @param HOUR24  Hour format for 24-hour formats (formats 20...22). */
      97             : #define NUMFMT_ALLDATETIMES( SYSTEMDATE, DAY, DAYSEP, MONTH, MONTHSEP, YEAR, HOUR12, HOUR24 ) \
      98             :     NUMFMT_STRING(  14, SYSTEMDATE ), \
      99             :     NUMFMT_STRING(  15, DAY DAYSEP MONTH MONTHSEP YEAR ), \
     100             :     NUMFMT_STRING(  16, DAY DAYSEP MONTH ), \
     101             :     NUMFMT_STRING(  17, MONTH MONTHSEP YEAR ), \
     102             :     NUMFMT_STRING(  18, HOUR12 ":mm AM/PM" ), \
     103             :     NUMFMT_STRING(  19, HOUR12 ":mm:ss AM/PM" ), \
     104             :     NUMFMT_STRING(  20, HOUR24 ":mm" ), \
     105             :     NUMFMT_STRING(  21, HOUR24 ":mm:ss" ), \
     106             :     NUMFMT_STRING(  22, SYSTEMDATE " " HOUR24 ":mm" )
     107             : 
     108             : /** Defines builtin time formats INDEX and INDEX+1 for CJK locales.
     109             :     @param INDEX  First number format index.
     110             :     @param HOURFORMAT  Hour format.
     111             :     @param HOUR  Hour symbol.
     112             :     @param MINUTE  Minute symbol.
     113             :     @param SECOND  Second symbol. */
     114             : #define NUMFMT_TIME_CJK( INDEX, HOURFORMAT, HOUR, MINUTE, SECOND ) \
     115             :     NUMFMT_STRING( INDEX + 0, HOURFORMAT "\"" HOUR "\"mm\"" MINUTE "\"" ), \
     116             :     NUMFMT_STRING( INDEX + 1, HOURFORMAT "\"" HOUR "\"mm\"" MINUTE "\"ss\"" SECOND "\"" )
     117             : 
     118             : /** Defines builtin time formats 32...35 for CJK locales.
     119             :     @param HOUR12  Hour format for 12-hour AM/PM formats (formats 34 and 35).
     120             :     @param HOUR24  Hour format for 24-hour formats (formats 32 and 33).
     121             :     @param HOUR  Hour symbol.
     122             :     @param MINUTE  Minute symbol.
     123             :     @param SECOND  Second symbol. */
     124             : #define NUMFMT_ALLTIMES_CJK( HOUR12, HOUR24, HOUR, MINUTE, SECOND ) \
     125             :     NUMFMT_TIME_CJK( 32, HOUR24, HOUR, MINUTE, SECOND ), \
     126             :     NUMFMT_TIME_CJK( 34, "AM/PM" HOUR12, HOUR, MINUTE, SECOND )
     127             : 
     128             : /** Defines builtin currency formats INDEX...INDEX+3 in the following format:
     129             :     "symbol, [minus], number".
     130             :     @param INDEX  First number format index.
     131             :     @param SYMBOL  Currency symbol.
     132             :     @param SPACE  Space character(s) between currency symbol and number.
     133             :     @param MODIF  Leading modifier for each portion (e.g. "t" for Thai formats). */
     134             : #define NUMFMT_CURRENCY_SYMBOL_MINUS_NUMBER( INDEX, SYMBOL, SPACE, MODIF ) \
     135             :     NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0;"            MODIF SYMBOL SPACE "-#,##0" ), \
     136             :     NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0;"    "[RED]" MODIF SYMBOL SPACE "-#,##0" ), \
     137             :     NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00;"         MODIF SYMBOL SPACE "-#,##0.00" ), \
     138             :     NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00;" "[RED]" MODIF SYMBOL SPACE "-#,##0.00" )
     139             : 
     140             : /** Defines builtin accounting formats INDEX...INDEX+3 in the following format:
     141             :     "symbol, [minus], number".
     142             :     @param INDEX  First number format index.
     143             :     @param SYMBOL  Currency symbol.
     144             :     @param SPACE  Space character(s) between currency symbol and number. */
     145             : #define NUMFMT_ACCOUNTING_SYMBOL_MINUS_NUMBER( INDEX, SYMBOL, SPACE ) \
     146             :     NUMFMT_STRING( INDEX + 0, "_ "              "* #,##0_ ;"    "_ "              "* -#,##0_ ;"    "_ "              "* \"-\"_ ;"    "_ @_ " ), \
     147             :     NUMFMT_STRING( INDEX + 1, "_ " SYMBOL SPACE "* #,##0_ ;"    "_ " SYMBOL SPACE "* -#,##0_ ;"    "_ " SYMBOL SPACE "* \"-\"_ ;"    "_ @_ " ), \
     148             :     NUMFMT_STRING( INDEX + 2, "_ "              "* #,##0.00_ ;" "_ "              "* -#,##0.00_ ;" "_ "              "* \"-\"?\?_ ;" "_ @_ " ), \
     149             :     NUMFMT_STRING( INDEX + 3, "_ " SYMBOL SPACE "* #,##0.00_ ;" "_ " SYMBOL SPACE "* -#,##0.00_ ;" "_ " SYMBOL SPACE "* \"-\"?\?_ ;" "_ @_ " )
     150             : 
     151             : /** Defines builtin currency formats 5...8 (with currency symbol), 37...40
     152             :     (blind currency symbol), and 41...44 (accounting), in the following format:
     153             :     "symbol, [minus], number".
     154             :     @param SYMBOL  Currency symbol.
     155             :     @param SPACE  Space character(s) between currency symbol and number. */
     156             : #define NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( SYMBOL, SPACE ) \
     157             :     NUMFMT_CURRENCY_SYMBOL_MINUS_NUMBER( 5, SYMBOL, SPACE, "" ), \
     158             :     NUMFMT_CURRENCY_SYMBOL_MINUS_NUMBER( 37, "", "", "" ), \
     159             :     NUMFMT_ACCOUNTING_SYMBOL_MINUS_NUMBER( 41, SYMBOL, SPACE )
     160             : 
     161             : /** Defines builtin currency formats INDEX...INDEX+3 in the following format:
     162             :     "symbol, number, [minus]".
     163             :     @param INDEX  First number format index.
     164             :     @param SYMBOL  Currency symbol.
     165             :     @param SPACE  Space character(s) between currency symbol and number.
     166             :     @param MODIF  Leading modifier for each portion (e.g. "t" for Thai formats). */
     167             : #define NUMFMT_CURRENCY_SYMBOL_NUMBER_MINUS( INDEX, SYMBOL, SPACE, MODIF ) \
     168             :     NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0_-;"            MODIF SYMBOL SPACE "#,##0-" ), \
     169             :     NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0_-;"    "[RED]" MODIF SYMBOL SPACE "#,##0-" ), \
     170             :     NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00_-;"         MODIF SYMBOL SPACE "#,##0.00-" ), \
     171             :     NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00_-;" "[RED]" MODIF SYMBOL SPACE "#,##0.00-" )
     172             : 
     173             : /** Defines builtin accounting formats INDEX...INDEX+3 in the following format:
     174             :     "symbol, number, [minus]".
     175             :     @param INDEX  First number format index.
     176             :     @param SYMBOL  Currency symbol.
     177             :     @param SPACE  Space character(s) between currency symbol and number. */
     178             : #define NUMFMT_ACCOUNTING_SYMBOL_NUMBER_MINUS( INDEX, SYMBOL, SPACE ) \
     179             :     NUMFMT_STRING( INDEX + 0, "_-"              "* #,##0_-;"    "_-"              "* #,##0-;"    "_-"              "* \"-\"_-;"    "_-@_-" ), \
     180             :     NUMFMT_STRING( INDEX + 1, "_-" SYMBOL SPACE "* #,##0_-;"    "_-" SYMBOL SPACE "* #,##0-;"    "_-" SYMBOL SPACE "* \"-\"_-;"    "_-@_-" ), \
     181             :     NUMFMT_STRING( INDEX + 2, "_-"              "* #,##0.00_-;" "_-"              "* #,##0.00-;" "_-"              "* \"-\"?\?_-;" "_-@_-" ), \
     182             :     NUMFMT_STRING( INDEX + 3, "_-" SYMBOL SPACE "* #,##0.00_-;" "_-" SYMBOL SPACE "* #,##0.00-;" "_-" SYMBOL SPACE "* \"-\"?\?_-;" "_-@_-" )
     183             : 
     184             : /** Defines builtin currency formats 5...8 (with currency symbol), 37...40
     185             :     (blind currency symbol), and 41...44 (accounting), in the following format:
     186             :     "symbol, number, [minus]".
     187             :     @param SYMBOL  Currency symbol.
     188             :     @param SPACE  Space character(s) between currency symbol and number. */
     189             : #define NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( SYMBOL, SPACE ) \
     190             :     NUMFMT_CURRENCY_SYMBOL_NUMBER_MINUS( 5, SYMBOL, SPACE, "" ), \
     191             :     NUMFMT_CURRENCY_SYMBOL_NUMBER_MINUS( 37, "", "", "" ), \
     192             :     NUMFMT_ACCOUNTING_SYMBOL_NUMBER_MINUS( 41, SYMBOL, SPACE )
     193             : 
     194             : /** Defines builtin currency formats INDEX...INDEX+3 in the following format:
     195             :     "number, symbol, [minus]".
     196             :     @param INDEX  First number format index.
     197             :     @param SYMBOL  Currency symbol.
     198             :     @param SPACE  Space character(s) between number and currency symbol.
     199             :     @param MODIF  Leading modifier for each portion (e.g. "t" for Thai formats). */
     200             : #define NUMFMT_CURRENCY_NUMBER_SYMBOL_MINUS( INDEX, SYMBOL, SPACE, MODIF ) \
     201             :     NUMFMT_STRING( INDEX + 0, MODIF "#,##0"    SPACE SYMBOL "_-;"         MODIF "#,##0"    SPACE SYMBOL "-" ), \
     202             :     NUMFMT_STRING( INDEX + 1, MODIF "#,##0"    SPACE SYMBOL "_-;" "[RED]" MODIF "#,##0"    SPACE SYMBOL "-" ), \
     203             :     NUMFMT_STRING( INDEX + 2, MODIF "#,##0.00" SPACE SYMBOL "_-;"         MODIF "#,##0.00" SPACE SYMBOL "-" ), \
     204             :     NUMFMT_STRING( INDEX + 3, MODIF "#,##0.00" SPACE SYMBOL "_-;" "[RED]" MODIF "#,##0.00" SPACE SYMBOL "-" )
     205             : 
     206             : /** Defines builtin accounting formats INDEX...INDEX+3 in the following format:
     207             :     "number, symbol, [minus]".
     208             :     @param INDEX  First number format index.
     209             :     @param SYMBOL  Currency symbol.
     210             :     @param BLINDS  Blind currency symbol.
     211             :     @param SPACE  Space character(s) between number and currency symbol. */
     212             : #define NUMFMT_ACCOUNTING_NUMBER_SYMBOL_MINUS( INDEX, SYMBOL, BLINDS, SPACE ) \
     213             :     NUMFMT_STRING( INDEX + 0, "_-* #,##0"    SPACE BLINDS "_-;_-* #,##0"    SPACE BLINDS "-;_-* \"-\""    SPACE BLINDS "_-;_-@_-" ), \
     214             :     NUMFMT_STRING( INDEX + 1, "_-* #,##0"    SPACE SYMBOL "_-;_-* #,##0"    SPACE SYMBOL "-;_-* \"-\""    SPACE SYMBOL "_-;_-@_-" ), \
     215             :     NUMFMT_STRING( INDEX + 2, "_-* #,##0.00" SPACE BLINDS "_-;_-* #,##0.00" SPACE BLINDS "-;_-* \"-\"?\?" SPACE BLINDS "_-;_-@_-" ), \
     216             :     NUMFMT_STRING( INDEX + 3, "_-* #,##0.00" SPACE SYMBOL "_-;_-* #,##0.00" SPACE SYMBOL "-;_-* \"-\"?\?" SPACE SYMBOL "_-;_-@_-" )
     217             : 
     218             : /** Defines builtin currency formats 5...8 (with currency symbol), 37...40
     219             :     (blind currency symbol), and 41...44 (accounting), in the following format:
     220             :     "number, symbol, [minus]".
     221             :     @param SYMBOL  Currency symbol.
     222             :     @param BLINDS  Blind currency symbol.
     223             :     @param SPACE  Space character(s) between number and currency symbol. */
     224             : #define NUMFMT_ALLCURRENCIES_NUMBER_SYMBOL_MINUS( SYMBOL, BLINDS, SPACE ) \
     225             :     NUMFMT_CURRENCY_NUMBER_SYMBOL_MINUS( 5, SYMBOL, SPACE, "" ), \
     226             :     NUMFMT_CURRENCY_NUMBER_SYMBOL_MINUS( 37, BLINDS, SPACE, "" ), \
     227             :     NUMFMT_ACCOUNTING_NUMBER_SYMBOL_MINUS( 41, SYMBOL, BLINDS, SPACE )
     228             : 
     229             : /** Defines builtin currency formats INDEX...INDEX+3 in the following format:
     230             :     "[minus], symbol, number".
     231             :     @param INDEX  First number format index.
     232             :     @param SYMBOL  Currency symbol.
     233             :     @param SPACE  Space character(s) between currency symbol and number.
     234             :     @param MODIF  Leading modifier for each portion (e.g. "t" for Thai formats). */
     235             : #define NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( INDEX, SYMBOL, SPACE, MODIF ) \
     236             :     NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0;"            MODIF "-" SYMBOL SPACE "#,##0" ), \
     237             :     NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0;"    "[RED]" MODIF "-" SYMBOL SPACE "#,##0" ), \
     238             :     NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00;"         MODIF "-" SYMBOL SPACE "#,##0.00" ), \
     239             :     NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00;" "[RED]" MODIF "-" SYMBOL SPACE "#,##0.00" )
     240             : 
     241             : /** Defines builtin accounting formats INDEX...INDEX+3 in the following order:
     242             :     "[minus], symbol, number".
     243             :     @param INDEX  First number format index.
     244             :     @param SYMBOL  Currency symbol.
     245             :     @param SPACE  Space character(s) between currency symbol and number. */
     246             : #define NUMFMT_ACCOUNTING_MINUS_SYMBOL_NUMBER( INDEX, SYMBOL, SPACE ) \
     247             :     NUMFMT_STRING( INDEX + 0, "_-"              "* #,##0_-;"    "-"              "* #,##0_-;"    "_-"              "* \"-\"_-;"    "_-@_-" ), \
     248             :     NUMFMT_STRING( INDEX + 1, "_-" SYMBOL SPACE "* #,##0_-;"    "-" SYMBOL SPACE "* #,##0_-;"    "_-" SYMBOL SPACE "* \"-\"_-;"    "_-@_-" ), \
     249             :     NUMFMT_STRING( INDEX + 2, "_-"              "* #,##0.00_-;" "-"              "* #,##0.00_-;" "_-"              "* \"-\"?\?_-;" "_-@_-" ), \
     250             :     NUMFMT_STRING( INDEX + 3, "_-" SYMBOL SPACE "* #,##0.00_-;" "-" SYMBOL SPACE "* #,##0.00_-;" "_-" SYMBOL SPACE "* \"-\"?\?_-;" "_-@_-" )
     251             : 
     252             : /** Defines builtin currency formats 5...8 (with currency symbol), 37...40
     253             :     (blind currency symbol), and 41...44 (accounting), in the following order:
     254             :     "[minus], symbol, number".
     255             :     @param SYMBOL  Currency symbol.
     256             :     @param SPACE  Space character(s) between currency symbol and number. */
     257             : #define NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( SYMBOL, SPACE ) \
     258             :     NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( 5, SYMBOL, SPACE, "" ), \
     259             :     NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( 37, "", "", "" ), \
     260             :     NUMFMT_ACCOUNTING_MINUS_SYMBOL_NUMBER( 41, SYMBOL, SPACE )
     261             : 
     262             : /** Defines builtin currency formats INDEX...INDEX+3 in the following format:
     263             :     "[minus], number, symbol".
     264             :     @param INDEX  First number format index.
     265             :     @param SYMBOL  Currency symbol.
     266             :     @param SPACE  Space character(s) between number and currency symbol.
     267             :     @param MODIF  Leading modifier for each portion (e.g. "t" for Thai formats). */
     268             : #define NUMFMT_CURRENCY_MINUS_NUMBER_SYMBOL( INDEX, SYMBOL, SPACE, MODIF ) \
     269             :     NUMFMT_STRING( INDEX + 0, MODIF "#,##0"    SPACE SYMBOL ";"         MODIF "-#,##0"    SPACE SYMBOL ), \
     270             :     NUMFMT_STRING( INDEX + 1, MODIF "#,##0"    SPACE SYMBOL ";" "[RED]" MODIF "-#,##0"    SPACE SYMBOL ), \
     271             :     NUMFMT_STRING( INDEX + 2, MODIF "#,##0.00" SPACE SYMBOL ";"         MODIF "-#,##0.00" SPACE SYMBOL ), \
     272             :     NUMFMT_STRING( INDEX + 3, MODIF "#,##0.00" SPACE SYMBOL ";" "[RED]" MODIF "-#,##0.00" SPACE SYMBOL )
     273             : 
     274             : /** Defines builtin accounting formats INDEX...INDEX+3 in the following format:
     275             :     "[minus], number, symbol".
     276             :     @param INDEX  First number format index.
     277             :     @param SYMBOL  Currency symbol.
     278             :     @param BLINDS  Blind currency symbol.
     279             :     @param SPACE  Space character(s) between number and currency symbol. */
     280             : #define NUMFMT_ACCOUNTING_MINUS_NUMBER_SYMBOL( INDEX, SYMBOL, BLINDS, SPACE ) \
     281             :     NUMFMT_STRING( INDEX + 0, "_-* #,##0"    SPACE BLINDS "_-;-* #,##0"    SPACE BLINDS "_-;_-* \"-\""    SPACE BLINDS "_-;_-@_-" ), \
     282             :     NUMFMT_STRING( INDEX + 1, "_-* #,##0"    SPACE SYMBOL "_-;-* #,##0"    SPACE SYMBOL "_-;_-* \"-\""    SPACE SYMBOL "_-;_-@_-" ), \
     283             :     NUMFMT_STRING( INDEX + 2, "_-* #,##0.00" SPACE BLINDS "_-;-* #,##0.00" SPACE BLINDS "_-;_-* \"-\"?\?" SPACE BLINDS "_-;_-@_-" ), \
     284             :     NUMFMT_STRING( INDEX + 3, "_-* #,##0.00" SPACE SYMBOL "_-;-* #,##0.00" SPACE SYMBOL "_-;_-* \"-\"?\?" SPACE SYMBOL "_-;_-@_-" )
     285             : 
     286             : /** Defines builtin currency formats 5...8 (with currency symbol), 37...40
     287             :     (blind currency symbol), and 41...44 (accounting), in the following format:
     288             :     "[minus], number, symbol".
     289             :     @param SYMBOL  Currency symbol.
     290             :     @param BLINDS  Blind currency symbol.
     291             :     @param SPACE  Space character(s) between number and currency symbol. */
     292             : #define NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( SYMBOL, BLINDS, SPACE ) \
     293             :     NUMFMT_CURRENCY_MINUS_NUMBER_SYMBOL( 5, SYMBOL, SPACE, "" ), \
     294             :     NUMFMT_CURRENCY_MINUS_NUMBER_SYMBOL( 37, BLINDS, SPACE, "" ), \
     295             :     NUMFMT_ACCOUNTING_MINUS_NUMBER_SYMBOL( 41, SYMBOL, BLINDS, SPACE )
     296             : 
     297             : /** Defines builtin currency formats INDEX...INDEX+3 in the following format:
     298             :     "[opening parenthesis], symbol, number, [closing parenthesis].".
     299             :     @param INDEX  First number format index.
     300             :     @param SYMBOL  Currency symbol.
     301             :     @param SPACE  Space character(s) between currency symbol and number.
     302             :     @param MODIF  Leading modifier for each portion (e.g. "t" for Thai formats). */
     303             : #define NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( INDEX, SYMBOL, SPACE, MODIF ) \
     304             :     NUMFMT_STRING( INDEX + 0, MODIF SYMBOL SPACE "#,##0_);"            MODIF "(" SYMBOL SPACE "#,##0)" ), \
     305             :     NUMFMT_STRING( INDEX + 1, MODIF SYMBOL SPACE "#,##0_);"    "[RED]" MODIF "(" SYMBOL SPACE "#,##0)" ), \
     306             :     NUMFMT_STRING( INDEX + 2, MODIF SYMBOL SPACE "#,##0.00_);"         MODIF "(" SYMBOL SPACE "#,##0.00)" ), \
     307             :     NUMFMT_STRING( INDEX + 3, MODIF SYMBOL SPACE "#,##0.00_);" "[RED]" MODIF "(" SYMBOL SPACE "#,##0.00)" )
     308             : 
     309             : /** Defines builtin accounting formats INDEX...INDEX+3 in the following format:
     310             :     "[opening parenthesis], symbol, number, [closing parenthesis].".
     311             :     @param INDEX  First number format index.
     312             :     @param SYMBOL  Currency symbol.
     313             :     @param SPACE  Space character(s) between currency symbol and number. */
     314             : #define NUMFMT_ACCOUNTING_OPEN_SYMBOL_NUMBER_CLOSE( INDEX, SYMBOL, SPACE ) \
     315             :     NUMFMT_STRING( INDEX + 0, "_("              "* #,##0_);"    "_("              "* (#,##0);"    "_("              "* \"-\"_);"    "_(@_)" ), \
     316             :     NUMFMT_STRING( INDEX + 1, "_(" SYMBOL SPACE "* #,##0_);"    "_(" SYMBOL SPACE "* (#,##0);"    "_(" SYMBOL SPACE "* \"-\"_);"    "_(@_)" ), \
     317             :     NUMFMT_STRING( INDEX + 2, "_("              "* #,##0.00_);" "_("              "* (#,##0.00);" "_("              "* \"-\"?\?_);" "_(@_)" ), \
     318             :     NUMFMT_STRING( INDEX + 3, "_(" SYMBOL SPACE "* #,##0.00_);" "_(" SYMBOL SPACE "* (#,##0.00);" "_(" SYMBOL SPACE "* \"-\"?\?_);" "_(@_)" )
     319             : 
     320             : /** Defines builtin currency formats 5...8 (with currency symbol), 37...40
     321             :     (blind currency symbol), and 41...44 (accounting), in the following format:
     322             :     "[opening parenthesis], symbol, number, [closing parenthesis].".
     323             :     @param SYMBOL  Currency symbol.
     324             :     @param SPACE  Space character(s) between currency symbol and number. */
     325             : #define NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( SYMBOL, SPACE ) \
     326             :     NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 5, SYMBOL, SPACE, "" ), \
     327             :     NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 37, "", "", "" ), \
     328             :     NUMFMT_ACCOUNTING_OPEN_SYMBOL_NUMBER_CLOSE( 41, SYMBOL, SPACE )
     329             : 
     330             : /** Defines builtin currency formats INDEX...INDEX+3 in the following format:
     331             :     "[opening parenthesis], number, symbol, [closing parenthesis].".
     332             :     @param INDEX  First number format index.
     333             :     @param SYMBOL  Currency symbol.
     334             :     @param SPACE  Space character(s) between number and currency symbol.
     335             :     @param MODIF  Leading modifier for each portion (e.g. "t" for Thai formats). */
     336             : #define NUMFMT_CURRENCY_OPEN_NUMBER_SYMBOL_CLOSE( INDEX, SYMBOL, SPACE, MODIF ) \
     337             :     NUMFMT_STRING( INDEX + 0, MODIF "#,##0"    SPACE SYMBOL "_);"         MODIF "(#,##0"    SPACE SYMBOL ")" ), \
     338             :     NUMFMT_STRING( INDEX + 1, MODIF "#,##0"    SPACE SYMBOL "_);" "[RED]" MODIF "(#,##0"    SPACE SYMBOL ")" ), \
     339             :     NUMFMT_STRING( INDEX + 2, MODIF "#,##0.00" SPACE SYMBOL "_);"         MODIF "(#,##0.00" SPACE SYMBOL ")" ), \
     340             :     NUMFMT_STRING( INDEX + 3, MODIF "#,##0.00" SPACE SYMBOL "_);" "[RED]" MODIF "(#,##0.00" SPACE SYMBOL ")" )
     341             : 
     342             : /** Defines builtin accounting formats INDEX...INDEX+3 in the following format:
     343             :     "[opening parenthesis], number, symbol, [closing parenthesis].".
     344             :     @param INDEX  First number format index.
     345             :     @param SYMBOL  Currency symbol.
     346             :     @param BLINDS  Blind currency symbol.
     347             :     @param SPACE  Space character(s) between number and currency symbol. */
     348             : #define NUMFMT_ACCOUNTING_OPEN_NUMBER_SYMBOL_CLOSE( INDEX, SYMBOL, BLINDS, SPACE ) \
     349             :     NUMFMT_STRING( INDEX + 0, "_ * #,##0_)"    SPACE BLINDS "_ ;_ * (#,##0)"    SPACE BLINDS "_ ;_ * \"-\"_)"    SPACE BLINDS "_ ;_ @_ " ), \
     350             :     NUMFMT_STRING( INDEX + 1, "_ * #,##0_)"    SPACE SYMBOL "_ ;_ * (#,##0)"    SPACE SYMBOL "_ ;_ * \"-\"_)"    SPACE SYMBOL "_ ;_ @_ " ), \
     351             :     NUMFMT_STRING( INDEX + 2, "_ * #,##0.00_)" SPACE BLINDS "_ ;_ * (#,##0.00)" SPACE BLINDS "_ ;_ * \"-\"?\?_)" SPACE BLINDS "_ ;_ @_ " ), \
     352             :     NUMFMT_STRING( INDEX + 3, "_ * #,##0.00_)" SPACE SYMBOL "_ ;_ * (#,##0.00)" SPACE SYMBOL "_ ;_ * \"-\"?\?_)" SPACE SYMBOL "_ ;_ @_ " )
     353             : 
     354             : /** Defines builtin currency formats 5...8 (with currency symbol), 37...40
     355             :     (blind currency symbol), and 41...44 (accounting), in the following format:
     356             :     "[opening parenthesis], number, symbol, [closing parenthesis].".
     357             :     @param SYMBOL  Currency symbol.
     358             :     @param BLINDS  Blind currency symbol.
     359             :     @param SPACE  Space character(s) between number and currency symbol. */
     360             : #define NUMFMT_ALLCURRENCIES_OPEN_NUMBER_SYMBOL_CLOSE( SYMBOL, BLINDS, SPACE ) \
     361             :     NUMFMT_CURRENCY_OPEN_NUMBER_SYMBOL_CLOSE( 5, SYMBOL, SPACE, "" ), \
     362             :     NUMFMT_CURRENCY_OPEN_NUMBER_SYMBOL_CLOSE( 37, BLINDS, SPACE, "" ), \
     363             :     NUMFMT_ACCOUNTING_OPEN_NUMBER_SYMBOL_CLOSE( 41, SYMBOL, BLINDS, SPACE )
     364             : 
     365             : // currency unit characters
     366             : #define UTF8_BAHT           "\340\270\277"
     367             : #define UTF8_COLON          "\342\202\241"
     368             : #define UTF8_CURR_AR_AE     "\330\257.\330\245."
     369             : #define UTF8_CURR_AR_BH     "\330\257.\330\250."
     370             : #define UTF8_CURR_AR_DZ     "\330\257.\330\254."
     371             : #define UTF8_CURR_AR_EG     "\330\254.\331\205."
     372             : #define UTF8_CURR_AR_IQ     "\330\257.\330\271."
     373             : #define UTF8_CURR_AR_JO     "\330\257.\330\247."
     374             : #define UTF8_CURR_AR_KW     "\330\257.\331\203."
     375             : #define UTF8_CURR_AR_LB     "\331\204.\331\204."
     376             : #define UTF8_CURR_AR_LY     "\330\257.\331\204."
     377             : #define UTF8_CURR_AR_MA     "\330\257.\331\205."
     378             : #define UTF8_CURR_AR_OM     "\330\261.\330\271."
     379             : #define UTF8_CURR_AR_QA     "\330\261.\331\202."
     380             : #define UTF8_CURR_AR_SA     "\330\261.\330\263."
     381             : #define UTF8_CURR_AR_SY     "\331\204.\330\263."
     382             : #define UTF8_CURR_AR_TN     "\330\257.\330\252."
     383             : #define UTF8_CURR_AR_YE     "\330\261.\331\212."
     384             : #define UTF8_CURR_BN_IN     "\340\246\237\340\246\276"
     385             : #define UTF8_CURR_FA_IR     "\330\261\331\212\330\247\331\204"
     386             : #define UTF8_CURR_GU_IN     "\340\252\260\340\253\202"
     387             : #define UTF8_CURR_HI_IN     "\340\244\260\340\245\201"
     388             : #define UTF8_CURR_KN_IN     "\340\262\260\340\263\202"
     389             : #define UTF8_CURR_ML_IN     "\340\264\225"
     390             : #define UTF8_CURR_PA_IN     "\340\250\260\340\251\201"
     391             : #define UTF8_CURR_TA_IN     "\340\256\260\340\257\202"
     392             : #define UTF8_CURR_TE_IN     "\340\260\260\340\261\202"
     393             : #define UTF8_DONG           "\342\202\253"
     394             : #define UTF8_EURO           "\342\202\254"
     395             : #define UTF8_POUND_GB       "\302\243"
     396             : #define UTF8_RUFIYAA        "\336\203"
     397             : #define UTF8_SHEQEL         "\342\202\252"
     398             : #define UTF8_TUGRUG         "\342\202\256"
     399             : #define UTF8_WON            "\342\202\251"
     400             : #define UTF8_YEN_CN         "\357\277\245"
     401             : #define UTF8_YEN_JP         "\302\245"
     402             : 
     403             : // Unicode characters for currency units
     404             : #define UTF8_CCARON_LC      "\304\215"
     405             : #define UTF8_LSTROKE_LC     "\305\202"
     406             : // Armenian
     407             : #define UTF8_HY_DA_LC       "\325\244"
     408             : #define UTF8_HY_REH_LC      "\326\200"
     409             : // Cyrillic
     410             : #define UTF8_CYR_G_LC       "\320\263"
     411             : #define UTF8_CYR_L_LC       "\320\273"
     412             : #define UTF8_CYR_M_LC       "\320\274"
     413             : #define UTF8_CYR_N_LC       "\320\275"
     414             : #define UTF8_CYR_O_LC       "\320\276"
     415             : #define UTF8_CYR_R_LC       "\321\200"
     416             : #define UTF8_CYR_S_LC       "\321\201"
     417             : #define UTF8_CYR_W_LC       "\320\262"
     418             : 
     419             : // Japanese/Chinese date/time characters
     420             : #define UTF8_CJ_YEAR        "\345\271\264"
     421             : #define UTF8_CJ_MON         "\346\234\210"
     422             : #define UTF8_CJ_DAY         "\346\227\245"
     423             : #define UTF8_CJ_HOUR        "\346\231\202"
     424             : #define UTF8_CJ_MIN         "\345\210\206"
     425             : #define UTF8_CJ_SEC         "\347\247\222"
     426             : 
     427             : // Chinese Simplified date/time characters
     428             : #define UTF8_CS_YEAR        "\345\271\264"
     429             : #define UTF8_CS_MON         "\346\234\210"
     430             : #define UTF8_CS_DAY         "\346\227\245"
     431             : #define UTF8_CS_HOUR        "\346\227\266"
     432             : #define UTF8_CS_MIN         "\345\210\206"
     433             : #define UTF8_CS_SEC         "\347\247\222"
     434             : 
     435             : // Korean date/time characters
     436             : #define UTF8_KO_YEAR        "\353\205\204"
     437             : #define UTF8_KO_MON         "\354\233\224"
     438             : #define UTF8_KO_DAY         "\354\235\274"
     439             : #define UTF8_KO_HOUR        "\354\213\234"
     440             : #define UTF8_KO_MIN         "\353\266\204"
     441             : #define UTF8_KO_SEC         "\354\264\210"
     442             : 
     443             : // ----------------------------------------------------------------------------
     444             : 
     445             : /** Default number format table. Last parent of all other tables, used for unknown locales. */
     446             : static const BuiltinFormat spBuiltinFormats_BASE[] =
     447             : {
     448             :     // 0..13 numeric and currency formats
     449             :     NUMFMT_PREDEF(   0, NUMBER_STANDARD ),          // General
     450             :     NUMFMT_PREDEF(   1, NUMBER_INT ),               // 0
     451             :     NUMFMT_PREDEF(   2, NUMBER_DEC2 ),              // 0.00
     452             :     NUMFMT_PREDEF(   3, NUMBER_1000INT ),           // #,##0
     453             :     NUMFMT_PREDEF(   4, NUMBER_1000DEC2 ),          // #,##0.00
     454             :     NUMFMT_PREDEF(   5, CURRENCY_1000INT ),         // #,##0[symbol]
     455             :     NUMFMT_PREDEF(   6, CURRENCY_1000INT_RED ),     // #,##0[symbol];[RED]-#,##0[symbol]
     456             :     NUMFMT_PREDEF(   7, CURRENCY_1000DEC2 ),        // #,##0.00[symbol]
     457             :     NUMFMT_PREDEF(   8, CURRENCY_1000DEC2_RED ),    // #,##0.00[symbol];[RED]-#,##0.00[symbol]
     458             :     NUMFMT_PREDEF(   9, PERCENT_INT ),              // 0%
     459             :     NUMFMT_PREDEF(  10, PERCENT_DEC2 ),             // 0.00%
     460             :     NUMFMT_PREDEF(  11, SCIENTIFIC_000E00 ),        // 0.00E+00
     461             :     NUMFMT_PREDEF(  12, FRACTION_1 ),               // # ?/?
     462             :     NUMFMT_PREDEF(  13, FRACTION_2 ),               // # ??/??
     463             : 
     464             :     // 14...22 date and time formats
     465             :     NUMFMT_PREDEF(  14, DATE_SYS_DDMMYYYY ),
     466             :     NUMFMT_PREDEF(  15, DATE_SYS_DMMMYY ),
     467             :     NUMFMT_PREDEF(  16, DATE_SYS_DDMMM ),
     468             :     NUMFMT_PREDEF(  17, DATE_SYS_MMYY ),
     469             :     NUMFMT_PREDEF(  18, TIME_HHMMAMPM ),
     470             :     NUMFMT_PREDEF(  19, TIME_HHMMSSAMPM ),
     471             :     NUMFMT_PREDEF(  20, TIME_HHMM ),
     472             :     NUMFMT_PREDEF(  21, TIME_HHMMSS ),
     473             :     NUMFMT_PREDEF(  22, DATETIME_SYSTEM_SHORT_HHMM ),
     474             : 
     475             :     // 23...36 international formats
     476             :     NUMFMT_REUSE(   23, 0 ),
     477             :     NUMFMT_REUSE(   24, 0 ),
     478             :     NUMFMT_REUSE(   25, 0 ),
     479             :     NUMFMT_REUSE(   26, 0 ),
     480             :     NUMFMT_REUSE(   27, 14 ),
     481             :     NUMFMT_REUSE(   28, 14 ),
     482             :     NUMFMT_REUSE(   29, 14 ),
     483             :     NUMFMT_REUSE(   30, 14 ),
     484             :     NUMFMT_REUSE(   31, 14 ),
     485             :     NUMFMT_REUSE(   32, 21 ),
     486             :     NUMFMT_REUSE(   33, 21 ),
     487             :     NUMFMT_REUSE(   34, 21 ),
     488             :     NUMFMT_REUSE(   35, 21 ),
     489             :     NUMFMT_REUSE(   36, 14 ),
     490             : 
     491             :     // 37...44 accounting formats, defaults without currency symbol here
     492             :     NUMFMT_CURRENCY_MINUS_SYMBOL_NUMBER( 37, "", "", "" ),
     493             :     NUMFMT_ACCOUNTING_MINUS_SYMBOL_NUMBER( 41, "", "" ),
     494             : 
     495             :     // 45...49 more special formats
     496             :     NUMFMT_STRING(  45, "mm:ss" ),
     497             :     NUMFMT_STRING(  46, "[h]:mm:ss" ),
     498             :     NUMFMT_STRING(  47, "mm:ss.0" ),
     499             :     NUMFMT_STRING(  48, "##0.0E+0" ),
     500             :     NUMFMT_PREDEF(  49, TEXT ),
     501             : 
     502             :     // 50...81 international formats
     503             :     NUMFMT_REUSE(   50, 14 ),
     504             :     NUMFMT_REUSE(   51, 14 ),
     505             :     NUMFMT_REUSE(   52, 14 ),
     506             :     NUMFMT_REUSE(   53, 14 ),
     507             :     NUMFMT_REUSE(   54, 14 ),
     508             :     NUMFMT_REUSE(   55, 14 ),
     509             :     NUMFMT_REUSE(   56, 14 ),
     510             :     NUMFMT_REUSE(   57, 14 ),
     511             :     NUMFMT_REUSE(   58, 14 ),
     512             :     NUMFMT_REUSE(   59, 1 ),
     513             :     NUMFMT_REUSE(   60, 2 ),
     514             :     NUMFMT_REUSE(   61, 3 ),
     515             :     NUMFMT_REUSE(   62, 4 ),
     516             :     NUMFMT_REUSE(   63, 5 ),
     517             :     NUMFMT_REUSE(   64, 6 ),
     518             :     NUMFMT_REUSE(   65, 7 ),
     519             :     NUMFMT_REUSE(   66, 8 ),
     520             :     NUMFMT_REUSE(   67, 9 ),
     521             :     NUMFMT_REUSE(   68, 10 ),
     522             :     NUMFMT_REUSE(   69, 12 ),
     523             :     NUMFMT_REUSE(   70, 13 ),
     524             :     NUMFMT_REUSE(   71, 14 ),
     525             :     NUMFMT_REUSE(   72, 14 ),
     526             :     NUMFMT_REUSE(   73, 15 ),
     527             :     NUMFMT_REUSE(   74, 16 ),
     528             :     NUMFMT_REUSE(   75, 17 ),
     529             :     NUMFMT_REUSE(   76, 20 ),
     530             :     NUMFMT_REUSE(   77, 21 ),
     531             :     NUMFMT_REUSE(   78, 22 ),
     532             :     NUMFMT_REUSE(   79, 45 ),
     533             :     NUMFMT_REUSE(   80, 46 ),
     534             :     NUMFMT_REUSE(   81, 47 ),
     535             : 
     536             :     // 82...163 not used, must not occur in a file (Excel may crash)
     537             : 
     538             :     NUMFMT_ENDTABLE()
     539             : };
     540             : 
     541             : // ----------------------------------------------------------------------------
     542             : 
     543             : /** Arabic, U.A.E. */
     544             : static const BuiltinFormat spBuiltinFormats_ar_AE[] =
     545             : {
     546             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     547             :     NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_AE "\"", " " ),
     548             :     NUMFMT_ENDTABLE()
     549             : };
     550             : 
     551             : /** Arabic, Bahrain. */
     552             : static const BuiltinFormat spBuiltinFormats_ar_BH[] =
     553             : {
     554             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     555             :     NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_BH "\"", " " ),
     556             :     NUMFMT_ENDTABLE()
     557             : };
     558             : 
     559             : /** Arabic, Algeria. */
     560             : static const BuiltinFormat spBuiltinFormats_ar_DZ[] =
     561             : {
     562             :     NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
     563             :     NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_DZ "\"", " " ),
     564             :     NUMFMT_ENDTABLE()
     565             : };
     566             : 
     567             : /** Arabic, Egypt. */
     568             : static const BuiltinFormat spBuiltinFormats_ar_EG[] =
     569             : {
     570             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     571             :     NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_EG "\"", " " ),
     572             :     NUMFMT_ENDTABLE()
     573             : };
     574             : 
     575             : /** Arabic, Iraq. */
     576             : static const BuiltinFormat spBuiltinFormats_ar_IQ[] =
     577             : {
     578             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     579             :     NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_IQ "\"", " " ),
     580             :     NUMFMT_ENDTABLE()
     581             : };
     582             : 
     583             : /** Arabic, Jordan. */
     584             : static const BuiltinFormat spBuiltinFormats_ar_JO[] =
     585             : {
     586             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     587             :     NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_JO "\"", " " ),
     588             :     NUMFMT_ENDTABLE()
     589             : };
     590             : 
     591             : /** Arabic, Kuwait. */
     592             : static const BuiltinFormat spBuiltinFormats_ar_KW[] =
     593             : {
     594             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     595             :     NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_KW "\"", " " ),
     596             :     NUMFMT_ENDTABLE()
     597             : };
     598             : 
     599             : /** Arabic, Lebanon. */
     600             : static const BuiltinFormat spBuiltinFormats_ar_LB[] =
     601             : {
     602             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     603             :     NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_LB "\"", " " ),
     604             :     NUMFMT_ENDTABLE()
     605             : };
     606             : 
     607             : /** Arabic, Libya. */
     608             : static const BuiltinFormat spBuiltinFormats_ar_LY[] =
     609             : {
     610             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     611             :     NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_LY "\"", " " ),
     612             :     NUMFMT_ENDTABLE()
     613             : };
     614             : 
     615             : /** Arabic, Morocco. */
     616             : static const BuiltinFormat spBuiltinFormats_ar_MA[] =
     617             : {
     618             :     NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
     619             :     NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_MA "\"", " " ),
     620             :     NUMFMT_ENDTABLE()
     621             : };
     622             : 
     623             : /** Arabic, Oman. */
     624             : static const BuiltinFormat spBuiltinFormats_ar_OM[] =
     625             : {
     626             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     627             :     NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_OM "\"", " " ),
     628             :     NUMFMT_ENDTABLE()
     629             : };
     630             : 
     631             : /** Arabic, Qatar. */
     632             : static const BuiltinFormat spBuiltinFormats_ar_QA[] =
     633             : {
     634             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     635             :     NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_QA "\"", " " ),
     636             :     NUMFMT_ENDTABLE()
     637             : };
     638             : 
     639             : /** Arabic, Saudi Arabia. */
     640             : static const BuiltinFormat spBuiltinFormats_ar_SA[] =
     641             : {
     642             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     643             :     NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_SA "\"", " " ),
     644             :     NUMFMT_ENDTABLE()
     645             : };
     646             : 
     647             : /** Arabic, Syria. */
     648             : static const BuiltinFormat spBuiltinFormats_ar_SY[] =
     649             : {
     650             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     651             :     NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_SY "\"", " " ),
     652             :     NUMFMT_ENDTABLE()
     653             : };
     654             : 
     655             : /** Arabic, Tunisia. */
     656             : static const BuiltinFormat spBuiltinFormats_ar_TN[] =
     657             : {
     658             :     NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
     659             :     NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_TN "\"", " " ),
     660             :     NUMFMT_ENDTABLE()
     661             : };
     662             : 
     663             : /** Arabic, Yemen. */
     664             : static const BuiltinFormat spBuiltinFormats_ar_YE[] =
     665             : {
     666             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     667             :     NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_AR_YE "\"", " " ),
     668             :     NUMFMT_ENDTABLE()
     669             : };
     670             : 
     671             : /** Belarusian, Belarus. */
     672             : static const BuiltinFormat spBuiltinFormats_be_BY[] =
     673             : {
     674             :     // space character is group separator, literal spaces must be quoted
     675             :     NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
     676             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"" UTF8_CYR_R_LC ".\"", "_" UTF8_CYR_R_LC "_.", "\\ " ),
     677             :     NUMFMT_ENDTABLE()
     678             : };
     679             : 
     680             : /** Bulgarian, Bulgaria. */
     681             : static const BuiltinFormat spBuiltinFormats_bg_BG[] =
     682             : {
     683             :     // space character is group separator, literal spaces must be quoted
     684             :     NUMFMT_ALLDATETIMES( "DD.M.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
     685             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"" UTF8_CYR_L_LC UTF8_CYR_W_LC "\"", "_" UTF8_CYR_L_LC "_" UTF8_CYR_W_LC, "\\ " ),
     686             :     NUMFMT_ENDTABLE()
     687             : };
     688             : 
     689             : /** Bengali, India. */
     690             : static const BuiltinFormat spBuiltinFormats_bn_IN[] =
     691             : {
     692             :     NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
     693             :     NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"" UTF8_CURR_BN_IN "\"", " " ),
     694             :     NUMFMT_ENDTABLE()
     695             : };
     696             : 
     697             : /** Czech, Czech Republic. */
     698             : static const BuiltinFormat spBuiltinFormats_cs_CZ[] =
     699             : {
     700             :     // space character is group separator, literal spaces must be quoted
     701             :     NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
     702             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"K" UTF8_CCARON_LC "\"", "_K_" UTF8_CCARON_LC, "\\ " ),
     703             :     NUMFMT_ENDTABLE()
     704             : };
     705             : 
     706             : /** Danish, Denmark. */
     707             : static const BuiltinFormat spBuiltinFormats_da_DK[] =
     708             : {
     709             :     NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
     710             :     NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"kr\"", " " ),
     711             :     NUMFMT_ENDTABLE()
     712             : };
     713             : 
     714             : /** German, Austria. */
     715             : static const BuiltinFormat spBuiltinFormats_de_AT[] =
     716             : {
     717             :     NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
     718             :     NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( UTF8_EURO, " " ),
     719             :     NUMFMT_ENDTABLE()
     720             : };
     721             : 
     722             : /** German, Switzerland. */
     723             : static const BuiltinFormat spBuiltinFormats_de_CH[] =
     724             : {
     725             :     NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ". ", "MMM", " ", "YY", "h", "hh" ),
     726             :     NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"SFr.\"", " " ),
     727             :     NUMFMT_ENDTABLE()
     728             : };
     729             : 
     730             : /** German, Germany. */
     731             : static const BuiltinFormat spBuiltinFormats_de_DE[] =
     732             : {
     733             :     NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ". ", "MMM", " ", "YY", "h", "hh" ),
     734             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, " " ),
     735             :     NUMFMT_ENDTABLE()
     736             : };
     737             : 
     738             : /** German, Liechtenstein. */
     739             : static const BuiltinFormat spBuiltinFormats_de_LI[] =
     740             : {
     741             :     NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ". ", "MMM", " ", "YY", "h", "hh" ),
     742             :     NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"CHF\"", " " ),
     743             :     NUMFMT_ENDTABLE()
     744             : };
     745             : 
     746             : /** German, Luxembourg. */
     747             : static const BuiltinFormat spBuiltinFormats_de_LU[] =
     748             : {
     749             :     NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
     750             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, " " ),
     751             :     NUMFMT_ENDTABLE()
     752             : };
     753             : 
     754             : /** Divehi, Maldives. */
     755             : static const BuiltinFormat spBuiltinFormats_div_MV[] =
     756             : {
     757             :     NUMFMT_ALLDATETIMES( "DD/MM/YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
     758             :     NUMFMT_ALLCURRENCIES_NUMBER_SYMBOL_MINUS( "\"" UTF8_RUFIYAA ".\"", "_" UTF8_RUFIYAA "_.", " " ),
     759             :     NUMFMT_ENDTABLE()
     760             : };
     761             : 
     762             : /** Greek, Greece. */
     763             : static const BuiltinFormat spBuiltinFormats_el_GR[] =
     764             : {
     765             :     NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
     766             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, " " ),
     767             :     NUMFMT_ENDTABLE()
     768             : };
     769             : 
     770             : /** English, Australia. */
     771             : static const BuiltinFormat spBuiltinFormats_en_AU[] =
     772             : {
     773             :     NUMFMT_ALLDATETIMES( "D/MM/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
     774             :     NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "$", "" ),
     775             :     NUMFMT_ENDTABLE()
     776             : };
     777             : 
     778             : /** English, Belize. */
     779             : static const BuiltinFormat spBuiltinFormats_en_BZ[] =
     780             : {
     781             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     782             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"BZ$\"", "" ),
     783             :     NUMFMT_ENDTABLE()
     784             : };
     785             : 
     786             : /** English, Canada. */
     787             : static const BuiltinFormat spBuiltinFormats_en_CA[] =
     788             : {
     789             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
     790             :     NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "$", "" ),
     791             :     NUMFMT_ENDTABLE()
     792             : };
     793             : 
     794             : /** English, Caribbean. */
     795             : static const BuiltinFormat spBuiltinFormats_en_CB[] =
     796             : {
     797             :     NUMFMT_ALLDATETIMES( "MM/DD/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
     798             :     NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "$", "" ),
     799             :     NUMFMT_ENDTABLE()
     800             : };
     801             : 
     802             : /** English, United Kingdom. */
     803             : static const BuiltinFormat spBuiltinFormats_en_GB[] =
     804             : {
     805             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
     806             :     NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( UTF8_POUND_GB, "" ),
     807             :     NUMFMT_ENDTABLE()
     808             : };
     809             : 
     810             : /** English, Ireland. */
     811             : static const BuiltinFormat spBuiltinFormats_en_IE[] =
     812             : {
     813             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
     814             :     NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( UTF8_EURO, "" ),
     815             :     NUMFMT_ENDTABLE()
     816             : };
     817             : 
     818             : /** English, Jamaica. */
     819             : static const BuiltinFormat spBuiltinFormats_en_JM[] =
     820             : {
     821             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     822             :     NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "\"J$\"", "" ),
     823             :     NUMFMT_ENDTABLE()
     824             : };
     825             : 
     826             : /** English, New Zealand. */
     827             : static const BuiltinFormat spBuiltinFormats_en_NZ[] =
     828             : {
     829             :     NUMFMT_ALLDATETIMES( "D/MM/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
     830             :     NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "$", "" ),
     831             :     NUMFMT_ENDTABLE()
     832             : };
     833             : 
     834             : /** English, Philippines. */
     835             : static const BuiltinFormat spBuiltinFormats_en_PH[] =
     836             : {
     837             :     NUMFMT_ALLDATETIMES( "M/D/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
     838             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"Php\"", "" ),
     839             :     NUMFMT_ENDTABLE()
     840             : };
     841             : 
     842             : /** English, Trinidad and Tobago. */
     843             : static const BuiltinFormat spBuiltinFormats_en_TT[] =
     844             : {
     845             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     846             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"TT$\"", "" ),
     847             :     NUMFMT_ENDTABLE()
     848             : };
     849             : 
     850             : /** English, USA. */
     851             : static const BuiltinFormat spBuiltinFormats_en_US[] =
     852             : {
     853             :     NUMFMT_ALLDATETIMES( "M/D/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
     854             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "$", "" ),
     855             :     NUMFMT_ENDTABLE()
     856             : };
     857             : 
     858             : /** English, South Africa. */
     859             : static const BuiltinFormat spBuiltinFormats_en_ZA[] =
     860             : {
     861             :     NUMFMT_ALLDATETIMES( "YYYY/MM/DD", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     862             :     NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\\R", " " ),
     863             :     NUMFMT_ENDTABLE()
     864             : };
     865             : 
     866             : /** English, Zimbabwe. */
     867             : static const BuiltinFormat spBuiltinFormats_en_ZW[] =
     868             : {
     869             :     NUMFMT_ALLDATETIMES( "M/D/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
     870             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"Z$\"", "" ),
     871             :     NUMFMT_ENDTABLE()
     872             : };
     873             : 
     874             : /** Spanish, Argentina. */
     875             : static const BuiltinFormat spBuiltinFormats_es_AR[] =
     876             : {
     877             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     878             :     NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "$", " " ),
     879             :     NUMFMT_ENDTABLE()
     880             : };
     881             : 
     882             : /** Spanish, Bolivia. */
     883             : static const BuiltinFormat spBuiltinFormats_es_BO[] =
     884             : {
     885             :     // slashes must be quoted to prevent conversion to minus
     886             :     NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     887             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"$b\"", " " ),
     888             :     NUMFMT_ENDTABLE()
     889             : };
     890             : 
     891             : /** Spanish, Chile. */
     892             : static const BuiltinFormat spBuiltinFormats_es_CL[] =
     893             : {
     894             :     NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
     895             :     NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "$", " " ),
     896             :     NUMFMT_ENDTABLE()
     897             : };
     898             : 
     899             : /** Spanish, Colombia. */
     900             : static const BuiltinFormat spBuiltinFormats_es_CO[] =
     901             : {
     902             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     903             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "$", " " ),
     904             :     NUMFMT_ENDTABLE()
     905             : };
     906             : 
     907             : /** Spanish, Costa Rica. */
     908             : static const BuiltinFormat spBuiltinFormats_es_CR[] =
     909             : {
     910             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     911             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( UTF8_COLON, "" ),
     912             :     NUMFMT_ENDTABLE()
     913             : };
     914             : 
     915             : /** Spanish, Dominican Republic. */
     916             : static const BuiltinFormat spBuiltinFormats_es_DO[] =
     917             : {
     918             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     919             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"RD$\"", "" ),
     920             :     NUMFMT_ENDTABLE()
     921             : };
     922             : 
     923             : /** Spanish, Ecuador. */
     924             : static const BuiltinFormat spBuiltinFormats_es_EC[] =
     925             : {
     926             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
     927             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "$", " " ),
     928             :     NUMFMT_ENDTABLE()
     929             : };
     930             : 
     931             : /** Spanish, Spain. */
     932             : static const BuiltinFormat spBuiltinFormats_es_ES[] =
     933             : {
     934             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
     935             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, " " ),
     936             :     NUMFMT_ENDTABLE()
     937             : };
     938             : 
     939             : /** Spanish, Guatemala. */
     940             : static const BuiltinFormat spBuiltinFormats_es_GT[] =
     941             : {
     942             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     943             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\\Q", "" ),
     944             :     NUMFMT_ENDTABLE()
     945             : };
     946             : 
     947             : /** Spanish, Honduras. */
     948             : static const BuiltinFormat spBuiltinFormats_es_HN[] =
     949             : {
     950             :     // slashes must be quoted to prevent conversion to minus
     951             :     NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     952             :     NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"L.\"", " " ),
     953             :     NUMFMT_ENDTABLE()
     954             : };
     955             : 
     956             : /** Spanish, Mexico. */
     957             : static const BuiltinFormat spBuiltinFormats_es_MX[] =
     958             : {
     959             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     960             :     NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "$", "" ),
     961             :     NUMFMT_ENDTABLE()
     962             : };
     963             : 
     964             : /** Spanish, Nicaragua. */
     965             : static const BuiltinFormat spBuiltinFormats_es_NI[] =
     966             : {
     967             :     // slashes must be quoted to prevent conversion to minus
     968             :     NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     969             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"C$\"", " " ),
     970             :     NUMFMT_ENDTABLE()
     971             : };
     972             : 
     973             : /** Spanish, Panama. */
     974             : static const BuiltinFormat spBuiltinFormats_es_PA[] =
     975             : {
     976             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     977             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"B/.\"", " " ),
     978             :     NUMFMT_ENDTABLE()
     979             : };
     980             : 
     981             : /** Spanish, Peru. */
     982             : static const BuiltinFormat spBuiltinFormats_es_PE[] =
     983             : {
     984             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     985             :     NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"S/.\"", " " ),
     986             :     NUMFMT_ENDTABLE()
     987             : };
     988             : 
     989             : /** Spanish, Puerto Rico. */
     990             : static const BuiltinFormat spBuiltinFormats_es_PR[] =
     991             : {
     992             :     // slashes must be quoted to prevent conversion to minus
     993             :     NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
     994             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "$", " " ),
     995             :     NUMFMT_ENDTABLE()
     996             : };
     997             : 
     998             : /** Spanish, Paraguay. */
     999             : static const BuiltinFormat spBuiltinFormats_es_PY[] =
    1000             : {
    1001             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
    1002             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"Gs\"", " " ),
    1003             :     NUMFMT_ENDTABLE()
    1004             : };
    1005             : 
    1006             : /** Spanish, El Salvador. */
    1007             : static const BuiltinFormat spBuiltinFormats_es_SV[] =
    1008             : {
    1009             :     // slashes must be quoted to prevent conversion to minus
    1010             :     NUMFMT_ALLDATETIMES( "DD\\/MM\\/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
    1011             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "$", "" ),
    1012             :     NUMFMT_ENDTABLE()
    1013             : };
    1014             : 
    1015             : /** Spanish, Uruguay. */
    1016             : static const BuiltinFormat spBuiltinFormats_es_UY[] =
    1017             : {
    1018             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
    1019             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"$U\"", " " ),
    1020             :     NUMFMT_ENDTABLE()
    1021             : };
    1022             : 
    1023             : /** Spanish, Venezuela. */
    1024             : static const BuiltinFormat spBuiltinFormats_es_VE[] =
    1025             : {
    1026             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
    1027             :     NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "Bs", " " ),
    1028             :     NUMFMT_ENDTABLE()
    1029             : };
    1030             : 
    1031             : /** Estonian, Estonia. */
    1032             : static const BuiltinFormat spBuiltinFormats_et_EE[] =
    1033             : {
    1034             :     // space character is group separator, literal spaces must be quoted
    1035             :     NUMFMT_ALLDATETIMES( "D.MM.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
    1036             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"kr\"", "_k_r", "\\ " ),
    1037             :     NUMFMT_ENDTABLE()
    1038             : };
    1039             : 
    1040             : /** Farsi, Iran. */
    1041             : static const BuiltinFormat spBuiltinFormats_fa_IR[] =
    1042             : {
    1043             :     NUMFMT_ALLDATETIMES( "YYYY/MM/DD", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
    1044             :     NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"" UTF8_CURR_FA_IR "\"", " " ),
    1045             :     NUMFMT_ENDTABLE()
    1046             : };
    1047             : 
    1048             : /** Finnish, Finland. */
    1049             : static const BuiltinFormat spBuiltinFormats_fi_FI[] =
    1050             : {
    1051             :     // space character is group separator, literal spaces must be quoted
    1052             :     NUMFMT_STRING(  9, "0\\ %" ),
    1053             :     NUMFMT_STRING( 10, "0.00\\ %" ),
    1054             :     NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
    1055             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, "\\ " ),
    1056             :     NUMFMT_ENDTABLE()
    1057             : };
    1058             : 
    1059             : /** Faroese, Faroe Islands. */
    1060             : static const BuiltinFormat spBuiltinFormats_fo_FO[] =
    1061             : {
    1062             :     NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
    1063             :     NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"kr\"", " " ),
    1064             :     NUMFMT_ENDTABLE()
    1065             : };
    1066             : 
    1067             : /** French, Belgium. */
    1068             : static const BuiltinFormat spBuiltinFormats_fr_BE[] =
    1069             : {
    1070             :     NUMFMT_ALLDATETIMES( "D/MM/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
    1071             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, " " ),
    1072             :     NUMFMT_ENDTABLE()
    1073             : };
    1074             : 
    1075             : /** French, Canada. */
    1076             : static const BuiltinFormat spBuiltinFormats_fr_CA[] =
    1077             : {
    1078             :     // space character is group separator, literal spaces must be quoted
    1079             :     NUMFMT_ALLDATETIMES( "YYYY-MM-DD", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
    1080             :     NUMFMT_ALLCURRENCIES_OPEN_NUMBER_SYMBOL_CLOSE( "$", "_$", "\\ " ),
    1081             :     NUMFMT_ENDTABLE()
    1082             : };
    1083             : 
    1084             : /** French, Switzerland. */
    1085             : static const BuiltinFormat spBuiltinFormats_fr_CH[] =
    1086             : {
    1087             :     NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
    1088             :     NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"SFr.\"", " " ),
    1089             :     NUMFMT_ENDTABLE()
    1090             : };
    1091             : 
    1092             : /** French, France. */
    1093             : static const BuiltinFormat spBuiltinFormats_fr_FR[] =
    1094             : {
    1095             :     // space character is group separator, literal spaces must be quoted
    1096             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
    1097             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, "\\ " ),
    1098             :     NUMFMT_ENDTABLE()
    1099             : };
    1100             : 
    1101             : /** French, Luxembourg. */
    1102             : static const BuiltinFormat spBuiltinFormats_fr_LU[] =
    1103             : {
    1104             :     // space character is group separator, literal spaces must be quoted
    1105             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
    1106             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, "\\ " ),
    1107             :     NUMFMT_ENDTABLE()
    1108             : };
    1109             : 
    1110             : /** French, Monaco. */
    1111             : static const BuiltinFormat spBuiltinFormats_fr_MC[] =
    1112             : {
    1113             :     // space character is group separator, literal spaces must be quoted
    1114             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
    1115             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, "\\ " ),
    1116             :     NUMFMT_ENDTABLE()
    1117             : };
    1118             : 
    1119             : /** Galizian, Spain. */
    1120             : static const BuiltinFormat spBuiltinFormats_gl_ES[] =
    1121             : {
    1122             :     NUMFMT_ALLDATETIMES( "DD/MM/YY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
    1123             :     NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( UTF8_EURO, " " ),
    1124             :     NUMFMT_ENDTABLE()
    1125             : };
    1126             : 
    1127             : /** Gujarati, India. */
    1128             : static const BuiltinFormat spBuiltinFormats_gu_IN[] =
    1129             : {
    1130             :     NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
    1131             :     NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"" UTF8_CURR_GU_IN "\"", " " ),
    1132             :     NUMFMT_ENDTABLE()
    1133             : };
    1134             : 
    1135             : /** Hebrew, Israel. */
    1136             : static const BuiltinFormat spBuiltinFormats_he_IL[] =
    1137             : {
    1138             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
    1139             :     NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( UTF8_SHEQEL, " " ),
    1140             :     NUMFMT_ENDTABLE()
    1141             : };
    1142             : 
    1143             : /** Hindi, India. */
    1144             : static const BuiltinFormat spBuiltinFormats_hi_IN[] =
    1145             : {
    1146             :     NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
    1147             :     NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"" UTF8_CURR_HI_IN "\"", " " ),
    1148             :     NUMFMT_ENDTABLE()
    1149             : };
    1150             : 
    1151             : /** Croatian, Bosnia and Herzegowina. */
    1152             : static const BuiltinFormat spBuiltinFormats_hr_BA[] =
    1153             : {
    1154             :     NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
    1155             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"KM\"", "_K_M", " " ),
    1156             :     NUMFMT_ENDTABLE()
    1157             : };
    1158             : 
    1159             : /** Croatian, Croatia. */
    1160             : static const BuiltinFormat spBuiltinFormats_hr_HR[] =
    1161             : {
    1162             :     NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
    1163             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"kn\"", "_k_n", " " ),
    1164             :     NUMFMT_ENDTABLE()
    1165             : };
    1166             : 
    1167             : /** Hungarian, Hungary. */
    1168             : static const BuiltinFormat spBuiltinFormats_hu_HU[] =
    1169             : {
    1170             :     // space character is group separator, literal spaces must be quoted
    1171             :     // MMM is rendered differently in Calc and Excel (see #i41488#)
    1172             :     NUMFMT_ALLDATETIMES( "YYYY.MM.DD", "DD", ".", "MMM", ".", "YY", "h", "h" ),
    1173             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"Ft\"", "_F_t", "\\ " ),
    1174             :     NUMFMT_ENDTABLE()
    1175             : };
    1176             : 
    1177             : /** Armenian, Armenia. */
    1178             : static const BuiltinFormat spBuiltinFormats_hy_AM[] =
    1179             : {
    1180             :     NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
    1181             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"" UTF8_HY_DA_LC UTF8_HY_REH_LC ".\"", "_" UTF8_HY_DA_LC "_" UTF8_HY_REH_LC "_.", " " ),
    1182             :     NUMFMT_ENDTABLE()
    1183             : };
    1184             : 
    1185             : /** Indonesian, Indonesia. */
    1186             : static const BuiltinFormat spBuiltinFormats_id_ID[] =
    1187             : {
    1188             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
    1189             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"Rp\"", "" ),
    1190             :     NUMFMT_ENDTABLE()
    1191             : };
    1192             : 
    1193             : /** Icelandic, Iceland. */
    1194             : static const BuiltinFormat spBuiltinFormats_is_IS[] =
    1195             : {
    1196             :     NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "hh" ),
    1197             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"kr.\"", "_k_r_.", " " ),
    1198             :     NUMFMT_ENDTABLE()
    1199             : };
    1200             : 
    1201             : /** Italian, Switzerland. */
    1202             : static const BuiltinFormat spBuiltinFormats_it_CH[] =
    1203             : {
    1204             :     NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
    1205             :     NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"SFr.\"", " " ),
    1206             :     NUMFMT_ENDTABLE()
    1207             : };
    1208             : 
    1209             : /** Italian, Italy. */
    1210             : static const BuiltinFormat spBuiltinFormats_it_IT[] =
    1211             : {
    1212             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
    1213             :     NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( UTF8_EURO, " " ),
    1214             :     NUMFMT_ENDTABLE()
    1215             : };
    1216             : 
    1217             : /** Georgian, Georgia. */
    1218             : static const BuiltinFormat spBuiltinFormats_ka_GE[] =
    1219             : {
    1220             :     // space character is group separator, literal spaces must be quoted
    1221             :     NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
    1222             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"Lari\"", "_L_a_r_i", "\\ " ),
    1223             :     NUMFMT_ENDTABLE()
    1224             : };
    1225             : 
    1226             : /** Kazakh, Kazakhstan. */
    1227             : static const BuiltinFormat spBuiltinFormats_kk_KZ[] =
    1228             : {
    1229             :     // space character is group separator, literal spaces must be quoted
    1230             :     NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
    1231             :     NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "\\T", "" ),
    1232             :     NUMFMT_ENDTABLE()
    1233             : };
    1234             : 
    1235             : /** Kannada, India. */
    1236             : static const BuiltinFormat spBuiltinFormats_kn_IN[] =
    1237             : {
    1238             :     NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
    1239             :     NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"" UTF8_CURR_KN_IN "\"", " " ),
    1240             :     NUMFMT_ENDTABLE()
    1241             : };
    1242             : 
    1243             : /** Kyrgyz, Kyrgyzstan. */
    1244             : static const BuiltinFormat spBuiltinFormats_ky_KG[] =
    1245             : {
    1246             :     // space character is group separator, literal spaces must be quoted
    1247             :     NUMFMT_ALLDATETIMES( "DD.MM.YY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
    1248             :     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, "\\ " ),
    1249             :     NUMFMT_ENDTABLE()
    1250             : };
    1251             : 
    1252             : /** Lithuanian, Lithuania. */
    1253             : static const BuiltinFormat spBuiltinFormats_lt_LT[] =
    1254             : {
    1255             :     NUMFMT_ALLDATETIMES( "YYYY.MM.DD", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
    1256             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"Lt\"", "_L_t", " " ),
    1257             :     NUMFMT_ENDTABLE()
    1258             : };
    1259             : 
    1260             : /** Latvian, Latvia. */
    1261             : static const BuiltinFormat spBuiltinFormats_lv_LV[] =
    1262             : {
    1263             :     // space character is group separator, literal spaces must be quoted
    1264             :     NUMFMT_ALLDATETIMES( "YYYY.MM.DD", "DD", ".", "MMM", ".", "YY", "h", "h" ),
    1265             :     NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "\"Ls\"", "\\ " ),
    1266             :     NUMFMT_ENDTABLE()
    1267             : };
    1268             : 
    1269             : /** Malayalam, India. */
    1270             : static const BuiltinFormat spBuiltinFormats_ml_IN[] =
    1271             : {
    1272             :     NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
    1273             :     NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"" UTF8_CURR_ML_IN "\"", " " ),
    1274             :     NUMFMT_ENDTABLE()
    1275             : };
    1276             : 
    1277             : /** Mongolian, Mongolia. */
    1278             : static const BuiltinFormat spBuiltinFormats_mn_MN[] =
    1279             : {
    1280             :     NUMFMT_ALLDATETIMES( "YY.MM.DD", "DD", ".", "MMM", ".", "YY", "h", "h" ),
    1281             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_TUGRUG, "_" UTF8_TUGRUG, "" ),
    1282             :     NUMFMT_ENDTABLE()
    1283             : };
    1284             : 
    1285             : /** Malay, Brunei Darussalam. */
    1286             : static const BuiltinFormat spBuiltinFormats_ms_BN[] =
    1287             : {
    1288             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
    1289             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "$", "" ),
    1290             :     NUMFMT_ENDTABLE()
    1291             : };
    1292             : 
    1293             : /** Malay, Malaysia. */
    1294             : static const BuiltinFormat spBuiltinFormats_ms_MY[] =
    1295             : {
    1296             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
    1297             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\\R", "" ),
    1298             :     NUMFMT_ENDTABLE()
    1299             : };
    1300             : 
    1301             : /** Maltese, Malta. */
    1302             : static const BuiltinFormat spBuiltinFormats_mt_MT[] =
    1303             : {
    1304             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
    1305             :     NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "\"Lm\"", "" ),
    1306             :     NUMFMT_ENDTABLE()
    1307             : };
    1308             : 
    1309             : /** Dutch, Belgium. */
    1310             : static const BuiltinFormat spBuiltinFormats_nl_BE[] =
    1311             : {
    1312             :     // slashes must be quoted to prevent conversion to minus
    1313             :     NUMFMT_ALLDATETIMES( "D\\/MM\\/YYYY", "D", "\\/", "MMM", "\\/", "YY", "h", "h" ),
    1314             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, " " ),
    1315             :     NUMFMT_ENDTABLE()
    1316             : };
    1317             : 
    1318             : /** Dutch, Netherlands. */
    1319             : static const BuiltinFormat spBuiltinFormats_nl_NL[] =
    1320             : {
    1321             :     NUMFMT_ALLDATETIMES( "D-M-YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
    1322             :     NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( UTF8_EURO, " " ),
    1323             :     NUMFMT_ENDTABLE()
    1324             : };
    1325             : 
    1326             : /** Norwegian (Bokmal and Nynorsk), Norway. */
    1327             : static const BuiltinFormat spBuiltinFormats_no_NO[] =
    1328             : {
    1329             :     // space character is group separator, literal spaces must be quoted
    1330             :     NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
    1331             :     NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"kr\"", "\\ " ),
    1332             :     NUMFMT_ENDTABLE()
    1333             : };
    1334             : 
    1335             : /** Punjabi, India. */
    1336             : static const BuiltinFormat spBuiltinFormats_pa_IN[] =
    1337             : {
    1338             :     NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "hh", "hh" ),
    1339             :     NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"" UTF8_CURR_PA_IN "\"", " " ),
    1340             :     NUMFMT_ENDTABLE()
    1341             : };
    1342             : 
    1343             : /** Polish, Poland. */
    1344             : static const BuiltinFormat spBuiltinFormats_pl_PL[] =
    1345             : {
    1346             :     // space character is group separator, literal spaces must be quoted
    1347             :     // MMM is rendered differently in Calc and Excel (see #i72300#)
    1348             :     NUMFMT_ALLDATETIMES( "YYYY-MM-DD", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
    1349             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"z" UTF8_LSTROKE_LC "\"", "_z_" UTF8_LSTROKE_LC, "\\ " ),
    1350             :     NUMFMT_ENDTABLE()
    1351             : };
    1352             : 
    1353             : /** Portugese, Brazil. */
    1354             : static const BuiltinFormat spBuiltinFormats_pt_BR[] =
    1355             : {
    1356             :     NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "/", "MMM", "/", "YY", "h", "hh" ),
    1357             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"R$\"", " " ),
    1358             :     NUMFMT_ENDTABLE()
    1359             : };
    1360             : 
    1361             : /** Portugese, Portugal. */
    1362             : static const BuiltinFormat spBuiltinFormats_pt_PT[] =
    1363             : {
    1364             :     NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
    1365             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, " " ),
    1366             :     NUMFMT_ENDTABLE()
    1367             : };
    1368             : 
    1369             : /** Romanian, Romania. */
    1370             : static const BuiltinFormat spBuiltinFormats_ro_RO[] =
    1371             : {
    1372             :     // space character is group separator, literal spaces must be quoted (but see #i75367#)
    1373             :     NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
    1374             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"lei\"", "_l_e_i", "\\ " ),
    1375             :     NUMFMT_ENDTABLE()
    1376             : };
    1377             : 
    1378             : /** Russian, Russian Federation. */
    1379             : static const BuiltinFormat spBuiltinFormats_ru_RU[] =
    1380             : {
    1381             :     // space character is group separator, literal spaces must be quoted
    1382             :     NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
    1383             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"" UTF8_CYR_R_LC ".\"", "_" UTF8_CYR_R_LC "_.", "" ),
    1384             :     NUMFMT_ENDTABLE()
    1385             : };
    1386             : 
    1387             : /** Slovak, Slovakia. */
    1388             : static const BuiltinFormat spBuiltinFormats_sk_SK[] =
    1389             : {
    1390             :     // space character is group separator, literal spaces must be quoted
    1391             :     NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
    1392             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"Sk\"", "_S_k", "\\ " ),
    1393             :     NUMFMT_ENDTABLE()
    1394             : };
    1395             : 
    1396             : /** Slovenian, Slovenia. */
    1397             : static const BuiltinFormat spBuiltinFormats_sl_SI[] =
    1398             : {
    1399             :     NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "h" ),
    1400             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"SIT\"", "_S_I_T", " " ),
    1401             :     NUMFMT_ENDTABLE()
    1402             : };
    1403             : 
    1404             : /** Swedish, Finland. */
    1405             : static const BuiltinFormat spBuiltinFormats_sv_FI[] =
    1406             : {
    1407             :     // space character is group separator, literal spaces must be quoted
    1408             :     NUMFMT_STRING(  9, "0\\ %" ),
    1409             :     NUMFMT_STRING( 10, "0.00\\ %" ),
    1410             :     NUMFMT_ALLDATETIMES( "D.M.YYYY", "D", ".", "MMM", ".", "YY", "h", "hh" ),
    1411             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_EURO, "_" UTF8_EURO, "\\ " ),
    1412             :     NUMFMT_ENDTABLE()
    1413             : };
    1414             : 
    1415             : /** Swedish, Sweden. */
    1416             : static const BuiltinFormat spBuiltinFormats_sv_SE[] =
    1417             : {
    1418             :     // space character is group separator, literal spaces must be quoted
    1419             :     NUMFMT_ALLDATETIMES( "YYYY-MM-DD", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
    1420             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"kr\"", "_k_r", "\\ " ),
    1421             :     NUMFMT_ENDTABLE()
    1422             : };
    1423             : 
    1424             : /** Swahili, Tanzania. */
    1425             : static const BuiltinFormat spBuiltinFormats_sw_TZ[] =
    1426             : {
    1427             :     NUMFMT_ALLDATETIMES( "M/D/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
    1428             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\\S", "" ),
    1429             :     NUMFMT_ENDTABLE()
    1430             : };
    1431             : 
    1432             : /** Tamil, India. */
    1433             : static const BuiltinFormat spBuiltinFormats_ta_IN[] =
    1434             : {
    1435             :     NUMFMT_ALLDATETIMES( "DD-MM-YYYY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
    1436             :     NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"" UTF8_CURR_TA_IN "\"", " " ),
    1437             :     NUMFMT_ENDTABLE()
    1438             : };
    1439             : 
    1440             : /** Telugu, India. */
    1441             : static const BuiltinFormat spBuiltinFormats_te_IN[] =
    1442             : {
    1443             :     NUMFMT_ALLDATETIMES( "DD-MM-YY", "DD", "-", "MMM", "-", "YY", "h", "hh" ),
    1444             :     NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( "\"" UTF8_CURR_TE_IN "\"", " " ),
    1445             :     NUMFMT_ENDTABLE()
    1446             : };
    1447             : 
    1448             : /** Thai, Thailand. */
    1449             : static const BuiltinFormat spBuiltinFormats_th_TH[] =
    1450             : {
    1451             :     NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
    1452             :     NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( UTF8_BAHT, "" ),
    1453             :     NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 63, UTF8_BAHT, "", "t" ),
    1454             :     NUMFMT_STRING( 59, "t0" ),
    1455             :     NUMFMT_STRING( 60, "t0.00" ),
    1456             :     NUMFMT_STRING( 61, "t#,##0" ),
    1457             :     NUMFMT_STRING( 62, "t#,##0.00" ),
    1458             :     NUMFMT_STRING( 67, "t0%" ),
    1459             :     NUMFMT_STRING( 68, "t0.00%" ),
    1460             :     NUMFMT_STRING( 69, "t# ?/?" ),
    1461             :     NUMFMT_STRING( 70, "t# ?\?/?\?" ),
    1462             :     NUMFMT_STRING( 71, "tD/M/EE" ),
    1463             :     NUMFMT_STRING( 72, "tD-MMM-E" ),
    1464             :     NUMFMT_STRING( 73, "tD-MMM" ),
    1465             :     NUMFMT_STRING( 74, "tMMM-E" ),
    1466             :     NUMFMT_STRING( 75, "th:mm" ),
    1467             :     NUMFMT_STRING( 76, "th:mm:ss" ),
    1468             :     NUMFMT_STRING( 77, "tD/M/EE h:mm" ),
    1469             :     NUMFMT_STRING( 78, "tmm:ss" ),
    1470             :     NUMFMT_STRING( 79, "t[h]:mm:ss" ),
    1471             :     NUMFMT_STRING( 80, "tmm:ss.0" ),
    1472             :     NUMFMT_STRING( 81, "D/M/E" ),
    1473             :     NUMFMT_ENDTABLE()
    1474             : };
    1475             : 
    1476             : /** Turkish, Turkey. */
    1477             : static const BuiltinFormat spBuiltinFormats_tr_TR[] =
    1478             : {
    1479             :     NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "hh" ),
    1480             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"TL\"", "_T_L", " " ),
    1481             :     NUMFMT_ENDTABLE()
    1482             : };
    1483             : 
    1484             : /** Tatar, Russian Federation. */
    1485             : static const BuiltinFormat spBuiltinFormats_tt_RU[] =
    1486             : {
    1487             :     // space character is group separator, literal spaces must be quoted
    1488             :     NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
    1489             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( "\"" UTF8_CYR_R_LC ".\"", "_" UTF8_CYR_R_LC "_.", "\\ " ),
    1490             :     NUMFMT_ENDTABLE()
    1491             : };
    1492             : 
    1493             : /** Ukrainian, Ukraine. */
    1494             : static const BuiltinFormat spBuiltinFormats_uk_UA[] =
    1495             : {
    1496             :     // space character is group separator, literal spaces must be quoted
    1497             :     NUMFMT_ALLDATETIMES( "DD.MM.YYYY", "DD", ".", "MMM", ".", "YY", "h", "h" ),
    1498             :     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 "_.", "\\ " ),
    1499             :     NUMFMT_ENDTABLE()
    1500             : };
    1501             : 
    1502             : /** Urdu, Pakistan. */
    1503             : static const BuiltinFormat spBuiltinFormats_ur_PK[] =
    1504             : {
    1505             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
    1506             :     NUMFMT_ALLCURRENCIES_SYMBOL_NUMBER_MINUS( "\"Rs\"", "" ),
    1507             :     NUMFMT_ENDTABLE()
    1508             : };
    1509             : 
    1510             : /** Vietnamese, Viet Nam. */
    1511             : static const BuiltinFormat spBuiltinFormats_vi_VN[] =
    1512             : {
    1513             :     NUMFMT_ALLDATETIMES( "DD/MM/YYYY", "DD", "-", "MMM", "-", "YY", "h", "h" ),
    1514             :     NUMFMT_ALLCURRENCIES_MINUS_NUMBER_SYMBOL( UTF8_DONG, "_" UTF8_DONG, " " ),
    1515             :     NUMFMT_ENDTABLE()
    1516             : };
    1517             : 
    1518             : // CJK ------------------------------------------------------------------------
    1519             : 
    1520             : /** Base table for CJK locales. */
    1521             : static const BuiltinFormat spBuiltinFormats_CJK[] =
    1522             : {
    1523             :     NUMFMT_REUSE( 29, 28 ),
    1524             :     NUMFMT_REUSE( 36, 27 ),
    1525             :     NUMFMT_REUSE( 50, 27 ),
    1526             :     NUMFMT_REUSE( 51, 28 ),
    1527             :     NUMFMT_REUSE( 52, 34 ),
    1528             :     NUMFMT_REUSE( 53, 35 ),
    1529             :     NUMFMT_REUSE( 54, 28 ),
    1530             :     NUMFMT_REUSE( 55, 34 ),
    1531             :     NUMFMT_REUSE( 56, 35 ),
    1532             :     NUMFMT_REUSE( 57, 27 ),
    1533             :     NUMFMT_REUSE( 58, 28 ),
    1534             :     NUMFMT_ENDTABLE()
    1535             : };
    1536             : 
    1537             : /** Japanese, Japan. */
    1538             : static const BuiltinFormat spBuiltinFormats_ja_JP[] =
    1539             : {
    1540             :     NUMFMT_ALLDATETIMES( "YYYY/MM/DD", "DD", "-", "MMM", "-", "YY", "h", "h" ),
    1541             :     NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( UTF8_YEN_JP, "" ),
    1542             :     NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "$", "", "" ),
    1543             :     NUMFMT_STRING( 27, "[$-411]GE.MM.DD" ),
    1544             :     NUMFMT_STRING( 28, "[$-411]GGGE\"" UTF8_CJ_YEAR "\"MM\"" UTF8_CJ_MON "\"DD\"" UTF8_CJ_DAY "\"" ),
    1545             :     NUMFMT_STRING( 30, "MM/DD/YY" ),
    1546             :     NUMFMT_STRING( 31, "YYYY\"" UTF8_CJ_YEAR "\"MM\"" UTF8_CJ_MON "\"DD\"" UTF8_CJ_DAY "\"" ),
    1547             :     NUMFMT_TIME_CJK( 32, "h", UTF8_CJ_HOUR, UTF8_CJ_MIN, UTF8_CJ_SEC ),
    1548             :     NUMFMT_STRING( 34, "YYYY\"" UTF8_CJ_YEAR "\"MM\"" UTF8_CJ_MON "\"" ),
    1549             :     NUMFMT_STRING( 35, "MM\"" UTF8_CJ_MON "\"DD\"" UTF8_CJ_DAY "\"" ),
    1550             :     NUMFMT_ENDTABLE()
    1551             : };
    1552             : 
    1553             : /** Korean, South Korea. */
    1554             : static const BuiltinFormat spBuiltinFormats_ko_KR[] =
    1555             : {
    1556             :     NUMFMT_ALLDATETIMES( "YYYY-MM-DD", "DD", "-", "MMM", "-", "YY", "h", "h" ),
    1557             :     NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( UTF8_WON, "" ),
    1558             :     NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "$", "", "" ),
    1559             :     NUMFMT_STRING( 27, "YYYY" UTF8_CJ_YEAR " MM" UTF8_CJ_MON " DD" UTF8_CJ_DAY ),
    1560             :     NUMFMT_STRING( 28, "MM-DD" ),
    1561             :     NUMFMT_STRING( 30, "MM-DD-YY" ),
    1562             :     NUMFMT_STRING( 31, "YYYY" UTF8_KO_YEAR " MM" UTF8_KO_MON " DD" UTF8_KO_DAY ),
    1563             :     NUMFMT_TIME_CJK( 32, "h", UTF8_KO_HOUR, UTF8_KO_MIN, UTF8_KO_SEC ),
    1564             :     // slashes must be quoted to prevent conversion to minus
    1565             :     NUMFMT_STRING( 34, "YYYY\\/MM\\/DD" ),
    1566             :     NUMFMT_REUSE( 35, 14 ),
    1567             :     NUMFMT_ENDTABLE()
    1568             : };
    1569             : 
    1570             : /** Chinese, China. */
    1571             : static const BuiltinFormat spBuiltinFormats_zh_CN[] =
    1572             : {
    1573             :     NUMFMT_ALLDATETIMES( "YYYY-M-D", "D", "-", "MMM", "-", "YY", "h", "h" ),
    1574             :     NUMFMT_ALLCURRENCIES_SYMBOL_MINUS_NUMBER( UTF8_YEN_CN, "" ),
    1575             :     NUMFMT_ALLTIMES_CJK( "h", "h", UTF8_CS_HOUR, UTF8_CS_MIN, UTF8_CS_SEC ),
    1576             :     NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "$", "", "" ),
    1577             :     NUMFMT_STRING( 27, "YYYY\"" UTF8_CS_YEAR "\"M\"" UTF8_CS_MON "\"" ),
    1578             :     NUMFMT_STRING( 28, "M\"" UTF8_CS_MON "\"D\"" UTF8_CS_DAY "\"" ),
    1579             :     NUMFMT_STRING( 30, "M-D-YY" ),
    1580             :     NUMFMT_STRING( 31, "YYYY\"" UTF8_CS_YEAR "\"M\"" UTF8_CS_MON "\"D\"" UTF8_CS_DAY "\"" ),
    1581             :     NUMFMT_REUSE( 52, 27 ),
    1582             :     NUMFMT_REUSE( 53, 28 ),
    1583             :     NUMFMT_ENDTABLE()
    1584             : };
    1585             : 
    1586             : /** Chinese, Hong Kong. */
    1587             : static const BuiltinFormat spBuiltinFormats_zh_HK[] =
    1588             : {
    1589             :     NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
    1590             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\"HK$\"", "" ),
    1591             :     NUMFMT_ALLTIMES_CJK( "h", "h", UTF8_CJ_HOUR, UTF8_CJ_MIN, UTF8_CJ_SEC ),
    1592             :     NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "\"US$\"", "", "" ),
    1593             :     NUMFMT_STRING( 27, "[$-404]D/M/E" ),
    1594             :     NUMFMT_STRING( 28, "[$-404]D\"" UTF8_CJ_DAY "\"M\"" UTF8_CJ_MON "\"E\"" UTF8_CJ_YEAR "\"" ),
    1595             :     NUMFMT_STRING( 30, "M/D/YY" ),
    1596             :     NUMFMT_STRING( 31, "D\"" UTF8_CJ_DAY "\"M\"" UTF8_CJ_MON "\"YYYY\"" UTF8_CJ_YEAR "\"" ),
    1597             :     NUMFMT_ENDTABLE()
    1598             : };
    1599             : 
    1600             : /** Chinese, Macau. */
    1601             : static const BuiltinFormat spBuiltinFormats_zh_MO[] =
    1602             : {
    1603             :     NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
    1604             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "\\P", "" ),
    1605             :     NUMFMT_ALLTIMES_CJK( "h", "h", UTF8_CJ_HOUR, UTF8_CJ_MIN, UTF8_CJ_SEC ),
    1606             :     NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "\"US$\"", "", "" ),
    1607             :     NUMFMT_STRING( 27, "[$-404]D/M/E" ),
    1608             :     NUMFMT_STRING( 28, "[$-404]D\"" UTF8_CJ_DAY "\"M\"" UTF8_CJ_MON "\"E\"" UTF8_CJ_YEAR "\"" ),
    1609             :     NUMFMT_STRING( 30, "M/D/YY" ),
    1610             :     NUMFMT_STRING( 31, "D\"" UTF8_CJ_DAY "\"M\"" UTF8_CJ_MON "\"YYYY\"" UTF8_CJ_YEAR "\"" ),
    1611             :     NUMFMT_ENDTABLE()
    1612             : };
    1613             : 
    1614             : /** Chinese, Singapore. */
    1615             : static const BuiltinFormat spBuiltinFormats_zh_SG[] =
    1616             : {
    1617             :     NUMFMT_ALLDATETIMES( "D/M/YYYY", "D", "-", "MMM", "-", "YY", "h", "h" ),
    1618             :     NUMFMT_ALLCURRENCIES_OPEN_SYMBOL_NUMBER_CLOSE( "$", "" ),
    1619             :     NUMFMT_ALLTIMES_CJK( "h", "h", UTF8_CS_HOUR, UTF8_CS_MIN, UTF8_CS_SEC ),
    1620             :     NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "$", "", "" ),
    1621             :     NUMFMT_STRING( 27, "YYYY\"" UTF8_CS_YEAR "\"M\"" UTF8_CS_MON "\"" ),
    1622             :     NUMFMT_STRING( 28, "M\"" UTF8_CS_MON "\"D\"" UTF8_CS_DAY "\"" ),
    1623             :     NUMFMT_STRING( 30, "M/D/YY" ),
    1624             :     NUMFMT_STRING( 31, "D\"" UTF8_CS_DAY "\"M\"" UTF8_CS_MON "\"YYYY\"" UTF8_CS_YEAR "\"" ),
    1625             :     NUMFMT_ENDTABLE()
    1626             : };
    1627             : 
    1628             : /** Chinese, Taiwan. */
    1629             : static const BuiltinFormat spBuiltinFormats_zh_TW[] =
    1630             : {
    1631             :     NUMFMT_ALLDATETIMES( "YYYY/M/D", "D", "-", "MMM", "-", "YY", "hh", "hh" ),
    1632             :     NUMFMT_ALLCURRENCIES_MINUS_SYMBOL_NUMBER( "$", "" ),
    1633             :     NUMFMT_ALLTIMES_CJK( "hh", "hh", UTF8_CJ_HOUR, UTF8_CJ_MIN, UTF8_CJ_SEC ),
    1634             :     NUMFMT_CURRENCY_OPEN_SYMBOL_NUMBER_CLOSE( 23, "\"US$\"", "", "" ),
    1635             :     NUMFMT_STRING( 27, "[$-404]E/M/D" ),
    1636             :     NUMFMT_STRING( 28, "[$-404]E\"" UTF8_CJ_YEAR "\"M\"" UTF8_CJ_MON "\"D\"" UTF8_CJ_DAY "\"" ),
    1637             :     NUMFMT_STRING( 30, "M/D/YY" ),
    1638             :     NUMFMT_STRING( 31, "YYYY\"" UTF8_CJ_YEAR "\"M\"" UTF8_CJ_MON "\"D\"" UTF8_CJ_DAY "\"" ),
    1639             :     NUMFMT_ENDTABLE()
    1640             : };
    1641             : 
    1642             : // ----------------------------------------------------------------------------
    1643             : 
    1644             : /** Specifies a built-in number format table for a specific locale. */
    1645             : struct BuiltinFormatTable
    1646             : {
    1647             :     const sal_Char*     mpcLocale;          /// The locale for this table.
    1648             :     const sal_Char*     mpcParent;          /// The locale of the parent table.
    1649             :     const BuiltinFormat* mpFormats;         /// The number format table (may be 0, if equal to parent).
    1650             : };
    1651             : 
    1652             : static const BuiltinFormatTable spBuiltinFormatTables[] =
    1653             : { //  locale    parent      format table
    1654             :     { "*",      "",         spBuiltinFormats_BASE   },  // Base table
    1655             :     { "af-ZA",  "*",        spBuiltinFormats_en_ZA  },  // Afrikaans, South Africa
    1656             :     { "ar-AE",  "*",        spBuiltinFormats_ar_AE  },  // Arabic, U.A.E.
    1657             :     { "ar-BH",  "*",        spBuiltinFormats_ar_BH  },  // Arabic, Bahrain
    1658             :     { "ar-DZ",  "*",        spBuiltinFormats_ar_DZ  },  // Arabic, Algeria
    1659             :     { "ar-EG",  "*",        spBuiltinFormats_ar_EG  },  // Arabic, Egypt
    1660             :     { "ar-IQ",  "*",        spBuiltinFormats_ar_IQ  },  // Arabic, Iraq
    1661             :     { "ar-JO",  "*",        spBuiltinFormats_ar_JO  },  // Arabic, Jordan
    1662             :     { "ar-KW",  "*",        spBuiltinFormats_ar_KW  },  // Arabic, Kuwait
    1663             :     { "ar-LB",  "*",        spBuiltinFormats_ar_LB  },  // Arabic, Lebanon
    1664             :     { "ar-LY",  "*",        spBuiltinFormats_ar_LY  },  // Arabic, Libya
    1665             :     { "ar-MA",  "*",        spBuiltinFormats_ar_MA  },  // Arabic, Morocco
    1666             :     { "ar-OM",  "*",        spBuiltinFormats_ar_OM  },  // Arabic, Oman
    1667             :     { "ar-QA",  "*",        spBuiltinFormats_ar_QA  },  // Arabic, Qatar
    1668             :     { "ar-SA",  "*",        spBuiltinFormats_ar_SA  },  // Arabic, Saudi Arabia
    1669             :     { "ar-SY",  "*",        spBuiltinFormats_ar_SY  },  // Arabic, Syria
    1670             :     { "ar-TN",  "*",        spBuiltinFormats_ar_TN  },  // Arabic, Tunisia
    1671             :     { "ar-YE",  "*",        spBuiltinFormats_ar_YE  },  // Arabic, Yemen
    1672             :     { "be-BY",  "*",        spBuiltinFormats_be_BY  },  // Belarusian, Belarus
    1673             :     { "bg-BG",  "*",        spBuiltinFormats_bg_BG  },  // Bulgarian, Bulgaria
    1674             :     { "bn-IN",  "*",        spBuiltinFormats_bn_IN  },  // Bengali, India
    1675             :     { "ca-ES",  "*",        spBuiltinFormats_es_ES  },  // Catalan, Spain
    1676             :     { "cs-CZ",  "*",        spBuiltinFormats_cs_CZ  },  // Czech, Czech Republic
    1677             :     { "cy-GB",  "*",        spBuiltinFormats_en_GB  },  // Welsh, United Kingdom
    1678             :     { "da-DK",  "*",        spBuiltinFormats_da_DK  },  // Danish, Denmark
    1679             :     { "de-AT",  "*",        spBuiltinFormats_de_AT  },  // German, Austria
    1680             :     { "de-CH",  "*",        spBuiltinFormats_de_CH  },  // German, Switzerland
    1681             :     { "de-DE",  "*",        spBuiltinFormats_de_DE  },  // German, Germany
    1682             :     { "de-LI",  "*",        spBuiltinFormats_de_LI  },  // German, Liechtenstein
    1683             :     { "de-LU",  "*",        spBuiltinFormats_de_LU  },  // German, Luxembourg
    1684             :     { "div-MV", "*",        spBuiltinFormats_div_MV },  // Divehi, Maldives
    1685             :     { "el-GR",  "*",        spBuiltinFormats_el_GR  },  // Greek, Greece
    1686             :     { "en-AU",  "*",        spBuiltinFormats_en_AU  },  // English, Australia
    1687             :     { "en-BZ",  "*",        spBuiltinFormats_en_BZ  },  // English, Belize
    1688             :     { "en-CA",  "*",        spBuiltinFormats_en_CA  },  // English, Canada
    1689             :     { "en-CB",  "*",        spBuiltinFormats_en_CB  },  // English, Caribbean
    1690             :     { "en-GB",  "*",        spBuiltinFormats_en_GB  },  // English, United Kingdom
    1691             :     { "en-IE",  "*",        spBuiltinFormats_en_IE  },  // English, Ireland
    1692             :     { "en-JM",  "*",        spBuiltinFormats_en_JM  },  // English, Jamaica
    1693             :     { "en-NZ",  "*",        spBuiltinFormats_en_NZ  },  // English, New Zealand
    1694             :     { "en-PH",  "*",        spBuiltinFormats_en_PH  },  // English, Philippines
    1695             :     { "en-TT",  "*",        spBuiltinFormats_en_TT  },  // English, Trinidad and Tobago
    1696             :     { "en-US",  "*",        spBuiltinFormats_en_US  },  // English, USA
    1697             :     { "en-ZA",  "*",        spBuiltinFormats_en_ZA  },  // English, South Africa
    1698             :     { "en-ZW",  "*",        spBuiltinFormats_en_ZW  },  // English, Zimbabwe
    1699             :     { "es-AR",  "*",        spBuiltinFormats_es_AR  },  // Spanish, Argentina
    1700             :     { "es-BO",  "*",        spBuiltinFormats_es_BO  },  // Spanish, Bolivia
    1701             :     { "es-CL",  "*",        spBuiltinFormats_es_CL  },  // Spanish, Chile
    1702             :     { "es-CO",  "*",        spBuiltinFormats_es_CO  },  // Spanish, Colombia
    1703             :     { "es-CR",  "*",        spBuiltinFormats_es_CR  },  // Spanish, Costa Rica
    1704             :     { "es-DO",  "*",        spBuiltinFormats_es_DO  },  // Spanish, Dominican Republic
    1705             :     { "es-EC",  "*",        spBuiltinFormats_es_EC  },  // Spanish, Ecuador
    1706             :     { "es-ES",  "*",        spBuiltinFormats_es_ES  },  // Spanish, Spain
    1707             :     { "es-GT",  "*",        spBuiltinFormats_es_GT  },  // Spanish, Guatemala
    1708             :     { "es-HN",  "*",        spBuiltinFormats_es_HN  },  // Spanish, Honduras
    1709             :     { "es-MX",  "*",        spBuiltinFormats_es_MX  },  // Spanish, Mexico
    1710             :     { "es-NI",  "*",        spBuiltinFormats_es_NI  },  // Spanish, Nicaragua
    1711             :     { "es-PA",  "*",        spBuiltinFormats_es_PA  },  // Spanish, Panama
    1712             :     { "es-PE",  "*",        spBuiltinFormats_es_PE  },  // Spanish, Peru
    1713             :     { "es-PR",  "*",        spBuiltinFormats_es_PR  },  // Spanish, Puerto Rico
    1714             :     { "es-PY",  "*",        spBuiltinFormats_es_PY  },  // Spanish, Paraguay
    1715             :     { "es-SV",  "*",        spBuiltinFormats_es_SV  },  // Spanish, El Salvador
    1716             :     { "es-UY",  "*",        spBuiltinFormats_es_UY  },  // Spanish, Uruguay
    1717             :     { "es-VE",  "*",        spBuiltinFormats_es_VE  },  // Spanish, Venezuela
    1718             :     { "et-EE",  "*",        spBuiltinFormats_et_EE  },  // Estonian, Estonia
    1719             :     { "fa-IR",  "*",        spBuiltinFormats_fa_IR  },  // Farsi, Iran
    1720             :     { "fi-FI",  "*",        spBuiltinFormats_fi_FI  },  // Finnish, Finland
    1721             :     { "fo-FO",  "*",        spBuiltinFormats_fo_FO  },  // Faroese, Faroe Islands
    1722             :     { "fr-BE",  "*",        spBuiltinFormats_fr_BE  },  // French, Belgium
    1723             :     { "fr-CA",  "*",        spBuiltinFormats_fr_CA  },  // French, Canada
    1724             :     { "fr-CH",  "*",        spBuiltinFormats_fr_CH  },  // French, Switzerland
    1725             :     { "fr-FR",  "*",        spBuiltinFormats_fr_FR  },  // French, France
    1726             :     { "fr-LU",  "*",        spBuiltinFormats_fr_LU  },  // French, Luxembourg
    1727             :     { "fr-MC",  "*",        spBuiltinFormats_fr_MC  },  // French, Monaco
    1728             :     { "gl-ES",  "*",        spBuiltinFormats_gl_ES  },  // Galizian, Spain
    1729             :     { "gu-IN",  "*",        spBuiltinFormats_gu_IN  },  // Gujarati, India
    1730             :     { "he-IL",  "*",        spBuiltinFormats_he_IL  },  // Hebrew, Israel
    1731             :     { "hi-IN",  "*",        spBuiltinFormats_hi_IN  },  // Hindi, India
    1732             :     { "hr-BA",  "*",        spBuiltinFormats_hr_BA  },  // Croatian, Bosnia and Herzegowina
    1733             :     { "hr-HR",  "*",        spBuiltinFormats_hr_HR  },  // Croatian, Croatia
    1734             :     { "hu-HU",  "*",        spBuiltinFormats_hu_HU  },  // Hungarian, Hungary
    1735             :     { "hy-AM",  "*",        spBuiltinFormats_hy_AM  },  // Armenian, Armenia
    1736             :     { "id-ID",  "*",        spBuiltinFormats_id_ID  },  // Indonesian, Indonesia
    1737             :     { "is-IS",  "*",        spBuiltinFormats_is_IS  },  // Icelandic, Iceland
    1738             :     { "it-CH",  "*",        spBuiltinFormats_it_CH  },  // Italian, Switzerland
    1739             :     { "it-IT",  "*",        spBuiltinFormats_it_IT  },  // Italian, Italy
    1740             :     { "ka-GE",  "*",        spBuiltinFormats_ka_GE  },  // Georgian, Georgia
    1741             :     { "kk-KZ",  "*",        spBuiltinFormats_kk_KZ  },  // Kazakh, Kazakhstan
    1742             :     { "kn-IN",  "*",        spBuiltinFormats_kn_IN  },  // Kannada, India
    1743             :     { "kok-IN", "*",        spBuiltinFormats_hi_IN  },  // Konkani, India
    1744             :     { "ky-KG",  "*",        spBuiltinFormats_ky_KG  },  // Kyrgyz, Kyrgyzstan
    1745             :     { "lt-LT",  "*",        spBuiltinFormats_lt_LT  },  // Lithuanian, Lithuania
    1746             :     { "lv-LV",  "*",        spBuiltinFormats_lv_LV  },  // Latvian, Latvia
    1747             :     { "mi-NZ",  "*",        spBuiltinFormats_en_NZ  },  // Maori, New Zealand
    1748             :     { "ml-IN",  "*",        spBuiltinFormats_ml_IN  },  // Malayalam, India
    1749             :     { "mn-MN",  "*",        spBuiltinFormats_mn_MN  },  // Mongolian, Mongolia
    1750             :     { "mr-IN",  "*",        spBuiltinFormats_hi_IN  },  // Marathi, India
    1751             :     { "ms-BN",  "*",        spBuiltinFormats_ms_BN  },  // Malay, Brunei Darussalam
    1752             :     { "ms-MY",  "*",        spBuiltinFormats_ms_MY  },  // Malay, Malaysia
    1753             :     { "mt-MT",  "*",        spBuiltinFormats_mt_MT  },  // Maltese, Malta
    1754             :     { "nb-NO",  "*",        spBuiltinFormats_no_NO  },  // Norwegian Bokmal, Norway
    1755             :     { "nl-BE",  "*",        spBuiltinFormats_nl_BE  },  // Dutch, Belgium
    1756             :     { "nl-NL",  "*",        spBuiltinFormats_nl_NL  },  // Dutch, Netherlands
    1757             :     { "nn-NO",  "*",        spBuiltinFormats_no_NO  },  // Norwegian Nynorsk, Norway
    1758             :     { "nso-ZA", "*",        spBuiltinFormats_en_ZA  },  // Northern Sotho, South Africa
    1759             :     { "pa-IN",  "*",        spBuiltinFormats_pa_IN  },  // Punjabi, India
    1760             :     { "pl-PL",  "*",        spBuiltinFormats_pl_PL  },  // Polish, Poland
    1761             :     { "pt-BR",  "*",        spBuiltinFormats_pt_BR  },  // Portugese, Brazil
    1762             :     { "pt-PT",  "*",        spBuiltinFormats_pt_PT  },  // Portugese, Portugal
    1763             :     { "qu-BO",  "*",        spBuiltinFormats_es_BO  },  // Quechua, Bolivia
    1764             :     { "qu-EC",  "*",        spBuiltinFormats_es_EC  },  // Quechua, Ecuador
    1765             :     { "qu-PE",  "*",        spBuiltinFormats_es_PE  },  // Quechua, Peru
    1766             :     { "ro-RO",  "*",        spBuiltinFormats_ro_RO  },  // Romanian, Romania
    1767             :     { "ru-RU",  "*",        spBuiltinFormats_ru_RU  },  // Russian, Russian Federation
    1768             :     { "sa-IN",  "*",        spBuiltinFormats_hi_IN  },  // Sanskrit, India
    1769             :     { "se-FI",  "*",        spBuiltinFormats_fi_FI  },  // Sami, Finland
    1770             :     { "se-NO",  "*",        spBuiltinFormats_no_NO  },  // Sami, Norway
    1771             :     { "se-SE",  "*",        spBuiltinFormats_sv_SE  },  // Sami, Sweden
    1772             :     { "sk-SK",  "*",        spBuiltinFormats_sk_SK  },  // Slovak, Slovakia
    1773             :     { "sl-SI",  "*",        spBuiltinFormats_sl_SI  },  // Slovenian, Slovenia
    1774             :     { "sv-FI",  "*",        spBuiltinFormats_sv_FI  },  // Swedish, Finland
    1775             :     { "sv-SE",  "*",        spBuiltinFormats_sv_SE  },  // Swedish, Sweden
    1776             :     { "sw-TZ",  "*",        spBuiltinFormats_sw_TZ  },  // Swahili, Tanzania
    1777             :     { "syr-SY", "*",        spBuiltinFormats_ar_SY  },  // Syriac, Syria
    1778             :     { "syr-TR", "*",        spBuiltinFormats_tr_TR  },  // Syriac, Turkey
    1779             :     { "ta-IN",  "*",        spBuiltinFormats_ta_IN  },  // Tamil, India
    1780             :     { "te-IN",  "*",        spBuiltinFormats_te_IN  },  // Telugu, India
    1781             :     { "th-TH",  "*",        spBuiltinFormats_th_TH  },  // Thai, Thailand
    1782             :     { "tn-ZA",  "*",        spBuiltinFormats_en_ZA  },  // Tswana, South Africa
    1783             :     { "tr-TR",  "*",        spBuiltinFormats_tr_TR  },  // Turkish, Turkey
    1784             :     { "tt-RU",  "*",        spBuiltinFormats_tt_RU  },  // Tatar, Russian Federation
    1785             :     { "uk-UA",  "*",        spBuiltinFormats_uk_UA  },  // Ukrainian, Ukraine
    1786             :     { "ur-PK",  "*",        spBuiltinFormats_ur_PK  },  // Urdu, Pakistan
    1787             :     { "vi-VN",  "*",        spBuiltinFormats_vi_VN  },  // Vietnamese, Viet Nam
    1788             :     { "xh-ZA",  "*",        spBuiltinFormats_en_ZA  },  // Xhosa, South Africa
    1789             :     { "zu-ZA",  "*",        spBuiltinFormats_en_ZA  },  // Zulu, South Africa
    1790             : 
    1791             :     { "*CJK",   "*",        spBuiltinFormats_CJK    },  // CJK base table
    1792             :     { "ja-JP",  "*CJK",     spBuiltinFormats_ja_JP  },  // Japanese, Japan
    1793             :     { "ko-KR",  "*CJK",     spBuiltinFormats_ko_KR  },  // Korean, South Korea
    1794             :     { "zh-CN",  "*CJK",     spBuiltinFormats_zh_CN  },  // Chinese, China
    1795             :     { "zh-HK",  "*CJK",     spBuiltinFormats_zh_HK  },  // Chinese, Hong Kong
    1796             :     { "zh-MO",  "*CJK",     spBuiltinFormats_zh_MO  },  // Chinese, Macau
    1797             :     { "zh-SG",  "*CJK",     spBuiltinFormats_zh_SG  },  // Chinese, Singapore
    1798             :     { "zh-TW",  "*CJK",     spBuiltinFormats_zh_TW  }   // Chinese, Taiwan
    1799             : };
    1800             : 
    1801             : } // namespace
    1802             : 
    1803             : // ============================================================================
    1804             : 
    1805        1001 : NumFmtModel::NumFmtModel() :
    1806        1001 :     mnPredefId( -1 )
    1807             : {
    1808        1001 : }
    1809             : 
    1810             : // ----------------------------------------------------------------------------
    1811             : 
    1812        1001 : ApiNumFmtData::ApiNumFmtData() :
    1813        1001 :     mnIndex( 0 )
    1814             : {
    1815        1001 : }
    1816             : 
    1817             : // ----------------------------------------------------------------------------
    1818             : 
    1819             : namespace {
    1820             : 
    1821         745 : sal_Int32 lclCreatePredefinedFormat( const Reference< XNumberFormats >& rxNumFmts,
    1822             :         sal_Int16 nPredefId, const Locale& rToLocale )
    1823             : {
    1824         745 :     sal_Int32 nIndex = 0;
    1825             :     try
    1826             :     {
    1827         745 :         Reference< XNumberFormatTypes > xNumFmtTypes( rxNumFmts, UNO_QUERY_THROW );
    1828             :         nIndex = (nPredefId >= 0) ?
    1829         745 :             xNumFmtTypes->getFormatIndex( nPredefId, rToLocale ) :
    1830        1490 :             xNumFmtTypes->getStandardIndex( rToLocale );
    1831             :     }
    1832           0 :     catch( Exception& )
    1833             :     {
    1834             :         OSL_FAIL( OStringBuffer( "lclCreatePredefinedFormat - cannot create predefined number format " ).
    1835             :             append( OString::valueOf( static_cast< sal_Int32 >( nPredefId ) ) ).getStr() );
    1836             :     }
    1837         745 :     return nIndex;
    1838             : }
    1839             : 
    1840         264 : sal_Int32 lclCreateFormat( const Reference< XNumberFormats >& rxNumFmts,
    1841             :         const OUString& rFmtCode, const Locale& rToLocale, const Locale& rFromLocale )
    1842             : {
    1843         264 :     sal_Int32 nIndex = 0;
    1844             :     try
    1845             :     {
    1846         264 :         nIndex = rxNumFmts->addNewConverted( rFmtCode, rFromLocale, rToLocale );
    1847             :     }
    1848           8 :     catch( Exception& )
    1849             :     {
    1850             :         // BIFF2-BIFF4 stores standard format explicitly in stream
    1851           8 :         if( rFmtCode.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "general" ) ) )
    1852             :         {
    1853           8 :             nIndex = lclCreatePredefinedFormat( rxNumFmts, 0, rToLocale );
    1854             :         }
    1855             :         else
    1856             :         {
    1857             :             // do not assert fractional number formats with fixed denominator
    1858             :             OSL_ENSURE( rFmtCode.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "#\\ ?/" ) ) ||
    1859             :                         rFmtCode.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "#\\ ?\?/" ) ) ||
    1860             :                         rFmtCode.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "#\\ ?\?\?/" ) ),
    1861             :                 OStringBuffer( "lclCreateFormat - cannot create number format '" ).
    1862             :                 append( OUStringToOString( rFmtCode, osl_getThreadTextEncoding() ) ).
    1863             :                 append( '\'' ).getStr() );
    1864             :         }
    1865             :     }
    1866         264 :     return nIndex;
    1867             : }
    1868             : 
    1869             : // ----------------------------------------------------------------------------
    1870             : 
    1871             : /** Functor for converting an XML number format to an API number format index. */
    1872          55 : class NumberFormatFinalizer
    1873             : {
    1874             : public:
    1875             :     explicit            NumberFormatFinalizer( const WorkbookHelper& rHelper );
    1876             : 
    1877             :     inline bool         is() const { return mxNumFmts.is(); }
    1878             : 
    1879        1001 :     inline void         operator()( NumberFormat& rNumFmt ) const
    1880        1001 :                             { rNumFmt.finalizeImport( mxNumFmts, maEnUsLocale ); }
    1881             : 
    1882             : private:
    1883             :     Reference< XNumberFormats > mxNumFmts;
    1884             :     Locale              maEnUsLocale;
    1885             : };
    1886             : 
    1887          11 : NumberFormatFinalizer::NumberFormatFinalizer( const WorkbookHelper& rHelper ) :
    1888          11 :     maEnUsLocale( "en", "US", OUString() )
    1889             : {
    1890             :     try
    1891             :     {
    1892          11 :         Reference< XNumberFormatsSupplier > xNumFmtsSupp( rHelper.getDocument(), UNO_QUERY_THROW );
    1893          11 :         mxNumFmts = xNumFmtsSupp->getNumberFormats();
    1894             :     }
    1895           0 :     catch( Exception& )
    1896             :     {
    1897             :     }
    1898             :     OSL_ENSURE( mxNumFmts.is(), "NumberFormatFinalizer::NumberFormatFinalizer - cannot get number formats" );
    1899          11 : }
    1900             : 
    1901             : } // namespace
    1902             : 
    1903             : // ----------------------------------------------------------------------------
    1904             : 
    1905        1001 : NumberFormat::NumberFormat( const WorkbookHelper& rHelper ) :
    1906        1001 :     WorkbookHelper( rHelper )
    1907             : {
    1908        1001 : }
    1909             : 
    1910          99 : void NumberFormat::setFormatCode( const OUString& rFmtCode )
    1911             : {
    1912          99 :     maModel.maFmtCode = rFmtCode;
    1913          99 : }
    1914             : 
    1915         132 : void NumberFormat::setFormatCode( const Locale& rLocale, const sal_Char* pcFmtCode )
    1916             : {
    1917         132 :     maModel.maLocale = rLocale;
    1918         132 :     maModel.maFmtCode = OStringToOUString( OString( pcFmtCode ), RTL_TEXTENCODING_UTF8 );
    1919         132 :     maModel.mnPredefId = -1;
    1920         132 : }
    1921             : 
    1922         264 : void NumberFormat::setPredefinedId( const Locale& rLocale, sal_Int16 nPredefId )
    1923             : {
    1924         264 :     maModel.maLocale = rLocale;
    1925         264 :     maModel.maFmtCode = OUString();
    1926         264 :     maModel.mnPredefId = nPredefId;
    1927         264 : }
    1928             : 
    1929        1001 : sal_Int32 NumberFormat::finalizeImport( const Reference< XNumberFormats >& rxNumFmts, const Locale& rFromLocale )
    1930             : {
    1931        1001 :     if( rxNumFmts.is() && !maModel.maFmtCode.isEmpty() )
    1932         264 :         maApiData.mnIndex = lclCreateFormat( rxNumFmts, maModel.maFmtCode, maModel.maLocale, rFromLocale );
    1933             :     else
    1934         737 :         maApiData.mnIndex = lclCreatePredefinedFormat( rxNumFmts, maModel.mnPredefId, maModel.maLocale );
    1935        1001 :     return maApiData.mnIndex;
    1936             : }
    1937             : 
    1938         161 : void NumberFormat::fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs ) const
    1939             : {
    1940         161 :     ScDocument& rDoc = getScDocument();
    1941         161 :     static sal_uLong  nDflt = rDoc.GetFormatTable()->GetStandardFormat( ScGlobal::eLnge );
    1942         161 :     sal_uLong nScNumFmt = nDflt;
    1943         161 :     if ( maApiData.mnIndex )
    1944          48 :         nScNumFmt = maApiData.mnIndex;
    1945         161 :     ScfTools::PutItem( rItemSet, SfxUInt32Item( ATTR_VALUE_FORMAT, nScNumFmt ), bSkipPoolDefs );
    1946         161 :     if( rItemSet.GetItemState( ATTR_VALUE_FORMAT, false ) == SFX_ITEM_SET )
    1947         161 :         ScGlobal::AddLanguage( rItemSet, *(rDoc.GetFormatTable()) );
    1948         161 : }
    1949             : 
    1950          47 : void NumberFormat::writeToPropertyMap( PropertyMap& rPropMap ) const
    1951             : {
    1952          47 :     rPropMap[ PROP_NumberFormat ] <<= maApiData.mnIndex;
    1953          47 : }
    1954             : 
    1955             : // ============================================================================
    1956             : 
    1957          11 : NumberFormatsBuffer::NumberFormatsBuffer( const WorkbookHelper& rHelper )
    1958             :     : WorkbookHelper(rHelper)
    1959          11 :     , mnHighestId(0)
    1960             : {
    1961             :     // get the current locale
    1962             :     // try user-defined locale setting
    1963          11 :     maLocaleStr = officecfg::Setup::L10N::ooSetupSystemLocale::get();
    1964             :     // if set to "use system", get locale from system
    1965          11 :     if( maLocaleStr.isEmpty() )
    1966          11 :         maLocaleStr = officecfg::System::L10N::Locale::get();
    1967             : 
    1968             :     // create built-in formats for current locale
    1969          11 :     insertBuiltinFormats();
    1970          11 : }
    1971             : 
    1972          99 : NumberFormatRef NumberFormatsBuffer::createNumFmt( sal_Int32 nNumFmtId, const OUString& rFmtCode )
    1973             : {
    1974          99 :     NumberFormatRef xNumFmt;
    1975          99 :     if( nNumFmtId >= 0 )
    1976             :     {
    1977          99 :         xNumFmt.reset( new NumberFormat( *this ) );
    1978          99 :         maNumFmts[ nNumFmtId ] = xNumFmt;
    1979          99 :         if ( nNumFmtId > mnHighestId )
    1980          29 :             mnHighestId = nNumFmtId;
    1981          99 :         xNumFmt->setFormatCode( rFmtCode );
    1982             :     }
    1983          99 :     return xNumFmt;
    1984             : }
    1985             : 
    1986          29 : NumberFormatRef NumberFormatsBuffer::importNumFmt( const AttributeList& rAttribs )
    1987             : {
    1988          29 :     sal_Int32 nNumFmtId = rAttribs.getInteger( XML_numFmtId, -1 );
    1989          29 :     OUString aFmtCode = rAttribs.getXString( XML_formatCode, OUString() );
    1990          29 :     return createNumFmt( nNumFmtId, aFmtCode );
    1991             : }
    1992             : 
    1993           0 : void NumberFormatsBuffer::importNumFmt( SequenceInputStream& rStrm )
    1994             : {
    1995           0 :     sal_Int32 nNumFmtId = rStrm.readuInt16();
    1996           0 :     OUString aFmtCode = BiffHelper::readString( rStrm );
    1997           0 :     createNumFmt( nNumFmtId, aFmtCode );
    1998           0 : }
    1999             : 
    2000          11 : void NumberFormatsBuffer::finalizeImport()
    2001             : {
    2002          11 :     maNumFmts.forEach( NumberFormatFinalizer( *this ) );
    2003          11 : }
    2004             : 
    2005         161 : void NumberFormatsBuffer::fillToItemSet( SfxItemSet& rItemSet, sal_Int32 nNumFmtId, bool bSkipPoolDefs ) const
    2006             : {
    2007         161 :     if( const NumberFormat* pNumFmt = maNumFmts.get( nNumFmtId ).get() )
    2008         161 :         pNumFmt->fillToItemSet( rItemSet, bSkipPoolDefs);
    2009         161 : }
    2010             : 
    2011          11 : void NumberFormatsBuffer::writeToPropertyMap( PropertyMap& rPropMap, sal_Int32 nNumFmtId ) const
    2012             : {
    2013          11 :     if( const NumberFormat* pNumFmt = maNumFmts.get( nNumFmtId ).get() )
    2014          11 :         pNumFmt->writeToPropertyMap( rPropMap );
    2015          11 : }
    2016             : 
    2017          11 : void NumberFormatsBuffer::insertBuiltinFormats()
    2018             : {
    2019             :     // build a map containing pointers to all tables
    2020             :     typedef ::std::map< OUString, const BuiltinFormatTable* > BuiltinMap;
    2021          11 :     BuiltinMap aBuiltinMap;
    2022        1595 :     for( const BuiltinFormatTable* pTable = spBuiltinFormatTables;
    2023             :             pTable != STATIC_ARRAY_END( spBuiltinFormatTables ); ++pTable )
    2024        1584 :         aBuiltinMap[ OUString::createFromAscii( pTable->mpcLocale ) ] = pTable;
    2025             : 
    2026             :     // convert locale string to locale struct
    2027          11 :     Locale aSysLocale;
    2028          11 :     sal_Int32 nDashPos = maLocaleStr.indexOf( '-' );
    2029          11 :     if( nDashPos < 0 ) nDashPos = maLocaleStr.getLength();
    2030          11 :     aSysLocale.Language = maLocaleStr.copy( 0, nDashPos );
    2031          11 :     if( nDashPos + 1 < maLocaleStr.getLength() )
    2032           0 :         aSysLocale.Country = maLocaleStr.copy( nDashPos + 1 );
    2033             : 
    2034             :     // build a list of table pointers for the current locale, with all parent tables
    2035             :     typedef ::std::vector< const BuiltinFormatTable* > BuiltinVec;
    2036          11 :     BuiltinVec aBuiltinVec;
    2037          11 :     BuiltinMap::const_iterator aMIt = aBuiltinMap.find( maLocaleStr ), aMEnd = aBuiltinMap.end();
    2038             :     OSL_ENSURE( aMIt != aMEnd,
    2039             :         OStringBuffer( "NumberFormatsBuffer::insertBuiltinFormats - locale '" ).
    2040             :         append( OUStringToOString( maLocaleStr, RTL_TEXTENCODING_ASCII_US ) ).
    2041             :         append( "' not supported (#i29949#)" ).getStr() );
    2042             :     // start with default table, if no table has been found
    2043          11 :     if( aMIt == aMEnd )
    2044          11 :         aMIt = aBuiltinMap.find( "*" );
    2045             :     OSL_ENSURE( aMIt != aMEnd, "NumberFormatsBuffer::insertBuiltinFormats - default map not found" );
    2046             :     // insert all tables into the vector
    2047          22 :     for( ; aMIt != aMEnd; aMIt = aBuiltinMap.find( OUString::createFromAscii( aMIt->second->mpcParent ) ) )
    2048          11 :         aBuiltinVec.push_back( aMIt->second );
    2049             : 
    2050             :     // insert the default formats in the format map (in reverse order from default table to system locale)
    2051             :     typedef ::std::map< sal_Int32, sal_Int32 > ReuseMap;
    2052          11 :     ReuseMap aReuseMap;
    2053          22 :     for( BuiltinVec::reverse_iterator aVIt = aBuiltinVec.rbegin(), aVEnd = aBuiltinVec.rend(); aVIt != aVEnd; ++aVIt )
    2054             :     {
    2055             :         // do not put the current system locale for default table
    2056          11 :         Locale aLocale;
    2057          11 :         if( (*aVIt)->mpcLocale[ 0 ] != '\0' )
    2058          11 :             aLocale = aSysLocale;
    2059         913 :         for( const BuiltinFormat* pBuiltin = (*aVIt)->mpFormats; pBuiltin && (pBuiltin->mnNumFmtId >= 0); ++pBuiltin )
    2060             :         {
    2061         902 :             NumberFormatRef& rxNumFmt = maNumFmts[ pBuiltin->mnNumFmtId ];
    2062         902 :             rxNumFmt.reset( new NumberFormat( *this ) );
    2063             : 
    2064         902 :             bool bReuse = false;
    2065         902 :             if( pBuiltin->mpcFmtCode )
    2066         132 :                 rxNumFmt->setFormatCode( aLocale, pBuiltin->mpcFmtCode );
    2067         770 :             else if( pBuiltin->mnPredefId >= 0 )
    2068         264 :                 rxNumFmt->setPredefinedId( aLocale, pBuiltin->mnPredefId );
    2069             :             else
    2070         506 :                 bReuse = pBuiltin->mnReuseId >= 0;
    2071             : 
    2072         902 :             if( bReuse )
    2073         506 :                 aReuseMap[ pBuiltin->mnNumFmtId ] = pBuiltin->mnReuseId;
    2074             :             else
    2075         396 :                 aReuseMap.erase( pBuiltin->mnNumFmtId );
    2076             :         }
    2077          11 :     }
    2078             : 
    2079             :     // copy reused number formats
    2080         517 :     for( ReuseMap::const_iterator aRIt = aReuseMap.begin(), aREnd = aReuseMap.end(); aRIt != aREnd; ++aRIt )
    2081             :     {
    2082         506 :         maNumFmts[ aRIt->first ] = maNumFmts[ aRIt->second ];
    2083         506 :         if ( aRIt->first > mnHighestId )
    2084         506 :             mnHighestId = aRIt->first;
    2085          11 :     }
    2086          11 : }
    2087             : 
    2088             : // ============================================================================
    2089             : 
    2090             : } // namespace xls
    2091           9 : } // namespace oox
    2092             : 
    2093             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10