diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2018-04-05 14:01:05 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-04-06 15:56:52 +0200 |
commit | 009a326d78fb62a80f9631844af324d0294710b6 (patch) | |
tree | 748cb45bfc801920be1e030b29b58faa1da8e53d /sc | |
parent | 12bb11c6466fb93fe3f0ec1a8302db32a2ce4839 (diff) |
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@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/table3.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
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: { |