From a2685c5fd47396589e0767c5926a5bdb9f7b3390 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Tue, 10 Jan 2012 16:45:24 +0100 Subject: bumped locale data wrapper to use XLocaleData4 and provide date acceptance patterns --- unotools/inc/unotools/localedatawrapper.hxx | 5 +++-- unotools/source/i18n/localedatawrapper.cxx | 25 ++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 3 deletions(-) (limited to 'unotools') 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 -#include +#include #include #include #include @@ -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: */ -- cgit