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