From d3c79d019114b7786268a1e821f96554e54767c0 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Mon, 22 Feb 2016 19:43:40 +0100 Subject: adapt places that call GetSearchTextPtr(), tdf#72196 ... to do that not only for regexp. Change-Id: I0a6d878c7b30b1668dda902f0e50ae3c3cc3b486 --- sc/source/core/data/dpcache.cxx | 10 +++++----- sc/source/core/data/table3.cxx | 18 +++++++++--------- sc/source/core/tool/compare.cxx | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx index d6e104dcde2d..b60e9c778cbe 100644 --- a/sc/source/core/data/dpcache.cxx +++ b/sc/source/core/data/dpcache.cxx @@ -529,10 +529,10 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam) const { // by String OUString aCellStr = pCellData->GetString(); - bool bRealRegExp = (rParam.eSearchType == utl::SearchParam::SRCH_REGEXP && + bool bRealWildOrRegExp = (rParam.eSearchType != utl::SearchParam::SRCH_NORMAL && ((rEntry.eOp == SC_EQUAL) || (rEntry.eOp == SC_NOT_EQUAL))); - bool bTestRegExp = false; - if (bRealRegExp || bTestRegExp) + bool bTestWildOrRegExp = false; + if (bRealWildOrRegExp || bTestWildOrRegExp) { sal_Int32 nStart = 0; sal_Int32 nEnd = aCellStr.getLength(); @@ -543,10 +543,10 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam) const if (bMatch && bMatchWholeCell && (nStart != 0 || nEnd != aCellStr.getLength())) bMatch = false; // RegExp must match entire cell string - if (bRealRegExp) + if (bRealWildOrRegExp) bOk = ((rEntry.eOp == SC_NOT_EQUAL) ? !bMatch : bMatch); } - if (!bRealRegExp) + if (!bRealWildOrRegExp) { if (rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL) { diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index cfefd5730ecd..dfebe57fb813 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -2213,20 +2213,20 @@ class QueryEvaluator return false; } - bool isRealRegExp(const ScQueryEntry& rEntry) const + bool isRealWildOrRegExp(const ScQueryEntry& rEntry) const { - if (mrParam.eSearchType != utl::SearchParam::SRCH_REGEXP) + if (mrParam.eSearchType == utl::SearchParam::SRCH_NORMAL) return false; return isTextMatchOp(rEntry); } - bool isTestRegExp(const ScQueryEntry& rEntry) const + bool isTestWildOrRegExp(const ScQueryEntry& rEntry) const { if (!mpTestEqualCondition) return false; - if (mrParam.eSearchType != utl::SearchParam::SRCH_REGEXP) + if (mrParam.eSearchType == utl::SearchParam::SRCH_NORMAL) return false; return (rEntry.eOp == SC_LESS_EQUAL || rEntry.eOp == SC_GREATER_EQUAL); @@ -2409,10 +2409,10 @@ public: aCellStr = mrStrPool.intern(aStr); } - bool bRealRegExp = isRealRegExp(rEntry); - bool bTestRegExp = isTestRegExp(rEntry); + bool bRealWildOrRegExp = isRealWildOrRegExp(rEntry); + bool bTestWildOrRegExp = isTestWildOrRegExp(rEntry); - if ( bRealRegExp || bTestRegExp ) + if ( bRealWildOrRegExp || bTestWildOrRegExp ) { sal_Int32 nStart = 0; sal_Int32 nEnd = aCellStr.getLength(); @@ -2434,7 +2434,7 @@ public: if ( bMatch && bMatchWholeCell && (nStart != 0 || nEnd != aCellStr.getLength()) ) bMatch = false; // RegExp must match entire cell string - if ( bRealRegExp ) + if ( bRealWildOrRegExp ) switch (rEntry.eOp) { case SC_EQUAL: @@ -2465,7 +2465,7 @@ public: else bTestEqual = bMatch; } - if ( !bRealRegExp ) + if ( !bRealWildOrRegExp ) { // Simple string matching i.e. no regexp match. if (isTextMatchOp(rEntry)) diff --git a/sc/source/core/tool/compare.cxx b/sc/source/core/tool/compare.cxx index 8433202dd11d..cf5c0ff69903 100644 --- a/sc/source/core/tool/compare.cxx +++ b/sc/source/core/tool/compare.cxx @@ -136,7 +136,7 @@ double CompareFunc( const Compare& rComp, CompareOptions* pOptions ) // regex to work through GetSearchTextPtr(). ScQueryEntry& rEntry = pOptions->aQueryEntry; OSL_ENSURE(rEntry.GetQueryItem().maString == rCell2.maStr, "ScInterpreter::CompareFunc: broken options"); - if (pOptions->eSearchType == utl::SearchParam::SRCH_REGEXP) + if (pOptions->eSearchType != utl::SearchParam::SRCH_NORMAL) { sal_Int32 nStart = 0; sal_Int32 nStop = rCell1.maStr.getLength(); -- cgit v1.2.3