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

Generated by: LCOV version 1.10