[Libreoffice-commits] core.git: sc/source
Dennis Francis
dennis.francis at collabora.co.uk
Wed Apr 11 12:45:06 UTC 2018
sc/source/core/data/table3.cxx | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
New commits:
commit d6b3f085d09e94e27b9a02c09f0587d390f62064
Author: Dennis Francis <dennis.francis at collabora.co.uk>
Date: Wed Apr 11 16:31:33 2018 +0530
Defer obtaining transliterator and collator...
till they are actually needed.
Change-Id: Ie07a6b3361c8f4715aabe8b4e2768f2e1f0d58e9
Reviewed-on: https://gerrit.libreoffice.org/52719
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index c8b4ae8124a7..dfe244b415f6 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2313,6 +2313,18 @@ class QueryEvaluator
return (rEntry.eOp == SC_LESS_EQUAL || rEntry.eOp == SC_GREATER_EQUAL);
}
+ void setupTransliteratorIfNeeded()
+ {
+ if (!mpTransliteration)
+ mpTransliteration = mrParam.bCaseSens ? ScGlobal::GetCaseTransliteration() : ScGlobal::GetpTransliteration();
+ }
+
+ void setupCollatorIfNeeded()
+ {
+ if (!mpCollator)
+ mpCollator = mrParam.bCaseSens ? ScGlobal::GetCaseCollator() : ScGlobal::GetCollator();
+ }
+
public:
QueryEvaluator(ScDocument& rDoc, const ScTable& rTab, const ScQueryParam& rParam,
const bool* pTestEqualCondition) :
@@ -2321,19 +2333,11 @@ public:
mrTab(rTab),
mrParam(rParam),
mpTestEqualCondition(pTestEqualCondition),
+ mpTransliteration(nullptr),
+ mpCollator(nullptr),
mbMatchWholeCell(rDoc.GetDocOptions().IsMatchWholeCell()),
mbCaseSensitive( rParam.bCaseSens )
{
- if (rParam.bCaseSens)
- {
- mpTransliteration = ScGlobal::GetCaseTransliteration();
- mpCollator = ScGlobal::GetCaseCollator();
- }
- else
- {
- mpTransliteration = ScGlobal::GetpTransliteration();
- mpCollator = ScGlobal::GetCollator();
- }
}
bool isQueryByValue(
@@ -2619,6 +2623,7 @@ public:
{
OUString aQueryStr = rItem.maString.getString();
const LanguageType nLang = ScGlobal::pSysLocale->GetLanguageTag().getLanguageType();
+ setupTransliteratorIfNeeded();
OUString aCell( mpTransliteration->transliterate(
rCellStr.getString(), nLang, 0, rCellStr.getLength(),
nullptr ) );
@@ -2666,6 +2671,7 @@ public:
}
else
{ // use collator here because data was probably sorted
+ setupCollatorIfNeeded();
sal_Int32 nCompare = mpCollator->compareString(
rCellStr.getString(), rItem.maString.getString());
switch (rEntry.eOp)
More information about the Libreoffice-commits
mailing list