File indexing completed on 2025-01-12 10:34:20

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