[Libreoffice-commits] core.git: sc/source
Michael Meeks
michael.meeks at collabora.com
Fri Apr 6 13:57:13 UTC 2018
sc/source/core/data/table3.cxx | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
New commits:
commit 009a326d78fb62a80f9631844af324d0294710b6
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Thu Apr 5 14:01:05 2018 +0100
query entry - preparatory pure re-factor.
No need to check lengths for ENDS_WITH - we get the right offsets
to start with before indexOf, and separate nStrPos for later.
Change-Id: I75bc58b0b7ac223362c635e2a3161cf78d8a9581
Reviewed-on: https://gerrit.libreoffice.org/52468
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Eike Rathke <erack at redhat.com>
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 15daec1af61e..6e69e2b35d5a 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2580,17 +2580,22 @@ public:
}
else
{
+ // Where do we find a match (if at all)
+ sal_Int32 nStrPos;
+
OUString aQueryStr = rItem.maString.getString();
const LanguageType nLang = ScGlobal::pSysLocale->GetLanguageTag().getLanguageType();
OUString aCell( mpTransliteration->transliterate(
aCellStr.getString(), nLang, 0, aCellStr.getLength(),
nullptr ) );
+
OUString aQuer( mpTransliteration->transliterate(
aQueryStr, nLang, 0, aQueryStr.getLength(),
nullptr ) );
+
sal_Int32 nIndex = (rEntry.eOp == SC_ENDS_WITH || rEntry.eOp == SC_DOES_NOT_END_WITH) ?
(aCell.getLength() - aQuer.getLength()) : 0;
- sal_Int32 nStrPos = ((nIndex < 0) ? -1 : aCell.indexOf( aQuer, nIndex ));
+ nStrPos = ((nIndex < 0) ? -1 : aCell.indexOf( aQuer, nIndex ));
switch (rEntry.eOp)
{
case SC_EQUAL:
@@ -2608,10 +2613,10 @@ public:
bOk = ( nStrPos != 0 );
break;
case SC_ENDS_WITH:
- bOk = (nStrPos >= 0 && nStrPos + aQuer.getLength() == aCell.getLength() );
+ bOk = ( nStrPos >= 0 );
break;
case SC_DOES_NOT_END_WITH:
- bOk = (nStrPos < 0 || nStrPos + aQuer.getLength() != aCell.getLength() );
+ bOk = ( nStrPos < 0 );
break;
default:
{
More information about the Libreoffice-commits
mailing list