diff options
author | Maarten Bosmans <mkbosmans@gmail.com> | 2016-09-20 20:27:04 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-09-22 18:59:30 +0000 |
commit | 450a2fd5e2dafd1a0c08e73ef85db978f6b1a927 (patch) | |
tree | a19d7660d2cb5339f8e4b44cfeb79e61d9cdee02 /i18npool/inc | |
parent | loplugin:unusedmethods in chart2..svx (diff) | |
download | core-450a2fd5e2dafd1a0c08e73ef85db978f6b1a927.tar.gz core-450a2fd5e2dafd1a0c08e73ef85db978f6b1a927.zip |
tdf#53698: Cache more than 1 item in NumberFormatCodeMapper
In zforlist.cxx the function SvNumberFormatter::GetPreviewStringGuess
switches between the system locale and en_US in order to guess the
formatting of a number. This results in poor performance, because in
the created SvNumberFormat only the last used locale is cached.
Caching more than 1 entries improves the load time for the document
attached to tdf#53698 from 90s to 60s in case of non en_US locales.
Change-Id: Id0eb4447dea6213015e2d958d8303a1e7892487a
Reviewed-on: https://gerrit.libreoffice.org/29136
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool/inc')
-rw-r--r-- | i18npool/inc/numberformatcode.hxx | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/i18npool/inc/numberformatcode.hxx b/i18npool/inc/numberformatcode.hxx index 62261f2e550d..765fa90abbaf 100644 --- a/i18npool/inc/numberformatcode.hxx +++ b/i18npool/inc/numberformatcode.hxx @@ -29,6 +29,9 @@ #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> +#include <deque> +#include <utility> + class NumberFormatCodeMapper : public cppu::WeakImplHelper < css::i18n::XNumberFormatCode, @@ -55,19 +58,15 @@ public: private: osl::Mutex maMutex; - css::lang::Locale aLocale; - css::uno::Reference < css::uno::XComponentContext > mxContext; - css::uno::Sequence< css::i18n::FormatElement > aFormatSeq; - css::uno::Reference < css::i18n::XLocaleData4 > mxLocaleData; - bool bFormatsValid; + css::uno::Reference < css::i18n::XLocaleData4 > m_xLocaleData; + typedef std::pair< css::lang::Locale, css::uno::Sequence< css::i18n::FormatElement > > FormatElementCacheItem; + std::deque < FormatElementCacheItem > m_aFormatElementCache; - void setupLocale( const css::lang::Locale& rLocale ); - void getFormats( const css::lang::Locale& rLocale ); + const css::uno::Sequence< css::i18n::FormatElement >& getFormats( const css::lang::Locale& rLocale ); static OUString mapElementTypeShortToString(sal_Int16 formatType); static sal_Int16 mapElementTypeStringToShort(const OUString& formatType); static OUString mapElementUsageShortToString(sal_Int16 formatUsage); static sal_Int16 mapElementUsageStringToShort(const OUString& formatUsage); - void createLocaleDataObject(); }; |