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 /i18npool | |
parent | 8af13dd19d589c9996848fab7f4967f9018751d6 (diff) |
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 'i18npool')
-rw-r--r-- | i18npool/qa/cppunit/test_textsearch.cxx | 3 | ||||
-rw-r--r-- | i18npool/source/search/textsearch.cxx | 7 |
2 files changed, 7 insertions, 3 deletions
diff --git a/i18npool/qa/cppunit/test_textsearch.cxx b/i18npool/qa/cppunit/test_textsearch.cxx index 1cb14f6a14a6..893bed5f1bb9 100644 --- a/i18npool/qa/cppunit/test_textsearch.cxx +++ b/i18npool/qa/cppunit/test_textsearch.cxx @@ -145,6 +145,9 @@ void TestTextSearch::testWildcardSearch() util::SearchResult aRes; aOptions.AlgorithmType2 = util::SearchAlgorithms2::WILDCARD ; + aOptions.WildcardEscapeCharacter = '~'; + // aOptions.searchFlag = ::css::util::SearchFlags::WILD_MATCH_SELECTION; + // is not set, so substring match is allowed. aOptions.transliterateFlags = ::css::i18n::TransliterationModules::TransliterationModules_IGNORE_CASE; aText = "abAca"; diff --git a/i18npool/source/search/textsearch.cxx b/i18npool/source/search/textsearch.cxx index 9d000021c0fd..dab32d11b1a5 100644 --- a/i18npool/source/search/textsearch.cxx +++ b/i18npool/source/search/textsearch.cxx @@ -113,8 +113,6 @@ TextSearch::TextSearch(const Reference < XComponentContext > & rxContext) , pJumpTable2( nullptr ) , pRegexMatcher( nullptr ) , pWLD( nullptr ) - , mcWildcardEscapeChar('~') /* TODO: make this option available through API */ - , mbWildcardAllowSubstring(true) /* TODO: make this option available through API */ { SearchOptions2 aOpt; aOpt.AlgorithmType2 = SearchAlgorithms2::ABSOLUTE; @@ -245,6 +243,8 @@ void TextSearch::setOptions2( const SearchOptions2& rOptions ) throw( RuntimeExc break; case SearchAlgorithms2::WILDCARD: + mcWildcardEscapeChar = static_cast<sal_uInt32>(aSrchPara.WildcardEscapeCharacter); + mbWildcardAllowSubstring = ((aSrchPara.searchFlag & SearchFlags::WILD_MATCH_SELECTION) == 0); fnForward = &TextSearch::WildcardSrchFrwrd; fnBackward = &TextSearch::WildcardSrchBkwrd; break; @@ -289,7 +289,8 @@ void TextSearch::setOptions( const SearchOptions& rOptions ) throw( RuntimeExcep rOptions.deletedChars, rOptions.insertedChars, rOptions.transliterateFlags, - nAlgorithmType2 + nAlgorithmType2, + 0 // no wildcard search, no escape character.. ); setOptions2( aOptions2); } |