diff options
author | Noel Grandin <noel@peralex.com> | 2016-08-30 11:48:07 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-08-31 10:00:07 +0200 |
commit | fd405ab457183f1c0d48d47bbd3308edb2e30242 (patch) | |
tree | faad42c1d8009c5d6118df7722216151a95b5812 /sw | |
parent | 4300656d9f0015c6a894b76ddcf537b446d0b9ba (diff) |
remove the SwMoveFnCollection* typedefs
which were just obscuring the code, and pass it around by const&
Change-Id: I4fce5ef4bf616867c46a145f660a8e90d3c94462
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/crsrsh.hxx | 12 | ||||
-rw-r--r-- | sw/inc/cshtyp.hxx | 35 | ||||
-rw-r--r-- | sw/inc/pam.hxx | 41 | ||||
-rw-r--r-- | sw/inc/swcrsr.hxx | 12 | ||||
-rw-r--r-- | sw/source/core/crsr/crsrsh.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/crsr/findattr.cxx | 22 | ||||
-rw-r--r-- | sw/source/core/crsr/findcoll.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/crsr/findfmt.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/crsr/findtxt.cxx | 14 | ||||
-rw-r--r-- | sw/source/core/crsr/pam.cxx | 70 | ||||
-rw-r--r-- | sw/source/core/crsr/paminit.cxx | 28 | ||||
-rw-r--r-- | sw/source/core/crsr/swcrsr.cxx | 20 | ||||
-rw-r--r-- | sw/source/core/crsr/trvlreg.cxx | 20 | ||||
-rw-r--r-- | sw/source/core/crsr/trvlreg.hxx | 8 | ||||
-rw-r--r-- | sw/source/core/crsr/trvltbl.cxx | 22 | ||||
-rw-r--r-- | sw/source/core/crsr/trvltbl.hxx | 6 | ||||
-rw-r--r-- | sw/source/core/frmedt/fetab.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/inc/pamtyp.hxx | 8 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/drpcps.cxx | 2 |
19 files changed, 168 insertions, 170 deletions
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index b54998022275..2b9b013fd4b2 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -267,7 +267,7 @@ typedef bool (SwCursor:: *FNCursor)(); protected: - inline SwMoveFnCollection* MakeFindRange( sal_uInt16, sal_uInt16, SwPaM* ) const; + inline SwMoveFnCollection const & MakeFindRange( sal_uInt16, sal_uInt16, SwPaM* ) const; /* * Compare-Methode for the StackCursor and the current Cursor. @@ -361,11 +361,11 @@ public: bool SttEndDoc( bool bStt ); bool MovePage( SwWhichPage, SwPosPage ); - bool MovePara( SwWhichPara, SwPosPara ); - bool MoveSection( SwWhichSection, SwPosSection ); - bool MoveTable( SwWhichTable, SwPosTable ); + bool MovePara( SwWhichPara, SwMoveFnCollection const & ); + bool MoveSection( SwWhichSection, SwMoveFnCollection const & ); + bool MoveTable( SwWhichTable, SwMoveFnCollection const & ); bool MoveColumn( SwWhichColumn, SwPosColumn ); - bool MoveRegion( SwWhichRegion, SwPosRegion ); + bool MoveRegion( SwWhichRegion, SwMoveFnCollection const & ); sal_uLong Find( const css::util::SearchOptions2& rSearchOpt, bool bSearchInNotes, @@ -845,7 +845,7 @@ public: }; // Cursor Inlines: -inline SwMoveFnCollection* SwCursorShell::MakeFindRange( +inline SwMoveFnCollection const & SwCursorShell::MakeFindRange( sal_uInt16 nStt, sal_uInt16 nEnd, SwPaM* pPam ) const { return m_pCurrentCursor->MakeFindRange( (SwDocPositions)nStt, (SwDocPositions)nEnd, pPam ); diff --git a/sw/inc/cshtyp.hxx b/sw/inc/cshtyp.hxx index dfa8c0d41681..e9dc3a7ad525 100644 --- a/sw/inc/cshtyp.hxx +++ b/sw/inc/cshtyp.hxx @@ -28,7 +28,6 @@ class SwLayoutFrame; // Structure for SwPaM. Contains the method-pointers for cursor movement. struct SwMoveFnCollection; -typedef SwMoveFnCollection* SwMoveFn; // Type definition for CursorShell. // Direction-parameter for MovePage (initialized in SwContentFrame). @@ -41,23 +40,23 @@ SwContentFrame *GetFirstSub( const SwLayoutFrame *pLayout ); SwContentFrame *GetLastSub( const SwLayoutFrame *pLayout ); // Direction-parameter for MovePara (initialized in SwContentFrame). -typedef SwMoveFnCollection* SwPosPara; -typedef bool (*SwWhichPara)( SwPaM&, SwPosPara ); +typedef bool (*SwWhichPara)( SwPaM&, SwMoveFnCollection const & ); extern SwWhichPara fnParaPrev, fnParaCurr, fnParaNext; -extern SwPosPara fnParaStart, fnParaEnd; +extern SwMoveFnCollection const & fnParaStart; +extern SwMoveFnCollection const & fnParaEnd; // Direction-parameter for MoveSection. -typedef SwMoveFnCollection* SwPosSection; -typedef bool (*SwWhichSection)( SwPaM&, SwPosSection ); -extern SwPosSection fnSectionStart, fnSectionEnd; +typedef bool (*SwWhichSection)( SwPaM&, SwMoveFnCollection const & ); +extern SwMoveFnCollection const & fnSectionStart; +extern SwMoveFnCollection const & fnSectionEnd; -bool GoCurrSection( SwPaM&, SwPosSection); +bool GoCurrSection( SwPaM&, SwMoveFnCollection const &); // Direction-parameter for MoveTable -typedef SwMoveFnCollection* SwPosTable; -typedef bool (*SwWhichTable)( SwPaM&, SwPosTable, bool bInReadOnly ); +typedef bool (*SwWhichTable)( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); extern SwWhichTable fnTablePrev, fnTableCurr, fnTableNext; -extern SwPosTable fnTableStart, fnTableEnd; +extern SwMoveFnCollection const & fnTableStart; +extern SwMoveFnCollection const & fnTableEnd; // Direction-parameter for MoveColumn typedef SwLayoutFrame * (*SwWhichColumn)( const SwLayoutFrame * ); @@ -66,10 +65,10 @@ extern SwWhichColumn fnColumnPrev, fnColumnCurr, fnColumnNext; extern SwPosColumn fnColumnStart, fnColumnEnd; // Direction-parameter for MoveRegion (ranges!) -typedef SwMoveFnCollection* SwPosRegion; -typedef bool (*SwWhichRegion)( SwPaM&, SwPosRegion, bool bInReadOnly ); +typedef bool (*SwWhichRegion)( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); extern SwWhichRegion fnRegionPrev, fnRegionCurr, fnRegionNext, fnRegionCurrAndSkip; -extern SwPosRegion fnRegionStart, fnRegionEnd; +extern SwMoveFnCollection const & fnRegionStart; +extern SwMoveFnCollection const & fnRegionEnd; /* * The following combinations are allowed: @@ -98,13 +97,13 @@ enum SwDocPositions }; SW_DLLPUBLIC SwWhichPara GetfnParaCurr(); -SW_DLLPUBLIC SwPosPara GetfnParaStart(); -SW_DLLPUBLIC SwPosPara GetfnParaEnd(); +SW_DLLPUBLIC SwMoveFnCollection const & GetfnParaStart(); +SW_DLLPUBLIC SwMoveFnCollection const & GetfnParaEnd(); SW_DLLPUBLIC SwWhichTable GetfnTablePrev(); SW_DLLPUBLIC SwWhichTable GetfnTableCurr(); -SW_DLLPUBLIC SwPosTable GetfnTableStart(); -SW_DLLPUBLIC SwPosTable GetfnTableEnd(); +SW_DLLPUBLIC SwMoveFnCollection const & GetfnTableStart(); +SW_DLLPUBLIC SwMoveFnCollection const & GetfnTableEnd(); #endif // INCLUDED_SW_INC_CSHTYP_HXX diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx index 05852095d627..fc25eed3d3ef 100644 --- a/sw/inc/pam.hxx +++ b/sw/inc/pam.hxx @@ -139,20 +139,19 @@ SwComparePosition ComparePosition( /// SwPointAndMark / SwPaM struct SwMoveFnCollection; -typedef SwMoveFnCollection* SwMoveFn; -SW_DLLPUBLIC extern SwMoveFn fnMoveForward; ///< SwPam::Move()/Find() default argument. -SW_DLLPUBLIC extern SwMoveFn fnMoveBackward; - -// also works: using SwGoInDoc = bool (*) (SwPaM& rPam, SwMoveFn fnMove); -// no works: using SwGoInDoc = [](SwPaM& rPam, SwMoveFn fnMove) -> bool; -using SwGoInDoc = auto (*)(SwPaM& rPam, SwMoveFn fnMove) -> bool; -SW_DLLPUBLIC bool GoInDoc( SwPaM&, SwMoveFn); -SW_DLLPUBLIC bool GoInSection( SwPaM&, SwMoveFn); -SW_DLLPUBLIC bool GoInNode( SwPaM&, SwMoveFn); -SW_DLLPUBLIC bool GoInContent( SwPaM&, SwMoveFn); -SW_DLLPUBLIC bool GoInContentCells( SwPaM&, SwMoveFn); -SW_DLLPUBLIC bool GoInContentSkipHidden( SwPaM&, SwMoveFn); -SW_DLLPUBLIC bool GoInContentCellsSkipHidden( SwPaM&, SwMoveFn); +SW_DLLPUBLIC extern SwMoveFnCollection const & fnMoveForward; ///< SwPam::Move()/Find() default argument. +SW_DLLPUBLIC extern SwMoveFnCollection const & fnMoveBackward; + +// also works: using SwGoInDoc = bool (*) (SwPaM& rPam, SwMoveFnCollection const & fnMove); +// no works: using SwGoInDoc = [](SwPaM& rPam, SwMoveFnCollection const & fnMove) -> bool; +using SwGoInDoc = auto (*)(SwPaM& rPam, SwMoveFnCollection const & fnMove) -> bool; +SW_DLLPUBLIC bool GoInDoc( SwPaM&, SwMoveFnCollection const &); +SW_DLLPUBLIC bool GoInSection( SwPaM&, SwMoveFnCollection const &); +SW_DLLPUBLIC bool GoInNode( SwPaM&, SwMoveFnCollection const &); +SW_DLLPUBLIC bool GoInContent( SwPaM&, SwMoveFnCollection const &); +SW_DLLPUBLIC bool GoInContentCells( SwPaM&, SwMoveFnCollection const &); +SW_DLLPUBLIC bool GoInContentSkipHidden( SwPaM&, SwMoveFnCollection const &); +SW_DLLPUBLIC bool GoInContentCellsSkipHidden( SwPaM&, SwMoveFnCollection const &); /// PaM is Point and Mark: a selection of the document model. class SW_DLLPUBLIC SwPaM : public sw::Ring<SwPaM> @@ -163,7 +162,7 @@ class SW_DLLPUBLIC SwPaM : public sw::Ring<SwPaM> SwPosition * m_pMark; ///< points at either m_Bound1 or m_Bound2 bool m_bIsInFrontOfLabel; - SwPaM* MakeRegion( SwMoveFn fnMove, const SwPaM * pOrigRg ); + SwPaM* MakeRegion( SwMoveFnCollection const & fnMove, const SwPaM * pOrigRg ); SwPaM(SwPaM const& rPaM) = delete; @@ -189,27 +188,27 @@ public: SwPaM& operator=( const SwPaM & ); /// Movement of cursor. - bool Move( SwMoveFn fnMove = fnMoveForward, + bool Move( SwMoveFnCollection const & fnMove = fnMoveForward, SwGoInDoc fnGo = GoInContent ); /// Search. bool Find( const css::util::SearchOptions2& rSearchOpt, bool bSearchInNotes, utl::TextSearch& rSText, - SwMoveFn fnMove = fnMoveForward, + SwMoveFnCollection const & fnMove = fnMoveForward, const SwPaM *pPam =nullptr, bool bInReadOnly = false); bool Find( const SwFormat& rFormat, - SwMoveFn fnMove = fnMoveForward, + SwMoveFnCollection const & fnMove = fnMoveForward, const SwPaM *pPam =nullptr, bool bInReadOnly = false); bool Find( const SfxPoolItem& rAttr, bool bValue, - SwMoveFn fnMove = fnMoveForward, + SwMoveFnCollection const & fnMove = fnMoveForward, const SwPaM *pPam =nullptr, bool bInReadOnly = false ); bool Find( const SfxItemSet& rAttr, bool bNoColls, - SwMoveFn fnMove, + SwMoveFnCollection const & fnMove, const SwPaM *pPam, bool bInReadOnly, bool bMoveFirst ); bool DoSearch( const css::util::SearchOptions2& rSearchOpt, utl::TextSearch& rSText, - SwMoveFn fnMove, bool bSrchForward, bool bRegSearch, bool bChkEmptyPara, bool bChkParaEnd, + SwMoveFnCollection const & fnMove, bool bSrchForward, bool bRegSearch, bool bChkEmptyPara, bool bChkParaEnd, sal_Int32 &nStart, sal_Int32 &nEnd, sal_Int32 nTextLen, SwNode* pNode, SwPaM* pPam); inline bool IsInFrontOfLabel() const { return m_bIsInFrontOfLabel; } diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx index 9d36721642c1..122dc4c0d7db 100644 --- a/sw/inc/swcrsr.hxx +++ b/sw/inc/swcrsr.hxx @@ -39,7 +39,7 @@ const int FIND_NO_RING = 2; struct SwFindParas { - virtual int Find( SwPaM*, SwMoveFn, const SwPaM*, bool ) = 0; + virtual int Find( SwPaM*, SwMoveFnCollection const &, const SwPaM*, bool ) = 0; virtual bool IsReplaceMode() const = 0; protected: @@ -109,7 +109,7 @@ public: virtual void SaveTableBoxContent( const SwPosition* pPos ); void FillFindPos( SwDocPositions ePos, SwPosition& rPos ) const; - SwMoveFnCollection* MakeFindRange( SwDocPositions, SwDocPositions, + SwMoveFnCollection const & MakeFindRange( SwDocPositions, SwDocPositions, SwPaM* ) const; sal_uLong Find( const css::util::SearchOptions2& rSearchOpt, @@ -185,10 +185,10 @@ public: bool GotoNextFootnoteAnchor(); bool GotoPrevFootnoteAnchor(); - bool MovePara( SwWhichPara, SwPosPara ); - bool MoveSection( SwWhichSection, SwPosSection ); - bool MoveTable( SwWhichTable, SwPosTable ); - bool MoveRegion( SwWhichRegion, SwPosRegion ); + bool MovePara( SwWhichPara, SwMoveFnCollection const & ); + bool MoveSection( SwWhichSection, SwMoveFnCollection const & ); + bool MoveTable( SwWhichTable, SwMoveFnCollection const & ); + bool MoveRegion( SwWhichRegion, SwMoveFnCollection const & ); // Is there a selection of content in table? // Return value indicates if cursor remains at its old position. diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 7b501f44e371..1c24eb6be242 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -672,7 +672,7 @@ bool SwCursorShell::isInHiddenTextFrame(SwShellCursor* pShellCursor) return !pFrame || (pFrame->IsTextFrame() && static_cast<SwTextFrame*>(pFrame)->IsHiddenNow()); } -bool SwCursorShell::MovePara(SwWhichPara fnWhichPara, SwPosPara fnPosPara ) +bool SwCursorShell::MovePara(SwWhichPara fnWhichPara, SwMoveFnCollection const & fnPosPara ) { SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed SwShellCursor* pTmpCursor = getShellCursor( true ); @@ -696,7 +696,7 @@ bool SwCursorShell::MovePara(SwWhichPara fnWhichPara, SwPosPara fnPosPara ) } bool SwCursorShell::MoveSection( SwWhichSection fnWhichSect, - SwPosSection fnPosSect) + SwMoveFnCollection const & fnPosSect) { SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed SwCursor* pTmpCursor = getShellCursor( true ); @@ -1502,7 +1502,7 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd ) { pTableFrame = nullptr; - SwPosSection fnPosSect = *pPos < *pITmpCursor->GetMark() + SwMoveFnCollection const & fnPosSect = *pPos < *pITmpCursor->GetMark() ? fnSectionStart : fnSectionEnd; diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index b97fa08b6d1d..fa25c7fb7289 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -156,17 +156,17 @@ static void lcl_SetAttrPam( SwPaM& rPam, sal_Int32 nStart, const sal_Int32* pEnd */ static bool lcl_Search( const SwTextNode& rTextNd, SwPaM& rPam, const SfxPoolItem& rCmpItem, - SwMoveFn fnMove, bool bValue ) + SwMoveFnCollection const & fnMove, bool bValue ) { if ( !rTextNd.HasHints() ) return false; const SwTextAttr *pTextHt = nullptr; - bool bForward = fnMove == fnMoveForward; + bool bForward = &fnMove == &fnMoveForward; sal_uInt16 nPos = bForward ? 0 : rTextNd.GetSwpHints().Count(); sal_Int32 nContentPos = rPam.GetPoint()->nContent.GetIndex(); - while( nullptr != ( pTextHt=(*fnMove->fnGetHint)(rTextNd.GetSwpHints(),nPos,nContentPos))) + while( nullptr != ( pTextHt=(*fnMove.fnGetHint)(rTextNd.GetSwpHints(),nPos,nContentPos))) if( pTextHt->Which() == rCmpItem.Which() && ( !bValue || CmpAttr( pTextHt->GetAttr(), rCmpItem ))) { @@ -881,7 +881,7 @@ static bool lcl_Search( const SwContentNode& rCNd, const SfxItemSet& rCmpSet, bo return true; // found } -bool SwPaM::Find( const SfxPoolItem& rAttr, bool bValue, SwMoveFn fnMove, +bool SwPaM::Find( const SfxPoolItem& rAttr, bool bValue, SwMoveFnCollection const & fnMove, const SwPaM *pRegion, bool bInReadOnly ) { // determine which attribute is searched: @@ -892,7 +892,7 @@ bool SwPaM::Find( const SfxPoolItem& rAttr, bool bValue, SwMoveFn fnMove, bool bFound = false; bool bFirst = true; - const bool bSrchForward = fnMove == fnMoveForward; + const bool bSrchForward = &fnMove == &fnMoveForward; SwContentNode * pNode; const SfxPoolItem* pItem; SwpFormats aFormatArr; @@ -902,7 +902,7 @@ bool SwPaM::Find( const SfxPoolItem& rAttr, bool bValue, SwMoveFn fnMove, ? pPam->GetPoint()->nContent.GetIndex() == pPam->GetContentNode()->Len() : !pPam->GetPoint()->nContent.GetIndex() ) { - if( !(*fnMove->fnNds)( &pPam->GetPoint()->nNode, false )) + if( !(*fnMove.fnNds)( &pPam->GetPoint()->nNode, false )) { return false; } @@ -963,14 +963,14 @@ bool SwPaM::Find( const SfxPoolItem& rAttr, bool bValue, SwMoveFn fnMove, typedef bool (*FnSearchAttr)( const SwTextNode&, SwAttrCheckArr&, SwPaM& ); -bool SwPaM::Find( const SfxItemSet& rSet, bool bNoColls, SwMoveFn fnMove, +bool SwPaM::Find( const SfxItemSet& rSet, bool bNoColls, SwMoveFnCollection const & fnMove, const SwPaM *pRegion, bool bInReadOnly, bool bMoveFirst ) { std::unique_ptr<SwPaM> pPam(MakeRegion( fnMove, pRegion )); bool bFound = false; bool bFirst = true; - const bool bSrchForward = fnMove == fnMoveForward; + const bool bSrchForward = &fnMove == &fnMoveForward; SwContentNode * pNode; SwpFormats aFormatArr; @@ -990,7 +990,7 @@ bool SwPaM::Find( const SfxItemSet& rSet, bool bNoColls, SwMoveFn fnMove, ? pPam->GetPoint()->nContent.GetIndex() == pPam->GetContentNode()->Len() : !pPam->GetPoint()->nContent.GetIndex() ) ) { - if( !(*fnMove->fnNds)( &pPam->GetPoint()->nNode, false )) + if( !(*fnMove.fnNds)( &pPam->GetPoint()->nNode, false )) { return false; } @@ -1068,11 +1068,11 @@ struct SwFindParaAttr : public SwFindParas virtual ~SwFindParaAttr() { delete pSText; } - virtual int Find( SwPaM* , SwMoveFn , const SwPaM*, bool bInReadOnly ) override; + virtual int Find( SwPaM* , SwMoveFnCollection const & , const SwPaM*, bool bInReadOnly ) override; virtual bool IsReplaceMode() const override; }; -int SwFindParaAttr::Find( SwPaM* pCursor, SwMoveFn fnMove, const SwPaM* pRegion, +int SwFindParaAttr::Find( SwPaM* pCursor, SwMoveFnCollection const & fnMove, const SwPaM* pRegion, bool bInReadOnly ) { // replace string (only if text given and search is not parameterized)? diff --git a/sw/source/core/crsr/findcoll.cxx b/sw/source/core/crsr/findcoll.cxx index 0be773e139b6..b70b702c2e93 100644 --- a/sw/source/core/crsr/findcoll.cxx +++ b/sw/source/core/crsr/findcoll.cxx @@ -35,11 +35,11 @@ struct SwFindParaFormatColl : public SwFindParas : pFormatColl( &rFormatColl ), pReplColl( pRpColl ) {} virtual ~SwFindParaFormatColl() {} - virtual int Find( SwPaM* , SwMoveFn , const SwPaM*, bool bInReadOnly ) override; + virtual int Find( SwPaM* , SwMoveFnCollection const & , const SwPaM*, bool bInReadOnly ) override; virtual bool IsReplaceMode() const override; }; -int SwFindParaFormatColl::Find( SwPaM* pCursor, SwMoveFn fnMove, const SwPaM* pRegion, +int SwFindParaFormatColl::Find( SwPaM* pCursor, SwMoveFnCollection const & fnMove, const SwPaM* pRegion, bool bInReadOnly ) { int nRet = FIND_FOUND; diff --git a/sw/source/core/crsr/findfmt.cxx b/sw/source/core/crsr/findfmt.cxx index 467622f60234..e6ae94286f9b 100644 --- a/sw/source/core/crsr/findfmt.cxx +++ b/sw/source/core/crsr/findfmt.cxx @@ -21,11 +21,11 @@ #include <pamtyp.hxx> #include <memory> -bool SwPaM::Find( const SwFormat& rFormat, SwMoveFn fnMove, +bool SwPaM::Find( const SwFormat& rFormat, SwMoveFnCollection const & fnMove, const SwPaM *pRegion, bool bInReadOnly ) { bool bFound = false; - const bool bSrchForward = (fnMove == fnMoveForward); + const bool bSrchForward = &fnMove == &fnMoveForward; std::unique_ptr<SwPaM> pPam(MakeRegion( fnMove, pRegion )); // if at beginning/end then move it out of the node @@ -33,7 +33,7 @@ bool SwPaM::Find( const SwFormat& rFormat, SwMoveFn fnMove, ? pPam->GetPoint()->nContent.GetIndex() == pPam->GetContentNode()->Len() : !pPam->GetPoint()->nContent.GetIndex() ) { - if( !(*fnMove->fnNds)( &pPam->GetPoint()->nNode, false )) + if( !(*fnMove.fnNds)( &pPam->GetPoint()->nNode, false )) { return false; } diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 2084cabdc845..32df0421fcd9 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -222,14 +222,14 @@ size_t GetPostIt(sal_Int32 aCount,const SwpHints *pHts) } bool SwPaM::Find( const SearchOptions2& rSearchOpt, bool bSearchInNotes , utl::TextSearch& rSText, - SwMoveFn fnMove, const SwPaM * pRegion, + SwMoveFnCollection const & fnMove, const SwPaM * pRegion, bool bInReadOnly ) { if( rSearchOpt.searchString.isEmpty() ) return false; SwPaM* pPam = MakeRegion( fnMove, pRegion ); - const bool bSrchForward = fnMove == fnMoveForward; + const bool bSrchForward = &fnMove == &fnMoveForward; SwNodeIndex& rNdIdx = pPam->GetPoint()->nNode; SwIndex& rContentIdx = pPam->GetPoint()->nContent; @@ -470,7 +470,7 @@ bool SwPaM::Find( const SearchOptions2& rSearchOpt, bool bSearchInNotes , utl::T } bool SwPaM::DoSearch( const SearchOptions2& rSearchOpt, utl::TextSearch& rSText, - SwMoveFn fnMove, bool bSrchForward, bool bRegSearch, + SwMoveFnCollection const & fnMove, bool bSrchForward, bool bRegSearch, bool bChkEmptyPara, bool bChkParaEnd, sal_Int32 &nStart, sal_Int32 &nEnd, sal_Int32 nTextLen, SwNode* pNode, SwPaM* pPam) @@ -553,7 +553,7 @@ bool SwPaM::DoSearch( const SearchOptions2& rSearchOpt, utl::TextSearch& rSText, sal_Int32 nProxyStart = nStart; sal_Int32 nProxyEnd = nEnd; if( nSearchScript == nCurrScript && - (rSText.*fnMove->fnSearch)( sCleanStr, &nProxyStart, &nProxyEnd, nullptr ) && + (rSText.*fnMove.fnSearch)( sCleanStr, &nProxyStart, &nProxyEnd, nullptr ) && !(bZeroMatch = (nProxyStart == nProxyEnd))) { nStart = nProxyStart; @@ -642,7 +642,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* , SwMoveFn , const SwPaM*, bool bInReadOnly ) override; + virtual int Find( SwPaM* , SwMoveFnCollection const & , const SwPaM*, bool bInReadOnly ) override; virtual bool IsReplaceMode() const override; virtual ~SwFindParaText(); }; @@ -651,7 +651,7 @@ SwFindParaText::~SwFindParaText() { } -int SwFindParaText::Find( SwPaM* pCursor, SwMoveFn fnMove, +int SwFindParaText::Find( SwPaM* pCursor, SwMoveFnCollection const & fnMove, const SwPaM* pRegion, bool bInReadOnly ) { if( bInReadOnly && m_bReplace ) @@ -695,7 +695,7 @@ int SwFindParaText::Find( SwPaM* pCursor, SwMoveFn fnMove, } if (bRegExp && !bReplaced) { // fdo#80715 avoid infinite loop if join failed - bool bRet = ((fnMoveForward == fnMove) ? &GoNextPara : &GoPrevPara) + bool bRet = ((&fnMoveForward == &fnMove) ? &GoNextPara : &GoPrevPara) (*pCursor, fnMove); (void) bRet; assert(bRet); // if join failed, next node must be SwTextNode diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index 6e8a6c2a4250..c83361b94778 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -487,7 +487,7 @@ void SwPaM::Exchange() #endif /// movement of cursor -bool SwPaM::Move( SwMoveFn fnMove, SwGoInDoc fnGo ) +bool SwPaM::Move( SwMoveFnCollection const & fnMove, SwGoInDoc fnGo ) { const bool bRet = (*fnGo)( *this, fnMove ); @@ -505,7 +505,7 @@ bool SwPaM::Move( SwMoveFn fnMove, SwGoInDoc fnGo ) @return Newly created range, in Ring with parameter pOrigRg. */ -SwPaM* SwPaM::MakeRegion( SwMoveFn fnMove, const SwPaM * pOrigRg ) +SwPaM* SwPaM::MakeRegion( SwMoveFnCollection const & fnMove, const SwPaM * pOrigRg ) { SwPaM* pPam; if( pOrigRg == nullptr ) @@ -523,7 +523,7 @@ SwPaM* SwPaM::MakeRegion( SwMoveFn fnMove, const SwPaM * pOrigRg ) // make sure that SPoint is on the "real" start position // FORWARD: SPoint always smaller than GetMark // BACKWARD: SPoint always bigger than GetMark - if( (pPam->GetMark()->*fnMove->fnCmpOp)( *pPam->GetPoint() ) ) + if( (pPam->GetMark()->*fnMove.fnCmpOp)( *pPam->GetPoint() ) ) pPam->Exchange(); } return pPam; @@ -748,11 +748,11 @@ bool SwPaM::HasReadonlySel( bool bFormView, bool bAnnotationMode ) const /// left or the next is out of the area, then a null-pointer is returned. /// @param rbFirst If <true> than first time request. If so than the position of /// the PaM must not be changed! -SwContentNode* GetNode( SwPaM & rPam, bool& rbFirst, SwMoveFn fnMove, +SwContentNode* GetNode( SwPaM & rPam, bool& rbFirst, SwMoveFnCollection const & fnMove, bool bInReadOnly ) { SwContentNode * pNd = nullptr; - if( ((*rPam.GetPoint()).*fnMove->fnCmpOp)( *rPam.GetMark() ) || + if( ((*rPam.GetPoint()).*fnMove.fnCmpOp)( *rPam.GetMark() ) || ( *rPam.GetPoint() == *rPam.GetMark() && rbFirst ) ) { SwContentFrame* pFrame; @@ -781,7 +781,7 @@ SwContentNode* GetNode( SwPaM & rPam, bool& rbFirst, SwMoveFn fnMove, if( !pNd ) // is the cursor not on a ContentNode? { SwPosition aPos( *rPam.GetPoint() ); - bool bSrchForward = fnMove == fnMoveForward; + bool bSrchForward = &fnMove == &fnMoveForward; SwNodes& rNodes = aPos.nNode.GetNodes(); // go to next/previous ContentNode @@ -794,7 +794,7 @@ SwContentNode* GetNode( SwPaM & rPam, bool& rbFirst, SwMoveFn fnMove, { aPos.nContent.Assign( pNd, ::GetSttOrEnd( bSrchForward,*pNd )); // is the position still in the area - if( (aPos.*fnMove->fnCmpOp)( *rPam.GetMark() ) ) + if( (aPos.*fnMove.fnCmpOp)( *rPam.GetMark() ) ) { // only in AutoTextSection can be nodes that are hidden if( nullptr == ( pFrame = pNd->getLayoutFrame( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) ) || @@ -865,60 +865,60 @@ void GoEndSection( SwPosition * pPos ) pPos->nNode.GetNode().GetContentNode()->MakeEndIndex( &pPos->nContent ); } -bool GoInDoc( SwPaM & rPam, SwMoveFn fnMove ) +bool GoInDoc( SwPaM & rPam, SwMoveFnCollection const & fnMove ) { - (*fnMove->fnDoc)( rPam.GetPoint() ); + (*fnMove.fnDoc)( rPam.GetPoint() ); return true; } -bool GoInSection( SwPaM & rPam, SwMoveFn fnMove ) +bool GoInSection( SwPaM & rPam, SwMoveFnCollection const & fnMove ) { - (*fnMove->fnSections)( rPam.GetPoint() ); + (*fnMove.fnSections)( rPam.GetPoint() ); return true; } -bool GoInNode( SwPaM & rPam, SwMoveFn fnMove ) +bool GoInNode( SwPaM & rPam, SwMoveFnCollection const & fnMove ) { - SwContentNode *pNd = (*fnMove->fnNds)( &rPam.GetPoint()->nNode, true ); + SwContentNode *pNd = (*fnMove.fnNds)( &rPam.GetPoint()->nNode, true ); if( pNd ) rPam.GetPoint()->nContent.Assign( pNd, - ::GetSttOrEnd( fnMove == fnMoveForward, *pNd ) ); + ::GetSttOrEnd( &fnMove == &fnMoveForward, *pNd ) ); return pNd; } -bool GoInContent( SwPaM & rPam, SwMoveFn fnMove ) +bool GoInContent( SwPaM & rPam, SwMoveFnCollection const & fnMove ) { - if( (*fnMove->fnNd)( &rPam.GetPoint()->nNode.GetNode(), + if( (*fnMove.fnNd)( &rPam.GetPoint()->nNode.GetNode(), &rPam.GetPoint()->nContent, CRSR_SKIP_CHARS )) return true; return GoInNode( rPam, fnMove ); } -bool GoInContentCells( SwPaM & rPam, SwMoveFn fnMove ) +bool GoInContentCells( SwPaM & rPam, SwMoveFnCollection const & fnMove ) { - if( (*fnMove->fnNd)( &rPam.GetPoint()->nNode.GetNode(), + if( (*fnMove.fnNd)( &rPam.GetPoint()->nNode.GetNode(), &rPam.GetPoint()->nContent, CRSR_SKIP_CELLS )) return true; return GoInNode( rPam, fnMove ); } -bool GoInContentSkipHidden( SwPaM & rPam, SwMoveFn fnMove ) +bool GoInContentSkipHidden( SwPaM & rPam, SwMoveFnCollection const & fnMove ) { - if( (*fnMove->fnNd)( &rPam.GetPoint()->nNode.GetNode(), + if( (*fnMove.fnNd)( &rPam.GetPoint()->nNode.GetNode(), &rPam.GetPoint()->nContent, CRSR_SKIP_CHARS | CRSR_SKIP_HIDDEN ) ) return true; return GoInNode( rPam, fnMove ); } -bool GoInContentCellsSkipHidden( SwPaM & rPam, SwMoveFn fnMove ) +bool GoInContentCellsSkipHidden( SwPaM & rPam, SwMoveFnCollection const & fnMove ) { - if( (*fnMove->fnNd)( &rPam.GetPoint()->nNode.GetNode(), + if( (*fnMove.fnNd)( &rPam.GetPoint()->nNode.GetNode(), &rPam.GetPoint()->nContent, CRSR_SKIP_CELLS | CRSR_SKIP_HIDDEN ) ) return true; return GoInNode( rPam, fnMove ); } -bool GoPrevPara( SwPaM & rPam, SwPosPara aPosPara ) +bool GoPrevPara( SwPaM & rPam, SwMoveFnCollection const & aPosPara ) { if( rPam.Move( fnMoveBackward, GoInNode ) ) { @@ -926,20 +926,20 @@ bool GoPrevPara( SwPaM & rPam, SwPosPara aPosPara ) SwPosition& rPos = *rPam.GetPoint(); SwContentNode * pNd = rPos.nNode.GetNode().GetContentNode(); rPos.nContent.Assign( pNd, - ::GetSttOrEnd( aPosPara == fnMoveForward, *pNd ) ); + ::GetSttOrEnd( &aPosPara == &fnMoveForward, *pNd ) ); return true; } return false; } -bool GoCurrPara( SwPaM & rPam, SwPosPara aPosPara ) +bool GoCurrPara( SwPaM & rPam, SwMoveFnCollection const & aPosPara ) { SwPosition& rPos = *rPam.GetPoint(); SwContentNode * pNd = rPos.nNode.GetNode().GetContentNode(); if( pNd ) { const sal_Int32 nOld = rPos.nContent.GetIndex(); - const sal_Int32 nNew = aPosPara == fnMoveForward ? 0 : pNd->Len(); + const sal_Int32 nNew = &aPosPara == &fnMoveForward ? 0 : pNd->Len(); // if already at beginning/end then to the next/previous if( nOld != nNew ) { @@ -948,19 +948,19 @@ bool GoCurrPara( SwPaM & rPam, SwPosPara aPosPara ) } } // move node to next/previous ContentNode - if( ( aPosPara==fnParaStart && nullptr != ( pNd = + if( ( &aPosPara==&fnParaStart && nullptr != ( pNd = GoPreviousNds( &rPos.nNode, true ))) || - ( aPosPara==fnParaEnd && nullptr != ( pNd = + ( &aPosPara==&fnParaEnd && nullptr != ( pNd = GoNextNds( &rPos.nNode, true ))) ) { rPos.nContent.Assign( pNd, - ::GetSttOrEnd( aPosPara == fnMoveForward, *pNd )); + ::GetSttOrEnd( &aPosPara == &fnMoveForward, *pNd )); return true; } return false; } -bool GoNextPara( SwPaM & rPam, SwPosPara aPosPara ) +bool GoNextPara( SwPaM & rPam, SwMoveFnCollection const & aPosPara ) { if( rPam.Move( fnMoveForward, GoInNode ) ) { @@ -968,27 +968,27 @@ bool GoNextPara( SwPaM & rPam, SwPosPara aPosPara ) SwPosition& rPos = *rPam.GetPoint(); SwContentNode * pNd = rPos.nNode.GetNode().GetContentNode(); rPos.nContent.Assign( pNd, - ::GetSttOrEnd( aPosPara == fnMoveForward, *pNd ) ); + ::GetSttOrEnd( &aPosPara == &fnMoveForward, *pNd ) ); return true; } return false; } -bool GoCurrSection( SwPaM & rPam, SwMoveFn fnMove ) +bool GoCurrSection( SwPaM & rPam, SwMoveFnCollection const & fnMove ) { SwPosition& rPos = *rPam.GetPoint(); SwPosition aSavePos( rPos ); // position for comparison - (fnMove->fnSection)( &rPos.nNode ); + (fnMove.fnSection)( &rPos.nNode ); SwContentNode *pNd; if( nullptr == ( pNd = rPos.nNode.GetNode().GetContentNode()) && - nullptr == ( pNd = (*fnMove->fnNds)( &rPos.nNode, true )) ) + nullptr == ( pNd = (*fnMove.fnNds)( &rPos.nNode, true )) ) { rPos = aSavePos; // do not change cursor return false; } rPos.nContent.Assign( pNd, - ::GetSttOrEnd( fnMove == fnMoveForward, *pNd ) ); + ::GetSttOrEnd( &fnMove == &fnMoveForward, *pNd ) ); return aSavePos != rPos; } diff --git a/sw/source/core/crsr/paminit.cxx b/sw/source/core/crsr/paminit.cxx index c36fe9ec2ed1..47879a97672f 100644 --- a/sw/source/core/crsr/paminit.cxx +++ b/sw/source/core/crsr/paminit.cxx @@ -47,33 +47,33 @@ static SwMoveFnCollection aBwrd = { SwWhichPara fnParaPrev = &GoPrevPara; SwWhichPara fnParaCurr = &GoCurrPara; SwWhichPara fnParaNext = &GoNextPara; -SwPosPara fnParaStart = &aFwrd; -SwPosPara fnParaEnd = &aBwrd; +SwMoveFnCollection const & fnParaStart = aFwrd; +SwMoveFnCollection const & fnParaEnd = aBwrd; -SwPosSection fnSectionStart = &aFwrd; -SwPosSection fnSectionEnd = &aBwrd; +SwMoveFnCollection const & fnSectionStart = aFwrd; +SwMoveFnCollection const & fnSectionEnd = aBwrd; SwWhichTable fnTablePrev = &GotoPrevTable; SwWhichTable fnTableCurr = &GotoCurrTable; SwWhichTable fnTableNext = &GotoNextTable; -SwPosTable fnTableStart = &aFwrd; -SwPosTable fnTableEnd = &aBwrd; +SwMoveFnCollection const & fnTableStart = aFwrd; +SwMoveFnCollection const & fnTableEnd = aBwrd; SwWhichRegion fnRegionPrev = &GotoPrevRegion; SwWhichRegion fnRegionCurr = &GotoCurrRegion; SwWhichRegion fnRegionCurrAndSkip = &GotoCurrRegionAndSkip; SwWhichRegion fnRegionNext = &GotoNextRegion; -SwPosRegion fnRegionStart = &aFwrd; -SwPosRegion fnRegionEnd = &aBwrd; +SwMoveFnCollection const & fnRegionStart = aFwrd; +SwMoveFnCollection const & fnRegionEnd = aBwrd; -SwMoveFn fnMoveBackward = &aBwrd; -SwMoveFn fnMoveForward = &aFwrd; +SwMoveFnCollection const & fnMoveBackward = aBwrd; +SwMoveFnCollection const & fnMoveForward = aFwrd; SwWhichPara GetfnParaCurr() { return fnParaCurr; } -SwPosPara GetfnParaStart() +SwMoveFnCollection const & GetfnParaStart() { return fnParaStart; } @@ -81,11 +81,11 @@ SwWhichTable GetfnTablePrev() { return fnTablePrev; } -SwPosPara GetfnParaEnd() +SwMoveFnCollection const & GetfnParaEnd() { return fnParaEnd; } -SwPosTable GetfnTableStart() +SwMoveFnCollection const & GetfnTableStart() { return fnTableStart; } @@ -93,7 +93,7 @@ SwWhichTable GetfnTableCurr() { return fnTableCurr; } -SwPosTable GetfnTableEnd() +SwMoveFnCollection const & GetfnTableEnd() { return fnTableEnd; } diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index b2267a83dfbc..0e377e906b6a 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -721,7 +721,7 @@ bool SwCursor::IsAtValidPos( bool bPoint ) const void SwCursor::SaveTableBoxContent( const SwPosition* ) {} /// set range for search in document -SwMoveFnCollection* SwCursor::MakeFindRange( SwDocPositions nStart, +SwMoveFnCollection const & SwCursor::MakeFindRange( SwDocPositions nStart, SwDocPositions nEnd, SwPaM* pRange ) const { pRange->SetMark(); @@ -736,7 +736,7 @@ SwMoveFnCollection* SwCursor::MakeFindRange( SwDocPositions nStart, } static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurrentCursor, - SwMoveFn fnMove, SwCursor*& pFndRing, + SwMoveFnCollection const & fnMove, SwCursor*& pFndRing, SwPaM& aRegion, FindRanges eFndRngs, bool bInReadOnly, bool& bCancel ) { @@ -744,7 +744,7 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurrentCurso bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); int nFndRet = 0; sal_uLong nFound = 0; - const bool bSrchBkwrd = fnMove == fnMoveBackward; + const bool bSrchBkwrd = &fnMove == &fnMoveBackward; SwPaM *pTmpCursor = pCurrentCursor, *pSaveCursor = pCurrentCursor; // only create progress bar for ShellCursor @@ -933,10 +933,10 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas, // create region without adding it to the ring SwPaM aRegion( *GetPoint() ); - SwMoveFn fnMove = MakeFindRange( nStart, nEnde, &aRegion ); + SwMoveFnCollection const & fnMove = MakeFindRange( nStart, nEnde, &aRegion ); sal_uLong nFound = 0; - const bool bMvBkwrd = fnMove == fnMoveBackward; + const bool bMvBkwrd = &fnMove == &fnMoveBackward; bool bInReadOnly = IsReadOnlyAvailable(); SwCursor* pFndRing = nullptr; @@ -1629,7 +1629,7 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, // can the cursor be moved n times? SwCursorSaveState aSave( *this ); - SwMoveFn fnMove = bLeft ? fnMoveBackward : fnMoveForward; + SwMoveFnCollection const & fnMove = bLeft ? fnMoveBackward : fnMoveForward; SwGoInDoc fnGo; if ( bSkipHidden ) @@ -1915,7 +1915,7 @@ bool SwCursor::SttEndDoc( bool bStt ) SwCursorSaveState aSave( *this ); // Never jump over section boundaries during selection! // Can the cursor still moved on? - SwMoveFn fnMove = bStt ? fnMoveBackward : fnMoveForward; + SwMoveFnCollection const & fnMove = bStt ? fnMoveBackward : fnMoveForward; bool bRet = (!HasMark() || !IsNoContent() ) && Move( fnMove, GoInDoc ) && !IsInProtectTable( true ) && @@ -2032,7 +2032,7 @@ bool SwCursor::GotoTableBox( const OUString& rName ) return bRet; } -bool SwCursor::MovePara(SwWhichPara fnWhichPara, SwPosPara fnPosPara ) +bool SwCursor::MovePara(SwWhichPara fnWhichPara, SwMoveFnCollection const & fnPosPara ) { // for optimization test something before const SwNode* pNd = &GetPoint()->nNode.GetNode(); @@ -2046,7 +2046,7 @@ bool SwCursor::MovePara(SwWhichPara fnWhichPara, SwPosPara fnPosPara ) const SwContentNode* pContentNd = pNd->GetContentNode(); if ( pContentNd ) { - const sal_Int32 nSttEnd = fnPosPara == fnMoveForward ? 0 : pContentNd->Len(); + const sal_Int32 nSttEnd = &fnPosPara == &fnMoveForward ? 0 : pContentNd->Len(); if ( GetPoint()->nContent.GetIndex() != nSttEnd ) bShortCut = true; } @@ -2072,7 +2072,7 @@ bool SwCursor::MovePara(SwWhichPara fnWhichPara, SwPosPara fnPosPara ) } bool SwCursor::MoveSection( SwWhichSection fnWhichSect, - SwPosSection fnPosSect) + SwMoveFnCollection const & fnPosSect) { SwCursorSaveState aSave( *this ); return (*fnWhichSect)( *this, fnPosSect ) && diff --git a/sw/source/core/crsr/trvlreg.cxx b/sw/source/core/crsr/trvlreg.cxx index 2847e85e394e..ccdde1d4e053 100644 --- a/sw/source/core/crsr/trvlreg.cxx +++ b/sw/source/core/crsr/trvlreg.cxx @@ -28,7 +28,7 @@ #include <section.hxx> #include <trvlreg.hxx> -bool GotoPrevRegion( SwPaM& rCurrentCursor, SwPosRegion fnPosRegion, +bool GotoPrevRegion( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosRegion, bool bInReadOnly ) { SwNodeIndex aIdx( rCurrentCursor.GetPoint()->nNode ); @@ -50,7 +50,7 @@ bool GotoPrevRegion( SwPaM& rCurrentCursor, SwPosRegion fnPosRegion, // skip protected or hidden ones aIdx.Assign( *pNd, - 1 ); } - else if( fnPosRegion == fnMoveForward ) + else if( &fnPosRegion == &fnMoveForward ) { aIdx = *pNd; SwContentNode* pCNd = pNd->GetNodes().GoNextSection( &aIdx, @@ -81,7 +81,7 @@ bool GotoPrevRegion( SwPaM& rCurrentCursor, SwPosRegion fnPosRegion, return false; } -bool GotoNextRegion( SwPaM& rCurrentCursor, SwPosRegion fnPosRegion, +bool GotoNextRegion( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosRegion, bool bInReadOnly ) { SwNodeIndex aIdx( rCurrentCursor.GetPoint()->nNode ); @@ -104,7 +104,7 @@ bool GotoNextRegion( SwPaM& rCurrentCursor, SwPosRegion fnPosRegion, // skip protected or hidden ones aIdx.Assign( *pNd->EndOfSectionNode(), +1 ); } - else if( fnPosRegion == fnMoveForward ) + else if( &fnPosRegion == &fnMoveForward ) { aIdx = *pNd; SwContentNode* pCNd = pNd->GetNodes().GoNextSection( &aIdx, @@ -135,7 +135,7 @@ bool GotoNextRegion( SwPaM& rCurrentCursor, SwPosRegion fnPosRegion, return false; } -bool GotoCurrRegion( SwPaM& rCurrentCursor, SwPosRegion fnPosRegion, +bool GotoCurrRegion( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosRegion, bool bInReadOnly ) { SwSectionNode* pNd = rCurrentCursor.GetNode().FindSectionNode(); @@ -143,7 +143,7 @@ bool GotoCurrRegion( SwPaM& rCurrentCursor, SwPosRegion fnPosRegion, return false; SwPosition* pPos = rCurrentCursor.GetPoint(); - bool bMoveBackward = fnPosRegion == fnMoveBackward; + bool bMoveBackward = &fnPosRegion == &fnMoveBackward; SwContentNode* pCNd; if( bMoveBackward ) @@ -165,7 +165,7 @@ bool GotoCurrRegion( SwPaM& rCurrentCursor, SwPosRegion fnPosRegion, return nullptr != pCNd; } -bool GotoCurrRegionAndSkip( SwPaM& rCurrentCursor, SwPosRegion fnPosRegion, +bool GotoCurrRegionAndSkip( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosRegion, bool bInReadOnly ) { SwNode& rCurrNd = rCurrentCursor.GetNode(); @@ -175,7 +175,7 @@ bool GotoCurrRegionAndSkip( SwPaM& rCurrentCursor, SwPosRegion fnPosRegion, SwPosition* pPos = rCurrentCursor.GetPoint(); const sal_Int32 nCurrCnt = pPos->nContent.GetIndex(); - bool bMoveBackward = fnPosRegion == fnMoveBackward; + bool bMoveBackward = &fnPosRegion == &fnMoveBackward; do { SwContentNode* pCNd; @@ -210,7 +210,7 @@ bool GotoCurrRegionAndSkip( SwPaM& rCurrentCursor, SwPosRegion fnPosRegion, return false; } -bool SwCursor::MoveRegion( SwWhichRegion fnWhichRegion, SwPosRegion fnPosRegion ) +bool SwCursor::MoveRegion( SwWhichRegion fnWhichRegion, SwMoveFnCollection const & fnPosRegion ) { SwCursorSaveState aSaveState( *this ); return !dynamic_cast<SwTableCursor*>(this) && @@ -220,7 +220,7 @@ bool SwCursor::MoveRegion( SwWhichRegion fnWhichRegion, SwPosRegion fnPosRegion GetPoint()->nContent.GetIndex() != m_pSavePos->nContent); } -bool SwCursorShell::MoveRegion( SwWhichRegion fnWhichRegion, SwPosRegion fnPosRegion ) +bool SwCursorShell::MoveRegion( SwWhichRegion fnWhichRegion, SwMoveFnCollection const & fnPosRegion ) { SwCallLink aLk( *this ); // watch Cursor-Moves;call Link if needed bool bRet = !m_pTableCursor && m_pCurrentCursor->MoveRegion( fnWhichRegion, fnPosRegion ); diff --git a/sw/source/core/crsr/trvlreg.hxx b/sw/source/core/crsr/trvlreg.hxx index 9679a6e248f4..ea069baf4f77 100644 --- a/sw/source/core/crsr/trvlreg.hxx +++ b/sw/source/core/crsr/trvlreg.hxx @@ -23,10 +23,10 @@ #include <sal/config.h> // Travelling in regions -bool GotoPrevRegion( SwPaM&, SwPosRegion, bool bInReadOnly ); -bool GotoCurrRegion( SwPaM&, SwPosRegion, bool bInReadOnly ); -bool GotoCurrRegionAndSkip( SwPaM&, SwPosRegion, bool bInReadOnly ); -bool GotoNextRegion( SwPaM&, SwPosRegion, bool bInReadOnly ); +bool GotoPrevRegion( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); +bool GotoCurrRegion( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); +bool GotoCurrRegionAndSkip( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); +bool GotoNextRegion( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); #endif diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx index 4e989bef0196..f56b196c83f9 100644 --- a/sw/source/core/crsr/trvltbl.cxx +++ b/sw/source/core/crsr/trvltbl.cxx @@ -477,7 +477,7 @@ static bool lcl_FindPrevCell( SwNodeIndex& rIdx, bool bInReadOnly ) return true; } -bool GotoPrevTable( SwPaM& rCurrentCursor, SwPosTable fnPosTable, +bool GotoPrevTable( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosTable, bool bInReadOnly ) { SwNodeIndex aIdx( rCurrentCursor.GetPoint()->nNode ); @@ -504,7 +504,7 @@ bool GotoPrevTable( SwPaM& rCurrentCursor, SwPosTable fnPosTable, if( pTableNd ) // any further table node? { - if( fnPosTable == fnMoveForward ) // at the beginning? + if( &fnPosTable == &fnMoveForward ) // at the beginning? { aIdx = *aIdx.GetNode().StartOfSectionNode(); if( !lcl_FindNextCell( aIdx, bInReadOnly )) @@ -529,7 +529,7 @@ bool GotoPrevTable( SwPaM& rCurrentCursor, SwPosTable fnPosTable, if ( pTextNode ) { rCurrentCursor.GetPoint()->nNode = *pTextNode; - rCurrentCursor.GetPoint()->nContent.Assign( pTextNode, fnPosTable == fnMoveBackward ? + rCurrentCursor.GetPoint()->nContent.Assign( pTextNode, &fnPosTable == &fnMoveBackward ? pTextNode->Len() : 0 ); } @@ -540,7 +540,7 @@ bool GotoPrevTable( SwPaM& rCurrentCursor, SwPosTable fnPosTable, return false; } -bool GotoNextTable( SwPaM& rCurrentCursor, SwPosTable fnPosTable, +bool GotoNextTable( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosTable, bool bInReadOnly ) { SwNodeIndex aIdx( rCurrentCursor.GetPoint()->nNode ); @@ -556,7 +556,7 @@ bool GotoNextTable( SwPaM& rCurrentCursor, SwPosTable fnPosTable, ++aIdx; if( pTableNd ) // any further table node? { - if( fnPosTable == fnMoveForward ) // at the beginning? + if( &fnPosTable == &fnMoveForward ) // at the beginning? { if( !lcl_FindNextCell( aIdx, bInReadOnly )) { @@ -581,7 +581,7 @@ bool GotoNextTable( SwPaM& rCurrentCursor, SwPosTable fnPosTable, if ( pTextNode ) { rCurrentCursor.GetPoint()->nNode = *pTextNode; - rCurrentCursor.GetPoint()->nContent.Assign( pTextNode, fnPosTable == fnMoveBackward ? + rCurrentCursor.GetPoint()->nContent.Assign( pTextNode, &fnPosTable == &fnMoveBackward ? pTextNode->Len() : 0 ); } @@ -592,7 +592,7 @@ bool GotoNextTable( SwPaM& rCurrentCursor, SwPosTable fnPosTable, return false; } -bool GotoCurrTable( SwPaM& rCurrentCursor, SwPosTable fnPosTable, +bool GotoCurrTable( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosTable, bool bInReadOnly ) { SwTableNode* pTableNd = rCurrentCursor.GetPoint()->nNode.GetNode().FindTableNode(); @@ -600,7 +600,7 @@ bool GotoCurrTable( SwPaM& rCurrentCursor, SwPosTable fnPosTable, return false; SwTextNode* pTextNode = nullptr; - if( fnPosTable == fnMoveBackward ) // to the end of the table + if( &fnPosTable == &fnMoveBackward ) // to the end of the table { SwNodeIndex aIdx( *pTableNd->EndOfSectionNode() ); if( !lcl_FindPrevCell( aIdx, bInReadOnly )) @@ -618,7 +618,7 @@ bool GotoCurrTable( SwPaM& rCurrentCursor, SwPosTable fnPosTable, if ( pTextNode ) { rCurrentCursor.GetPoint()->nNode = *pTextNode; - rCurrentCursor.GetPoint()->nContent.Assign( pTextNode, fnPosTable == fnMoveBackward ? + rCurrentCursor.GetPoint()->nContent.Assign( pTextNode, &fnPosTable == &fnMoveBackward ? pTextNode->Len() : 0 ); } @@ -626,7 +626,7 @@ bool GotoCurrTable( SwPaM& rCurrentCursor, SwPosTable fnPosTable, return true; } -bool SwCursor::MoveTable( SwWhichTable fnWhichTable, SwPosTable fnPosTable ) +bool SwCursor::MoveTable( SwWhichTable fnWhichTable, SwMoveFnCollection const & fnPosTable ) { bool bRet = false; SwTableCursor* pTableCursor = dynamic_cast<SwTableCursor*>(this); @@ -641,7 +641,7 @@ bool SwCursor::MoveTable( SwWhichTable fnWhichTable, SwPosTable fnPosTable ) return bRet; } -bool SwCursorShell::MoveTable( SwWhichTable fnWhichTable, SwPosTable fnPosTable ) +bool SwCursorShell::MoveTable( SwWhichTable fnWhichTable, SwMoveFnCollection const & fnPosTable ) { SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed diff --git a/sw/source/core/crsr/trvltbl.hxx b/sw/source/core/crsr/trvltbl.hxx index 6fbcee1a42dd..51ad4206e519 100644 --- a/sw/source/core/crsr/trvltbl.hxx +++ b/sw/source/core/crsr/trvltbl.hxx @@ -23,9 +23,9 @@ #include <sal/config.h> // Travelling in tables -bool GotoPrevTable( SwPaM&, SwPosTable, bool bInReadOnly ); -bool GotoCurrTable( SwPaM&, SwPosTable, bool bInReadOnly ); -bool GotoNextTable( SwPaM&, SwPosTable, bool bInReadOnly ); +bool GotoPrevTable( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); +bool GotoCurrTable( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); +bool GotoNextTable( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); #endif diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index 3d722f3d0ad5..8fa6f8d3ff06 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -2135,7 +2135,7 @@ static bool lcl_GoTableRow( SwCursorShell* pShell, bool bUp ) GoInContent( *pPam, fnMoveForward ); // go to beginning end of table box - SwPosSection fnPosSect = bUp ? fnSectionStart : fnSectionEnd; + SwMoveFnCollection const & fnPosSect = bUp ? fnSectionStart : fnSectionEnd; pShell->MoveSection( GoCurrSection, fnPosSect ); // and go up/down into next content diff --git a/sw/source/core/inc/pamtyp.hxx b/sw/source/core/inc/pamtyp.hxx index 4588e6cfe59b..3e02c997ccb3 100644 --- a/sw/source/core/inc/pamtyp.hxx +++ b/sw/source/core/inc/pamtyp.hxx @@ -43,9 +43,9 @@ SW_DLLPUBLIC SwContentNode* GoNextNds( SwNodeIndex * pIdx, bool ); SwContentNode* GoPreviousNds( SwNodeIndex * pIdx, bool ); // Funktionsdefinitionen fuer die SwCursorShell -bool GoPrevPara( SwPaM&, SwPosPara); -bool GoCurrPara( SwPaM&, SwPosPara); -bool GoNextPara( SwPaM&, SwPosPara); +bool GoPrevPara( SwPaM&, SwMoveFnCollection const &); +bool GoCurrPara( SwPaM&, SwMoveFnCollection const &); +bool GoNextPara( SwPaM&, SwMoveFnCollection const &); // Typedefiniton fuer Funktionen typedef bool (*GoNd)( SwNode*, SwIndex*, sal_uInt16 ); @@ -71,7 +71,7 @@ struct SwMoveFnCollection }; // Funktionsdefinitionen fuers Suchen -SwContentNode* GetNode( SwPaM&, bool&, SwMoveFn, bool bInReadOnly = false ); +SwContentNode* GetNode( SwPaM&, bool&, SwMoveFnCollection const &, bool bInReadOnly = false ); #endif diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx index 725c69b8e0d0..c1e84334d932 100644 --- a/sw/source/ui/chrdlg/drpcps.cxx +++ b/sw/source/ui/chrdlg/drpcps.cxx @@ -281,7 +281,7 @@ void SwDropCapsPict::UpdatePaintSettings() mpPage->rSh.SttCursorMove(); mpPage->rSh.ClearMark(); SwWhichPara pSwuifnParaCurr = GetfnParaCurr(); - SwPosPara pSwuifnParaStart = GetfnParaStart(); + SwMoveFnCollection const & pSwuifnParaStart = GetfnParaStart(); mpPage->rSh.MovePara(pSwuifnParaCurr,pSwuifnParaStart); // normal GetFontSettings( *mpPage, aFont, RES_CHRATR_FONT ); |