summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-07-17 21:59:38 +0200
committerAron Budea <aron.budea@collabora.com>2017-07-25 15:59:44 +0200
commit3274eae5ba8bc02ab6f39ee0b3b95880547aa5b5 (patch)
tree0e62efb42d5eb61f69198a72d17342ed3899ec2b
parent93075f4df21a7d5202703e813be60f1b46996942 (diff)
Defer also loading of the English CalendarWrapper, tdf#109045 follow-up
Always constructing the en-US CalendarWrapper defeats the original intention that not for every construction of SvNumberFormatter a calendar is needed, plus if no en-US is requested constructing such calendar is just wasted. Since commit 2a22696546ace75c38a72ad13f7383aedd00e06a Date: Mon Jul 10 15:56:32 2017 +0200 tdf#109045: store en calendar separately in OnDemandCalendarWrapper Change-Id: I06e13754f03fc1fe4fbf48b76ccb82c917606480 (cherry picked from commit 21394b08475d1d869aa62c1dbb46c3dcc93ae3f0) Reviewed-on: https://gerrit.libreoffice.org/40094 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit edc2ba3bddf2d9a4c72a4ca90579c66f229a6a47) Reviewed-on: https://gerrit.libreoffice.org/40414 Reviewed-by: Aron Budea <aron.budea@collabora.com> Tested-by: Aron Budea <aron.budea@collabora.com>
-rw-r--r--include/svl/ondemand.hxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/include/svl/ondemand.hxx b/include/svl/ondemand.hxx
index 8482040c2950..10ffe99ff05d 100644
--- a/include/svl/ondemand.hxx
+++ b/include/svl/ondemand.hxx
@@ -129,7 +129,7 @@ public:
const LocaleDataWrapper& operator*() const { return *get(); }
};
-/** Load a calendar only if it's needed. Keep calendar for "en" locale
+/** Load a calendar only if it's needed. Keep calendar for "en-US" locale
separately, as there can be alternation between locale dependent and
locale independent formats.
SvNumberformatter uses it upon switching locales.
@@ -143,7 +143,7 @@ class OnDemandCalendarWrapper
css::lang::Locale aEnglishLocale;
css::lang::Locale aLocale;
mutable css::lang::Locale aLastAnyLocale;
- std::unique_ptr<CalendarWrapper> pEnglishPtr;
+ mutable std::unique_ptr<CalendarWrapper> pEnglishPtr;
mutable std::unique_ptr<CalendarWrapper> pAnyPtr;
public:
@@ -161,8 +161,7 @@ public:
{
m_xContext = rxContext;
changeLocale( rLocale );
- pEnglishPtr.reset(new CalendarWrapper( m_xContext ));
- pEnglishPtr->loadDefaultCalendar( aEnglishLocale );
+ pEnglishPtr.reset();
pAnyPtr.reset();
}
@@ -176,6 +175,11 @@ public:
CalendarWrapper* pPtr;
if ( aLocale == aEnglishLocale )
{
+ if (!pEnglishPtr)
+ {
+ pEnglishPtr.reset( new CalendarWrapper( m_xContext ));
+ pEnglishPtr->loadDefaultCalendar( aEnglishLocale );
+ }
pPtr = pEnglishPtr.get();
}
else