diff options
author | Eike Rathke <erack@redhat.com> | 2016-02-23 23:18:47 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-02-23 23:25:15 +0100 |
commit | 1f3357013ba1f319a3bcddf4c9a658c46e8c0390 (patch) | |
tree | f170f7bbe5759119e80ae09eafb0f9e8409dd58e /sc | |
parent | loplugin:staticcall (diff) | |
download | core-1f3357013ba1f319a3bcddf4c9a658c46e8c0390.tar.gz core-1f3357013ba1f319a3bcddf4c9a658c46e8c0390.zip |
SearchFlags::WILD_MATCH_SELECTION, SearchOptions2::WildcardEscapeCharacter
At least '\' (search in Word) and '~' (search in Excel) should be
supported as escape character.
Being able to restrict a match to entire selection instead of substring
speeds up the Calc match whole cell scenario.
Change-Id: Ice242b9cd59009f172b724e03c2cc08feda4cd3c
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/queryentry.hxx | 3 | ||||
-rw-r--r-- | sc/source/core/data/dpcache.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/table3.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/compare.cxx | 5 | ||||
-rw-r--r-- | sc/source/core/tool/interpr1.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/queryentry.cxx | 5 |
6 files changed, 11 insertions, 10 deletions
diff --git a/sc/inc/queryentry.hxx b/sc/inc/queryentry.hxx index 1669f6cc3e75..ab1a36fc5d9e 100644 --- a/sc/inc/queryentry.hxx +++ b/sc/inc/queryentry.hxx @@ -59,7 +59,8 @@ struct SC_DLLPUBLIC ScQueryEntry ~ScQueryEntry(); /// creates pSearchParam and pSearchText if necessary - utl::TextSearch* GetSearchTextPtr( utl::SearchParam::SearchType eSearchType, bool bCaseSens ) const; + utl::TextSearch* GetSearchTextPtr( utl::SearchParam::SearchType eSearchType, bool bCaseSens, + bool bWildMatchSel ) const; QueryItemsType& GetQueryItems() { return maQueryItems;} const QueryItemsType& GetQueryItems() const { return maQueryItems;} diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx index b60e9c778cbe..9fdf5a2dfbad 100644 --- a/sc/source/core/data/dpcache.cxx +++ b/sc/source/core/data/dpcache.cxx @@ -537,7 +537,7 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam) const sal_Int32 nStart = 0; sal_Int32 nEnd = aCellStr.getLength(); - bool bMatch = (bool) rEntry.GetSearchTextPtr( rParam.eSearchType, rParam.bCaseSens ) + bool bMatch = (bool) rEntry.GetSearchTextPtr( rParam.eSearchType, rParam.bCaseSens, bMatchWholeCell ) ->SearchForward( aCellStr, &nStart, &nEnd ); // from 614 on, nEnd is behind the found text if (bMatch && bMatchWholeCell diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index b3974f5a0a7e..e1842c883704 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -2423,12 +2423,12 @@ public: { nEnd = 0; nStart = aCellStr.getLength(); - bMatch = rEntry.GetSearchTextPtr( mrParam.eSearchType, mrParam.bCaseSens ) + bMatch = rEntry.GetSearchTextPtr( mrParam.eSearchType, mrParam.bCaseSens, bMatchWholeCell ) ->SearchBackward(aCellStr.getString(), &nStart, &nEnd); } else { - bMatch = rEntry.GetSearchTextPtr( mrParam.eSearchType, mrParam.bCaseSens ) + bMatch = rEntry.GetSearchTextPtr( mrParam.eSearchType, mrParam.bCaseSens, bMatchWholeCell ) ->SearchForward(aCellStr.getString(), &nStart, &nEnd); } if ( bMatch && bMatchWholeCell diff --git a/sc/source/core/tool/compare.cxx b/sc/source/core/tool/compare.cxx index cf5c0ff69903..a1dd6026ce17 100644 --- a/sc/source/core/tool/compare.cxx +++ b/sc/source/core/tool/compare.cxx @@ -140,9 +140,8 @@ double CompareFunc( const Compare& rComp, CompareOptions* pOptions ) { sal_Int32 nStart = 0; sal_Int32 nStop = rCell1.maStr.getLength(); - bool bMatch = rEntry.GetSearchTextPtr( pOptions->eSearchType, - !rComp.mbIgnoreCase)->SearchForward( - rCell1.maStr.getString(), &nStart, &nStop); + bool bMatch = rEntry.GetSearchTextPtr( pOptions->eSearchType, !rComp.mbIgnoreCase, + pOptions->bMatchWholeCell)->SearchForward( rCell1.maStr.getString(), &nStart, &nStop); if (bMatch && pOptions->bMatchWholeCell && (nStart != 0 || nStop != rCell1.maStr.getLength())) bMatch = false; // RegEx must match entire string. fRes = (bMatch ? 0 : 1); diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index a35a9762eb67..8d2636f0ccb9 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -8148,7 +8148,7 @@ void ScInterpreter::ScSearch() else { utl::SearchParam::SearchType eSearchType = DetectSearchType( SearchStr, pDok ); - utl::SearchParam sPar(SearchStr, eSearchType, false, false, false); + utl::SearchParam sPar(SearchStr, eSearchType, false, false, false, '~', false); utl::TextSearch sT( sPar, *ScGlobal::pCharClass ); bool bBool = sT.SearchForward(sStr, &nPos, &nEndPos); if (!bBool) diff --git a/sc/source/core/tool/queryentry.cxx b/sc/source/core/tool/queryentry.cxx index 17529c52a4b8..e628baaffb47 100644 --- a/sc/source/core/tool/queryentry.cxx +++ b/sc/source/core/tool/queryentry.cxx @@ -164,13 +164,14 @@ bool ScQueryEntry::operator==( const ScQueryEntry& r ) const // do not compare pSearchParam and pSearchText! } -utl::TextSearch* ScQueryEntry::GetSearchTextPtr( utl::SearchParam::SearchType eSearchType, bool bCaseSens ) const +utl::TextSearch* ScQueryEntry::GetSearchTextPtr( utl::SearchParam::SearchType eSearchType, bool bCaseSens, + bool bWildMatchSel ) const { if ( !pSearchParam ) { OUString aStr = maQueryItems[0].maString.getString(); pSearchParam = new utl::SearchParam( - aStr, eSearchType, bCaseSens, false, false); + aStr, eSearchType, bCaseSens, false, false, '~', bWildMatchSel); pSearchText = new utl::TextSearch( *pSearchParam, *ScGlobal::pCharClass ); } return pSearchText; |