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/inc | |
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/inc')
-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 |
4 files changed, 49 insertions, 51 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. |