diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-08-01 13:50:45 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-08-02 10:36:07 +0200 |
commit | 13fac4894f752e922727c6f22c6303712e06ba12 (patch) | |
tree | 5689829e917927bb13461d91988ec99e461f1831 /filter/source/t602 | |
parent | 13cadf3fe38daa0b4cfddcfa68ec8631bc85f44a (diff) |
normalize resource locale ctor construction mechanisms
make them all the same and share std::locales more
various OModuleClient, etc, classes go away
Change-Id: I7e3ff01a69332eeacd22e3078f66a60318de62d5
Reviewed-on: https://gerrit.libreoffice.org/40634
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'filter/source/t602')
-rw-r--r-- | filter/source/t602/t602filter.cxx | 29 | ||||
-rw-r--r-- | filter/source/t602/t602filter.hxx | 7 |
2 files changed, 14 insertions, 22 deletions
diff --git a/filter/source/t602/t602filter.cxx b/filter/source/t602/t602filter.cxx index 476d3b59cdae..902edf23e8bc 100644 --- a/filter/source/t602/t602filter.cxx +++ b/filter/source/t602/t602filter.cxx @@ -886,7 +886,8 @@ Reference< XInterface > SAL_CALL T602ImportFilter_createInstance( const Referenc } T602ImportFilterDialog::T602ImportFilterDialog() - : mpResLocale(nullptr) + : maLocale(SvtSysLocale().GetUILanguageTag()) + , maResLocale(Translate::Create("flt")) { } @@ -896,15 +897,19 @@ T602ImportFilterDialog::~T602ImportFilterDialog() // XLocalizable -void SAL_CALL T602ImportFilterDialog::setLocale( const Locale& eLocale ) +void SAL_CALL T602ImportFilterDialog::setLocale(const Locale& rLocale) { - meLocale = eLocale; - initLocale(); + LanguageTag aLocale(rLocale); + if (maLocale != aLocale) + { + maLocale = aLocale; + maResLocale = Translate::Create("flt", maLocale); + } } Locale SAL_CALL T602ImportFilterDialog::getLocale() { - return meLocale; + return maLocale.getLocale(false); } bool T602ImportFilterDialog::OptionsDlg() @@ -1088,18 +1093,6 @@ bool T602ImportFilterDialog::OptionsDlg() return ret; } -void T602ImportFilterDialog::initLocale() -{ - mpResLocale.reset(new std::locale(Translate::Create("flt", LanguageTag(meLocale)))); -} - -const std::locale* T602ImportFilterDialog::getResLocale() -{ - if (!mpResLocale) - initLocale(); - return mpResLocale.get(); -} - void SAL_CALL T602ImportFilterDialog::setTitle( const OUString& ) { } @@ -1114,7 +1107,7 @@ sal_Int16 SAL_CALL T602ImportFilterDialog::execute() OUString T602ImportFilterDialog::getResStr(const char* resid) { - return Translate::get(resid, *getResLocale()); + return Translate::get(resid, maResLocale); } uno::Sequence<beans::PropertyValue> SAL_CALL T602ImportFilterDialog::getPropertyValues() diff --git a/filter/source/t602/t602filter.hxx b/filter/source/t602/t602filter.hxx index 8d81fb1b476a..1b407ed996e9 100644 --- a/filter/source/t602/t602filter.hxx +++ b/filter/source/t602/t602filter.hxx @@ -33,6 +33,7 @@ #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <cppuhelper/implbase.hxx> #include <xmloff/attrlist.hxx> +#include <i18nlangtag/languagetag.hxx> namespace T602ImportFilter { @@ -82,12 +83,10 @@ class T602ImportFilterDialog : public cppu::WeakImplHelper < css::beans::XPropertyAccess > { - css::lang::Locale meLocale; - std::unique_ptr<std::locale> mpResLocale; + LanguageTag maLocale; + std::locale maResLocale; bool OptionsDlg(); - const std::locale* getResLocale(); OUString getResStr(const char* resid); - void initLocale(); virtual ~T602ImportFilterDialog() override; |