diff options
author | Eike Rathke <erack@redhat.com> | 2012-01-10 16:45:24 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2012-01-11 13:18:48 +0100 |
commit | a2685c5fd47396589e0767c5926a5bdb9f7b3390 (patch) | |
tree | 286c15ea2a7d9d509d5cf8254c30cf154b21d6c0 /unotools | |
parent | ee660ba9b7bf83e21a9fb9bdcb10318e152ab988 (diff) |
bumped locale data wrapper to use XLocaleData4 and provide date acceptance patterns
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/inc/unotools/localedatawrapper.hxx | 5 | ||||
-rw-r--r-- | unotools/source/i18n/localedatawrapper.cxx | 25 |
2 files changed, 27 insertions, 3 deletions
diff --git a/unotools/inc/unotools/localedatawrapper.hxx b/unotools/inc/unotools/localedatawrapper.hxx index 0bfaa9768fe0..2f4186f0044a 100644 --- a/unotools/inc/unotools/localedatawrapper.hxx +++ b/unotools/inc/unotools/localedatawrapper.hxx @@ -30,7 +30,7 @@ #define _UNOTOOLS_LOCALEDATAWRAPPER_HXX #include <tools/string.hxx> -#include <com/sun/star/i18n/XLocaleData3.hpp> +#include <com/sun/star/i18n/XLocaleData4.hpp> #include <com/sun/star/i18n/LocaleItem.hpp> #include <com/sun/star/i18n/reservedWords.hpp> #include <unotools/readwritemutexguard.hxx> @@ -67,7 +67,7 @@ class UNOTOOLS_DLLPUBLIC LocaleDataWrapper static sal_uInt8 nLocaleDataChecking; // 0:=dontknow, 1:=yes, 2:=no ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr; - ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData3 > xLD; + ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData4 > xLD; ::com::sun::star::lang::Locale aLocale; ::boost::shared_ptr< ::com::sun::star::i18n::Calendar2 > xDefaultCalendar; ::com::sun::star::i18n::LocaleDataItem aLocaleDataItem; @@ -163,6 +163,7 @@ public: ::com::sun::star::i18n::ForbiddenCharacters getForbiddenCharacters() const; ::com::sun::star::uno::Sequence< ::rtl::OUString > getReservedWord() const; ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > getAllInstalledLocaleNames() const; + ::com::sun::star::uno::Sequence< ::rtl::OUString > getDateAcceptancePatterns() const; /// same as the wrapper implementation but static static ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > getInstalledLocaleNames(); diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx index f6248e97cda1..704415d84aac 100644 --- a/unotools/source/i18n/localedatawrapper.cxx +++ b/unotools/source/i18n/localedatawrapper.cxx @@ -82,7 +82,7 @@ LocaleDataWrapper::LocaleDataWrapper( bReservedWordValid( sal_False ) { setLocale( rLocale ); - xLD = Reference< XLocaleData3 > ( + xLD = Reference< XLocaleData4 > ( intl_createInstance( xSMgr, "com.sun.star.i18n.LocaleData", "LocaleDataWrapper" ), uno::UNO_QUERY ); } @@ -1950,4 +1950,27 @@ void LocaleDataWrapper::evaluateLocaleDataChecking() return ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Calendar2 >(0); } + +// --- XLocaleData4 ---------------------------------------------------------- + +::com::sun::star::uno::Sequence< ::rtl::OUString > LocaleDataWrapper::getDateAcceptancePatterns() const +{ + try + { + if ( xLD.is() ) + return xLD->getDateAcceptancePatterns( getLocale() ); + } + catch ( Exception& e ) + { +#ifdef DBG_UTIL + rtl::OStringBuffer aMsg("getDateAcceptancePatterns: Exception caught\n"); + aMsg.append(rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8)); + DBG_ERRORFILE(aMsg.getStr()); +#else + (void)e; +#endif + } + return ::com::sun::star::uno::Sequence< ::rtl::OUString >(0); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |