diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-10-16 00:05:16 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-10-16 00:05:16 +0200 |
commit | ad482351a6c12cddb06575f6a9a00ec1b72d92fb (patch) | |
tree | e97f35e966aef21423e70f325a66943664ed62a9 /unotools/inc | |
parent | 9a4d0581c72653e60562d1b8e2121772d21f8a9e (diff) |
#i103496#: split svtools; improve ConfitItems
Diffstat (limited to 'unotools/inc')
-rw-r--r-- | unotools/inc/unotools/configitem.hxx | 4 | ||||
-rw-r--r-- | unotools/inc/unotools/options.hxx | 26 | ||||
-rw-r--r-- | unotools/inc/unotools/syslocale.hxx | 6 | ||||
-rw-r--r-- | unotools/inc/unotools/syslocaleoptions.hxx | 15 |
4 files changed, 38 insertions, 13 deletions
diff --git a/unotools/inc/unotools/configitem.hxx b/unotools/inc/unotools/configitem.hxx index 0e938cedd47f..3cc0dc1b079e 100644 --- a/unotools/inc/unotools/configitem.hxx +++ b/unotools/inc/unotools/configitem.hxx @@ -186,7 +186,7 @@ namespace utl /** is called from the ConfigManager before application ends of from the PropertyChangeListener if the sub tree broadcasts changes. */ - virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames); + virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames)=0; /** is called from the ConfigManager if it is destroyed before the ConfigItem. */ void ReleaseConfigMgr(); @@ -201,7 +201,7 @@ namespace utl sal_Bool IsModified() const; /** writes the changed values into the sub tree. Always called in the Dtor of the derived class. */ - virtual void Commit(); + virtual void Commit()=0; sal_Bool IsInValueChange() const; diff --git a/unotools/inc/unotools/options.hxx b/unotools/inc/unotools/options.hxx index ca8d70657f0f..f7254589150d 100644 --- a/unotools/inc/unotools/options.hxx +++ b/unotools/inc/unotools/options.hxx @@ -34,26 +34,40 @@ #include "sal/config.h" #include "unotools/unotoolsdllapi.h" +/* + The class utl::detail::Options provides a kind of multiplexer. It implements a ConfigurationListener + that is usually registered at a ConfigItem class. At the same time it implements a ConfigurationBroadcaster + that allows further ("external") listeners to register. + Once the class deriving from Options is notified about + configuration changes by the ConfigItem if its content has been changed by calling some of its methods, + a call of the Options::NotifyListeners() method will send out notifications to all external listeners. +*/ + namespace utl { class ConfigurationBroadcaster; class IMPL_ConfigurationListenerList; + // interface for configuration listener class UNOTOOLS_DLLPUBLIC ConfigurationListener { public: - virtual void ConfigurationChanged( ConfigurationBroadcaster* ) = 0; + virtual void ConfigurationChanged( ConfigurationBroadcaster* p, sal_uInt32 nHint=0 ) = 0; }; + // complete broadcasting implementation class UNOTOOLS_DLLPUBLIC ConfigurationBroadcaster { IMPL_ConfigurationListenerList* mpList; sal_Int32 m_nBroadcastBlocked; // broadcast only if this is 0 + sal_uInt32 m_nBlockedHint; public: void AddListener( utl::ConfigurationListener* pListener ); void RemoveListener( utl::ConfigurationListener* pListener ); - void NotifyListeners(); + + // notify listeners; nHint is an implementation detail of the particular class deriving from ConfigurationBroadcaster + void NotifyListeners( sal_uInt32 nHint ); ConfigurationBroadcaster(); ~ConfigurationBroadcaster(); void BlockBroadcasts( bool bBlock ); @@ -63,7 +77,9 @@ namespace detail { // A base class for the various option classes supported by // unotools/source/config/itemholderbase.hxx (which must be public, as it is -// shared between svl and svt): +// shared between unotools, svl and svt) +// It also provides an implementation for a Configuration Listener and inherits a broadcaster implementation + class UNOTOOLS_DLLPUBLIC Options : public utl::ConfigurationBroadcaster, public utl::ConfigurationListener { public: @@ -74,7 +90,9 @@ public: private: UNOTOOLS_DLLPRIVATE Options(Options &); // not defined UNOTOOLS_DLLPRIVATE void operator =(Options &); // not defined - virtual void ConfigurationChanged( utl::ConfigurationBroadcaster* ); + +protected: + virtual void ConfigurationChanged( ::utl::ConfigurationBroadcaster* p, sal_uInt32 nHint=0 ); }; } } diff --git a/unotools/inc/unotools/syslocale.hxx b/unotools/inc/unotools/syslocale.hxx index 87482abbb117..adce66b7e84a 100644 --- a/unotools/inc/unotools/syslocale.hxx +++ b/unotools/inc/unotools/syslocale.hxx @@ -28,8 +28,8 @@ * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_SYSLOCALE_HXX -#define INCLUDED_SVTOOLS_SYSLOCALE_HXX +#ifndef INCLUDED_UNOTOOLS_SYSLOCALE_HXX +#define INCLUDED_UNOTOOLS_SYSLOCALE_HXX #include "unotools/unotoolsdllapi.h" #include <unotools/localedatawrapper.hxx> @@ -77,6 +77,8 @@ public: SvtSysLocaleOptions& GetOptions() const; com::sun::star::lang::Locale GetLocale() const; LanguageType GetLanguage() const; + com::sun::star::lang::Locale GetUILocale() const; + LanguageType GetUILanguage() const; }; #endif // INCLUDED_SVTOOLS_SYSLOCALE_HXX diff --git a/unotools/inc/unotools/syslocaleoptions.hxx b/unotools/inc/unotools/syslocaleoptions.hxx index 6c48c83a8500..2da102c161cc 100644 --- a/unotools/inc/unotools/syslocaleoptions.hxx +++ b/unotools/inc/unotools/syslocaleoptions.hxx @@ -43,6 +43,8 @@ // bits for broadcasting hints of changes in a SfxSimpleHint, may be combined const ULONG SYSLOCALEOPTIONS_HINT_LOCALE = 0x00000001; const ULONG SYSLOCALEOPTIONS_HINT_CURRENCY = 0x00000002; +const ULONG SYSLOCALEOPTIONS_HINT_UILOCALE = 0x00000004; +const ULONG SYSLOCALEOPTIONS_HINT_DECSEP = 0x00000008; class SvtSysLocaleOptions_Impl; class SvtListener; @@ -54,12 +56,14 @@ class UNOTOOLS_DLLPUBLIC SvtSysLocaleOptions: public utl::detail::Options static sal_Int32 nRefCount; UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetMutex(); + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster* p, sal_uInt32 nHint ); public: enum EOption { E_LOCALE, + E_UILOCALE, E_CURRENCY }; SvtSysLocaleOptions(); @@ -102,6 +106,12 @@ public: /// The config string may be empty to denote the SYSTEM locale const ::rtl::OUString& GetLocaleConfigString() const; void SetLocaleConfigString( const ::rtl::OUString& rStr ); + com::sun::star::lang::Locale GetLocale() const; + + /// The config string may be empty to denote the SYSTEM locale + const ::rtl::OUString& GetUILocaleConfigString() const; + void SetUILocaleConfigString( const ::rtl::OUString& rStr ); + com::sun::star::lang::Locale GetUILocale() const; /// The config string may be empty to denote the default currency of the locale const ::rtl::OUString& GetCurrencyConfigString() const; @@ -113,11 +123,6 @@ public: // convenience methods - /** Get the LanguageType of the current locale, may be LANGUAGE_SYSTEM if - LocaleConfigString is empty. If you need the real locale used in the - application, call Application::GetSettings().GetLanguage() instead */ - LanguageType GetLocaleLanguageType() const; - /// Get currency abbreviation and locale from an USD-en-US or EUR-de-DE string static void GetCurrencyAbbrevAndLanguage( String& rAbbrev, |