From 4256c764aee0777770466115a97420d9b55c23ac Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Sat, 5 Mar 2022 11:23:38 +0100 Subject: do not pass XComponentContext to officecfg::...::get() calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's used only for the ConfigurationWrapper singleton, so it's used only the first time and then ignored. It also causes calls to comphelper::getProcessComponentContext() for every single invocation despite the value not being needed, and the calls may not be cheap (it's ~5% CPU during ODS save because relatively frequent calls to officecfg::Office::Common::Save::ODF::DefaultVersion::get()). Change-Id: I02c17a1a9cb498aeef220ddd5a0bde5523cb0ffb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131056 Tested-by: Jenkins Reviewed-by: Luboš Luňák --- svl/source/config/asiancfg.cxx | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'svl') diff --git a/svl/source/config/asiancfg.cxx b/svl/source/config/asiancfg.cxx index 5f179447839d..3ff5797fccaf 100644 --- a/svl/source/config/asiancfg.cxx +++ b/svl/source/config/asiancfg.cxx @@ -54,15 +54,12 @@ OUString toString(css::lang::Locale const & locale) { struct SvxAsianConfig::Impl { Impl(): - context(comphelper::getProcessComponentContext()), - batch(comphelper::ConfigurationChanges::create(context)) + batch(comphelper::ConfigurationChanges::create()) {} Impl(const Impl&) = delete; Impl& operator=(const Impl&) = delete; - css::uno::Reference< css::uno::XComponentContext > context; - std::shared_ptr< comphelper::ConfigurationChanges > batch; }; @@ -76,8 +73,7 @@ void SvxAsianConfig::Commit() { bool SvxAsianConfig::IsKerningWesternTextOnly() const { return - officecfg::Office::Common::AsianLayout::IsKerningWesternTextOnly::get( - impl_->context); + officecfg::Office::Common::AsianLayout::IsKerningWesternTextOnly::get(); } void SvxAsianConfig::SetKerningWesternTextOnly(bool value) { @@ -86,8 +82,7 @@ void SvxAsianConfig::SetKerningWesternTextOnly(bool value) { } CharCompressType SvxAsianConfig::GetCharDistanceCompression() const { - return static_cast(officecfg::Office::Common::AsianLayout::CompressCharacterDistance::get( - impl_->context)); + return static_cast(officecfg::Office::Common::AsianLayout::CompressCharacterDistance::get()); } void SvxAsianConfig::SetCharDistanceCompression(CharCompressType value) { @@ -99,8 +94,7 @@ css::uno::Sequence< css::lang::Locale > SvxAsianConfig::GetStartEndCharLocales() const { const css::uno::Sequence< OUString > ns( - officecfg::Office::Common::AsianLayout::StartEndCharacters::get( - impl_->context)-> + officecfg::Office::Common::AsianLayout::StartEndCharacters::get()-> getElementNames()); css::uno::Sequence< css::lang::Locale > ls(ns.getLength()); std::transform(ns.begin(), ns.end(), ls.getArray(), @@ -114,8 +108,7 @@ bool SvxAsianConfig::GetStartEndChars( OUString & endChars) const { css::uno::Reference< css::container::XNameAccess > set( - officecfg::Office::Common::AsianLayout::StartEndCharacters::get( - impl_->context)); + officecfg::Office::Common::AsianLayout::StartEndCharacters::get()); css::uno::Any v; try { v = set->getByName(toString(locale)); -- cgit