diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-09-18 16:21:44 +0200 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-09-19 10:08:55 +0200 |
commit | f62ba688ca1c22fcdcf7efd811d702e982799882 (patch) | |
tree | b0b58daa34da816da3376864d43fe5bd50a441b9 /sw/source/core/crsr/swcrsr.cxx | |
parent | 18dbdd512b11c02b2b5c8d28355a4d2188003d46 (diff) |
sw: rework annoying GetFrameOfModify/getLayoutFrame parameters
private/mst/sw_redlinehide_2
The bCalcFrame is only evaluated if a pPoint is given; this is
surprising and should be more visible in the interface, so people don't
go on a goose chase to find places that may do formatting in
inappropriate places.
So put these parameters into a pair instead, which doesn't have
particularly good ergonomics in C++, particularly since compilers
warn about taking the address of a temporary object...
Change-Id: I101c6eeb5bd6baf83c2bd9a6cb91ccaa04036cc3
Diffstat (limited to 'sw/source/core/crsr/swcrsr.cxx')
-rw-r--r-- | sw/source/core/crsr/swcrsr.cxx | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 6578d9e2b1ca..7f8086955169 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -1680,7 +1680,10 @@ SwCursor::DoSetBidiLevelLeftRight( // for visual cursor travelling (used in bidi layout) // we first have to convert the logic to a visual position Point aPt; - pSttFrame = rTNd.getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); + std::pair<Point, bool> const tmp(aPt, true); + pSttFrame = rTNd.getLayoutFrame( + GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + GetPoint(), &tmp); if( pSttFrame ) { sal_uInt8 nCursorLevel = GetCursorBidiLevel(); @@ -1864,7 +1867,10 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, if ( &rTmpNode != &rNode && rTmpNode.IsTextNode() ) { Point aPt; - const SwContentFrame* pEndFrame = rTmpNode.GetTextNode()->getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); + std::pair<Point, bool> const tmp(aPt, true); + const SwContentFrame* pEndFrame = rTmpNode.GetTextNode()->getLayoutFrame( + GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + GetPoint(), &tmp); if ( pEndFrame ) { if ( ! pEndFrame->IsRightToLeft() != ! pSttFrame->IsRightToLeft() ) @@ -1936,7 +1942,8 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, Point aPt; if( pPt ) aPt = *pPt; - SwContentFrame* pFrame = GetContentNode()->getLayoutFrame(&rLayout, &aPt, GetPoint()); + std::pair<Point, bool> const temp(aPt, true); + SwContentFrame* pFrame = GetContentNode()->getLayoutFrame(&rLayout, GetPoint(), &temp); if( pFrame ) { @@ -1972,7 +1979,8 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, const SwNode* pEndNd = pTableNd->EndOfSectionNode(); GetPoint()->nNode = *pEndNd; pTableCursor->Move( fnMoveBackward, GoInNode ); - pFrame = GetContentNode()->getLayoutFrame(&rLayout, &aPt, GetPoint()); + std::pair<Point, bool> const tmp(aPt, true); + pFrame = GetContentNode()->getLayoutFrame(&rLayout, GetPoint(), &tmp); } } @@ -1981,7 +1989,8 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, : pFrame->UnitDown( this, nUpDownX, bInReadOnly ) ) && CheckNodesRange( aOldPos.nNode, GetPoint()->nNode, bChkRange )) { - pFrame = GetContentNode()->getLayoutFrame(&rLayout, &aPt, GetPoint()); + std::pair<Point, bool> const tmp(aPt, true); + pFrame = GetContentNode()->getLayoutFrame(&rLayout, GetPoint(), &tmp); --nCnt; } @@ -1993,7 +2002,8 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, { // try to position the cursor at half of the char-rect's height DisableCallbackAction a(rLayout); - pFrame = GetContentNode()->getLayoutFrame(&rLayout, &aPt, GetPoint()); + std::pair<Point, bool> const tmp(aPt, true); + pFrame = GetContentNode()->getLayoutFrame(&rLayout, GetPoint(), &tmp); SwCursorMoveState eTmpState( MV_UPDOWN ); eTmpState.m_bSetInReadOnly = bInReadOnly; SwRect aTmpRect; @@ -2025,7 +2035,9 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, bool SwCursor::LeftRightMargin( bool bLeft, bool bAPI ) { Point aPt; - SwContentFrame * pFrame = GetContentNode()->getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); + std::pair<Point, bool> const tmp(aPt, true); + SwContentFrame *const pFrame = GetContentNode()->getLayoutFrame( + GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), GetPoint(), &tmp); // calculate cursor bidi level if ( pFrame ) @@ -2041,7 +2053,9 @@ bool SwCursor::IsAtLeftRightMargin( bool bLeft, bool bAPI ) const { bool bRet = false; Point aPt; - SwContentFrame * pFrame = GetContentNode()->getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); + std::pair<Point, bool> const tmp(aPt, true); + SwContentFrame *const pFrame = GetContentNode()->getLayoutFrame( + GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), GetPoint(), &tmp); if( pFrame ) { SwPaM aPam( *GetPoint() ); |