tdf#125706 Fields slow down down load, cache NativeNumberSupplierService
Cache the NativeNumberSupplierService in DefaultNumberingProvider.
Takes the load time from 5s to 4.5s.
Change-Id: I13de1cd4db8785a1c94d40fb163bcc9b80a5c7f5
Reviewed-on: https://gerrit.libreoffice.org/74741
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/i18npool/inc/defaultnumberingprovider.hxx b/i18npool/inc/defaultnumberingprovider.hxx
index eb9446c..f01378a 100644
--- a/i18npool/inc/defaultnumberingprovider.hxx
+++ b/i18npool/inc/defaultnumberingprovider.hxx
@@ -28,7 +28,10 @@
namespace com::sun::star::container { class XHierarchicalNameAccess; }
namespace com::sun::star::uno { class XComponentContext; }
namespace i18npool { class TransliterationImpl; }
namespace i18npool {
class TransliterationImpl;
class NativeNumberSupplierService;
}
namespace i18npool {
@@ -74,6 +77,7 @@
css::uno::Reference < css::uno::XComponentContext > m_xContext;
css::uno::Reference < css::container::XHierarchicalNameAccess > xHierarchicalNameAccess;
rtl::Reference<TransliterationImpl> translit;
rtl::Reference<NativeNumberSupplierService> mxNatNum;
/// @throws css::uno::RuntimeException
OUString makeNumberingIdentifier( sal_Int16 index );
/// @throws css::uno::RuntimeException
diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
index ce6eb1d..5e21a5a 100644
--- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
+++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
@@ -905,8 +905,9 @@
}
if (natNum) {
rtl::Reference<NativeNumberSupplierService> xNatNum(new NativeNumberSupplierService);
result += xNatNum->getNativeNumberStringParams(OUString::number(number), locale,
if (!mxNatNum)
mxNatNum.set(new NativeNumberSupplierService);
result += mxNatNum->getNativeNumberStringParams(OUString::number(number), locale,
natNum, sNatNumParams);
} else if (tableSize) {
if ( number > tableSize && !bRecycleSymbol)