diff options
author | Eike Rathke <erack@redhat.com> | 2016-02-24 22:37:57 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-02-24 22:42:05 +0100 |
commit | 21edff2a37c9c22d200df2638e31f7ff3afe85b6 (patch) | |
tree | 8b3ded0d95c55ddf739e4baf71d5726fa79d80ab | |
parent | eb3e47dbf798103d09bb8f3461959726e917a75f (diff) |
let SvxSearchItem use SearchOptions2
And all those places that interface to SvxSearchItem.
Change-Id: I08915824a596cd0f247a89f44e4684cd22b98082
25 files changed, 128 insertions, 79 deletions
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 0abb8106031f..29a11179c941 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -2606,7 +2606,7 @@ bool ImpEditEngine::Search( const SvxSearchItem& rSearchItem, EditView* pEditVie bool ImpEditEngine::ImpSearch( const SvxSearchItem& rSearchItem, const EditSelection& rSearchSelection, const EditPaM& rStartPos, EditSelection& rFoundSel ) { - util::SearchOptions aSearchOptions( rSearchItem.GetSearchOptions() ); + util::SearchOptions2 aSearchOptions( rSearchItem.GetSearchOptions() ); aSearchOptions.Locale = GetLocale( rStartPos ); bool bBack = rSearchItem.GetBackward(); @@ -2622,7 +2622,7 @@ bool ImpEditEngine::ImpSearch( const SvxSearchItem& rSearchItem, nEndNode = bBack ? 0 : aEditDoc.Count()-1; } - utl::TextSearch aSearcher( utl::TextSearch::UpgradeToSearchOptions2( aSearchOptions) ); + utl::TextSearch aSearcher( aSearchOptions ); // iterate over the paragraphs ... for ( sal_Int32 nNode = nStartNode; diff --git a/include/sfx2/msg.hxx b/include/sfx2/msg.hxx index f00b94b3c804..6753181644a9 100644 --- a/include/sfx2/msg.hxx +++ b/include/sfx2/msg.hxx @@ -146,7 +146,7 @@ SFX_DECL_TYPE(13); // for SwAddPrinterItem, Sd... SFX_DECL_TYPE(14); SFX_DECL_TYPE(16); // for SwDocDisplayItem SFX_DECL_TYPE(17); // for SvxAddressItem -SFX_DECL_TYPE(22); // for SvxSearchItem +SFX_DECL_TYPE(23); // for SvxSearchItem // all SfxTypes must be in this header #undef SFX_DECL_TYPE diff --git a/include/svl/memberid.hrc b/include/svl/memberid.hrc index f3fdd5334667..b5a2262958e5 100644 --- a/include/svl/memberid.hrc +++ b/include/svl/memberid.hrc @@ -35,9 +35,9 @@ // SvxSearchItem // XXX When changing the MID count here, also increment the corresponding -// SvxSearchItem SFX_DECL_TYPE(n) value to match, and add a member to -// struct SvxSearch in sfx2/sdi/sfxitems.sdi so that dependent slot items get -// generated. +// SvxSearchItem SFX_DECL_TYPE(n) value in include/sfx2/msg.hxx to match, and +// add a member to struct SvxSearch in sfx2/sdi/sfxitems.sdi so that dependent +// slot items get generated. #define MID_SEARCH_STYLEFAMILY 1 #define MID_SEARCH_CELLTYPE 2 #define MID_SEARCH_ROWDIRECTION 3 @@ -60,6 +60,7 @@ #define MID_SEARCH_STARTPOINTX 20 #define MID_SEARCH_STARTPOINTY 21 #define MID_SEARCH_SEARCHFORMATTED 22 +#define MID_SEARCH_ALGORITHMTYPE2 23 #endif diff --git a/include/svl/srchitem.hxx b/include/svl/srchitem.hxx index a2f3d79bfda6..dd7afac19f2b 100644 --- a/include/svl/srchitem.hxx +++ b/include/svl/srchitem.hxx @@ -22,7 +22,8 @@ #include <sal/config.h> #include <svl/svldllapi.h> #include <com/sun/star/util/XSearchDescriptor.hpp> -#include <com/sun/star/util/SearchOptions.hpp> +#include <com/sun/star/util/SearchOptions2.hpp> +#include <com/sun/star/util/SearchAlgorithms2.hpp> #include <com/sun/star/util/SearchFlags.hpp> #include <com/sun/star/i18n/TransliterationModules.hpp> #include <unotools/configitem.hxx> @@ -63,7 +64,7 @@ class SVL_DLLPUBLIC SvxSearchItem : public SfxPoolItem, public utl::ConfigItem { - css::util::SearchOptions m_aSearchOpt; + css::util::SearchOptions2 m_aSearchOpt; SfxStyleFamily m_eFamily; // style family @@ -177,9 +178,9 @@ public: inline sal_uInt16 GetLEVLonger() const; inline void SetLEVLonger(sal_uInt16 nSet); - inline const css::util::SearchOptions & + inline const css::util::SearchOptions2 & GetSearchOptions() const; - inline void SetSearchOptions( const css::util::SearchOptions &rOpt ); + inline void SetSearchOptions( const css::util::SearchOptions2 &rOpt ); inline sal_Int32 GetTransliterationFlags() const; void SetTransliterationFlags( sal_Int32 nFlags ); @@ -234,6 +235,10 @@ bool SvxSearchItem::GetSelection() const bool SvxSearchItem::GetRegExp() const { + // Ensure old and new algorithm types are in sync until all places are + // adapted to use only new types. + assert( (m_aSearchOpt.algorithmType == css::util::SearchAlgorithms_REGEXP) == + (m_aSearchOpt.AlgorithmType2 == css::util::SearchAlgorithms2::REGEXP)); return m_aSearchOpt.algorithmType == css::util::SearchAlgorithms_REGEXP ; } @@ -274,15 +279,19 @@ void SvxSearchItem::SetLEVLonger( sal_uInt16 nVal ) bool SvxSearchItem::IsLevenshtein() const { + // Ensure old and new algorithm types are in sync until all places are + // adapted to use only new types. + assert( (m_aSearchOpt.algorithmType == css::util::SearchAlgorithms_APPROXIMATE) == + (m_aSearchOpt.AlgorithmType2 == css::util::SearchAlgorithms2::APPROXIMATE)); return m_aSearchOpt.algorithmType == css::util::SearchAlgorithms_APPROXIMATE; } -const css::util::SearchOptions & SvxSearchItem::GetSearchOptions() const +const css::util::SearchOptions2 & SvxSearchItem::GetSearchOptions() const { return m_aSearchOpt; } -void SvxSearchItem::SetSearchOptions( const css::util::SearchOptions &rOpt ) +void SvxSearchItem::SetSearchOptions( const css::util::SearchOptions2 &rOpt ) { m_aSearchOpt = rOpt; } diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx index d99fa4258289..d094a7e513d3 100644 --- a/sc/source/core/data/table6.cxx +++ b/sc/source/core/data/table6.cxx @@ -35,8 +35,6 @@ #include "postit.hxx" #include "stringutil.hxx" -using ::com::sun::star::util::SearchOptions; - namespace { bool lcl_GetTextWithBreaks( const EditTextObject& rData, ScDocument* pDoc, OUString& rVal ) @@ -727,7 +725,7 @@ bool ScTable::SearchAndReplace( else { // SearchParam no longer needed - SearchOptions contains all settings - css::util::SearchOptions aSearchOptions = rSearchItem.GetSearchOptions(); + css::util::SearchOptions2 aSearchOptions = rSearchItem.GetSearchOptions(); aSearchOptions.Locale = *ScGlobal::GetLocale(); if (aSearchOptions.searchString.isEmpty()) @@ -744,7 +742,7 @@ bool ScTable::SearchAndReplace( ( css::i18n::TransliterationModules_IGNORE_CASE | css::i18n::TransliterationModules_IGNORE_WIDTH ); - pSearchText = new utl::TextSearch( utl::TextSearch::UpgradeToSearchOptions2( aSearchOptions) ); + pSearchText = new utl::TextSearch( aSearchOptions ); if (nCommand == SvxSearchCmd::FIND) bFound = Search(rSearchItem, rCol, rRow, rMark, rUndoStr, pUndoDoc); diff --git a/sfx2/sdi/sfxitems.sdi b/sfx2/sdi/sfxitems.sdi index 854a38451fed..ab1b3fd067e0 100644 --- a/sfx2/sdi/sfxitems.sdi +++ b/sfx2/sdi/sfxitems.sdi @@ -90,6 +90,7 @@ INT32 SearchStartPointX MID_SEARCH_STARTPOINTX; INT32 SearchStartPointY MID_SEARCH_STARTPOINTY; BOOL SearchFormatted MID_SEARCH_SEARCHFORMATTED; + INT16 AlgorithmType2 MID_SEARCH_ALGORITHMTYPE2; }; item SvxSearch SvxSearchItem; diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx index d234969f52d0..99d1a565fd0a 100644 --- a/svl/source/items/srchitem.cxx +++ b/svl/source/items/srchitem.cxx @@ -111,7 +111,8 @@ SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) : OUString(), lang::Locale(), 2, 2, 2, - TransliterationModules_IGNORE_CASE ), + TransliterationModules_IGNORE_CASE, + SearchAlgorithms2::ABSOLUTE, '\\' ), m_eFamily ( SFX_STYLE_FAMILY_PARA ), m_nCommand ( SvxSearchCmd::FIND ), m_nCellType ( SvxSearchCellType::FORMULA ), @@ -137,9 +138,15 @@ SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) : m_bNotes = aOpt.IsNotes(); 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; @@ -232,7 +239,7 @@ SfxPoolItem* SvxSearchItem::Clone( SfxItemPool *) const //! used below -static bool equalsWithoutLocale( const SearchOptions& rItem1, const SearchOptions& rItem2 ) +static bool equalsWithoutLocale( const SearchOptions2& rItem1, const SearchOptions2& rItem2 ) { return rItem1.algorithmType == rItem2.algorithmType && rItem1.searchFlag == rItem2.searchFlag && @@ -242,7 +249,9 @@ static bool equalsWithoutLocale( const SearchOptions& rItem1, const SearchOption rItem1.changedChars == rItem2.changedChars && rItem1.deletedChars == rItem2.deletedChars && rItem1.insertedChars == rItem2.insertedChars && - rItem1.transliterateFlags == rItem2.transliterateFlags; + rItem1.transliterateFlags == rItem2.transliterateFlags && + rItem1.AlgorithmType2 == rItem2.AlgorithmType2 && + rItem1.WildcardEscapeCharacter == rItem2.WildcardEscapeCharacter; } @@ -335,9 +344,15 @@ void SvxSearchItem::SetSelection( bool bVal ) void SvxSearchItem::SetRegExp( bool bVal ) { if ( bVal ) + { + m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::REGEXP; m_aSearchOpt.algorithmType = SearchAlgorithms_REGEXP; + } else if ( SearchAlgorithms_REGEXP == m_aSearchOpt.algorithmType ) + { + m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::ABSOLUTE; m_aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE; + } } @@ -353,9 +368,15 @@ void SvxSearchItem::SetLEVRelaxed( bool bVal ) void SvxSearchItem::SetLevenshtein( bool bVal ) { if ( bVal ) + { + m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::APPROXIMATE; m_aSearchOpt.algorithmType = SearchAlgorithms_APPROXIMATE; + } else if ( SearchAlgorithms_APPROXIMATE == m_aSearchOpt.algorithmType ) + { + m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::ABSOLUTE; m_aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE; + } } @@ -425,6 +446,8 @@ bool SvxSearchItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const rVal <<= m_bAsianOptions; break; case MID_SEARCH_ALGORITHMTYPE: rVal <<= (sal_Int16) m_aSearchOpt.algorithmType; break; + case MID_SEARCH_ALGORITHMTYPE2: + rVal <<= m_aSearchOpt.AlgorithmType2; break; case MID_SEARCH_FLAGS: rVal <<= m_aSearchOpt.searchFlag; break; case MID_SEARCH_SEARCHSTRING: @@ -585,6 +608,8 @@ bool SvxSearchItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) bRet = (rVal >>= m_bAsianOptions); break; case MID_SEARCH_ALGORITHMTYPE: bRet = (rVal >>= nInt); m_aSearchOpt.algorithmType = (SearchAlgorithms)(sal_Int16)nInt; break; + case MID_SEARCH_ALGORITHMTYPE2: + bRet = (rVal >>= nInt); m_aSearchOpt.AlgorithmType2 = (sal_Int16)nInt; break; case MID_SEARCH_FLAGS: bRet = (rVal >>= m_aSearchOpt.searchFlag); break; case MID_SEARCH_SEARCHSTRING: diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx index 8f9a22017f3d..f8c372715c47 100644 --- a/sw/inc/PostItMgr.hxx +++ b/sw/inc/PostItMgr.hxx @@ -29,7 +29,7 @@ #include <swrect.hxx> #include <unotools/configitem.hxx> #include <unotools/options.hxx> -#include <com/sun/star/util/SearchOptions.hpp> +#include <com/sun/star/util/SearchOptions2.hpp> #include <com/sun/star/uno/Any.hxx> #include <SidebarWindowsTypes.hxx> #include <svl/lstner.hxx> @@ -272,8 +272,8 @@ class SwPostItMgr: public SfxListener void CheckMetaText(); sal_uInt16 Replace(SvxSearchItem* pItem); - sal_uInt16 SearchReplace(const SwFormatField &pField, const css::util::SearchOptions& rSearchOptions,bool bSrchForward); - sal_uInt16 FinishSearchReplace(const css::util::SearchOptions& rSearchOptions,bool bSrchForward); + sal_uInt16 SearchReplace(const SwFormatField &pField, const css::util::SearchOptions2& rSearchOptions,bool bSrchForward); + sal_uInt16 FinishSearchReplace(const css::util::SearchOptions2& rSearchOptions,bool bSrchForward); void AssureStdModeAtShell(); diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 85f662523ab1..aefacf20b9b4 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -67,7 +67,7 @@ class SwTextField; struct SwPosition; namespace com { namespace sun { namespace star { namespace util { - struct SearchOptions; + struct SearchOptions2; } } } } namespace com { namespace sun { namespace star { namespace text { @@ -134,7 +134,7 @@ const int CRSR_POSOLD = 0x01, // cursor stays at old position CRSR_POSCHG = 0x02; // position changed by the layout /// Helperfunction to resolve backward references in regular expressions -OUString *ReplaceBackReferences( const css::util::SearchOptions& rSearchOpt, SwPaM* pPam ); +OUString *ReplaceBackReferences( const css::util::SearchOptions2& rSearchOpt, SwPaM* pPam ); class SW_DLLPUBLIC SwCursorShell : public SwViewShell @@ -367,7 +367,7 @@ public: bool MoveColumn( SwWhichColumn, SwPosColumn ); bool MoveRegion( SwWhichRegion, SwPosRegion ); - sal_uLong Find( const css::util::SearchOptions& rSearchOpt, + sal_uLong Find( const css::util::SearchOptions2& rSearchOpt, bool bSearchInNotes, SwDocPositions eStart, SwDocPositions eEnd, bool& bCancel, @@ -382,7 +382,7 @@ public: SwDocPositions eStart, SwDocPositions eEnd, bool& bCancel, FindRanges eRng, - const css::util::SearchOptions* pSearchOpt = nullptr, + const css::util::SearchOptions2* pSearchOpt = nullptr, const SfxItemSet* rReplSet = nullptr ); // Position the Cursor diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx index 295aaf5d804b..4e1d9f76d5ee 100644 --- a/sw/inc/pam.hxx +++ b/sw/inc/pam.hxx @@ -40,7 +40,7 @@ class SwPaM; class Point; namespace com { namespace sun { namespace star { namespace util { - struct SearchOptions; + struct SearchOptions2; } } } } namespace utl { @@ -194,7 +194,7 @@ public: SwGoInDoc fnGo = fnGoContent ); /// Search. - bool Find( const css::util::SearchOptions& rSearchOpt, + bool Find( const css::util::SearchOptions2& rSearchOpt, bool bSearchInNotes, utl::TextSearch& rSText, SwMoveFn fnMove = fnMoveForward, @@ -209,7 +209,7 @@ public: SwMoveFn fnMove, const SwPaM *pPam, bool bInReadOnly, bool bMoveFirst ); - bool DoSearch( const css::util::SearchOptions& rSearchOpt, utl::TextSearch& rSText, + bool DoSearch( const css::util::SearchOptions2& rSearchOpt, utl::TextSearch& rSText, SwMoveFn fnMove, bool bSrchForward, bool bRegSearch, bool bChkEmptyPara, bool bChkParaEnd, sal_Int32 &nStart, sal_Int32 &nEnd, sal_Int32 nTextLen, SwNode* pNode, SwPaM* pPam); diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx index 1d37cbfb960d..941f2a052f6e 100644 --- a/sw/inc/swcrsr.hxx +++ b/sw/inc/swcrsr.hxx @@ -28,7 +28,7 @@ struct _SwCursor_SavePos; namespace com { namespace sun { namespace star { namespace util { - struct SearchOptions; + struct SearchOptions2; } } } } // Base structure for parameters of the find-methods. @@ -103,7 +103,7 @@ public: SwMoveFnCollection* MakeFindRange( SwDocPositions, SwDocPositions, SwPaM* ) const; - sal_uLong Find( const css::util::SearchOptions& rSearchOpt, + sal_uLong Find( const css::util::SearchOptions2& rSearchOpt, bool bSearchInNotes, SwDocPositions nStart, SwDocPositions nEnde, bool& bCancel, @@ -118,7 +118,7 @@ public: SwDocPositions nStart, SwDocPositions nEnde, bool& bCancel, FindRanges = FND_IN_BODY, - const css::util::SearchOptions* pSearchOpt = nullptr, + const css::util::SearchOptions2* pSearchOpt = nullptr, const SfxItemSet* rReplSet = nullptr ); // UI versions diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx index 8d408c3ba68b..687ac8661103 100644 --- a/sw/qa/core/macros-test.cxx +++ b/sw/qa/core/macros-test.cxx @@ -18,7 +18,8 @@ #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/util/SearchOptions.hpp> +#include <com/sun/star/util/SearchOptions2.hpp> +#include <com/sun/star/util/SearchAlgorithms2.hpp> #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/XStorable.hpp> @@ -451,7 +452,7 @@ void SwMacrosTest::testFindReplace() pPaM->Move(fnMoveBackward, fnGoDoc); bool bCancel(false); - util::SearchOptions opts( + util::SearchOptions2 opts( util::SearchAlgorithms_REGEXP, 65536, "$", @@ -460,7 +461,9 @@ void SwMacrosTest::testFindReplace() 2, 2, 2, - 1073745152); + 1073745152, + util::SearchAlgorithms2::REGEXP, + '\\'); // find newline on 1st paragraph bool bFound = pPaM->Find( diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 71ed6801aa16..304393e216cc 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -69,7 +69,8 @@ #include "com/sun/star/util/XNumberFormatTypes.hpp" #include "com/sun/star/util/NumberFormat.hpp" #include "com/sun/star/util/XNumberFormatsSupplier.hpp" -#include <com/sun/star/util/SearchOptions.hpp> +#include <com/sun/star/util/SearchOptions2.hpp> +#include <com/sun/star/util/SearchAlgorithms2.hpp> #include <com/sun/star/util/SearchFlags.hpp> #include "com/sun/star/util/SearchAlgorithms.hpp" #include "com/sun/star/i18n/TransliterationModulesExtra.hpp" @@ -1819,7 +1820,7 @@ void SwUiWriterTest::testSearchWithTransliterate() aIdx = SwNodeIndex(pDoc->GetNodes().GetEndOfContent(), -1); aPaM = SwPaM(aIdx); pDoc->getIDocumentContentOperations().InsertString(aPaM,"This is Other PARAGRAPH"); - css::util::SearchOptions SearchOpt; + css::util::SearchOptions2 SearchOpt; SearchOpt.algorithmType = css::util::SearchAlgorithms_ABSOLUTE; SearchOpt.searchFlag = 0x00000001; SearchOpt.searchString = "other"; @@ -1828,6 +1829,8 @@ void SwUiWriterTest::testSearchWithTransliterate() SearchOpt.deletedChars = 0; SearchOpt.insertedChars = 0; SearchOpt.transliterateFlags = css::i18n::TransliterationModulesExtra::IGNORE_DIACRITICS_CTL; + SearchOpt.AlgorithmType2 = css::util::SearchAlgorithms2::ABSOLUTE; + SearchOpt.WildcardEscapeCharacter = 0; //transliteration option set so that at least one of the search strings is not found sal_uLong case1 = pWrtShell->SearchPattern(SearchOpt,true,DOCPOS_START,DOCPOS_END); SwShellCursor* pShellCursor = pWrtShell->getShellCursor(true); diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 806c34d6fc6a..d4bff232657f 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <com/sun/star/util/SearchOptions.hpp> +#include <com/sun/star/util/SearchOptions2.hpp> #include <com/sun/star/text/XTextRange.hpp> #include <hintids.hxx> @@ -3165,7 +3165,7 @@ bool SwCursorShell::SelectHiddenRange() return bRet; } -sal_uLong SwCursorShell::Find( const SearchOptions& rSearchOpt, +sal_uLong SwCursorShell::Find( const SearchOptions2& rSearchOpt, bool bSearchInNotes, SwDocPositions eStart, SwDocPositions eEnd, bool& bCancel, @@ -3207,7 +3207,7 @@ sal_uLong SwCursorShell::Find( const SfxItemSet& rSet, SwDocPositions eStart, SwDocPositions eEnd, bool& bCancel, FindRanges eRng, - const SearchOptions* pSearchOpt, + const SearchOptions2* pSearchOpt, const SfxItemSet* rReplSet ) { if( m_pTableCursor ) diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index c8f402ae895f..43bec93de0e5 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -18,7 +18,7 @@ */ #include <com/sun/star/lang/Locale.hpp> -#include <com/sun/star/util/SearchOptions.hpp> +#include <com/sun/star/util/SearchOptions2.hpp> #include <com/sun/star/util/SearchFlags.hpp> #include <i18nlangtag/languagetag.hxx> #include <hintids.hxx> @@ -1056,12 +1056,12 @@ struct SwFindParaAttr : public SwFindParas { bool bValue; const SfxItemSet *pSet, *pReplSet; - const SearchOptions *pSearchOpt; + const SearchOptions2 *pSearchOpt; SwCursor& m_rCursor; utl::TextSearch* pSText; SwFindParaAttr( const SfxItemSet& rSet, bool bNoCollection, - const SearchOptions* pOpt, const SfxItemSet* pRSet, + const SearchOptions2* pOpt, const SfxItemSet* pRSet, SwCursor& rCursor ) : bValue( bNoCollection ), pSet( &rSet ), pReplSet( pRSet ), pSearchOpt( pOpt ), m_rCursor( rCursor ),pSText( nullptr ) {} @@ -1109,7 +1109,7 @@ int SwFindParaAttr::Find( SwPaM* pCursor, SwMoveFn fnMove, const SwPaM* pRegion, // then search in text of it if( !pSText ) { - SearchOptions aTmp( *pSearchOpt ); + SearchOptions2 aTmp( *pSearchOpt ); // search in selection aTmp.searchFlag |= (SearchFlags::REG_NOT_BEGINOFLINE | @@ -1117,7 +1117,7 @@ int SwFindParaAttr::Find( SwPaM* pCursor, SwMoveFn fnMove, const SwPaM* pRegion, aTmp.Locale = SvtSysLocale().GetLanguageTag().getLocale(); - pSText = new utl::TextSearch( utl::TextSearch::UpgradeToSearchOptions2( aTmp) ); + pSText = new utl::TextSearch( aTmp ); } // TODO: searching for attributes in Outliner text?! @@ -1221,7 +1221,7 @@ bool SwFindParaAttr::IsReplaceMode() const sal_uLong SwCursor::Find( const SfxItemSet& rSet, bool bNoCollections, SwDocPositions nStart, SwDocPositions nEnd, bool& bCancel, FindRanges eFndRngs, - const SearchOptions* pSearchOpt, + const SearchOptions2* pSearchOpt, const SfxItemSet* pReplSet ) { // switch off OLE-notifications diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 61943acb0937..f918bb620c45 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -19,7 +19,7 @@ #include <memory> -#include <com/sun/star/util/SearchOptions.hpp> +#include <com/sun/star/util/SearchOptions2.hpp> #include <com/sun/star/util/SearchFlags.hpp> #include <comphelper/string.hxx> #include <vcl/svapp.hxx> @@ -220,7 +220,7 @@ size_t GetPostIt(sal_Int32 aCount,const SwpHints *pHts) return aIndex; } -bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::TextSearch& rSText, +bool SwPaM::Find( const SearchOptions2& rSearchOpt, bool bSearchInNotes , utl::TextSearch& rSText, SwMoveFn fnMove, const SwPaM * pRegion, bool bInReadOnly ) { @@ -465,7 +465,7 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::Te return bFound; } -bool SwPaM::DoSearch( const SearchOptions& rSearchOpt, utl::TextSearch& rSText, +bool SwPaM::DoSearch( const SearchOptions2& rSearchOpt, utl::TextSearch& rSText, SwMoveFn fnMove, bool bSrchForward, bool bRegSearch, bool bChkEmptyPara, bool bChkParaEnd, sal_Int32 &nStart, sal_Int32 &nEnd, sal_Int32 nTextLen, @@ -628,13 +628,13 @@ bool SwPaM::DoSearch( const SearchOptions& rSearchOpt, utl::TextSearch& rSText, /// parameters for search and replace in text struct SwFindParaText : public SwFindParas { - const SearchOptions& m_rSearchOpt; + const SearchOptions2& m_rSearchOpt; SwCursor& m_rCursor; utl::TextSearch m_aSText; bool m_bReplace; bool m_bSearchInNotes; - SwFindParaText( const SearchOptions& rOpt, bool bSearchInNotes, bool bRepl, SwCursor& rCursor ) + SwFindParaText( const SearchOptions2& rOpt, bool bSearchInNotes, bool bRepl, SwCursor& rCursor ) : m_rSearchOpt( rOpt ), m_rCursor( rCursor ), m_aSText( utl::TextSearch::UpgradeToSearchOptions2( rOpt) ), m_bReplace( bRepl ), m_bSearchInNotes( bSearchInNotes ) {} @@ -708,7 +708,7 @@ bool SwFindParaText::IsReplaceMode() const return m_bReplace; } -sal_uLong SwCursor::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes, +sal_uLong SwCursor::Find( const SearchOptions2& rSearchOpt, bool bSearchInNotes, SwDocPositions nStart, SwDocPositions nEnd, bool& bCancel, FindRanges eFndRngs, bool bReplace ) { @@ -741,7 +741,7 @@ sal_uLong SwCursor::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes, return nRet; } -OUString *ReplaceBackReferences( const SearchOptions& rSearchOpt, SwPaM* pPam ) +OUString *ReplaceBackReferences( const SearchOptions2& rSearchOpt, SwPaM* pPam ) { OUString *pRet = nullptr; if( pPam && pPam->HasMark() && diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx index 36af137ef033..d52205a968e1 100644 --- a/sw/source/core/edit/edtox.cxx +++ b/sw/source/core/edit/edtox.cxx @@ -17,7 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <com/sun/star/util/SearchOptions.hpp> +#include <com/sun/star/util/SearchOptions2.hpp> +#include <com/sun/star/util/SearchAlgorithms2.hpp> #include <com/sun/star/util/SearchFlags.hpp> #include <com/sun/star/i18n/TransliterationModules.hpp> #include <comphelper/string.hxx> @@ -314,12 +315,14 @@ void SwEditShell::ApplyAutoMark() sal_Int32 nSrchFlags = SearchFlags::LEV_RELAXED; - SearchOptions aSearchOpt( + SearchOptions2 aSearchOpt( SearchAlgorithms_ABSOLUTE, nSrchFlags, "", "", SvtSysLocale().GetLanguageTag().getLocale(), nLEV_Other, nLEV_Longer, nLEV_Shorter, - nTransliterationFlags ); + nTransliterationFlags, + SearchAlgorithms2::ABSOLUTE, + '\\' ); while( !rStrm.GetError() && !rStrm.IsEof() ) { diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index b64ecf87bbe2..b0ffb27d3e72 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -27,7 +27,8 @@ #include <com/sun/star/frame/Bibliography.hpp> #include <com/sun/star/i18n/TransliterationModules.hpp> #include <com/sun/star/i18n/IndexEntrySupplier.hpp> -#include <com/sun/star/util/SearchOptions.hpp> +#include <com/sun/star/util/SearchOptions2.hpp> +#include <com/sun/star/util/SearchAlgorithms2.hpp> #include <com/sun/star/util/SearchFlags.hpp> #include <svl/stritem.hxx> #include <vcl/layout.hxx> @@ -427,7 +428,7 @@ static void lcl_SelectSameStrings(SwWrtShell& rSh, bool bWordOnly, bool bCaseSen { rSh.Push(); - SearchOptions aSearchOpt( + SearchOptions2 aSearchOpt( SearchAlgorithms_ABSOLUTE, ( bWordOnly ? SearchFlags::NORM_WORD_ONLY : 0 ), rSh.GetSelText(), OUString(), @@ -435,7 +436,9 @@ static void lcl_SelectSameStrings(SwWrtShell& rSh, bool bWordOnly, bool bCaseSen 0, 0, 0, (bCaseSensitive ? 0 - : static_cast<int>(TransliterationModules_IGNORE_CASE)) ); + : static_cast<int>(TransliterationModules_IGNORE_CASE)), + SearchAlgorithms2::ABSOLUTE, + '\\' ); rSh.ClearMark(); bool bCancel; diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index b0ddb3bc863d..a09c6c9a89ed 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -2057,7 +2057,7 @@ sal_uInt16 SwPostItMgr::Replace(SvxSearchItem* pItem) return aResult; } -sal_uInt16 SwPostItMgr::FinishSearchReplace(const css::util::SearchOptions& rSearchOptions, bool bSrchForward) +sal_uInt16 SwPostItMgr::FinishSearchReplace(const css::util::SearchOptions2& rSearchOptions, bool bSrchForward) { SwSidebarWin* pWin = GetActiveSidebarWin(); SvxSearchItem aItem(SID_SEARCH_ITEM ); @@ -2069,7 +2069,7 @@ sal_uInt16 SwPostItMgr::FinishSearchReplace(const css::util::SearchOptions& rSea return aResult; } -sal_uInt16 SwPostItMgr::SearchReplace(const SwFormatField &pField, const css::util::SearchOptions& rSearchOptions, bool bSrchForward) +sal_uInt16 SwPostItMgr::SearchReplace(const SwFormatField &pField, const css::util::SearchOptions2& rSearchOptions, bool bSrchForward) { sal_uInt16 aResult = 0; SwSidebarWin* pWin = GetSidebarWin(&pField); diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx index ff159305dd6d..5392561cf3c9 100644 --- a/sw/source/uibase/inc/wrtsh.hxx +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -48,7 +48,7 @@ struct SwCallMouseEvent; class SfxStringListItem; namespace com { namespace sun { namespace star { namespace util { - struct SearchOptions; + struct SearchOptions2; } } } } typedef sal_Int32 SelectionType; @@ -362,7 +362,7 @@ typedef bool (SwWrtShell:: *FNSimpleMove)(); void GetDoStrings( DoType eDoType, SfxStringListItem& rStrLstItem ) const; // search and replace - sal_uLong SearchPattern(const css::util::SearchOptions& rSearchOpt, + sal_uLong SearchPattern(const css::util::SearchOptions2& rSearchOpt, bool bSearchInNotes, SwDocPositions eStart, SwDocPositions eEnd, FindRanges eFlags = FND_IN_BODY, @@ -377,7 +377,7 @@ typedef bool (SwWrtShell:: *FNSimpleMove)(); bool bNoColls, SwDocPositions eStart, SwDocPositions eEnd, FindRanges eFlags = FND_IN_BODY, - const css::util::SearchOptions* pSearchOpt = nullptr, + const css::util::SearchOptions2* pSearchOpt = nullptr, const SfxItemSet* pReplaceSet = nullptr); void AutoCorrect( SvxAutoCorrect& rACorr, sal_Unicode cChar ); diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index a20b6a965e4c..60a45b663314 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -18,7 +18,7 @@ */ #include <hintids.hxx> -#include <com/sun/star/util/SearchOptions.hpp> +#include <com/sun/star/util/SearchOptions2.hpp> #include <com/sun/star/util/SearchFlags.hpp> #include <com/sun/star/i18n/TransliterationModules.hpp> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> @@ -96,7 +96,7 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::ui::dialogs; using namespace ::sfx2; -using ::com::sun::star::util::SearchOptions; +using ::com::sun::star::util::SearchOptions2; #define SWSRCVIEWFLAGS ( SfxViewShellFlags::CAN_PRINT | SfxViewShellFlags::NO_NEWWINDOW ) @@ -587,7 +587,7 @@ void SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem, pTextView->SetSelection( TextSelection( aPaM, aPaM )); } - util::SearchOptions aSearchOpt( rSearchItem.GetSearchOptions() ); + util::SearchOptions2 aSearchOpt( rSearchItem.GetSearchOptions() ); aSearchOpt.Locale = GetAppLanguageTag().getLocale(); sal_uInt16 nFound; diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 928289cf3d9a..075802f97d52 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -19,7 +19,8 @@ #include <config_features.h> -#include <com/sun/star/util/SearchOptions.hpp> +#include <com/sun/star/util/SearchOptions2.hpp> +#include <com/sun/star/util/SearchAlgorithms2.hpp> #include <com/sun/star/util/SearchFlags.hpp> #include <com/sun/star/i18n/TransliterationModules.hpp> #include <vcl/graphicfilter.hxx> @@ -1986,12 +1987,14 @@ bool SwView::JumpToSwMark( const OUString& rMark ) // normal text search m_pWrtShell->EnterStdMode(); - SearchOptions aSearchOpt( + SearchOptions2 aSearchOpt( SearchAlgorithms_ABSOLUTE, 0, sName, OUString(), SvtSysLocale().GetLanguageTag().getLocale(), 0,0,0, - TransliterationModules_IGNORE_CASE ); + TransliterationModules_IGNORE_CASE, + SearchAlgorithms2::ABSOLUTE, + '\\' ); //todo/mba: assuming that notes shouldn't be searched bool bSearchInNotes = false; diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx index bc922495e0f0..d0989d66f2b3 100644 --- a/sw/source/uibase/uiview/viewsrch.cxx +++ b/sw/source/uibase/uiview/viewsrch.cxx @@ -26,7 +26,7 @@ #include <hintids.hxx> -#include <com/sun/star/util/SearchOptions.hpp> +#include <com/sun/star/util/SearchOptions2.hpp> #include <svl/cjkoptions.hxx> #include <svl/ctloptions.hxx> #include <svx/pageitem.hxx> @@ -322,7 +322,7 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage) if (bBack) m_pWrtShell->Push(); OUString aReplace( m_pSrchItem->GetReplaceString() ); - SearchOptions aTmp( m_pSrchItem->GetSearchOptions() ); + SearchOptions2 aTmp( m_pSrchItem->GetSearchOptions() ); OUString *pBackRef = ReplaceBackReferences( aTmp, m_pWrtShell->GetCursor() ); if( pBackRef ) m_pSrchItem->SetReplaceString( *pBackRef ); @@ -850,7 +850,7 @@ sal_uLong SwView::FUNC_Search( const SwSearchOptions& rOptions ) // build SearchOptions to be used - SearchOptions aSearchOpt( m_pSrchItem->GetSearchOptions() ); + SearchOptions2 aSearchOpt( m_pSrchItem->GetSearchOptions() ); aSearchOpt.Locale = GetAppLanguageTag().getLocale(); if( !bDoReplace ) aSearchOpt.replaceString.clear(); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 565af8c894a7..853001f2cd08 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -74,7 +74,7 @@ #include <globals.hrc> #include <unomid.h> #include <unotools/printwarningoptions.hxx> -#include <com/sun/star/util/SearchOptions.hpp> +#include <com/sun/star/util/SearchOptions2.hpp> #include <com/sun/star/lang/ServiceNotRegisteredException.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> @@ -755,7 +755,7 @@ sal_Int32 SwXTextDocument::replaceAll(const Reference< util::XSearchDescriptor > int eRanges(FND_IN_BODY|FND_IN_SELALL); - util::SearchOptions aSearchOpt; + util::SearchOptions2 aSearchOpt; pSearch->FillSearchOptions( aSearchOpt ); SwDocPositions eStart = pSearch->bBack ? DOCPOS_END : DOCPOS_START; @@ -878,7 +878,7 @@ SwUnoCursor* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor > rRangeNode.FindFooterStartNode() ; } - util::SearchOptions aSearchOpt; + util::SearchOptions2 aSearchOpt; pSearch->FillSearchOptions( aSearchOpt ); /** diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx index 3226dd6ff316..71dce0e22fc6 100644 --- a/sw/source/uibase/wrtsh/select.cxx +++ b/sw/source/uibase/wrtsh/select.cxx @@ -42,7 +42,7 @@ #include <memory> namespace com { namespace sun { namespace star { namespace util { - struct SearchOptions; + struct SearchOptions2; } } } } using namespace ::com::sun::star::util; @@ -210,7 +210,7 @@ long SwWrtShell::SelAll() // Description: Text search -sal_uLong SwWrtShell::SearchPattern( const SearchOptions& rSearchOpt, bool bSearchInNotes, +sal_uLong SwWrtShell::SearchPattern( const SearchOptions2& rSearchOpt, bool bSearchInNotes, SwDocPositions eStt, SwDocPositions eEnd, FindRanges eFlags, bool bReplace ) { @@ -256,7 +256,7 @@ sal_uLong SwWrtShell::SearchTempl( const OUString &rTempl, sal_uLong SwWrtShell::SearchAttr( const SfxItemSet& rFindSet, bool bNoColls, SwDocPositions eStart, SwDocPositions eEnd, - FindRanges eFlags, const SearchOptions* pSearchOpt, + FindRanges eFlags, const SearchOptions2* pSearchOpt, const SfxItemSet* pReplaceSet ) { // no enhancement of existing selections |