summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/crsrsh.hxx7
-rw-r--r--sw/inc/pam.hxx31
-rw-r--r--sw/inc/swcrsr.hxx12
-rw-r--r--sw/qa/core/macros-test.cxx4
-rw-r--r--sw/source/core/crsr/crsrsh.cxx12
-rw-r--r--sw/source/core/crsr/findattr.cxx90
-rw-r--r--sw/source/core/crsr/findcoll.cxx12
-rw-r--r--sw/source/core/crsr/findfmt.cxx21
-rw-r--r--sw/source/core/crsr/findtxt.cxx92
-rw-r--r--sw/source/core/crsr/pam.cxx19
-rw-r--r--sw/source/core/crsr/swcrsr.cxx9
-rw-r--r--sw/source/core/edit/edfld.cxx7
-rw-r--r--sw/source/core/edit/edtox.cxx2
-rw-r--r--sw/source/core/inc/pamtyp.hxx32
-rw-r--r--sw/source/ui/index/swuiidxmrk.cxx2
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx12
-rw-r--r--sw/source/uibase/wrtsh/select.cxx6
17 files changed, 197 insertions, 173 deletions
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 327674e3c547..fca0cc4f78f5 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -358,18 +358,19 @@ public:
void MoveColumn( SwWhichColumn, SwPosColumn );
bool MoveRegion( SwWhichRegion, SwMoveFnCollection const & );
- sal_uLong Find( const i18nutil::SearchOptions2& rSearchOpt,
+ // note: DO NOT call it FindText because windows.h
+ sal_uLong Find_Text( const i18nutil::SearchOptions2& rSearchOpt,
bool bSearchInNotes,
SwDocPositions eStart, SwDocPositions eEnd,
bool& bCancel,
FindRanges eRng, bool bReplace = false );
- sal_uLong Find( const SwTextFormatColl& rFormatColl,
+ sal_uLong FindFormat( const SwTextFormatColl& rFormatColl,
SwDocPositions eStart, SwDocPositions eEnd,
bool& bCancel,
FindRanges eRng, const SwTextFormatColl* pReplFormat );
- sal_uLong Find( const SfxItemSet& rSet, bool bNoCollections,
+ sal_uLong FindAttrs( const SfxItemSet& rSet, bool bNoCollections,
SwDocPositions eStart, SwDocPositions eEnd,
bool& bCancel,
FindRanges eRng,
diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index c71667e30f50..c7bc752ff347 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -27,18 +27,9 @@
#include <iostream>
-class SwFormat;
-class SfxPoolItem;
-class SfxItemSet;
class SwDoc;
class SwPaM;
class Point;
-namespace i18nutil {
- struct SearchOptions2;
-}
-namespace utl {
- class TextSearch;
-}
/// Marks a position in the document model.
struct SAL_WARN_UNUSED SW_DLLPUBLIC SwPosition
@@ -150,8 +141,6 @@ class SAL_WARN_UNUSED SW_DLLPUBLIC SwPaM : public sw::Ring<SwPaM>
SwPosition * m_pMark; ///< points at either m_Bound1 or m_Bound2
bool m_bIsInFrontOfLabel;
- std::unique_ptr<SwPaM> MakeRegion( SwMoveFnCollection const & fnMove, const SwPaM * pOrigRg );
-
SwPaM(SwPaM const& rPaM) = delete;
public:
@@ -179,26 +168,6 @@ public:
bool Move( SwMoveFnCollection const & fnMove = fnMoveForward,
SwGoInDoc fnGo = GoInContent );
- /// Search.
- bool Find( const i18nutil::SearchOptions2& rSearchOpt,
- bool bSearchInNotes,
- utl::TextSearch& rSText,
- SwMoveFnCollection const & fnMove,
- const SwPaM *pPam, bool bInReadOnly = false);
- bool Find( const SwFormat& rFormat,
- SwMoveFnCollection const & fnMove,
- const SwPaM *pPam, bool bInReadOnly = false);
- bool Find( const SfxPoolItem& rAttr, bool bValue,
- SwMoveFnCollection const & fnMove,
- const SwPaM *pPam, bool bInReadOnly = false );
- bool Find( const SfxItemSet& rAttr, bool bNoColls,
- SwMoveFnCollection const & fnMove,
- const SwPaM *pPam, bool bInReadOnly, bool bMoveFirst );
-
- bool DoSearch( const i18nutil::SearchOptions2& rSearchOpt, utl::TextSearch& rSText,
- SwMoveFnCollection const & fnMove, bool bSrchForward, bool bRegSearch, bool bChkEmptyPara, bool bChkParaEnd,
- sal_Int32 &nStart, sal_Int32 &nEnd, sal_Int32 nTextLen, SwNode* pNode, SwPaM* pPam);
-
bool IsInFrontOfLabel() const { return m_bIsInFrontOfLabel; }
void SetInFrontOfLabel_( bool bNew ) { m_bIsInFrontOfLabel = bNew; }
diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx
index c463fdf37b33..9267ba0f10a0 100644
--- a/sw/inc/swcrsr.hxx
+++ b/sw/inc/swcrsr.hxx
@@ -23,6 +23,7 @@
#include "tblsel.hxx"
#include "cshtyp.hxx"
+class SfxItemSet;
struct SwCursor_SavePos;
namespace i18nutil {
struct SearchOptions2;
@@ -36,7 +37,7 @@ const int FIND_NO_RING = 2;
struct SwFindParas
{
- virtual int Find( SwPaM*, SwMoveFnCollection const &, const SwPaM*, bool ) = 0;
+ virtual int DoFind(SwPaM &, SwMoveFnCollection const &, const SwPaM&, bool) = 0;
virtual bool IsReplaceMode() const = 0;
protected:
@@ -75,8 +76,6 @@ class SW_DLLPUBLIC SwCursor : public SwPaM
sal_uLong FindAll( SwFindParas& , SwDocPositions, SwDocPositions, FindRanges, bool& bCancel );
- using SwPaM::Find;
-
SwCursor(SwCursor const& rPaM) = delete;
protected:
@@ -112,18 +111,19 @@ public:
SwMoveFnCollection const & MakeFindRange( SwDocPositions, SwDocPositions,
SwPaM* ) const;
- sal_uLong Find( const i18nutil::SearchOptions2& rSearchOpt,
+ // note: DO NOT call it FindText because windows.h
+ sal_uLong Find_Text( const i18nutil::SearchOptions2& rSearchOpt,
bool bSearchInNotes,
SwDocPositions nStart, SwDocPositions nEnde,
bool& bCancel,
FindRanges,
bool bReplace = false );
- sal_uLong Find( const SwTextFormatColl& rFormatColl,
+ sal_uLong FindFormat( const SwTextFormatColl& rFormatColl,
SwDocPositions nStart, SwDocPositions nEnde,
bool& bCancel,
FindRanges,
const SwTextFormatColl* pReplFormat );
- sal_uLong Find( const SfxItemSet& rSet, bool bNoCollections,
+ sal_uLong FindAttrs( const SfxItemSet& rSet, bool bNoCollections,
SwDocPositions nStart, SwDocPositions nEnde,
bool& bCancel,
FindRanges,
diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx
index 068001c7551b..187a82e93f77 100644
--- a/sw/qa/core/macros-test.cxx
+++ b/sw/qa/core/macros-test.cxx
@@ -554,7 +554,7 @@ void SwMacrosTest::testFindReplace()
'\\');
// find newline on 1st paragraph
- bool bFound = pPaM->Find(
+ bool bFound = pPaM->Find_Text(
opts, false, SwDocPositions::Curr, SwDocPositions::End, bCancel, FindRanges::InBody);
CPPUNIT_ASSERT(bFound);
CPPUNIT_ASSERT(pPaM->HasMark());
@@ -562,7 +562,7 @@ void SwMacrosTest::testFindReplace()
// now do another Find, inside the selection from the first Find
// opts.searchFlags = 71680;
- bFound = pPaM->Find(
+ bFound = pPaM->Find_Text(
opts, false, SwDocPositions::Curr, SwDocPositions::End, bCancel, FindRanges::InSel);
CPPUNIT_ASSERT(bFound);
CPPUNIT_ASSERT(pPaM->HasMark());
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 9705ca7d1d08..286cce30f0cf 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -3317,7 +3317,7 @@ bool SwCursorShell::SelectHiddenRange()
return bRet;
}
-sal_uLong SwCursorShell::Find( const i18nutil::SearchOptions2& rSearchOpt,
+sal_uLong SwCursorShell::Find_Text( const i18nutil::SearchOptions2& rSearchOpt,
bool bSearchInNotes,
SwDocPositions eStart, SwDocPositions eEnd,
bool& bCancel,
@@ -3329,14 +3329,14 @@ sal_uLong SwCursorShell::Find( const i18nutil::SearchOptions2& rSearchOpt,
delete m_pTableCursor;
m_pTableCursor = nullptr;
SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed
- sal_uLong nRet = m_pCurrentCursor->Find( rSearchOpt, bSearchInNotes, eStart, eEnd,
+ sal_uLong nRet = m_pCurrentCursor->Find_Text(rSearchOpt, bSearchInNotes, eStart, eEnd,
bCancel, eRng, bReplace );
if( nRet || bCancel )
UpdateCursor();
return nRet;
}
-sal_uLong SwCursorShell::Find( const SwTextFormatColl& rFormatColl,
+sal_uLong SwCursorShell::FindFormat( const SwTextFormatColl& rFormatColl,
SwDocPositions eStart, SwDocPositions eEnd,
bool& bCancel,
FindRanges eRng,
@@ -3347,14 +3347,14 @@ sal_uLong SwCursorShell::Find( const SwTextFormatColl& rFormatColl,
delete m_pTableCursor;
m_pTableCursor = nullptr;
SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed
- sal_uLong nRet = m_pCurrentCursor->Find( rFormatColl, eStart, eEnd, bCancel, eRng,
+ sal_uLong nRet = m_pCurrentCursor->FindFormat(rFormatColl, eStart, eEnd, bCancel, eRng,
pReplFormat );
if( nRet )
UpdateCursor();
return nRet;
}
-sal_uLong SwCursorShell::Find( const SfxItemSet& rSet,
+sal_uLong SwCursorShell::FindAttrs( const SfxItemSet& rSet,
bool bNoCollections,
SwDocPositions eStart, SwDocPositions eEnd,
bool& bCancel,
@@ -3367,7 +3367,7 @@ sal_uLong SwCursorShell::Find( const SfxItemSet& rSet,
delete m_pTableCursor;
m_pTableCursor = nullptr;
SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed
- sal_uLong nRet = m_pCurrentCursor->Find( rSet, bNoCollections, eStart, eEnd,
+ sal_uLong nRet = m_pCurrentCursor->FindAttrs(rSet, bNoCollections, eStart, eEnd,
bCancel, eRng, pSearchOpt, rReplSet );
if( nRet )
UpdateCursor();
diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx
index 65436e89bfb2..cc0dfbeff4b1 100644
--- a/sw/source/core/crsr/findattr.cxx
+++ b/sw/source/core/crsr/findattr.cxx
@@ -888,14 +888,17 @@ static bool lcl_Search( const SwContentNode& rCNd, const SfxItemSet& rCmpSet, bo
return true; // found
}
-bool SwPaM::Find( const SfxPoolItem& rAttr, bool bValue, SwMoveFnCollection const & fnMove,
- const SwPaM *pRegion, bool bInReadOnly )
+namespace sw {
+
+bool FindAttrImpl(SwPaM & rSearchPam,
+ const SfxPoolItem& rAttr, bool bValue, SwMoveFnCollection const & fnMove,
+ const SwPaM & rRegion, bool bInReadOnly)
{
// determine which attribute is searched:
const sal_uInt16 nWhich = rAttr.Which();
bool bCharAttr = isCHRATR(nWhich) || isTXTATR(nWhich);
- std::unique_ptr<SwPaM> pPam(MakeRegion( fnMove, pRegion ));
+ std::unique_ptr<SwPaM> pPam(sw::MakeRegion(fnMove, rRegion));
bool bFound = false;
bool bFirst = true;
@@ -928,9 +931,9 @@ bool SwPaM::Find( const SfxPoolItem& rAttr, bool bValue, SwMoveFnCollection cons
lcl_Search( *pNode->GetTextNode(), *pPam, rAttr, fnMove, bValue ))
{
// set to the values of the attribute
- SetMark();
- *GetPoint() = *pPam->GetPoint();
- *GetMark() = *pPam->GetMark();
+ rSearchPam.SetMark();
+ *rSearchPam.GetPoint() = *pPam->GetPoint();
+ *rSearchPam.GetMark() = *pPam->GetMark();
bFound = true;
break;
}
@@ -953,9 +956,9 @@ bool SwPaM::Find( const SfxPoolItem& rAttr, bool bValue, SwMoveFnCollection cons
// FORWARD: SPoint at the end, GetMark at the beginning of the node
// BACKWARD: SPoint at the beginning, GetMark at the end of the node
// always: incl. start and incl. end
- *GetPoint() = *pPam->GetPoint();
- SetMark();
- pNode->MakeEndIndex( &GetPoint()->nContent );
+ *rSearchPam.GetPoint() = *pPam->GetPoint();
+ rSearchPam.SetMark();
+ pNode->MakeEndIndex( &rSearchPam.GetPoint()->nContent );
bFound = true;
break;
}
@@ -963,17 +966,20 @@ bool SwPaM::Find( const SfxPoolItem& rAttr, bool bValue, SwMoveFnCollection cons
// if backward search, switch point and mark
if( bFound && !bSrchForward )
- Exchange();
+ rSearchPam.Exchange();
return bFound;
}
+} // namespace sw
+
typedef bool (*FnSearchAttr)( const SwTextNode&, SwAttrCheckArr&, SwPaM& );
-bool SwPaM::Find( const SfxItemSet& rSet, bool bNoColls, SwMoveFnCollection const & fnMove,
- const SwPaM *pRegion, bool bInReadOnly, bool bMoveFirst )
+static bool FindAttrsImpl(SwPaM & rSearchPam,
+ const SfxItemSet& rSet, bool bNoColls, SwMoveFnCollection const & fnMove,
+ const SwPaM & rRegion, bool bInReadOnly, bool bMoveFirst)
{
- std::unique_ptr<SwPaM> pPam(MakeRegion( fnMove, pRegion ));
+ std::unique_ptr<SwPaM> pPam(sw::MakeRegion(fnMove, rRegion));
bool bFound = false;
bool bFirst = true;
@@ -983,7 +989,7 @@ bool SwPaM::Find( const SfxItemSet& rSet, bool bNoColls, SwMoveFnCollection cons
// check which text/char attributes are searched
SwAttrCheckArr aCmpArr( rSet, bSrchForward, bNoColls );
- SfxItemSet aOtherSet( GetDoc()->GetAttrPool(),
+ SfxItemSet aOtherSet( rSearchPam.GetDoc()->GetAttrPool(),
svl::Items<RES_PARATR_BEGIN, RES_GRFATR_END-1>{} );
aOtherSet.Put( rSet, false ); // got all invalid items
@@ -1017,9 +1023,9 @@ bool SwPaM::Find( const SfxItemSet& rSet, bool bNoColls, SwMoveFnCollection cons
(*fnSearch)( *pNode->GetTextNode(), aCmpArr, *pPam ))
{
// set to the values of the attribute
- SetMark();
- *GetPoint() = *pPam->GetPoint();
- *GetMark() = *pPam->GetMark();
+ rSearchPam.SetMark();
+ *rSearchPam.GetPoint() = *pPam->GetPoint();
+ *rSearchPam.GetMark() = *pPam->GetMark();
bFound = true;
break;
}
@@ -1043,9 +1049,9 @@ bool SwPaM::Find( const SfxItemSet& rSet, bool bNoColls, SwMoveFnCollection cons
// FORWARD: SPoint at the end, GetMark at the beginning of the node
// BACKWARD: SPoint at the beginning, GetMark at the end of the node
// always: incl. start and incl. end
- *GetPoint() = *pPam->GetPoint();
- SetMark();
- pNode->MakeEndIndex( &GetPoint()->nContent );
+ *rSearchPam.GetPoint() = *pPam->GetPoint();
+ rSearchPam.SetMark();
+ pNode->MakeEndIndex( &rSearchPam.GetPoint()->nContent );
bFound = true;
break;
}
@@ -1053,7 +1059,7 @@ bool SwPaM::Find( const SfxItemSet& rSet, bool bNoColls, SwMoveFnCollection cons
// if backward search, switch point and mark
if( bFound && !bSrchForward )
- Exchange();
+ rSearchPam.Exchange();
return bFound;
}
@@ -1075,12 +1081,12 @@ struct SwFindParaAttr : public SwFindParas
virtual ~SwFindParaAttr() {}
- virtual int Find( SwPaM* , SwMoveFnCollection const & , const SwPaM*, bool bInReadOnly ) override;
+ virtual int DoFind(SwPaM &, SwMoveFnCollection const &, const SwPaM &, bool bInReadOnly) override;
virtual bool IsReplaceMode() const override;
};
-int SwFindParaAttr::Find( SwPaM* pCursor, SwMoveFnCollection const & fnMove, const SwPaM* pRegion,
- bool bInReadOnly )
+int SwFindParaAttr::DoFind(SwPaM & rCursor, SwMoveFnCollection const & fnMove,
+ const SwPaM & rRegion, bool bInReadOnly)
{
// replace string (only if text given and search is not parameterized)?
bool bReplaceText = pSearchOpt && ( !pSearchOpt->replaceString.isEmpty() ||
@@ -1092,16 +1098,16 @@ int SwFindParaAttr::Find( SwPaM* pCursor, SwMoveFnCollection const & fnMove, con
// We search for attributes, should we search for text as well?
{
- SwPaM aRegion( *pRegion->GetMark(), *pRegion->GetPoint() );
+ SwPaM aRegion( *rRegion.GetMark(), *rRegion.GetPoint() );
SwPaM* pTextRegion = &aRegion;
- SwPaM aSrchPam( *pCursor->GetPoint() );
+ SwPaM aSrchPam( *rCursor.GetPoint() );
while( true )
{
if( pSet->Count() ) // any attributes?
{
// first attributes
- if( !aSrchPam.Find( *pSet, bValue, fnMove, &aRegion, bInReadOnly, bMoveFirst ) )
+ if (!FindAttrsImpl(aSrchPam, *pSet, bValue, fnMove, aRegion, bInReadOnly, bMoveFirst))
return FIND_NOT_FOUND;
bMoveFirst = true;
@@ -1130,7 +1136,7 @@ int SwFindParaAttr::Find( SwPaM* pCursor, SwMoveFnCollection const & fnMove, con
// TODO: searching for attributes in Outliner text?!
// continue search in correct section (pTextRegion)
- if( aSrchPam.Find( *pSearchOpt, false/*bSearchInNotes*/, *pSText, fnMove, pTextRegion, bInReadOnly ) &&
+ if (sw::FindTextImpl(aSrchPam, *pSearchOpt, false/*bSearchInNotes*/, *pSText, fnMove, *pTextRegion, bInReadOnly) &&
*aSrchPam.GetMark() != *aSrchPam.GetPoint() )
break; // found
else if( !pSet->Count() )
@@ -1139,41 +1145,41 @@ int SwFindParaAttr::Find( SwPaM* pCursor, SwMoveFnCollection const & fnMove, con
*aRegion.GetMark() = *aSrchPam.GetPoint();
}
- *pCursor->GetPoint() = *aSrchPam.GetPoint();
- pCursor->SetMark();
- *pCursor->GetMark() = *aSrchPam.GetMark();
+ *rCursor.GetPoint() = *aSrchPam.GetPoint();
+ rCursor.SetMark();
+ *rCursor.GetMark() = *aSrchPam.GetMark();
}
if( bReplaceText )
{
const bool bRegExp(
SearchAlgorithms2::REGEXP == pSearchOpt->AlgorithmType2);
- SwIndex& rSttCntIdx = pCursor->Start()->nContent;
+ SwIndex& rSttCntIdx = rCursor.Start()->nContent;
const sal_Int32 nSttCnt = rSttCntIdx.GetIndex();
// add to shell-cursor-ring so that the regions will be moved eventually
SwPaM* pPrevRing(nullptr);
if( bRegExp )
{
- pPrevRing = const_cast< SwPaM* >(pRegion)->GetPrev();
- const_cast< SwPaM* >(pRegion)->GetRingContainer().merge( m_rCursor.GetRingContainer() );
+ pPrevRing = const_cast<SwPaM &>(rRegion).GetPrev();
+ const_cast<SwPaM &>(rRegion).GetRingContainer().merge( m_rCursor.GetRingContainer() );
}
std::unique_ptr<OUString> pRepl( bRegExp ?
- ReplaceBackReferences( *pSearchOpt, pCursor ) : nullptr );
+ ReplaceBackReferences(*pSearchOpt, &rCursor) : nullptr );
m_rCursor.GetDoc()->getIDocumentContentOperations().ReplaceRange(
- *pCursor, pRepl ? *pRepl : pSearchOpt->replaceString, bRegExp);
- m_rCursor.SaveTableBoxContent( pCursor->GetPoint() );
+ rCursor, pRepl ? *pRepl : pSearchOpt->replaceString, bRegExp);
+ m_rCursor.SaveTableBoxContent( rCursor.GetPoint() );
if( bRegExp )
{
// and remove region again
SwPaM* p;
- SwPaM* pNext = const_cast<SwPaM*>(pRegion);
+ SwPaM* pNext = const_cast<SwPaM*>(&rRegion);
do {
p = pNext;
pNext = p->GetNext();
- p->MoveTo( const_cast<SwPaM*>(pRegion) );
+ p->MoveTo(const_cast<SwPaM*>(&rRegion));
} while( p != pPrevRing );
}
rSttCntIdx = nSttCnt;
@@ -1186,7 +1192,7 @@ int SwFindParaAttr::Find( SwPaM* pCursor, SwMoveFnCollection const & fnMove, con
// they are not in ReplaceSet
if( !pSet->Count() )
{
- pCursor->GetDoc()->getIDocumentContentOperations().InsertItemSet( *pCursor, *pReplSet );
+ rCursor.GetDoc()->getIDocumentContentOperations().InsertItemSet(rCursor, *pReplSet);
}
else
{
@@ -1207,7 +1213,7 @@ int SwFindParaAttr::Find( SwPaM* pCursor, SwMoveFnCollection const & fnMove, con
pItem = aIter.NextItem();
}
aSet.Put( *pReplSet );
- pCursor->GetDoc()->getIDocumentContentOperations().InsertItemSet( *pCursor, aSet );
+ rCursor.GetDoc()->getIDocumentContentOperations().InsertItemSet(rCursor, aSet);
}
return FIND_NO_RING;
@@ -1223,7 +1229,7 @@ bool SwFindParaAttr::IsReplaceMode() const
}
/// search for attributes
-sal_uLong SwCursor::Find( const SfxItemSet& rSet, bool bNoCollections,
+sal_uLong SwCursor::FindAttrs( const SfxItemSet& rSet, bool bNoCollections,
SwDocPositions nStart, SwDocPositions nEnd,
bool& bCancel, FindRanges eFndRngs,
const i18nutil::SearchOptions2* pSearchOpt,
diff --git a/sw/source/core/crsr/findcoll.cxx b/sw/source/core/crsr/findcoll.cxx
index 6f59f3148750..b05fe2c5f742 100644
--- a/sw/source/core/crsr/findcoll.cxx
+++ b/sw/source/core/crsr/findcoll.cxx
@@ -34,22 +34,22 @@ struct SwFindParaFormatColl : public SwFindParas
: pFormatColl( &rFormatColl ), pReplColl( pRpColl )
{}
virtual ~SwFindParaFormatColl() {}
- virtual int Find( SwPaM* , SwMoveFnCollection const & , const SwPaM*, bool bInReadOnly ) override;
+ virtual int DoFind(SwPaM &, SwMoveFnCollection const &, const SwPaM &, bool bInReadOnly) override;
virtual bool IsReplaceMode() const override;
};
-int SwFindParaFormatColl::Find( SwPaM* pCursor, SwMoveFnCollection const & fnMove, const SwPaM* pRegion,
- bool bInReadOnly )
+int SwFindParaFormatColl::DoFind(SwPaM & rCursor, SwMoveFnCollection const & fnMove,
+ const SwPaM & rRegion, bool bInReadOnly)
{
int nRet = FIND_FOUND;
if( bInReadOnly && pReplColl )
bInReadOnly = false;
- if( !pCursor->Find( *pFormatColl, fnMove, pRegion, bInReadOnly ) )
+ if (!sw::FindFormatImpl(rCursor, *pFormatColl, fnMove, rRegion, bInReadOnly))
nRet = FIND_NOT_FOUND;
else if( pReplColl )
{
- pCursor->GetDoc()->SetTextFormatColl( *pCursor, const_cast<SwTextFormatColl*>(pReplColl) );
+ rCursor.GetDoc()->SetTextFormatColl(rCursor, const_cast<SwTextFormatColl*>(pReplColl));
nRet = FIND_NO_RING;
}
return nRet;
@@ -61,7 +61,7 @@ bool SwFindParaFormatColl::IsReplaceMode() const
}
/// search for Format-Collections
-sal_uLong SwCursor::Find( const SwTextFormatColl& rFormatColl, SwDocPositions nStart,
+sal_uLong SwCursor::FindFormat( const SwTextFormatColl& rFormatColl, SwDocPositions nStart,
SwDocPositions nEnd, bool& bCancel,
FindRanges eFndRngs, const SwTextFormatColl* pReplFormatColl )
{
diff --git a/sw/source/core/crsr/findfmt.cxx b/sw/source/core/crsr/findfmt.cxx
index 2b16d0481ddd..f45759e5a0d6 100644
--- a/sw/source/core/crsr/findfmt.cxx
+++ b/sw/source/core/crsr/findfmt.cxx
@@ -22,12 +22,15 @@
#include <pam.hxx>
#include <memory>
-bool SwPaM::Find( const SwFormat& rFormat, SwMoveFnCollection const & fnMove,
- const SwPaM *pRegion, bool bInReadOnly )
+namespace sw {
+
+bool FindFormatImpl(SwPaM & rSearchPam,
+ const SwFormat& rFormat, SwMoveFnCollection const & fnMove,
+ const SwPaM &rRegion, bool bInReadOnly)
{
bool bFound = false;
const bool bSrchForward = &fnMove == &fnMoveForward;
- std::unique_ptr<SwPaM> pPam(MakeRegion( fnMove, pRegion ));
+ std::unique_ptr<SwPaM> pPam(MakeRegion( fnMove, rRegion ));
// if at beginning/end then move it out of the node
if( bSrchForward
@@ -53,14 +56,14 @@ bool SwPaM::Find( const SwFormat& rFormat, SwMoveFnCollection const & fnMove,
// FORWARD: SPoint at the end, GetMark at the beginning of the node
// BACKWARD: SPoint at the beginning, GetMark at the end of the node
// always: incl. start and incl. end
- *GetPoint() = *pPam->GetPoint();
- SetMark();
- pNode->MakeEndIndex( &GetPoint()->nContent );
- GetMark()->nContent = 0;
+ *rSearchPam.GetPoint() = *pPam->GetPoint();
+ rSearchPam.SetMark();
+ pNode->MakeEndIndex( &rSearchPam.GetPoint()->nContent );
+ rSearchPam.GetMark()->nContent = 0;
// if backward search, switch point and mark
if( !bSrchForward )
- Exchange();
+ rSearchPam.Exchange();
bFound = true;
break;
@@ -69,4 +72,6 @@ bool SwPaM::Find( const SwFormat& rFormat, SwMoveFnCollection const & fnMove,
return bFound;
}
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index ad7ec024ef4a..b70a2219d0b3 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -226,14 +226,25 @@ static size_t GetPostIt(sal_Int32 aCount,const SwpHints *pHts)
return aIndex;
}
-bool SwPaM::Find( const i18nutil::SearchOptions2& rSearchOpt, bool bSearchInNotes , utl::TextSearch& rSText,
- SwMoveFnCollection const & fnMove, const SwPaM * pRegion,
- bool bInReadOnly )
+static bool DoSearch(SwPaM & rSearchPam,
+ const i18nutil::SearchOptions2& rSearchOpt, utl::TextSearch& rSText,
+ SwMoveFnCollection const & fnMove,
+ bool bSrchForward, bool bRegSearch, bool bChkEmptyPara, bool bChkParaEnd,
+ sal_Int32 &nStart, sal_Int32 &nEnd, sal_Int32 nTextLen, SwNode* pNode,
+ SwPaM* pPam);
+
+namespace sw {
+
+bool FindTextImpl(SwPaM & rSearchPam,
+ const i18nutil::SearchOptions2& rSearchOpt, bool bSearchInNotes,
+ utl::TextSearch& rSText,
+ SwMoveFnCollection const & fnMove, const SwPaM & rRegion,
+ bool bInReadOnly)
{
if( rSearchOpt.searchString.isEmpty() )
return false;
- std::unique_ptr<SwPaM> pPam = MakeRegion( fnMove, pRegion );
+ std::unique_ptr<SwPaM> pPam = sw::MakeRegion(fnMove, rRegion);
const bool bSrchForward = &fnMove == &fnMoveForward;
SwNodeIndex& rNdIdx = pPam->GetPoint()->nNode;
SwIndex& rContentIdx = pPam->GetPoint()->nContent;
@@ -373,9 +384,9 @@ bool SwPaM::Find( const i18nutil::SearchOptions2& rSearchOpt, bool bSearchInNote
if (pPosition)
{
// Set search position to the shape's anchor point.
- *GetPoint() = *pPosition;
- GetPoint()->nContent.Assign(pPosition->nNode.GetNode().GetContentNode(), 0);
- SetMark();
+ *rSearchPam.GetPoint() = *pPosition;
+ rSearchPam.GetPoint()->nContent.Assign(pPosition->nNode.GetNode().GetContentNode(), 0);
+ rSearchPam.SetMark();
bFound = true;
break;
}
@@ -433,7 +444,8 @@ bool SwPaM::Find( const i18nutil::SearchOptions2& rSearchOpt, bool bSearchInNote
nTextLen = nStartInside - nEndInside;
}
// search inside the text between a note
- bFound = DoSearch( rSearchOpt, rSText, fnMove, bSrchForward,
+ bFound = DoSearch( rSearchPam,
+ rSearchOpt, rSText, fnMove, bSrchForward,
bRegSearch, bChkEmptyPara, bChkParaEnd,
nStartInside, nEndInside, nTextLen, pNode,
pPam.get() );
@@ -462,7 +474,8 @@ bool SwPaM::Find( const i18nutil::SearchOptions2& rSearchOpt, bool bSearchInNote
{
// if there is no SwPostItField inside or searching inside notes
// is disabled, we search the whole length just like before
- bFound = DoSearch( rSearchOpt, rSText, fnMove, bSrchForward,
+ bFound = DoSearch( rSearchPam,
+ rSearchOpt, rSText, fnMove, bSrchForward,
bRegSearch, bChkEmptyPara, bChkParaEnd,
nStart, nEnd, nTextLen, pNode, pPam.get() );
}
@@ -473,7 +486,10 @@ bool SwPaM::Find( const i18nutil::SearchOptions2& rSearchOpt, bool bSearchInNote
return bFound;
}
-bool SwPaM::DoSearch( const i18nutil::SearchOptions2& rSearchOpt, utl::TextSearch& rSText,
+} // namespace sw
+
+bool DoSearch(SwPaM & rSearchPam,
+ const i18nutil::SearchOptions2& rSearchOpt, utl::TextSearch& rSText,
SwMoveFnCollection const & fnMove, bool bSrchForward, bool bRegSearch,
bool bChkEmptyPara, bool bChkParaEnd,
sal_Int32 &nStart, sal_Int32 &nEnd, sal_Int32 nTextLen,
@@ -564,8 +580,8 @@ bool SwPaM::DoSearch( const i18nutil::SearchOptions2& rSearchOpt, utl::TextSearc
nStart = nProxyStart;
nEnd = nProxyEnd;
// set section correctly
- *GetPoint() = *pPam->GetPoint();
- SetMark();
+ *rSearchPam.GetPoint() = *pPam->GetPoint();
+ rSearchPam.SetMark();
// adjust start and end
if( !aFltArr.empty() )
@@ -590,12 +606,12 @@ bool SwPaM::DoSearch( const i18nutil::SearchOptions2& rSearchOpt, utl::TextSearc
// if backward search, switch positions temporarily
if( !bSrchForward ) { std::swap(nStart, nEnd); }
}
- GetMark()->nContent = nStart;
- GetPoint()->nContent = nEnd;
+ rSearchPam.GetMark()->nContent = nStart;
+ rSearchPam.GetPoint()->nContent = nEnd;
// if backward search, switch point and mark
if( !bSrchForward )
- Exchange();
+ rSearchPam.Exchange();
bFound = true;
break;
}
@@ -612,21 +628,21 @@ bool SwPaM::DoSearch( const i18nutil::SearchOptions2& rSearchOpt, utl::TextSearc
return true;
else if( ( bChkEmptyPara && !nStart && !nTextLen ) || bChkParaEnd)
{
- *GetPoint() = *pPam->GetPoint();
- GetPoint()->nContent = bChkParaEnd ? nTextLen : 0;
- SetMark();
+ *rSearchPam.GetPoint() = *pPam->GetPoint();
+ rSearchPam.GetPoint()->nContent = bChkParaEnd ? nTextLen : 0;
+ rSearchPam.SetMark();
/* FIXME: this condition does not work for !bSrchForward backward
* search, it probably never did. (pSttNd != &rNdIdx.GetNode())
* is never true in this case. */
if( (bSrchForward || pSttNd != &rNdIdx.GetNode()) &&
- Move( fnMoveForward, GoInContent ) &&
- (!bSrchForward || pSttNd != &GetPoint()->nNode.GetNode()) &&
- 1 == std::abs( static_cast<int>( GetPoint()->nNode.GetIndex() -
- GetMark()->nNode.GetIndex()) ) )
+ rSearchPam.Move(fnMoveForward, GoInContent) &&
+ (!bSrchForward || pSttNd != &rSearchPam.GetPoint()->nNode.GetNode()) &&
+ 1 == std::abs(static_cast<int>(rSearchPam.GetPoint()->nNode.GetIndex() -
+ rSearchPam.GetMark()->nNode.GetIndex())))
{
// if backward search, switch point and mark
if( !bSrchForward )
- Exchange();
+ rSearchPam.Exchange();
return true;
}
}
@@ -646,7 +662,7 @@ struct SwFindParaText : public SwFindParas
: m_rSearchOpt( rOpt ), m_rCursor( rCursor ), m_aSText( utl::TextSearch::UpgradeToSearchOptions2( rOpt) ),
m_bReplace( bRepl ), m_bSearchInNotes( bSearchInNotes )
{}
- virtual int Find( SwPaM* , SwMoveFnCollection const & , const SwPaM*, bool bInReadOnly ) override;
+ virtual int DoFind(SwPaM &, SwMoveFnCollection const &, const SwPaM &, bool bInReadOnly) override;
virtual bool IsReplaceMode() const override;
virtual ~SwFindParaText();
};
@@ -655,54 +671,54 @@ SwFindParaText::~SwFindParaText()
{
}
-int SwFindParaText::Find( SwPaM* pCursor, SwMoveFnCollection const & fnMove,
- const SwPaM* pRegion, bool bInReadOnly )
+int SwFindParaText::DoFind(SwPaM & rCursor, SwMoveFnCollection const & fnMove,
+ const SwPaM & rRegion, bool bInReadOnly)
{
if( bInReadOnly && m_bReplace )
bInReadOnly = false;
- const bool bFnd = pCursor->Find( m_rSearchOpt, m_bSearchInNotes, m_aSText, fnMove, pRegion, bInReadOnly );
+ const bool bFnd = sw::FindTextImpl(rCursor, m_rSearchOpt, m_bSearchInNotes, m_aSText, fnMove, rRegion, bInReadOnly);
if( bFnd && m_bReplace ) // replace string
{
// use replace method in SwDoc
const bool bRegExp(SearchAlgorithms2::REGEXP == m_rSearchOpt.AlgorithmType2);
- SwIndex& rSttCntIdx = pCursor->Start()->nContent;
+ SwIndex& rSttCntIdx = rCursor.Start()->nContent;
const sal_Int32 nSttCnt = rSttCntIdx.GetIndex();
// add to shell-cursor-ring so that the regions will be moved eventually
SwPaM* pPrev(nullptr);
if( bRegExp )
{
- pPrev = const_cast<SwPaM*>(pRegion)->GetPrev();
- const_cast<SwPaM*>(pRegion)->GetRingContainer().merge( m_rCursor.GetRingContainer() );
+ pPrev = const_cast<SwPaM&>(rRegion).GetPrev();
+ const_cast<SwPaM&>(rRegion).GetRingContainer().merge( m_rCursor.GetRingContainer() );
}
std::unique_ptr<OUString> pRepl( bRegExp
- ? ReplaceBackReferences( m_rSearchOpt, pCursor ) : nullptr );
+ ? ReplaceBackReferences(m_rSearchOpt, &rCursor) : nullptr );
bool const bReplaced = m_rCursor.GetDoc()->getIDocumentContentOperations().ReplaceRange(
- *pCursor, pRepl ? *pRepl : m_rSearchOpt.replaceString, bRegExp);
- m_rCursor.SaveTableBoxContent( pCursor->GetPoint() );
+ rCursor, pRepl ? *pRepl : m_rSearchOpt.replaceString, bRegExp);
+ m_rCursor.SaveTableBoxContent( rCursor.GetPoint() );
if( bRegExp )
{
// and remove region again
SwPaM* p;
- SwPaM* pNext(const_cast<SwPaM*>(pRegion));
+ SwPaM* pNext(const_cast<SwPaM*>(&rRegion));
do {
p = pNext;
pNext = p->GetNext();
- p->MoveTo( const_cast<SwPaM*>(pRegion) );
+ p->MoveTo(const_cast<SwPaM*>(&rRegion));
} while( p != pPrev );
}
if (bRegExp && !bReplaced)
{ // fdo#80715 avoid infinite loop if join failed
bool bRet = ((&fnMoveForward == &fnMove) ? &GoNextPara : &GoPrevPara)
- (*pCursor, fnMove);
+ (rCursor, fnMove);
(void) bRet;
assert(bRet); // if join failed, next node must be SwTextNode
}
else
- pCursor->Start()->nContent = nSttCnt;
+ rCursor.Start()->nContent = nSttCnt;
return FIND_NO_RING;
}
return bFnd ? FIND_FOUND : FIND_NOT_FOUND;
@@ -713,7 +729,7 @@ bool SwFindParaText::IsReplaceMode() const
return m_bReplace;
}
-sal_uLong SwCursor::Find( const i18nutil::SearchOptions2& rSearchOpt, bool bSearchInNotes,
+sal_uLong SwCursor::Find_Text( const i18nutil::SearchOptions2& rSearchOpt, bool bSearchInNotes,
SwDocPositions nStart, SwDocPositions nEnd,
bool& bCancel, FindRanges eFndRngs, bool bReplace )
{
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 1c10bea10ac5..354adfbbfe37 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -481,6 +481,8 @@ bool SwPaM::Move( SwMoveFnCollection const & fnMove, SwGoInDoc fnGo )
return bRet;
}
+namespace sw {
+
/** make a new region
Sets the first SwPaM onto the given SwPaM, or to the beginning or end of a
@@ -491,21 +493,12 @@ bool SwPaM::Move( SwMoveFnCollection const & fnMove, SwGoInDoc fnGo )
@return Newly created range, in Ring with parameter pOrigRg.
*/
-std::unique_ptr<SwPaM> SwPaM::MakeRegion( SwMoveFnCollection const & fnMove, const SwPaM * pOrigRg )
+std::unique_ptr<SwPaM> MakeRegion(SwMoveFnCollection const & fnMove,
+ const SwPaM & rOrigRg)
{
std::unique_ptr<SwPaM> pPam;
- if( pOrigRg == nullptr )
- {
- pPam.reset(new SwPaM( *m_pPoint ));
- pPam->SetMark(); // set beginning
- pPam->Move( fnMove, GoInSection); // to beginning or end of a node
-
- // set SPoint onto its old position; set GetMark to the "end"
- pPam->Exchange();
- }
- else
{
- pPam.reset(new SwPaM(*pOrigRg, const_cast<SwPaM*>(pOrigRg))); // given search range
+ pPam.reset(new SwPaM(rOrigRg, const_cast<SwPaM*>(&rOrigRg))); // given search range
// make sure that SPoint is on the "real" start position
// FORWARD: SPoint always smaller than GetMark
// BACKWARD: SPoint always bigger than GetMark
@@ -515,6 +508,8 @@ std::unique_ptr<SwPaM> SwPaM::MakeRegion( SwMoveFnCollection const & fnMove, con
return pPam;
}
+} // namespace sw
+
void SwPaM::Normalize(bool bPointFirst)
{
if (HasMark())
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index ad453fc2b8de..669a2d4f7f00 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -776,8 +776,8 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurrentCurso
// as long as found and not at same position
while( *pSttPos <= *pEndPos &&
- 0 != ( nFndRet = rParas.Find( pCurrentCursor, fnMove,
- &aRegion, bInReadOnly )) &&
+ 0 != ( nFndRet = rParas.DoFind(*pCurrentCursor, fnMove,
+ aRegion, bInReadOnly)) &&
( !pFndRing ||
*pFndRing->GetPoint() != *pCurrentCursor->GetPoint() ||
*pFndRing->GetMark() != *pCurrentCursor->GetMark() ))
@@ -1063,9 +1063,8 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas,
SwPosition aMarkPos( *GetMark() );
const bool bMarkPos = HasMark() && (eFndRngs == FindRanges::InBody);
- if( 0 != (nFound = rParas.Find( this, fnMove,
- &aRegion, bInReadOnly ) ? 1 : 0)
- && bMarkPos )
+ nFound = rParas.DoFind(*this, fnMove, aRegion, bInReadOnly) ? 1 : 0;
+ if (0 != nFound && bMarkPos)
*GetMark() = aMarkPos;
}
diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index 57a4f77e43c1..da0a15e0199e 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -28,6 +28,7 @@
#include <docary.hxx>
#include <fmtfld.hxx>
#include <txtfld.hxx>
+#include <pamtyp.hxx>
#include <edimp.hxx>
#include <dbfld.hxx>
#include <expfld.hxx>
@@ -260,9 +261,9 @@ void SwEditShell::UpdateFields( SwField &rField )
// Search for SwTextField ...
while( bOkay
&& pCurStt->nContent != pCurEnd->nContent
- && ( aPam.Find( aFieldHint, false, fnMoveForward, &aCurPam, true )
- || aPam.Find( aAnnotationFieldHint, false, fnMoveForward, &aCurPam )
- || aPam.Find( aInputFieldHint, false, fnMoveForward, &aCurPam ) ) )
+ && (sw::FindAttrImpl(aPam, aFieldHint, false, fnMoveForward, aCurPam, true)
+ || sw::FindAttrImpl(aPam, aAnnotationFieldHint, false, fnMoveForward, aCurPam)
+ || sw::FindAttrImpl(aPam, aInputFieldHint, false, fnMoveForward, aCurPam)))
{
// if only one PaM has more than one field ...
if( aPam.Start()->nContent != pCurStt->nContent )
diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx
index f38d29f3f1a9..4d4bae4af901 100644
--- a/sw/source/core/edit/edtox.cxx
+++ b/sw/source/core/edit/edtox.cxx
@@ -366,7 +366,7 @@ void SwEditShell::ApplyAutoMark()
bool bCancel;
// todo/mba: assuming that notes shouldn't be searched
- sal_uLong nRet = Find( aSearchOpt, false/*bSearchInNotes*/, SwDocPositions::Start, SwDocPositions::End, bCancel,
+ sal_uLong nRet = Find_Text(aSearchOpt, false/*bSearchInNotes*/, SwDocPositions::Start, SwDocPositions::End, bCancel,
FindRanges::InSelAll );
if(nRet)
diff --git a/sw/source/core/inc/pamtyp.hxx b/sw/source/core/inc/pamtyp.hxx
index 098d0941e38a..b8a81a090387 100644
--- a/sw/source/core/inc/pamtyp.hxx
+++ b/sw/source/core/inc/pamtyp.hxx
@@ -27,6 +27,15 @@ class SwpHints;
struct SwPosition;
class SwPaM;
class SwTextAttr;
+class SwFormat;
+class SfxPoolItem;
+
+namespace i18nutil {
+ struct SearchOptions2;
+}
+namespace utl {
+ class TextSearch;
+}
// function prototypes for the move/find methods of SwPaM
@@ -68,6 +77,29 @@ struct SwMoveFnCollection
// function prototype for searching
SwContentNode* GetNode( SwPaM&, bool&, SwMoveFnCollection const &, bool bInReadOnly = false );
+namespace sw {
+
+ std::unique_ptr<SwPaM> MakeRegion(SwMoveFnCollection const & fnMove,
+ const SwPaM & rOrigRg);
+
+ /// Search.
+ bool FindTextImpl(SwPaM & rSearchPam,
+ const i18nutil::SearchOptions2& rSearchOpt,
+ bool bSearchInNotes,
+ utl::TextSearch& rSText,
+ SwMoveFnCollection const & fnMove,
+ const SwPaM & rRegion, bool bInReadOnly = false);
+ bool FindFormatImpl(SwPaM & rSearchPam,
+ const SwFormat& rFormat,
+ SwMoveFnCollection const & fnMove,
+ const SwPaM & rRegion, bool bInReadOnly = false);
+ bool FindAttrImpl(SwPaM & rSearchPam,
+ const SfxPoolItem& rAttr, bool bValue,
+ SwMoveFnCollection const & fnMove,
+ const SwPaM & rPam, bool bInReadOnly = false);
+
+} // namespace sw
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index e8240b7d2fc1..db0a9f85e6d7 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -442,7 +442,7 @@ static void lcl_SelectSameStrings(SwWrtShell& rSh, bool bWordOnly, bool bCaseSen
bool bCancel;
//todo/mba: assuming that notes should not be searched
- rSh.Find( aSearchOpt, false/*bSearchInNotes*/, SwDocPositions::Start, SwDocPositions::End, bCancel,
+ rSh.Find_Text(aSearchOpt, false/*bSearchInNotes*/, SwDocPositions::Start, SwDocPositions::End, bCancel,
FindRanges::InSelAll | FindRanges::InBodyOnly );
}
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 41f44162bfcf..b4d47d5e5640 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -791,7 +791,7 @@ sal_Int32 SwXTextDocument::replaceAll(const Reference< util::XSearchDescriptor >
pSearch->FillSearchItemSet(aSearch);
pSearch->FillReplaceItemSet(aReplace);
bool bCancel;
- nResult = static_cast<sal_Int32>(pUnoCursor->Find( aSearch, !pSearch->m_bStyles,
+ nResult = static_cast<sal_Int32>(pUnoCursor->FindAttrs(aSearch, !pSearch->m_bStyles,
eStart, eEnd, bCancel,
static_cast<FindRanges>(eRanges),
!pSearch->m_sSearchText.isEmpty() ? &aSearchOpt : nullptr,
@@ -803,7 +803,7 @@ sal_Int32 SwXTextDocument::replaceAll(const Reference< util::XSearchDescriptor >
SwTextFormatColl *pReplaceColl = lcl_GetParaStyle(pSearch->m_sReplaceText, pUnoCursor->GetDoc());
bool bCancel;
- nResult = pUnoCursor->Find( *pSearchColl,
+ nResult = pUnoCursor->FindFormat(*pSearchColl,
eStart, eEnd, bCancel,
static_cast<FindRanges>(eRanges), pReplaceColl );
@@ -812,7 +812,7 @@ sal_Int32 SwXTextDocument::replaceAll(const Reference< util::XSearchDescriptor >
{
//todo/mba: assuming that notes should be omitted
bool bCancel;
- nResult = pUnoCursor->Find( aSearchOpt, false/*bSearchInNotes*/,
+ nResult = pUnoCursor->Find_Text(aSearchOpt, false/*bSearchInNotes*/,
eStart, eEnd, bCancel,
static_cast<FindRanges>(eRanges),
true );
@@ -920,7 +920,7 @@ SwUnoCursor* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor >
RES_FRMATR_BEGIN, RES_FRMATR_END - 1>{});
pSearch->FillSearchItemSet(aSearch);
bool bCancel;
- nResult = static_cast<sal_Int32>(pUnoCursor->Find( aSearch, !pSearch->m_bStyles,
+ nResult = static_cast<sal_Int32>(pUnoCursor->FindAttrs(aSearch, !pSearch->m_bStyles,
eStart, eEnd, bCancel,
eRanges,
!pSearch->m_sSearchText.isEmpty() ? &aSearchOpt : nullptr ));
@@ -931,7 +931,7 @@ SwUnoCursor* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor >
//pSearch->sReplaceText
SwTextFormatColl *pReplaceColl = nullptr;
bool bCancel;
- nResult = static_cast<sal_Int32>(pUnoCursor->Find( *pSearchColl,
+ nResult = static_cast<sal_Int32>(pUnoCursor->FindFormat(*pSearchColl,
eStart, eEnd, bCancel,
eRanges, pReplaceColl ));
}
@@ -939,7 +939,7 @@ SwUnoCursor* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor >
{
//todo/mba: assuming that notes should be omitted
bool bCancel;
- nResult = static_cast<sal_Int32>(pUnoCursor->Find( aSearchOpt, false/*bSearchInNotes*/,
+ nResult = static_cast<sal_Int32>(pUnoCursor->Find_Text(aSearchOpt, false/*bSearchInNotes*/,
eStart, eEnd, bCancel,
eRanges ));
}
diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx
index 6459ef5284ff..153ca18355ab 100644
--- a/sw/source/uibase/wrtsh/select.cxx
+++ b/sw/source/uibase/wrtsh/select.cxx
@@ -219,7 +219,7 @@ sal_uLong SwWrtShell::SearchPattern( const i18nutil::SearchOptions2& rSearchOpt,
if(!(eFlags & FindRanges::InSel))
ClearMark();
bool bCancel = false;
- sal_uLong nRet = Find( rSearchOpt, bSearchInNotes, eStt, eEnd, bCancel, eFlags, bReplace );
+ sal_uLong nRet = Find_Text(rSearchOpt, bSearchInNotes, eStt, eEnd, bCancel, eFlags, bReplace);
if(bCancel)
{
Undo();
@@ -243,7 +243,7 @@ sal_uLong SwWrtShell::SearchTempl( const OUString &rTempl,
pReplaceColl = GetParaStyle(*pReplTempl, SwWrtShell::GETSTYLE_CREATESOME );
bool bCancel = false;
- sal_uLong nRet = Find(pColl? *pColl: GetDfltTextFormatColl(),
+ sal_uLong nRet = FindFormat(pColl ? *pColl : GetDfltTextFormatColl(),
eStt,eEnd, bCancel, eFlags, pReplaceColl);
if(bCancel)
{
@@ -266,7 +266,7 @@ sal_uLong SwWrtShell::SearchAttr( const SfxItemSet& rFindSet, bool bNoColls,
// Searching
bool bCancel = false;
- sal_uLong nRet = Find( rFindSet, bNoColls, eStart, eEnd, bCancel, eFlags, pSearchOpt, pReplaceSet);
+ sal_uLong nRet = FindAttrs(rFindSet, bNoColls, eStart, eEnd, bCancel, eFlags, pSearchOpt, pReplaceSet);
if(bCancel)
{