sync master with lastest vba changes
[ooovba.git] / binfilter / inc / bf_svtools / syslocaleoptions.hxx
blobbf1eb81af95ab24fbb6a55349f9458fa923aca4b
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: syslocaleoptions.hxx,v $
10 * $Revision: 1.4 $
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 INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX
32 #define INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX
34 #ifndef INCLUDED_SVTDLLAPI_H
35 #include "bf_svtools/svtdllapi.h"
36 #endif
38 #ifndef _SAL_TYPES_H_
39 #include <sal/types.h>
40 #endif
41 #ifndef _RTL_USTRING_HXX_
42 #include <rtl/ustring.hxx>
43 #endif
45 #ifndef _SOLAR_H
46 #include <tools/solar.h>
47 #endif
48 #ifndef _LINK_HXX
49 #include <tools/link.hxx>
50 #endif
51 #ifndef INCLUDED_I18NPOOL_LANG_H
52 #include <i18npool/lang.h>
53 #endif
54 #ifndef _STRING_HXX
55 #include <tools/string.hxx>
56 #endif
57 #ifndef INCLUDED_SVTOOLS_OPTIONS_HXX
58 #include <bf_svtools/options.hxx>
59 #endif
61 namespace osl { class Mutex; }
63 namespace binfilter
66 // bits for broadcasting hints of changes in a SfxSimpleHint, may be combined
67 const ULONG SYSLOCALEOPTIONS_HINT_LOCALE = 0x00000001;
68 const ULONG SYSLOCALEOPTIONS_HINT_CURRENCY = 0x00000002;
70 class SvtSysLocaleOptions_Impl;
71 class SvtListener;
74 class SvtSysLocaleOptions: public Options
76 static SvtSysLocaleOptions_Impl* pOptions;
77 static sal_Int32 nRefCount;
79 static ::osl::Mutex& GetMutex();
81 public:
83 enum EOption
85 E_LOCALE,
86 E_CURRENCY
88 SvtSysLocaleOptions();
89 virtual ~SvtSysLocaleOptions();
91 // ConfigItem methods
93 /** Add a listener to react on config changes
94 which are broadcasted in a SfxSimpleHint
95 @return
96 <TRUE/> if added
97 <FALSE/> if not added
99 BOOL AddListener( SvtListener& );
100 BOOL RemoveListener( SvtListener& );
102 // config value access methods
104 /// The config string may be empty to denote the default currency of the locale
105 const ::rtl::OUString& GetCurrencyConfigString() const;
107 // convenience methods
109 /// Get currency abbreviation and locale from an USD-en-US or EUR-de-DE string
110 static void GetCurrencyAbbrevAndLanguage(
111 String& rAbbrev,
112 LanguageType& eLang,
113 const ::rtl::OUString& rConfigString );
115 void GetCurrencyAbbrevAndLanguage(
116 String& rAbbrev,
117 LanguageType& eLang ) const
119 GetCurrencyAbbrevAndLanguage( rAbbrev,
120 eLang, GetCurrencyConfigString() );
123 /** Set a link to a method to be called whenever the default currency
124 changes. This can be only one method, and normally it is the static
125 link method which calls SvNumberFormatter::SetDefaultSystemCurrency().
126 This is needed because the number formatter isn't part of the svl light
127 library, otherwise we could call SetDefaultSystemCurrency() directly.
129 static void SetCurrencyChangeLink( const Link& rLink );
130 static const Link& GetCurrencyChangeLink();
135 #endif // INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX