summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-08-30 12:35:42 +0200
committerNoel Grandin <noel@peralex.com>2016-08-31 10:00:07 +0200
commit7bf9abffb69966882feecca4b35a04722e5b7822 (patch)
tree53736730de90f3167fc264a7133c9c36e079b743 /sw/source
parent8b52d4e73a06d433d128d61a4939e92e4a497d71 (diff)
convert FindRanges to o3tl::typed_flags_set
Change-Id: I745b2f469e44b79a06a18bc5264aae75b096835c
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/crsr/findtxt.cxx2
-rw-r--r--sw/source/core/crsr/swcrsr.cxx18
-rw-r--r--sw/source/core/edit/edtox.cxx2
-rw-r--r--sw/source/ui/index/swuiidxmrk.cxx2
-rw-r--r--sw/source/uibase/inc/wrtsh.hxx6
-rw-r--r--sw/source/uibase/uiview/viewsrch.cxx8
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx22
-rw-r--r--sw/source/uibase/wrtsh/select.cxx6
8 files changed, 34 insertions, 32 deletions
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 32df0421fcd9..057d0a99ca14 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -729,7 +729,7 @@ sal_uLong SwCursor::Find( const SearchOptions2& rSearchOpt, bool bSearchInNotes,
bool bSearchSel = 0 != (rSearchOpt.searchFlag & SearchFlags::REG_NOT_BEGINOFLINE);
if( bSearchSel )
- eFndRngs = (FindRanges)(eFndRngs | FND_IN_SEL);
+ eFndRngs = (FindRanges)(eFndRngs | FindRanges::InSel);
SwFindParaText aSwFindParaText( rSearchOpt, bSearchInNotes, bReplace, *this );
sal_uLong nRet = FindAll( aSwFindParaText, nStart, nEnd, eFndRngs, bCancel );
pDoc->SetOle2Link( aLnk );
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 3309d8923577..484b0be0a000 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -751,7 +751,7 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurrentCurso
bool bIsUnoCursor = dynamic_cast<SwUnoCursor*>(pCurrentCursor) != nullptr;
std::unique_ptr<PercentHdl> pPHdl;
sal_uInt16 nCursorCnt = 0;
- if( FND_IN_SEL & eFndRngs )
+ if( FindRanges::InSel & eFndRngs )
{
while( pCurrentCursor != ( pTmpCursor = pTmpCursor->GetNext() ))
++nCursorCnt;
@@ -797,7 +797,7 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurrentCurso
++nFound;
- if( !( eFndRngs & FND_IN_SELALL) )
+ if( !( eFndRngs & FindRanges::InSelAll) )
{
bEnd = true;
break;
@@ -841,7 +841,7 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurrentCurso
}
}
- if( bEnd || !( eFndRngs & ( FND_IN_SELALL | FND_IN_SEL )) )
+ if( bEnd || !( eFndRngs & ( FindRanges::InSelAll | FindRanges::InSel )) )
break;
pTmpCursor = pTmpCursor->GetNext();
@@ -943,7 +943,7 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas,
SwNodes& rNds = GetDoc()->GetNodes();
// search in sections?
- if( FND_IN_SEL & eFndRngs )
+ if( FindRanges::InSel & eFndRngs )
{
// if string was not found in region then get all sections (cursors
// stays unchanged)
@@ -962,7 +962,7 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas,
pFndRing->GetRingContainer().merge( GetRingContainer() );
delete pFndRing;
}
- else if( FND_IN_OTHER & eFndRngs )
+ else if( FindRanges::InOther & eFndRngs )
{
// put cursor as copy of current into ring
// chaining points always to first created, so forward
@@ -999,7 +999,7 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas,
}
pSav.release();
- if( !( FND_IN_SELALL & eFndRngs ))
+ if( !( FindRanges::InSelAll & eFndRngs ))
{
// there should only be a single one, thus add it
// independent from search direction: SPoint is always bigger than
@@ -1021,11 +1021,11 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas,
}
delete pFndRing;
}
- else if( FND_IN_SELALL & eFndRngs )
+ else if( FindRanges::InSelAll & eFndRngs )
{
std::unique_ptr< SwCursor> pSav( Create( this ) ); // save the current cursor
- const SwNode* pSttNd = ( FND_IN_BODYONLY & eFndRngs )
+ const SwNode* pSttNd = ( FindRanges::InBodyOnly & eFndRngs )
? rNds.GetEndOfContent().StartOfSectionNode()
: rNds.GetEndOfPostIts().StartOfSectionNode();
@@ -1065,7 +1065,7 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas,
// if a GetMark is set then keep the GetMark of the found object
// This allows spanning an area with this search.
SwPosition aMarkPos( *GetMark() );
- const bool bMarkPos = HasMark() && !eFndRngs;
+ const bool bMarkPos = HasMark() && (eFndRngs == FindRanges::InBody);
if( 0 != (nFound = rParas.Find( this, fnMove,
&aRegion, bInReadOnly ) ? 1 : 0)
diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx
index d1d58f5e3c67..c4756af05c95 100644
--- a/sw/source/core/edit/edtox.cxx
+++ b/sw/source/core/edit/edtox.cxx
@@ -374,7 +374,7 @@ void SwEditShell::ApplyAutoMark()
// todo/mba: assuming that notes shouldn't be searched
bool bSearchInNotes = false;
sal_uLong nRet = Find( aSearchOpt, bSearchInNotes, SwDocPositions::Start, SwDocPositions::End, bCancel,
- (FindRanges)(FND_IN_SELALL) );
+ (FindRanges)(FindRanges::InSelAll) );
if(nRet)
{
diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index 2bbf6145988a..d86f9e720167 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -456,7 +456,7 @@ static void lcl_SelectSameStrings(SwWrtShell& rSh, bool bWordOnly, bool bCaseSen
//todo/mba: assuming that notes should not be searched
bool bSearchInNotes = false;
rSh.Find( aSearchOpt, bSearchInNotes, SwDocPositions::Start, SwDocPositions::End, bCancel,
- (FindRanges)(FND_IN_SELALL|FND_IN_BODYONLY) );
+ (FindRanges)(FindRanges::InSelAll|FindRanges::InBodyOnly) );
}
void SwIndexMarkPane::InsertMark()
diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx
index 0042cfe35613..5226c3ad6480 100644
--- a/sw/source/uibase/inc/wrtsh.hxx
+++ b/sw/source/uibase/inc/wrtsh.hxx
@@ -364,18 +364,18 @@ typedef bool (SwWrtShell:: *FNSimpleMove)();
sal_uLong SearchPattern(const css::util::SearchOptions2& rSearchOpt,
bool bSearchInNotes,
SwDocPositions eStart, SwDocPositions eEnd,
- FindRanges eFlags = FND_IN_BODY,
+ FindRanges eFlags = FindRanges::InBody,
bool bReplace = false );
sal_uLong SearchTempl (const OUString &rTempl,
SwDocPositions eStart, SwDocPositions eEnd,
- FindRanges eFlags = FND_IN_BODY,
+ FindRanges eFlags = FindRanges::InBody,
const OUString* pReplTempl = nullptr );
sal_uLong SearchAttr (const SfxItemSet& rFindSet,
bool bNoColls,
SwDocPositions eStart, SwDocPositions eEnd,
- FindRanges eFlags = FND_IN_BODY,
+ FindRanges eFlags = FindRanges::InBody,
const css::util::SearchOptions2* pSearchOpt = nullptr,
const SfxItemSet* pReplaceSet = nullptr);
diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
index 48eee5e63b99..6bbc5f402b7b 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -791,11 +791,13 @@ sal_uLong SwView::FUNC_Search( const SwSearchOptions& rOptions )
bool bDoReplace = m_pSrchItem->GetCommand() == SvxSearchCmd::REPLACE ||
m_pSrchItem->GetCommand() == SvxSearchCmd::REPLACE_ALL;
- int eRanges = m_pSrchItem->GetSelection() ?
- FND_IN_SEL : m_bExtra ? FND_IN_OTHER : FND_IN_BODY;
+ FindRanges eRanges = m_pSrchItem->GetSelection()
+ ? FindRanges::InSel
+ : m_bExtra
+ ? FindRanges::InOther : FindRanges::InBody;
if (m_pSrchItem->GetCommand() == SvxSearchCmd::FIND_ALL ||
m_pSrchItem->GetCommand() == SvxSearchCmd::REPLACE_ALL)
- eRanges |= FND_IN_SELALL;
+ eRanges |= FindRanges::InSelAll;
m_pWrtShell->SttSelect();
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 4944162bcd7d..b1737ca3b30d 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -756,7 +756,7 @@ sal_Int32 SwXTextDocument::replaceAll(const Reference< util::XSearchDescriptor >
const SwXTextSearch* pSearch = reinterpret_cast<const SwXTextSearch*>(
xDescTunnel->getSomething(SwXTextSearch::getUnoTunnelId()));
- int eRanges(FND_IN_BODY|FND_IN_SELALL);
+ int eRanges(FindRanges::InBody|FindRanges::InSelAll);
util::SearchOptions2 aSearchOpt;
pSearch->FillSearchOptions( aSearchOpt );
@@ -886,17 +886,17 @@ SwUnoCursor* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor >
/**
* The following combinations are allowed:
- * - Search in the body: -> FND_IN_BODY
- * - Search all in the body: -> FND_IN_BODYONLY | FND_IN_SELALL
- * - Search in selections: one / all -> FND_IN_SEL [ | FND_IN_SELALL ]
- * - Search outside the body: one / all -> FND_IN_OTHER [ | FND_IN_SELALL ]
- * - Search everywhere all: -> FND_IN_SELALL
+ * - Search in the body: -> FindRanges::InBody
+ * - Search all in the body: -> FindRanges::InBodyOnly | FindRanges::InSelAll
+ * - Search in selections: one / all -> FindRanges::InSel [ | FindRanges::InSelAll ]
+ * - Search outside the body: one / all -> FindRanges::InOther [ | FindRanges::InSelAll ]
+ * - Search everywhere all: -> FindRanges::InSelAll
*/
- int eRanges(FND_IN_BODY);
+ FindRanges eRanges(FindRanges::InBody);
if(bParentInExtra)
- eRanges = FND_IN_OTHER;
+ eRanges = FindRanges::InOther;
if(bAll) //always - everywhere?
- eRanges = FND_IN_SELALL;
+ eRanges = FindRanges::InSelAll;
SwDocPositions eStart = !bAll ? SwDocPositions::Curr : pSearch->m_bBack ? SwDocPositions::End : SwDocPositions::Start;
SwDocPositions eEnd = pSearch->m_bBack ? SwDocPositions::Start : SwDocPositions::End;
@@ -938,10 +938,10 @@ SwUnoCursor* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor >
eStart, eEnd, bCancel,
(FindRanges)eRanges );
}
- if(nResult || (eRanges&(FND_IN_SELALL|FND_IN_OTHER)))
+ if(nResult || (eRanges&(FindRanges::InSelAll|FindRanges::InOther)))
break;
//second step - find in other
- eRanges = FND_IN_OTHER;
+ eRanges = FindRanges::InOther;
}
return pUnoCursor;
}
diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx
index 90e5c98b0f0b..4998aa9eb91f 100644
--- a/sw/source/uibase/wrtsh/select.cxx
+++ b/sw/source/uibase/wrtsh/select.cxx
@@ -214,7 +214,7 @@ sal_uLong SwWrtShell::SearchPattern( const SearchOptions2& rSearchOpt, bool bSea
FindRanges eFlags, bool bReplace )
{
// no enhancement of existing selections
- if(!(eFlags & FND_IN_SEL))
+ if(!(eFlags & FindRanges::InSel))
ClearMark();
bool bCancel = false;
sal_uLong nRet = Find( rSearchOpt, bSearchInNotes, eStt, eEnd, bCancel, eFlags, bReplace );
@@ -233,7 +233,7 @@ sal_uLong SwWrtShell::SearchTempl( const OUString &rTempl,
FindRanges eFlags, const OUString* pReplTempl )
{
// no enhancement of existing selections
- if(!(eFlags & FND_IN_SEL))
+ if(!(eFlags & FindRanges::InSel))
ClearMark();
SwTextFormatColl *pColl = GetParaStyle(rTempl, SwWrtShell::GETSTYLE_CREATESOME);
SwTextFormatColl *pReplaceColl = nullptr;
@@ -259,7 +259,7 @@ sal_uLong SwWrtShell::SearchAttr( const SfxItemSet& rFindSet, bool bNoColls,
const SfxItemSet* pReplaceSet )
{
// no enhancement of existing selections
- if (!(eFlags & FND_IN_SEL))
+ if (!(eFlags & FindRanges::InSel))
ClearMark();
// Searching