1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // ============================================================================
25 
26 #ifndef INCLUDED_SVX_COUNTRYID_HXX
27 #define INCLUDED_SVX_COUNTRYID_HXX
28 
29 #include <sal/types.h>
30 #include <i18npool/lang.h>
31 #include "filter/msfilter/msfilterdllapi.h"
32 
33 // ----------------------------------------------------------------------------
34 
35 namespace msfilter {
36 
37 // Windows Country IDs ========================================================
38 
39 /** Represents a Windows country ID.
40 
41     The country IDs used in Windows are equal to the international calling
42     code of each country, i.e. the code 353 represents Ireland (+353).
43 
44     ATTENTION: These country codes are not supposed to be used anywhere in core
45     structures! They shall ONLY be used in the import/export filters for
46     Microsoft Office documents!
47  */
48 typedef sal_uInt16 CountryId;
49 
50 const CountryId COUNTRY_DONTKNOW            =   0;
51 const CountryId COUNTRY_USA                 =   1;
52 const CountryId COUNTRY_DOMINICAN_REPUBLIC  =   1;  // NANP
53 const CountryId COUNTRY_GUAM                =   1;  // NANP
54 const CountryId COUNTRY_JAMAICA             =   1;  // NANP
55 const CountryId COUNTRY_PUERTO_RICO         =   1;  // NANP
56 const CountryId COUNTRY_TRINIDAD_Y_TOBAGO   =   1;  // NANP
57 const CountryId COUNTRY_CANADA              =   2;
58 const CountryId COUNTRY_RUSSIA              =   7;
59 const CountryId COUNTRY_KAZAKHSTAN          =   7;  // no own ID
60 const CountryId COUNTRY_TATARSTAN           =   7;  // no own ID
61 const CountryId COUNTRY_EGYPT               =  20;
62 const CountryId COUNTRY_SOUTH_AFRICA        =  27;
63 const CountryId COUNTRY_GREECE              =  30;
64 const CountryId COUNTRY_NETHERLANDS         =  31;
65 const CountryId COUNTRY_BELGIUM             =  32;
66 const CountryId COUNTRY_FRANCE              =  33;
67 const CountryId COUNTRY_SPAIN               =  34;
68 const CountryId COUNTRY_HUNGARY             =  36;
69 const CountryId COUNTRY_ITALY               =  39;
70 const CountryId COUNTRY_ROMANIA             =  40;
71 const CountryId COUNTRY_SWITZERLAND         =  41;
72 const CountryId COUNTRY_AUSTRIA             =  43;
73 const CountryId COUNTRY_UNITED_KINGDOM      =  44;
74 const CountryId COUNTRY_DENMARK             =  45;
75 const CountryId COUNTRY_SWEDEN              =  46;
76 const CountryId COUNTRY_NORWAY              =  47;
77 const CountryId COUNTRY_POLAND              =  48;
78 const CountryId COUNTRY_GERMANY             =  49;
79 const CountryId COUNTRY_PERU                =  51;
80 const CountryId COUNTRY_MEXICO              =  52;
81 const CountryId COUNTRY_CUBA                =  53;
82 const CountryId COUNTRY_ARGENTINIA          =  54;
83 const CountryId COUNTRY_BRAZIL              =  55;
84 const CountryId COUNTRY_CHILE               =  56;
85 const CountryId COUNTRY_COLOMBIA            =  57;
86 const CountryId COUNTRY_VENEZUELA           =  58;
87 const CountryId COUNTRY_MALAYSIA            =  60;
88 const CountryId COUNTRY_AUSTRALIA           =  61;
89 const CountryId COUNTRY_INDONESIA           =  62;
90 const CountryId COUNTRY_PHILIPPINES         =  63;
91 const CountryId COUNTRY_NEW_ZEALAND         =  64;
92 const CountryId COUNTRY_SINGAPORE           =  65;
93 const CountryId COUNTRY_THAILAND            =  66;
94 const CountryId COUNTRY_JAPAN               =  81;
95 const CountryId COUNTRY_SOUTH_KOREA         =  82;
96 const CountryId COUNTRY_VIET_NAM            =  84;
97 const CountryId COUNTRY_PR_CHINA            =  86;
98 const CountryId COUNTRY_TIBET               =  86;  // no own ID
99 const CountryId COUNTRY_TURKEY              =  90;
100 const CountryId COUNTRY_INDIA               =  91;
101 const CountryId COUNTRY_PAKISTAN            =  92;
102 const CountryId COUNTRY_AFGHANISTAN         =  93;
103 const CountryId COUNTRY_SRI_LANKA           =  94;
104 const CountryId COUNTRY_MYANMAR             =  95;
105 const CountryId COUNTRY_MOROCCO             = 212;
106 const CountryId COUNTRY_ALGERIA             = 213;
107 const CountryId COUNTRY_TUNISIA             = 216;
108 const CountryId COUNTRY_LIBYA               = 218;
109 const CountryId COUNTRY_GAMBIA              = 220;
110 const CountryId COUNTRY_SENEGAL             = 221;
111 const CountryId COUNTRY_MAURITANIA          = 222;
112 const CountryId COUNTRY_MALI                = 223;
113 const CountryId COUNTRY_GUINEA              = 224;
114 const CountryId COUNTRY_COTE_D_IVOIRE       = 225;
115 const CountryId COUNTRY_BURKINA_FARSO       = 226;
116 const CountryId COUNTRY_NIGER               = 227;
117 const CountryId COUNTRY_TOGO                = 228;
118 const CountryId COUNTRY_BENIN               = 229;
119 const CountryId COUNTRY_MAURITIUS           = 230;
120 const CountryId COUNTRY_LIBERIA             = 231;
121 const CountryId COUNTRY_SIERRA_LEONE        = 232;
122 const CountryId COUNTRY_GHANA               = 233;
123 const CountryId COUNTRY_NIGERIA             = 234;
124 const CountryId COUNTRY_CHAD                = 235;
125 const CountryId COUNTRY_CENTRAL_AFR_REP     = 236;
126 const CountryId COUNTRY_CAMEROON            = 237;
127 const CountryId COUNTRY_CAPE_VERDE          = 238;
128 const CountryId COUNTRY_SAO_TOME            = 239;
129 const CountryId COUNTRY_EQUATORIAL_GUINEA   = 240;
130 const CountryId COUNTRY_GABON               = 241;
131 const CountryId COUNTRY_CONGO               = 242;
132 const CountryId COUNTRY_ZAIRE               = 243;
133 const CountryId COUNTRY_ANGOLA              = 244;
134 const CountryId COUNTRY_GUINEA_BISSAU       = 245;
135 const CountryId COUNTRY_DIEGO_GARCIA        = 246;
136 const CountryId COUNTRY_ASCENSION_ISLAND    = 247;
137 const CountryId COUNTRY_SEYCHELLES          = 248;
138 const CountryId COUNTRY_SUDAN               = 249;
139 const CountryId COUNTRY_RWANDA              = 250;
140 const CountryId COUNTRY_ETHIOPIA            = 251;
141 const CountryId COUNTRY_SOMALIA             = 252;
142 const CountryId COUNTRY_DJIBOUTI            = 253;
143 const CountryId COUNTRY_KENYA               = 254;
144 const CountryId COUNTRY_TANZANIA            = 255;
145 const CountryId COUNTRY_UGANDA              = 256;
146 const CountryId COUNTRY_BURUNDI             = 257;
147 const CountryId COUNTRY_MOZAMBIQUE          = 258;
148 const CountryId COUNTRY_ZANZIBAR            = 259;
149 const CountryId COUNTRY_ZAMBIA              = 260;
150 const CountryId COUNTRY_MADAGASKAR          = 261;
151 const CountryId COUNTRY_REUNION             = 262;
152 const CountryId COUNTRY_ZIMBABWE            = 263;
153 const CountryId COUNTRY_NAMIBIA             = 264;
154 const CountryId COUNTRY_MALAWI              = 265;
155 const CountryId COUNTRY_LESOTHO             = 266;
156 const CountryId COUNTRY_BOTSWANA            = 267;
157 const CountryId COUNTRY_SWAZILAND           = 268;
158 const CountryId COUNTRY_COMOROS_MAYOTTE     = 269;
159 const CountryId COUNTRY_ST_HELENA           = 290;
160 const CountryId COUNTRY_ERITREA             = 291;
161 const CountryId COUNTRY_ARUBA               = 297;
162 const CountryId COUNTRY_FAEROE_ISLANDS      = 298;
163 const CountryId COUNTRY_GREEN_ISLAND        = 299;
164 const CountryId COUNTRY_GIBRALTAR           = 350;
165 const CountryId COUNTRY_PORTUGAL            = 351;
166 const CountryId COUNTRY_LUXEMBOURG          = 352;
167 const CountryId COUNTRY_IRELAND             = 353;
168 const CountryId COUNTRY_ICELAND             = 354;
169 const CountryId COUNTRY_ALBANIA             = 355;
170 const CountryId COUNTRY_MALTA               = 356;
171 const CountryId COUNTRY_CYPRUS              = 357;
172 const CountryId COUNTRY_FINLAND             = 358;
173 const CountryId COUNTRY_BULGARIA            = 359;
174 const CountryId COUNTRY_LITHUANIA           = 370;
175 const CountryId COUNTRY_LATVIA              = 371;
176 const CountryId COUNTRY_ESTONIA             = 372;
177 const CountryId COUNTRY_MOLDOVA             = 373;
178 const CountryId COUNTRY_ARMENIA             = 374;
179 const CountryId COUNTRY_BELARUS             = 375;
180 const CountryId COUNTRY_ANDORRA             = 376;
181 const CountryId COUNTRY_MONACO              = 377;
182 const CountryId COUNTRY_SAN_MARINO          = 378;
183 const CountryId COUNTRY_VATICAN_CITY        = 379;
184 const CountryId COUNTRY_UKRAINE             = 380;
185 const CountryId COUNTRY_SERBIA              = 381;
186 const CountryId COUNTRY_CROATIA             = 385;
187 const CountryId COUNTRY_SLOVENIA            = 386;
188 const CountryId COUNTRY_BOSNIA              = 387;
189 const CountryId COUNTRY_MACEDONIA           = 389;
190 const CountryId COUNTRY_CZECH               = 420;
191 const CountryId COUNTRY_SLOVAK              = 421;
192 const CountryId COUNTRY_LIECHTENSTEIN       = 423;
193 const CountryId COUNTRY_FALKLAND_ISLANDS    = 500;
194 const CountryId COUNTRY_BELIZE              = 501;
195 const CountryId COUNTRY_GUATEMALA           = 502;
196 const CountryId COUNTRY_EL_SALVADOR         = 503;
197 const CountryId COUNTRY_HONDURAS            = 504;
198 const CountryId COUNTRY_NICARAGUA           = 505;
199 const CountryId COUNTRY_COSTA_RICA          = 506;
200 const CountryId COUNTRY_PANAMA              = 507;
201 const CountryId COUNTRY_ST_PIERRE           = 508;
202 const CountryId COUNTRY_HAITI               = 509;
203 const CountryId COUNTRY_GUADELOUPE          = 590;
204 const CountryId COUNTRY_BOLIVIA             = 591;
205 const CountryId COUNTRY_GUYANA              = 592;
206 const CountryId COUNTRY_ECUADOR             = 593;
207 const CountryId COUNTRY_FRENCH_GUIANA       = 594;
208 const CountryId COUNTRY_PARAGUAY            = 595;
209 const CountryId COUNTRY_MARTINIQUE          = 596;
210 const CountryId COUNTRY_SURINAME            = 597;
211 const CountryId COUNTRY_URUGUAY             = 598;
212 const CountryId COUNTRY_NETHERL_ANTILLES    = 599;
213 const CountryId COUNTRY_EAST_TIMOR          = 670;
214 const CountryId COUNTRY_ANTARCTICA          = 672;
215 const CountryId COUNTRY_BRUNEI_DARUSSALAM   = 673;
216 const CountryId COUNTRY_NARUPU              = 674;
217 const CountryId COUNTRY_PAPUA_NEW_GUINEA    = 675;
218 const CountryId COUNTRY_TONGA               = 676;
219 const CountryId COUNTRY_SOLOMON_ISLANDS     = 677;
220 const CountryId COUNTRY_VANUATU             = 678;
221 const CountryId COUNTRY_FIJI                = 679;
222 const CountryId COUNTRY_PALAU               = 680;
223 const CountryId COUNTRY_WALLIS_AND_FUTUNA   = 681;
224 const CountryId COUNTRY_COOK_ISLANDS        = 682;
225 const CountryId COUNTRY_NIUE_ISLAND         = 683;
226 const CountryId COUNTRY_AMERICAN_SAMOA      = 684;
227 const CountryId COUNTRY_WESTERN_SAMOA       = 685;
228 const CountryId COUNTRY_KIRIBATI            = 686;
229 const CountryId COUNTRY_NEW_CALEDONIA       = 687;
230 const CountryId COUNTRY_TUVALU              = 688;
231 const CountryId COUNTRY_FRENCH_POLYNESIA    = 689;
232 const CountryId COUNTRY_TOKELAU             = 690;
233 const CountryId COUNTRY_MICRONESIA          = 691;
234 const CountryId COUNTRY_MARSHALL_ISLANDS    = 692;
235 const CountryId COUNTRY_NORTH_KOREA         = 850;
236 const CountryId COUNTRY_HONG_KONG           = 852;
237 const CountryId COUNTRY_MACAU               = 853;
238 const CountryId COUNTRY_CAMBODIA            = 855;
239 const CountryId COUNTRY_LAOS                = 856;
240 const CountryId COUNTRY_BANGLADESH          = 880;
241 const CountryId COUNTRY_TAIWAN              = 886;
242 const CountryId COUNTRY_MALDIVES            = 960;
243 const CountryId COUNTRY_LEBANON             = 961;
244 const CountryId COUNTRY_JORDAN              = 962;
245 const CountryId COUNTRY_SYRIA               = 963;
246 const CountryId COUNTRY_IRAQ                = 964;
247 const CountryId COUNTRY_KUWAIT              = 965;
248 const CountryId COUNTRY_SAUDI_ARABIA        = 966;
249 const CountryId COUNTRY_YEMEN               = 967;
250 const CountryId COUNTRY_OMAN                = 968;
251 const CountryId COUNTRY_PALESTINE           = 970;
252 const CountryId COUNTRY_UAE                 = 971;
253 const CountryId COUNTRY_ISRAEL              = 972;
254 const CountryId COUNTRY_BAHRAIN             = 973;
255 const CountryId COUNTRY_QATAR               = 974;
256 const CountryId COUNTRY_BHUTAN              = 975;
257 const CountryId COUNTRY_MONGOLIA            = 976;
258 const CountryId COUNTRY_NEPAL               = 977;
259 const CountryId COUNTRY_IRAN                = 981;
260 const CountryId COUNTRY_TAJIKISTAN          = 992;
261 const CountryId COUNTRY_TURKMENISTAN        = 993;
262 const CountryId COUNTRY_AZERBAIJAN          = 994;
263 const CountryId COUNTRY_GEORGIA             = 995;
264 const CountryId COUNTRY_KYRGYZSTAN          = 996;
265 const CountryId COUNTRY_UZBEKISTAN          = 998;
266 
267 // Country ID <-> Language type conversion ====================================
268 
269 /** Converts a language type to a Windows country ID.
270 
271     The function regards the sub type of the passed language, and tries to
272     return the appropriate country, i.e. COUNTRY_IRELAND for
273     LANGUAGE_ENGLISH_EIRE.
274 
275     A few countries do not have an own associated country ID. Most of these
276     countries are mapped to another related country, i.e. Kazakhstan is
277     mapped to Russia.
278 
279     If no country can be found, the value COUNTRY_DONTKNOW will be returned.
280 
281     @param eLanguage
282         A language type, defined in tools/lang.hxx.
283 
284     @return
285         The best Windows country ID for the passed language type, or
286         COUNTRY_DONTKNOW on error.
287  */
288 MSFILTER_DLLPUBLIC CountryId ConvertLanguageToCountry( LanguageType eLanguage );
289 
290 /** Converts a Windows country ID to a language type.
291 
292     The function returns the most used language for the passed country
293     (hopefully), i.e. LANGUAGE_ENGLISH_EIRE for COUNTRY_IRELAND.
294 
295     If the passed country ID is not valid, the value LANGUAGE_DONTKNOW will be
296     returned.
297 
298     @param eCountry
299         A Windows country ID, defined above.
300 
301     @return
302         The most used language type in the passed country, or LANGUAGE_DONTKNOW
303         on error.
304  */
305 MSFILTER_DLLPUBLIC LanguageType ConvertCountryToLanguage( CountryId eCountry );
306 
307 // ============================================================================
308 
309 } // namespace svx
310 
311 // ============================================================================
312 
313 #endif
314 
315