diff options
author | Eike Rathke <erack@redhat.com> | 2012-08-29 20:49:01 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2012-08-29 21:17:46 +0200 |
commit | cda156257003df673fa853a0a5ffcd1cb4848d43 (patch) | |
tree | 5fcd7aa0c1c8e5de2da387e069423530500b15b4 /unotools/inc | |
parent | 332451bea5ebe08136de2d51e0e29cac88f89e8c (diff) |
resolved fdo#52240 fdo#52137 fdo#52288 user editable date patterns
Implemented user editable date acceptance patterns.
The introduction of strict date parsing using locale dependent date
acceptance patterns in 3.6.0 wasn't always welcomed. Besides that not
every locale had patterns for incomplete (only day and month) date
input, users also complained about not being able to key in dates on
numeric keypads if the locale's date separator wasn't '/' or '-'
This commit implements a "Date acceptance patterns" edit field under
Tools->Options->LanguageSettings->Languages that follows the selected
locale and enables the user to add patterns.
Example de-DE locale:
* default patterns: D.M.Y;D.M.
* to enable additional input on numeric keypad: D.M.Y;D.M.;D-M-Y;D-M
* if 3-4 shall not result in a date, D-M- could be used instead of D-M
* note that to enter an ISO 8601 Y-M-D date with a D-M-Y pattern
active one needs to enter a year >31 or with at least 3 digits, e.g.
011
Change-Id: I9e20fcb168578b02d0f0248a0e209942e0f27113
Diffstat (limited to 'unotools/inc')
-rw-r--r-- | unotools/inc/unotools/localedatawrapper.hxx | 6 | ||||
-rw-r--r-- | unotools/inc/unotools/syslocaleoptions.hxx | 18 |
2 files changed, 19 insertions, 5 deletions
diff --git a/unotools/inc/unotools/localedatawrapper.hxx b/unotools/inc/unotools/localedatawrapper.hxx index 4391719eb7fc..1b6e95beae6d 100644 --- a/unotools/inc/unotools/localedatawrapper.hxx +++ b/unotools/inc/unotools/localedatawrapper.hxx @@ -62,6 +62,7 @@ class UNOTOOLS_DLLPUBLIC LocaleDataWrapper : private boost::noncopyable ::boost::shared_ptr< ::com::sun::star::i18n::Calendar2 > xDefaultCalendar; ::com::sun::star::i18n::LocaleDataItem aLocaleDataItem; ::com::sun::star::uno::Sequence< ::rtl::OUString > aReservedWordSeq; + ::com::sun::star::uno::Sequence< ::rtl::OUString > aDateAcceptancePatterns; ::com::sun::star::uno::Sequence< sal_Int32 > aGrouping; // cached items rtl::OUString aLocaleItem[::com::sun::star::i18n::LocaleItem::COUNT]; @@ -148,6 +149,11 @@ public: ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > getAllInstalledLocaleNames() const; ::com::sun::star::uno::Sequence< ::rtl::OUString > getDateAcceptancePatterns() const; + /** Override locale's date acceptance patterns. + An empty sequence resets the patterns to the locale's pattern sequence. + */ + void setDateAcceptancePatterns( const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rPatterns ); + /// same as the wrapper implementation but static static ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > getInstalledLocaleNames(); diff --git a/unotools/inc/unotools/syslocaleoptions.hxx b/unotools/inc/unotools/syslocaleoptions.hxx index 6db9a0fd4349..1c62ad809492 100644 --- a/unotools/inc/unotools/syslocaleoptions.hxx +++ b/unotools/inc/unotools/syslocaleoptions.hxx @@ -31,10 +31,11 @@ #include <com/sun/star/lang/Locale.hpp> // bits for broadcasting hints of changes in a SfxSimpleHint, may be combined -const sal_uLong SYSLOCALEOPTIONS_HINT_LOCALE = 0x00000001; -const sal_uLong SYSLOCALEOPTIONS_HINT_CURRENCY = 0x00000002; -const sal_uLong SYSLOCALEOPTIONS_HINT_UILOCALE = 0x00000004; -const sal_uLong SYSLOCALEOPTIONS_HINT_DECSEP = 0x00000008; +const sal_uLong SYSLOCALEOPTIONS_HINT_LOCALE = 0x00000001; +const sal_uLong SYSLOCALEOPTIONS_HINT_CURRENCY = 0x00000002; +const sal_uLong SYSLOCALEOPTIONS_HINT_UILOCALE = 0x00000004; +const sal_uLong SYSLOCALEOPTIONS_HINT_DECSEP = 0x00000008; +const sal_uLong SYSLOCALEOPTIONS_HINT_DATEPATTERNS = 0x00000010; class SvtSysLocaleOptions_Impl; class SvtListener; @@ -54,7 +55,8 @@ public: { E_LOCALE, E_UILOCALE, - E_CURRENCY + E_CURRENCY, + E_DATEPATTERNS }; SvtSysLocaleOptions(); virtual ~SvtSysLocaleOptions(); @@ -108,6 +110,12 @@ public: /// The config string may be empty to denote the default currency of the locale const ::rtl::OUString& GetCurrencyConfigString() const; void SetCurrencyConfigString( const ::rtl::OUString& rStr ); + + /** The config string may be empty to denote the default + DateAcceptancePatterns of the locale */ + const ::rtl::OUString& GetDatePatternsConfigString() const; + void SetDatePatternsConfigString( const ::rtl::OUString& rStr ); + // determine whether the decimal separator defined in the keyboard layout is used // or the one approriate to the locale sal_Bool IsDecimalSeparatorAsLocale() const; |