1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef _RTL_LOCALE_H_ 29*cdf0e10cSrcweir #define _RTL_LOCALE_H_ 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <rtl/ustring.h> 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #ifdef __cplusplus 34*cdf0e10cSrcweir extern "C" { 35*cdf0e10cSrcweir #endif 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir #ifdef SAL_W32 38*cdf0e10cSrcweir # pragma pack(push, 8) 39*cdf0e10cSrcweir #elif defined(SAL_OS2) 40*cdf0e10cSrcweir # pragma pack(push, 4) 41*cdf0e10cSrcweir #endif 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir /** 44*cdf0e10cSrcweir The implementation structur of a locale. Do not create this structure 45*cdf0e10cSrcweir direct. Only use the functions rtl_locale_register and 46*cdf0e10cSrcweir rtl_locale_setDefault. The strings Language, Country and Variant 47*cdf0e10cSrcweir are constants, so it is not necessary to acquire and release them. 48*cdf0e10cSrcweir */ 49*cdf0e10cSrcweir typedef struct _rtl_Locale 50*cdf0e10cSrcweir { 51*cdf0e10cSrcweir /** 52*cdf0e10cSrcweir Lowercase two-letter ISO 639-1 or three-letter ISO 639-3 code. 53*cdf0e10cSrcweir */ 54*cdf0e10cSrcweir rtl_uString * Language; 55*cdf0e10cSrcweir /** 56*cdf0e10cSrcweir uppercase two-letter ISO-3166 code. 57*cdf0e10cSrcweir */ 58*cdf0e10cSrcweir rtl_uString * Country; 59*cdf0e10cSrcweir /** 60*cdf0e10cSrcweir Lowercase vendor and browser specific code. 61*cdf0e10cSrcweir */ 62*cdf0e10cSrcweir rtl_uString * Variant; 63*cdf0e10cSrcweir /** 64*cdf0e10cSrcweir The merged hash value of the Language, Country and Variant strings. 65*cdf0e10cSrcweir */ 66*cdf0e10cSrcweir sal_Int32 HashCode; 67*cdf0e10cSrcweir } rtl_Locale; 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir #if defined( SAL_W32) || defined(SAL_OS2) 70*cdf0e10cSrcweir #pragma pack(pop) 71*cdf0e10cSrcweir #endif 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir /** 74*cdf0e10cSrcweir Register a locale from language, country and variant. 75*cdf0e10cSrcweir @param language lowercase two-letter ISO 639-1 or three-letter ISO 639-3 code. 76*cdf0e10cSrcweir @param country uppercase two-letter ISO-3166 code. May be null. 77*cdf0e10cSrcweir @param variant vendor and browser specific code. May be null. 78*cdf0e10cSrcweir */ 79*cdf0e10cSrcweir rtl_Locale * SAL_CALL rtl_locale_register( const sal_Unicode * language, const sal_Unicode * country, const sal_Unicode * variant ); 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir /** 82*cdf0e10cSrcweir Common method of getting the current default Locale. 83*cdf0e10cSrcweir Used for the presentation: menus, dialogs, etc. 84*cdf0e10cSrcweir Generally set once when your applet or application is initialized, 85*cdf0e10cSrcweir then never reset. (If you do reset the default locale, you 86*cdf0e10cSrcweir probably want to reload your GUI, so that the change is reflected 87*cdf0e10cSrcweir in your interface.) 88*cdf0e10cSrcweir <p>More advanced programs will allow users to use different locales 89*cdf0e10cSrcweir for different fields, e.g. in a spreadsheet. 90*cdf0e10cSrcweir <BR>Note that the initial setting will match the host system. 91*cdf0e10cSrcweir */ 92*cdf0e10cSrcweir rtl_Locale * SAL_CALL rtl_locale_getDefault(); 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir /** 95*cdf0e10cSrcweir Sets the default. 96*cdf0e10cSrcweir Normally set once at the beginning of applet or application, 97*cdf0e10cSrcweir then never reset. <code>setDefault</code> does not reset the host locale. 98*cdf0e10cSrcweir @param language lowercase two-letter ISO 639-1 or three-letter ISO 639-3 code. 99*cdf0e10cSrcweir @param country uppercase two-letter ISO-3166 code. 100*cdf0e10cSrcweir @param variant vendor and browser specific code. See class description. 101*cdf0e10cSrcweir */ 102*cdf0e10cSrcweir void SAL_CALL rtl_locale_setDefault( const sal_Unicode * language, const sal_Unicode * country, const sal_Unicode * variant ); 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir /** 105*cdf0e10cSrcweir Getter for programmatic name of field, 106*cdf0e10cSrcweir a lowercased two-letter ISO 639-1 or three-letter ISO 639-3 code. 107*cdf0e10cSrcweir @see #getDisplayLanguage 108*cdf0e10cSrcweir */ 109*cdf0e10cSrcweir rtl_uString * SAL_CALL rtl_locale_getLanguage( rtl_Locale * This ); 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir /** 112*cdf0e10cSrcweir Getter for programmatic name of field, 113*cdf0e10cSrcweir an uppercased two-letter ISO-3166 code. 114*cdf0e10cSrcweir @see #getDisplayCountry 115*cdf0e10cSrcweir */ 116*cdf0e10cSrcweir rtl_uString * SAL_CALL rtl_locale_getCountry( rtl_Locale * This ); 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir /** 119*cdf0e10cSrcweir Getter for programmatic name of field. 120*cdf0e10cSrcweir @see #getDisplayVariant 121*cdf0e10cSrcweir */ 122*cdf0e10cSrcweir rtl_uString * SAL_CALL rtl_locale_getVariant( rtl_Locale * This ); 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir /** 125*cdf0e10cSrcweir Returns the hash code of the locale This. 126*cdf0e10cSrcweir */ 127*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_locale_hashCode( rtl_Locale * This ); 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir /** 130*cdf0e10cSrcweir Returns true if the locals are equal, otherwis false. 131*cdf0e10cSrcweir */ 132*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_locale_equals( rtl_Locale * This, rtl_Locale * obj ); 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir #ifdef __cplusplus 135*cdf0e10cSrcweir } 136*cdf0e10cSrcweir #endif 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir #endif /* _RTL_LOCALE_H_ */ 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir 141