summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.co.uk>2018-04-11 16:31:33 +0530
committerMichael Meeks <michael.meeks@collabora.com>2018-04-11 14:44:43 +0200
commitd6b3f085d09e94e27b9a02c09f0587d390f62064 (patch)
treec8e46f4b3abf96128899499c5979e880015625dd
parente5246409cc384cd2ba321620e92250f7ddf153af (diff)
Defer obtaining transliterator and collator...
till they are actually needed. Change-Id: Ie07a6b3361c8f4715aabe8b4e2768f2e1f0d58e9 Reviewed-on: https://gerrit.libreoffice.org/52719 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r--sc/source/core/data/table3.cxx26
1 files changed, 16 insertions, 10 deletions
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)