summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2021-05-01 08:30:46 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-02 10:00:43 +0200
commit86b345a963a64fd9b9a3cab522b3ac2e909977fd (patch)
treeb55be7134aa02c203b0b4eea6afeab3aecfd65a6 /sw/source
parentaa38eede9d340cbb11a792ab1ebbe681521a4489 (diff)
tdf#79049 speed up OOXML workbook load (4)
Optimise LocaleDataWrapper for reads by initialising the data we in the constructor, so we don't need any kind of locking Reduces load time from 34s to 28s. Change-Id: I4bd3bddb30b70ba015fe5b1372534f9507762b74 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114960 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/bastyp/calc.cxx20
-rw-r--r--sw/source/core/doc/DocumentFieldsManager.cxx2
2 files changed, 9 insertions, 13 deletions
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index 652e269c32d9..19d3d92bcb40 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -218,7 +218,6 @@ SwCalc::SwCalc( SwDoc& rD )
, m_aErrExpr( OUString(), SwSbxValue(), nullptr )
, m_nCommandPos(0)
, m_rDoc( rD )
- , m_pLocaleDataWrapper( m_aSysLocale.GetLocaleDataPtr() )
, m_pCharClass( &GetAppCharClass() )
, m_nListPor( 0 )
, m_bHasNumber( false )
@@ -228,16 +227,15 @@ SwCalc::SwCalc( SwDoc& rD )
{
m_aErrExpr.aStr = "~C_ERR~";
LanguageType eLang = GetDocAppScriptLang( m_rDoc );
+ LanguageTag aLanguageTag( eLang );
- if( eLang != m_pLocaleDataWrapper->getLanguageTag().getLanguageType() ||
- eLang != m_pCharClass->getLanguageTag().getLanguageType() )
+ if( eLang != m_pCharClass->getLanguageTag().getLanguageType() )
{
- LanguageTag aLanguageTag( eLang );
m_pCharClass = new CharClass( ::comphelper::getProcessComponentContext(), aLanguageTag );
- m_pLocaleDataWrapper = new LocaleDataWrapper( aLanguageTag );
}
+ m_xLocaleDataWrapper.reset(new LocaleDataWrapper( aLanguageTag ));
- m_sCurrSym = comphelper::string::strip(m_pLocaleDataWrapper->getCurrSymbol(), ' ');
+ m_sCurrSym = comphelper::string::strip(m_xLocaleDataWrapper->getCurrSymbol(), ' ');
m_sCurrSym = m_pCharClass->lowercase( m_sCurrSym );
static char const
@@ -349,8 +347,6 @@ SwCalc::SwCalc( SwDoc& rD )
SwCalc::~SwCalc() COVERITY_NOEXCEPT_FALSE
{
- if( m_pLocaleDataWrapper != m_aSysLocale.GetLocaleDataPtr() )
- delete m_pLocaleDataWrapper;
if( m_pCharClass != &GetAppCharClass() )
delete m_pCharClass;
}
@@ -410,7 +406,7 @@ OUString SwCalc::GetStrResult( double nValue )
nValue,
rtl_math_StringFormat_Automatic,
nDecPlaces,
- m_pLocaleDataWrapper->getNumDecimalSep()[0],
+ m_xLocaleDataWrapper->getNumDecimalSep()[0],
true ));
return aRetStr;
}
@@ -532,7 +528,7 @@ SwCalcExp* SwCalc::VarLook( const OUString& rStr, bool bIns )
OUString sResult;
double nNumber = DBL_MAX;
- LanguageType nLang = m_pLocaleDataWrapper->getLanguageTag().getLanguageType();
+ LanguageType nLang = m_xLocaleDataWrapper->getLanguageTag().getLanguageType();
if(pMgr->GetColumnCnt( sSourceName, sTableName, sColumnName,
nTmpRec, nLang, sResult, &nNumber ))
{
@@ -1376,7 +1372,7 @@ bool SwCalc::Str2Double( const OUString& rCommand, sal_Int32& rCommandPos,
double& rVal )
{
const SvtSysLocale aSysLocale;
- return lcl_Str2Double( rCommand, rCommandPos, rVal, aSysLocale.GetLocaleDataPtr() );
+ return lcl_Str2Double( rCommand, rCommandPos, rVal, &aSysLocale.GetLocaleData() );
}
bool SwCalc::Str2Double( const OUString& rCommand, sal_Int32& rCommandPos,
@@ -1394,7 +1390,7 @@ bool SwCalc::Str2Double( const OUString& rCommand, sal_Int32& rCommandPos,
}
bool const bRet = lcl_Str2Double(rCommand, rCommandPos, rVal,
- pLclD ? pLclD.get() : aSysLocale.GetLocaleDataPtr());
+ pLclD ? pLclD.get() : &aSysLocale.GetLocaleData());
return bRet;
}
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx
index 4ef9322d7c91..b187e709e9b0 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -973,7 +973,7 @@ void DocumentFieldsManager::UpdateExpFieldsImpl(
pMgr->CloseAll( false );
SvtSysLocale aSysLocale;
- const LocaleDataWrapper* pLclData = aSysLocale.GetLocaleDataPtr();
+ const LocaleDataWrapper* pLclData = &aSysLocale.GetLocaleData();
const LanguageType nLang = pLclData->getLanguageTag().getLanguageType();
bool bCanFill = pMgr->FillCalcWithMergeData( m_rDoc.GetNumberFormatter(), nLang, aCalc );
#endif