File indexing completed on 2024-05-12 16:28:56

0001 /*
0002  * This file is part of Office 2007 Filters for Calligra
0003  * Copyright (C) 2002 Laurent Montel <lmontel@mandrakesoft.com>
0004  * Copyright (c) 2003 Lukas Tinkl <lukas@kde.org>
0005  * Copyright (C) 2003 David Faure <faure@kde.org>
0006  * Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
0007  * Contact: Suresh Chande suresh.chande@nokia.com
0008  * Copyright (C) 2011 Matus Uzak <matus.uzak@ixonos.com>
0009  * Copyright 2014 Inge Wallin <inge@lysator.liu.se>
0010  *
0011  * Utils::columnName() based on Cell::columnName() from calligra/kspread/Utils.cpp:
0012  * Copyright 2006-2007 Stefan Nikolaus <stefan.nikolaus@kdemail.net>
0013  * Copyright 2004 Tomas Mecir <mecirt@gmail.com>
0014  * Copyright 1999-2002,2004 Laurent Montel <montel@kde.org>
0015  * Copyright 2002,2004 Ariya Hidayat <ariya@kde.org>
0016  * Copyright 2002-2003 Norbert Andres <nandres@web.de>
0017  * Copyright 2003 Stefan Hetzl <shetzl@chello.at>
0018  * Copyright 2001-2002 Philipp Mueller <philipp.mueller@gmx.de>
0019  * Copyright 2002 Harri Porten <porten@kde.org>
0020  * Copyright 2002 John Dailey <dailey@vt.edu>
0021  * Copyright 1999-2001 David Faure <faure@kde.org>
0022  * Copyright 2000-2001 Werner Trobin <trobin@kde.org>
0023  * Copyright 2000 Simon Hausmann <hausmann@kde.org
0024  * Copyright 1998-1999 Torben Weis <weis@kde.org>
0025  * Copyright 1999 Michael Reiher <michael.reiher@gmx.de>
0026  * Copyright 1999 Reginald Stadlbauer <reggie@kde.org>
0027  *
0028  * This library is free software; you can redistribute it and/or
0029  * modify it under the terms of the GNU Lesser General Public License
0030  * version 2.1 as published by the Free Software Foundation.
0031  *
0032  * This library is distributed in the hope that it will be useful, but
0033  * WITHOUT ANY WARRANTY; without even the implied warranty of
0034  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0035  * Lesser General Public License for more details.
0036  *
0037  * You should have received a copy of the GNU Lesser General Public
0038  * License along with this library; if not, write to the Free Software
0039  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
0040  * 02110-1301 USA
0041  *
0042  */
0043 
0044 // Own
0045 #include "MsoUtils.h"
0046 
0047 // Qt
0048 #include <QMap>
0049 #include <QString>
0050 #include <QPalette>
0051 #include <QGlobalStatic>
0052 
0053 
0054 class DefaultIndexedColors : public QList< QColor >
0055 {
0056 public:
0057     DefaultIndexedColors()
0058     {
0059         push_back( QColor( 0, 0, 0 ) );
0060         push_back( QColor( 255, 255, 255 ) );
0061         push_back( QColor( 255, 0, 0 ) );
0062         push_back( QColor( 0, 255, 0 ) );
0063         push_back( QColor( 0, 0, 255 ) );
0064         push_back( QColor( 255, 255, 0 ) );
0065         push_back( QColor( 255, 0, 255 ) );
0066         push_back( QColor( 0, 255, 255 ) );
0067         push_back( QColor( 0, 0, 0 ) );
0068         push_back( QColor( 255, 255, 255 ) );
0069         push_back( QColor( 255, 0, 0 ) );
0070         push_back( QColor( 0, 255, 0 ) );
0071         push_back( QColor( 0, 0, 255 ) );
0072         push_back( QColor( 255, 255, 0 ) );
0073         push_back( QColor( 255, 0, 255 ) );
0074         push_back( QColor( 0, 255, 255 ) );
0075         push_back( QColor( 128, 0, 0 ) );
0076         push_back( QColor( 0, 128, 0 ) );
0077         push_back( QColor( 0, 0, 128 ) );
0078         push_back( QColor( 128, 128, 0 ) );
0079         push_back( QColor( 128, 0, 128 ) );
0080         push_back( QColor( 0, 128, 128 ) );
0081         push_back( QColor( 192, 192, 192 ) );
0082         push_back( QColor( 128, 128, 128 ) );
0083         push_back( QColor( 153, 153, 255 ) );
0084         push_back( QColor( 153, 51, 102 ) );
0085         push_back( QColor( 255, 255, 204 ) );
0086         push_back( QColor( 204, 255, 255 ) );
0087         push_back( QColor( 102, 0, 102 ) );
0088         push_back( QColor( 255, 128, 128 ) );
0089         push_back( QColor( 0, 102, 204 ) );
0090         push_back( QColor( 204, 204, 255 ) );
0091         push_back( QColor( 0, 0, 128 ) );
0092         push_back( QColor( 255, 0, 255 ) );
0093         push_back( QColor( 255, 255, 0 ) );
0094         push_back( QColor( 0, 255, 255 ) );
0095         push_back( QColor( 128, 0, 128 ) );
0096         push_back( QColor( 128, 0, 0 ) );
0097         push_back( QColor( 0, 128, 128 ) );
0098         push_back( QColor( 0, 0, 255 ) );
0099         push_back( QColor( 0, 204, 255 ) );
0100         push_back( QColor( 204, 255, 255 ) );
0101         push_back( QColor( 204, 255, 204 ) );
0102         push_back( QColor( 255, 255, 153 ) );
0103         push_back( QColor( 153, 204, 255 ) );
0104         push_back( QColor( 255, 153, 204 ) );
0105         push_back( QColor( 204, 153, 255 ) );
0106         push_back( QColor( 255, 204, 153 ) );
0107         push_back( QColor( 51, 102, 255 ) );
0108         push_back( QColor( 51, 204, 204 ) );
0109         push_back( QColor( 153, 204, 0 ) );
0110         push_back( QColor( 255, 204, 0 ) );
0111         push_back( QColor( 255, 153, 0 ) );
0112         push_back( QColor( 255, 102, 0 ) );
0113         push_back( QColor( 102, 102, 153 ) );
0114         push_back( QColor( 150, 150, 150 ) );
0115         push_back( QColor( 0, 51, 102 ) );
0116         push_back( QColor( 51, 102, 153 ) );
0117         push_back( QColor( 0, 51, 0 ) );
0118         push_back( QColor( 51, 51, 0 ) );
0119         push_back( QColor( 153, 51, 0 ) );
0120         push_back( QColor( 153, 51, 102 ) );
0121         push_back( QColor( 51, 51, 153 ) );
0122         push_back( QColor( 51, 51, 51 ) );
0123     // FIXME: The palette colors can apparently change during execution so
0124     //        this should be calculated on the fly instead.
0125         push_back( QPalette().color( QPalette::Active, QPalette::WindowText ) );
0126         push_back( QPalette().color( QPalette::Active, QPalette::Window ) );
0127      }
0128 };
0129 
0130 Q_GLOBAL_STATIC( DefaultIndexedColors, s_defaultIndexedColors )
0131 
0132 QColor MSO::defaultIndexedColor( int index )
0133 {
0134     if( index < 0 || s_defaultIndexedColors->count() <= index )
0135         return QColor();
0136     return s_defaultIndexedColors->at( index );
0137 }
0138 
0139 
0140 class LangIdToLocaleMapping : public QMap< int, QString >
0141 {
0142 public:
0143     LangIdToLocaleMapping()
0144     {
0145 #define DEFINELOCALE( ID, CODE ) insert( ID, QLatin1String( CODE ) );
0146         DEFINELOCALE( 0x0436, "af-ZA" ) //  Afrikaans   South Africa
0147         DEFINELOCALE( 0x041c, "sq-AL" ) //  Albanian    Albania
0148         DEFINELOCALE( 0x0484, "gsw-FR" ) //  Alsatian    France
0149         DEFINELOCALE( 0x045e, "am-ET" ) //   Amharic     Ethiopia
0150         DEFINELOCALE( 0x0401, "ar-SA" ) //   Arabic  Saudi Arabia
0151         DEFINELOCALE( 0x0801, "ar-IQ" ) //   Arabic  Iraq
0152         DEFINELOCALE( 0x0c01, "ar-EG" ) //   Arabic  Egypt
0153         DEFINELOCALE( 0x1001, "ar-LY" ) //   Arabic  Libya
0154         DEFINELOCALE( 0x1401, "ar-DZ" ) //   Arabic  Algeria
0155         DEFINELOCALE( 0x1801, "ar-MA" ) //   Arabic  Morocco
0156         DEFINELOCALE( 0x1c01, "ar-TN" ) //   Arabic  Tunisia
0157         DEFINELOCALE( 0x2001, "ar-OM" ) //   Arabic  Oman
0158         DEFINELOCALE( 0x2401, "ar-YE" ) //   Arabic  Yemen
0159         DEFINELOCALE( 0x2801, "ar-SY" ) //   Arabic  Syria
0160         DEFINELOCALE( 0x2c01, "ar-JO" ) //   Arabic  Jordan
0161         DEFINELOCALE( 0x3001, "ar-LB" ) //   Arabic  Lebanon
0162         DEFINELOCALE( 0x3401, "ar-KW" ) //   Arabic  Kuwait
0163         DEFINELOCALE( 0x3801, "ar-AE" ) //   Arabic  U.A.E.
0164         DEFINELOCALE( 0x3c01, "ar-BH" ) //   Arabic  Bahrain
0165         DEFINELOCALE( 0x4001, "ar-QA" ) //   Arabic  Qatar
0166         DEFINELOCALE( 0x042b, "hy-AM" ) //   Armenian    Armenia
0167         DEFINELOCALE( 0x044d, "as-IN" ) //   Assamese    India
0168         DEFINELOCALE( 0x082c, "az-Cyrl-AZ" ) //  Azeri (Cyrillic)    Azerbaijan
0169         DEFINELOCALE( 0x042c, "az-Latn-AZ" ) //  Azeri (Latin)   Azerbaijan
0170         DEFINELOCALE( 0x046d, "ba-RU" ) //   Bashkir     Russia
0171         DEFINELOCALE( 0x042d, "eu-ES" ) //   Basque  Basque
0172         DEFINELOCALE( 0x0423, "be-BY" ) //   Belarusian  Belarus
0173         DEFINELOCALE( 0x0445, "bn-IN" ) //   Bengali     India
0174         DEFINELOCALE( 0x0845, "bn-BD" ) //   Bengali     Bangladesh
0175         DEFINELOCALE( 0x201a, "bs-Cyrl-BA" ) //  Bosnian (Cyrillic)  Bosnia and Herzegovina
0176         DEFINELOCALE( 0x141a, "bs-Latn-BA" ) //  Bosnian (Latin)     Bosnia and Herzegovina
0177         DEFINELOCALE( 0x047e, "br-FR" ) //   Breton  France
0178         DEFINELOCALE( 0x0402, "bg-BG" ) //   Bulgarian   Bulgaria
0179         DEFINELOCALE( 0x0403, "ca-ES" ) //   Catalan     Catalan
0180         DEFINELOCALE( 0x0404, "zh-TW" ) //   Chinese     Taiwan
0181         DEFINELOCALE( 0x0804, "zh-CN" ) //   Chinese     PRC
0182         DEFINELOCALE( 0x0c04, "zh-HK" ) //   Chinese     Hong Kong SAR
0183         DEFINELOCALE( 0x1004, "zh-SG" ) //   Chinese     Singapore
0184         DEFINELOCALE( 0x1404, "zh-MO" ) //   Chinese     Macao SAR
0185         DEFINELOCALE( 0x0483, "co-FR" ) //   Corsican    France
0186         DEFINELOCALE( 0x041a, "hr-HR" ) //   Croatian    Croatia
0187         DEFINELOCALE( 0x101a, "hr-BA" ) //   Croatian (Latin)    Bosnia and Herzegovina
0188         DEFINELOCALE( 0x0405, "cs-CZ" ) //   Czech   Czech Republic
0189         DEFINELOCALE( 0x0406, "da-DK" ) //   Danish  Denmark
0190         DEFINELOCALE( 0x048c, "prs-AF" ) //  Dari    Afghanistan
0191         DEFINELOCALE( 0x0465, "dv-MV" ) //   Divehi  Maldives
0192         DEFINELOCALE( 0x0813, "nl-BE" ) //   Dutch   Belgium
0193         DEFINELOCALE( 0x0413, "nl-NL" ) //   Dutch   Netherlands
0194         DEFINELOCALE( 0x1009, "en-CA" ) //   English     Canada
0195         DEFINELOCALE( 0x2009, "en-JM" ) //   English     Jamaica
0196         DEFINELOCALE( 0x2409, "en-029" ) //  English     Caribbean
0197         DEFINELOCALE( 0x2809, "en-BZ" ) //   English     Belize
0198         DEFINELOCALE( 0x2c09, "en-TT" ) //   English     Trinidad
0199         DEFINELOCALE( 0x0809, "en-GB" ) //   English     United Kingdom
0200         DEFINELOCALE( 0x1809, "en-IE" ) //   English     Ireland
0201         DEFINELOCALE( 0x4009, "en-IN" ) //   English     India
0202         DEFINELOCALE( 0x1c09, "en-ZA" ) //   English     South Africa
0203         DEFINELOCALE( 0x3009, "en-ZW" ) //   English     Zimbabwe
0204         DEFINELOCALE( 0x0c09, "en-AU" ) //   English     Australia
0205         DEFINELOCALE( 0x1409, "en-NZ" ) //   English     New Zealand
0206         DEFINELOCALE( 0x3409, "en-PH" ) //   English     Philippines
0207         DEFINELOCALE( 0x0409, "en-US" ) //   English     United States
0208         DEFINELOCALE( 0x4409, "en-MY" ) //   English     Malaysia
0209         DEFINELOCALE( 0x4809, "en-SG" ) //   English     Singapore
0210         DEFINELOCALE( 0x0425, "et-EE" ) //   Estonian    Estonia
0211         DEFINELOCALE( 0x0438, "fo-FO" ) //   Faroese     Faroe Islands
0212         DEFINELOCALE( 0x0464, "fil-PH" ) //  Filipino    Philippines
0213         DEFINELOCALE( 0x040b, "fi-FI" ) //   Finnish     Finland
0214         DEFINELOCALE( 0x0c0c, "fr-CA" ) //   French  Canada
0215         DEFINELOCALE( 0x040c, "fr-FR" ) //   French  France
0216         DEFINELOCALE( 0x180c, "fr-MC" ) //   French  Monaco
0217         DEFINELOCALE( 0x100c, "fr-CH" ) //   French  Switzerland
0218         DEFINELOCALE( 0x080c, "fr-BE" ) //   French  Belgium
0219         DEFINELOCALE( 0x140c, "fr-LU" ) //   French  Luxembourg
0220         DEFINELOCALE( 0x0462, "fy-NL" ) //   Frisian     Netherlands
0221         DEFINELOCALE( 0x0456, "gl-ES" ) //   Galician    Galician
0222         DEFINELOCALE( 0x0437, "ka-GE" ) //   Georgian    Georgia
0223         DEFINELOCALE( 0x0407, "de-DE" ) //   German  Germany
0224         DEFINELOCALE( 0x0807, "de-CH" ) //   German  Switzerland
0225         DEFINELOCALE( 0x0c07, "de-AT" ) //   German  Austria
0226         DEFINELOCALE( 0x1407, "de-LI" ) //   German  Liechtenstein
0227         DEFINELOCALE( 0x1007, "de-LU" ) //   German  Luxembourg
0228         DEFINELOCALE( 0x0408, "el-GR" ) //   Greek   Greece
0229         DEFINELOCALE( 0x046f, "kl-GL" ) //   Greenlandic     Greenland
0230         DEFINELOCALE( 0x0447, "gu-IN" ) //   Gujarati    India
0231         DEFINELOCALE( 0x0468, "ha-Latn-NG" ) //  Hausa   Nigeria
0232         DEFINELOCALE( 0x040d, "he-IL" ) //   Hebrew  Israel
0233         DEFINELOCALE( 0x0439, "hi-IN" ) //   Hindi   India
0234         DEFINELOCALE( 0x040e, "hu-HU" ) //   Hungarian   Hungary
0235         DEFINELOCALE( 0x040f, "is-IS" ) //   Icelandic   Iceland
0236         DEFINELOCALE( 0x0470, "ig-NG" ) //   Igbo    Nigeria
0237         DEFINELOCALE( 0x0421, "id-ID" ) //   Indonesian  Indonesia
0238         DEFINELOCALE( 0x045d, "iu-Cans-CA" ) //  Inukitut (Syllabics)    Canada
0239         DEFINELOCALE( 0x085d, "iu-Latn-CA" ) //  Inuktitut (Latin)   Canada
0240         DEFINELOCALE( 0x083c, "ga-IE" ) //   Irish   Ireland
0241         DEFINELOCALE( 0x0434, "xh-ZA" ) //   isiXhosa    South Africa
0242         DEFINELOCALE( 0x0435, "zu-ZA" ) //   isiZulu     South Africa
0243         DEFINELOCALE( 0x0410, "it-IT" ) //   Italian     Italy
0244         DEFINELOCALE( 0x0810, "it-CH" ) //   Italian     Switzerland
0245         DEFINELOCALE( 0x0411, "ja-JP" ) //   Japanese    Japan
0246         DEFINELOCALE( 0x044b, "kn-IN" ) //   Kannada     India
0247         DEFINELOCALE( 0x043f, "kk-KZ" ) //   Kazakh  Kazakhstan
0248         DEFINELOCALE( 0x0453, "km-KH" ) //   Khmer   Cambodia
0249         DEFINELOCALE( 0x0486, "qut-GT" ) //  K'iche  Guatemala
0250         DEFINELOCALE( 0x0487, "rw-RW" ) //   Kinyarwanda     Rwanda
0251         DEFINELOCALE( 0x0441, "sw-KE" ) //   Kiswahili   Kenya
0252         DEFINELOCALE( 0x0457, "kok-IN" ) //  Konkani     India
0253         DEFINELOCALE( 0x0412, "ko-KR" ) //   Korean  Korea
0254         DEFINELOCALE( 0x0440, "ky-KG" ) //   Kyrgyz  Kyrgyzistan
0255         DEFINELOCALE( 0x0454, "lo-LA" ) //   Lao     Lao P.D.R.
0256         DEFINELOCALE( 0x0426, "lv-LV" ) //   Latvian     Latvia
0257         DEFINELOCALE( 0x0427, "lt-LT" ) //   Lithuanian  Lithuania
0258         DEFINELOCALE( 0x082e, "dsb-DE" ) //  Lower Sorbian   Germany
0259         DEFINELOCALE( 0x046e, "lb-LU" ) //   Luxembourgish   Luxembourg
0260         DEFINELOCALE( 0x042f, "mk-MK" ) //   Macedonian (FYROM)  Macedonia (FYROM)
0261         DEFINELOCALE( 0x043e, "ms-MY" ) //   Malay   Malaysia
0262         DEFINELOCALE( 0x083e, "ms-BN" ) //   Malay   Brunei Darussalam
0263         DEFINELOCALE( 0x044c, "ml-IN" ) //   Malayalam   India
0264         DEFINELOCALE( 0x043a, "mt-MT" ) //   Maltese     Malta
0265         DEFINELOCALE( 0x0481, "mi-NZ" ) //   Maori   New Zealand
0266         DEFINELOCALE( 0x047a, "arn-CL" ) //  Mapudungun  Chile
0267         DEFINELOCALE( 0x044e, "mr-IN" ) //   Marathi     India
0268         DEFINELOCALE( 0x047c, "moh-CA" ) //  Mohawk  Mohawk
0269         DEFINELOCALE( 0x0450, "mn-MN" ) //   Mongolian (Cyrillic)    Mongolia
0270         DEFINELOCALE( 0x0850, "mn-Mong-CN" ) //  Mongolian (Mongolian)   PRC
0271         DEFINELOCALE( 0x0461, "ne-NP" ) //   Nepali  Nepal
0272         DEFINELOCALE( 0x0414, "nb-NO" ) //   Norwegian (Bokmål)  Norway
0273         DEFINELOCALE( 0x0814, "nn-NO" ) //   Norwegian (Nynorsk)     Norway
0274         DEFINELOCALE( 0x0482, "oc-FR" ) //   Occitan     France
0275         DEFINELOCALE( 0x0448, "or-IN" ) //   Oriya   India
0276         DEFINELOCALE( 0x0463, "ps-AF" ) //   Pashto  Afghanistan
0277         DEFINELOCALE( 0x0429, "fa-IR" ) //   Persian     Iran
0278         DEFINELOCALE( 0x0415, "pl-PL" ) //   Polish  Poland
0279         DEFINELOCALE( 0x0416, "pt-BR" ) //   Portuguese  Brazil
0280         DEFINELOCALE( 0x0816, "pt-PT" ) //   Portuguese  Portugal
0281         DEFINELOCALE( 0x0446, "pa-IN" ) //   Punjabi (Gurmukhi)  India
0282         DEFINELOCALE( 0x046b, "quz-BO" ) //  Quechua     Bolivia
0283         DEFINELOCALE( 0x086b, "quz-EC" ) //  Quechua     Ecuador
0284         DEFINELOCALE( 0x0c6b, "quz-PE" ) //  Quechua     Peru
0285         DEFINELOCALE( 0x0418, "ro-RO" ) //   Romanian    Romania
0286         DEFINELOCALE( 0x0417, "rm-CH" ) //   Romansh     Switzerland
0287         DEFINELOCALE( 0x0419, "ru-RU" ) //   Russian     Russia
0288         DEFINELOCALE( 0x243b, "smn-FI" ) //  Sami, Inari     Finland
0289         DEFINELOCALE( 0x143b, "smj-SE" ) //  Sami, Lule  Sweden
0290         DEFINELOCALE( 0x103b, "smj-NO" ) //  Sami, Lule  Norway
0291         DEFINELOCALE( 0x043b, "se-NO" ) //   Sami, Northern  Norway
0292         DEFINELOCALE( 0x083b, "se-SE" ) //   Sami, Northern  Sweden
0293         DEFINELOCALE( 0x0c3b, "se-FI" ) //   Sami, Northern  Finland
0294         DEFINELOCALE( 0x203b, "sms-FI" ) //  Sami, Skolt     Finland
0295         DEFINELOCALE( 0x183b, "sma-NO" ) //  Sami, Southern  Norway
0296         DEFINELOCALE( 0x1c3b, "sma-SE" ) //  Sami, Southern  Sweden
0297         DEFINELOCALE( 0x044f, "sa-IN" ) //   Sanskrit    India
0298         DEFINELOCALE( 0x0c1a, "sr-Cyrl-CS" ) //  Serbian (Cyrillic)  Serbia
0299         DEFINELOCALE( 0x1c1a, "sr-Cyrl-BA" ) //  Serbian (Cyrillic)  Bosnia and Herzegovina
0300         DEFINELOCALE( 0x081a, "sr-Latn-CS" ) //  Serbian (Latin)     Serbia
0301         DEFINELOCALE( 0x181a, "sr-Latn-BA" ) //  Serbian (Latin)     Bosnia and Herzegovina
0302         DEFINELOCALE( 0x046c, "nso-ZA" ) //  Sesotho sa Leboa    South Africa
0303         DEFINELOCALE( 0x0432, "tn-ZA" ) //   Setswana    South Africa
0304         DEFINELOCALE( 0x045b, "si-LK" ) //   Sinhala     Sri Lanka
0305         DEFINELOCALE( 0x041b, "sk-SK" ) //   Slovak  Slovakia
0306         DEFINELOCALE( 0x0424, "sl-SI" ) //   Slovenian   Slovenia
0307         DEFINELOCALE( 0x080a, "es-MX" ) //   Spanish     Mexico
0308         DEFINELOCALE( 0x100a, "es-GT" ) //   Spanish     Guatemala
0309         DEFINELOCALE( 0x140a, "es-CR" ) //   Spanish     Costa Rica
0310         DEFINELOCALE( 0x180a, "es-PA" ) //   Spanish     Panama
0311         DEFINELOCALE( 0x1c0a, "es-DO" ) //   Spanish     Dominican Republic
0312         DEFINELOCALE( 0x200a, "es-VE" ) //   Spanish     Venezuela
0313         DEFINELOCALE( 0x240a, "es-CO" ) //   Spanish     Colombia
0314         DEFINELOCALE( 0x280a, "es-PE" ) //   Spanish     Peru
0315         DEFINELOCALE( 0x2c0a, "es-AR" ) //   Spanish     Argentina
0316         DEFINELOCALE( 0x300a, "es-EC" ) //   Spanish     Ecuador
0317         DEFINELOCALE( 0x340a, "es-CL" ) //   Spanish     Chile
0318         DEFINELOCALE( 0x3c0a, "es-PY" ) //   Spanish     Paraguay
0319         DEFINELOCALE( 0x400a, "es-BO" ) //   Spanish     Bolivia
0320         DEFINELOCALE( 0x440a, "es-SV" ) //   Spanish     El Salvador
0321         DEFINELOCALE( 0x480a, "es-HN" ) //   Spanish     Honduras
0322         DEFINELOCALE( 0x4c0a, "es-NI" ) //   Spanish     Nicaragua
0323         DEFINELOCALE( 0x500a, "es-PR" ) //   Spanish     Puerto Rico
0324         DEFINELOCALE( 0x540a, "es-US" ) //   Spanish     United States
0325         DEFINELOCALE( 0x380a, "es-UY" ) //   Spanish     Uruguay
0326         DEFINELOCALE( 0x0c0a, "es-ES" ) //   Spanish (International Sort)    Spain
0327         DEFINELOCALE( 0x040a, "es-ES_tradnl" ) //    Spanish (Traditional Sort)  Spain
0328         DEFINELOCALE( 0x041d, "sv-SE" ) //   Swedish     Sweden
0329         DEFINELOCALE( 0x081d, "sv-FI" ) //   Swedish     Finland
0330         DEFINELOCALE( 0x045a, "syr-SY" ) //  Syriac  Syria
0331         DEFINELOCALE( 0x0428, "tg-Cyrl-TJ" ) //  Tajik   Tajikistan
0332         DEFINELOCALE( 0x085f, "tzm-Latn-DZ" ) //     Tamazight (Latin)   Algeria
0333         DEFINELOCALE( 0x0449, "ta-IN" ) //   Tamil   India
0334         DEFINELOCALE( 0x0444, "tt-RU" ) //   Tatar   Russia
0335         DEFINELOCALE( 0x044a, "te-IN" ) //   Telugu  India
0336         DEFINELOCALE( 0x041e, "th-TH" ) //   Thai    Thailand
0337         DEFINELOCALE( 0x0451, "bo-CN" ) //   Tibetan     PRC
0338         DEFINELOCALE( 0x041f, "tr-TR" ) //   Turkish     Turkey
0339         DEFINELOCALE( 0x0442, "tk-TM" ) //   Turkmen     Turkmenistan
0340         DEFINELOCALE( 0x0480, "ug-CN" ) //   Uighur  PRC
0341         DEFINELOCALE( 0x0422, "uk-UA" ) //   Ukrainian   Ukraine
0342         DEFINELOCALE( 0x042e, "wen-DE" ) //  Upper Sorbian   Germany
0343         DEFINELOCALE( 0x0420, "ur-PK" ) //   Urdu    Pakistan
0344         DEFINELOCALE( 0x0843, "uz-Cyrl-UZ" ) //  Uzbek (Cyrillic)    Uzbekistan
0345         DEFINELOCALE( 0x0443, "uz-Latn-UZ" ) //  Uzbek (Latin)   Uzbekistan
0346         DEFINELOCALE( 0x042a, "vi-VN" ) //   Vietnamese  Vietnam
0347         DEFINELOCALE( 0x0452, "cy-GB" ) //   Welsh   United Kingdom
0348         DEFINELOCALE( 0x0488, "wo-SN" ) //   Wolof   Senegal
0349         DEFINELOCALE( 0x0485, "sah-RU" ) //  Yakut   Russia
0350         DEFINELOCALE( 0x0478, "ii-CN" ) //   Yi  PRC
0351         DEFINELOCALE( 0x046a, "yo-NG" ) //   Yoruba  Nigeria
0352 
0353 #undef DEFINELOCALE
0354     }
0355 };
0356 
0357 Q_GLOBAL_STATIC( LangIdToLocaleMapping, s_LangIdToLocaleMapping )
0358 
0359 QLocale MSO::localeForLangId( int langid )
0360 {
0361     return QLocale( s_LangIdToLocaleMapping->value( langid ) );
0362 }