diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-06-28 05:47:16 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-06-28 11:06:54 +0200 |
commit | 67c807ada5d7930f262ace9798629c06f0175a86 (patch) | |
tree | 3e6c7d7c0e35f4893cedb91e83601e7514506f38 /svl | |
parent | b1ce8bb078904db1df542f7a1c2ed527dde1a2d3 (diff) |
Drop i18nutil::SearchOptions
It was mostly unused by now, only remained in a couple of function
arguments, where callers actually passed SearchOptions2, and where
internally it was converted back to SearchOptions2.
Change-Id: Ib188ec3bf0de6d1f70a04eb90fb3a577df8b3d98
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153687
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/items/srchitem.cxx | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx index 1554f55efd3e..d3b2fad7c216 100644 --- a/svl/source/items/srchitem.cxx +++ b/svl/source/items/srchitem.cxx @@ -100,8 +100,7 @@ SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) : SfxPoolItem( nId ), ConfigItem( CFG_ROOT_NODE ), - m_aSearchOpt ( SearchAlgorithms_ABSOLUTE, - SearchFlags::LEV_RELAXED, + m_aSearchOpt ( SearchFlags::LEV_RELAXED, OUString(), OUString(), lang::Locale(), @@ -135,17 +134,14 @@ SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) : if (aOpt.IsUseWildcard()) { m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::WILDCARD; - m_aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE; // something valid } if (aOpt.IsUseRegularExpression()) { m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::REGEXP; - m_aSearchOpt.algorithmType = SearchAlgorithms_REGEXP; } if (aOpt.IsSimilaritySearch()) { m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::APPROXIMATE; - m_aSearchOpt.algorithmType = SearchAlgorithms_APPROXIMATE; } if (aOpt.IsWholeWordsOnly()) m_aSearchOpt.searchFlag |= SearchFlags::NORM_WORD_ONLY; @@ -238,8 +234,7 @@ SvxSearchItem* SvxSearchItem::Clone( SfxItemPool *) const static bool equalsWithoutLocaleOrReplace(const i18nutil::SearchOptions2& rItem1, const i18nutil::SearchOptions2& rItem2) { - return rItem1.algorithmType == rItem2.algorithmType && - rItem1.searchFlag == rItem2.searchFlag && + return rItem1.searchFlag == rItem2.searchFlag && rItem1.searchString == rItem2.searchString && //rItem1.replaceString == rItem2.replaceString && //rItem1.Locale == rItem2.Locale && @@ -353,12 +348,10 @@ void SvxSearchItem::SetRegExp( bool bVal ) if ( bVal ) { m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::REGEXP; - m_aSearchOpt.algorithmType = SearchAlgorithms_REGEXP; } else if ( SearchAlgorithms2::REGEXP == m_aSearchOpt.AlgorithmType2 ) { m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::ABSOLUTE; - m_aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE; } } @@ -368,12 +361,10 @@ void SvxSearchItem::SetWildcard( bool bVal ) if ( bVal ) { m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::WILDCARD; - m_aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE; // something valid } else if ( SearchAlgorithms2::REGEXP == m_aSearchOpt.AlgorithmType2 ) { m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::ABSOLUTE; - m_aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE; } } @@ -392,12 +383,10 @@ void SvxSearchItem::SetLevenshtein( bool bVal ) if ( bVal ) { m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::APPROXIMATE; - m_aSearchOpt.algorithmType = SearchAlgorithms_APPROXIMATE; } else if ( SearchAlgorithms2::APPROXIMATE == m_aSearchOpt.AlgorithmType2 ) { m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::ABSOLUTE; - m_aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE; } } @@ -460,7 +449,7 @@ bool SvxSearchItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const case MID_SEARCH_ASIANOPTIONS: rVal <<= m_bAsianOptions; break; case MID_SEARCH_ALGORITHMTYPE: - rVal <<= static_cast<sal_Int16>(m_aSearchOpt.algorithmType); break; + rVal <<= static_cast<sal_Int16>(i18nutil::downgradeSearchAlgorithms2(m_aSearchOpt.AlgorithmType2)); break; case MID_SEARCH_ALGORITHMTYPE2: rVal <<= m_aSearchOpt.AlgorithmType2; break; case MID_SEARCH_FLAGS: @@ -626,9 +615,15 @@ bool SvxSearchItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) case MID_SEARCH_ASIANOPTIONS: bRet = (rVal >>= m_bAsianOptions); break; case MID_SEARCH_ALGORITHMTYPE: - bRet = (rVal >>= nInt); m_aSearchOpt.algorithmType = static_cast<SearchAlgorithms>(static_cast<sal_Int16>(nInt)); break; + bRet = (rVal >>= nInt); + if (bRet) + m_aSearchOpt.AlgorithmType2 = i18nutil::upgradeSearchAlgorithms(static_cast<SearchAlgorithms>(static_cast<sal_Int16>(nInt))); + break; case MID_SEARCH_ALGORITHMTYPE2: - bRet = (rVal >>= nInt); m_aSearchOpt.AlgorithmType2 = static_cast<sal_Int16>(nInt); break; + bRet = (rVal >>= nInt); + if (bRet) + m_aSearchOpt.AlgorithmType2 = static_cast<sal_Int16>(nInt); + break; case MID_SEARCH_FLAGS: bRet = (rVal >>= m_aSearchOpt.searchFlag); break; case MID_SEARCH_SEARCHSTRING: |