diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-09-12 11:28:06 +0200 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-09-19 10:08:55 +0200 |
commit | 72685e3c42399bf1916981f422621e37efc7c60e (patch) | |
tree | b065ca2a54f6da7c9533ba76c3e9d6e55ad6ac37 | |
parent | f6a60ce214117946eef222701023dca612bf0a2b (diff) |
sw_redlinehide_2: adapt SwCursor::UpDown()
Actually it already works, this is just a clean up to pass in the
SwCursorShell's layout...
Change-Id: I1a90bbe9966c7f4d5b5e959122ca1f995df93a45
-rw-r--r-- | sw/inc/swcrsr.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/crsr/swcrsr.cxx | 17 | ||||
-rw-r--r-- | sw/source/core/crsr/viscrs.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/edit/eddel.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/frmedt/fecopy.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 7 |
6 files changed, 19 insertions, 14 deletions
diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx index 41aba80df7e5..9ec86d6f5f77 100644 --- a/sw/inc/swcrsr.hxx +++ b/sw/inc/swcrsr.hxx @@ -168,7 +168,7 @@ public: virtual bool LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, bool bAllowVisual, bool bSkipHidden, bool bInsertCursor, SwRootFrame const* pLayout); - bool UpDown( bool bUp, sal_uInt16 nCnt, Point const * pPt, long nUpDownX ); + bool UpDown(bool bUp, sal_uInt16 nCnt, Point const * pPt, long nUpDownX, SwRootFrame & rLayout); bool LeftRightMargin( bool bLeftMargin, bool bAPI ); bool IsAtLeftRightMargin( bool bLeftMargin, bool bAPI ) const; bool SttEndDoc( bool bSttDoc ); diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 25118e6f9aa9..ac0e0e812004 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -1825,7 +1825,8 @@ void SwCursor::DoSetBidiLevelUpDown() } bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, - Point const * pPt, long nUpDownX ) + Point const * pPt, long nUpDownX, + SwRootFrame & rLayout) { SwTableCursor* pTableCursor = dynamic_cast<SwTableCursor*>(this); bool bAdjustTableCursor = false; @@ -1844,7 +1845,7 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, Point aPt; if( pPt ) aPt = *pPt; - SwContentFrame* pFrame = GetContentNode()->getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); + SwContentFrame* pFrame = GetContentNode()->getLayoutFrame(&rLayout, &aPt, GetPoint()); if( pFrame ) { @@ -1880,7 +1881,7 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, const SwNode* pEndNd = pTableNd->EndOfSectionNode(); GetPoint()->nNode = *pEndNd; pTableCursor->Move( fnMoveBackward, GoInNode ); - pFrame = GetContentNode()->getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); + pFrame = GetContentNode()->getLayoutFrame(&rLayout, &aPt, GetPoint()); } } @@ -1889,7 +1890,7 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, : pFrame->UnitDown( this, nUpDownX, bInReadOnly ) ) && CheckNodesRange( aOldPos.nNode, GetPoint()->nNode, bChkRange )) { - pFrame = GetContentNode()->getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); + pFrame = GetContentNode()->getLayoutFrame(&rLayout, &aPt, GetPoint()); --nCnt; } @@ -1900,8 +1901,8 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, if( !pTableCursor ) { // try to position the cursor at half of the char-rect's height - DisableCallbackAction a(*GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()); - pFrame = GetContentNode()->getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); + DisableCallbackAction a(rLayout); + pFrame = GetContentNode()->getLayoutFrame(&rLayout, &aPt, GetPoint()); SwCursorMoveState eTmpState( MV_UPDOWN ); eTmpState.m_bSetInReadOnly = bInReadOnly; SwRect aTmpRect; @@ -1909,13 +1910,13 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, if ( pFrame->IsVertical() ) { aPt.setX(aTmpRect.Center().getX()); - pFrame->Calc(pFrame->getRootFrame()->GetCurrShell()->GetOut()); + pFrame->Calc(rLayout.GetCurrShell()->GetOut()); aPt.setY(pFrame->getFrameArea().Top() + nUpDownX); } else { aPt.setY(aTmpRect.Center().getY()); - pFrame->Calc(pFrame->getRootFrame()->GetCurrShell()->GetOut()); + pFrame->Calc(rLayout.GetCurrShell()->GetOut()); aPt.setX(pFrame->getFrameArea().Left() + nUpDownX); } pFrame->GetCursorOfst( GetPoint(), aPt, &eTmpState ); diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index be6be7f0d868..4a2b73d5a194 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -698,7 +698,8 @@ void SwShellCursor::SaveTableBoxContent( const SwPosition* pPos ) bool SwShellCursor::UpDown( bool bUp, sal_uInt16 nCnt ) { return SwCursor::UpDown( bUp, nCnt, - &GetPtPos(), GetShell()->GetUpDownX() ); + &GetPtPos(), GetShell()->GetUpDownX(), + *GetShell()->GetLayout()); } // if <true> than the cursor can be set to the position. diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx index 658a650c8048..126b5000a923 100644 --- a/sw/source/core/edit/eddel.cxx +++ b/sw/source/core/edit/eddel.cxx @@ -185,7 +185,7 @@ bool SwEditShell::Copy( SwEditShell* pDestShell ) if( nMove ) { SwCursor aCursor( *pPos, nullptr); - if( aCursor.UpDown( false, nMove, nullptr, 0 ) ) + if (aCursor.UpDown(false, nMove, nullptr, 0, *GetLayout())) { pInsertPos.reset( new SwPosition( *aCursor.GetPoint() ) ); aInsertList.push_back( pInsertPos ); diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index b30bd26fffa6..d0f69864d9e0 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -761,7 +761,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc ) SwCursor aCursor( aStartPos, nullptr); // Check if we find another insert position by moving // down the last given position - if( aCursor.UpDown( false, ++nMove, nullptr, 0 ) ) + if (aCursor.UpDown(false, ++nMove, nullptr, 0, *GetLayout())) aInsertPos = *aCursor.GetPoint(); else // if there is no paragraph we have to create it bCompletePara = nCount > 0; diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 9725815c5ed0..95a52d7b0ed1 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -42,6 +42,7 @@ #include <IDocumentContentOperations.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include <shellres.hxx> #include <docary.hxx> #include <ndole.hxx> @@ -1602,7 +1603,8 @@ sal_Bool SwXTextTableCursor::goUp(sal_Int16 Count, sal_Bool bExpand) SwUnoCursor& rUnoCursor = GetCursor(); SwUnoTableCursor& rTableCursor = dynamic_cast<SwUnoTableCursor&>(rUnoCursor); lcl_CursorSelect(rTableCursor, bExpand); - return rTableCursor.UpDown(true, Count, nullptr, 0); + return rTableCursor.UpDown(true, Count, nullptr, 0, + *rUnoCursor.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()); } sal_Bool SwXTextTableCursor::goDown(sal_Int16 Count, sal_Bool bExpand) @@ -1611,7 +1613,8 @@ sal_Bool SwXTextTableCursor::goDown(sal_Int16 Count, sal_Bool bExpand) SwUnoCursor& rUnoCursor = GetCursor(); SwUnoTableCursor& rTableCursor = dynamic_cast<SwUnoTableCursor&>(rUnoCursor); lcl_CursorSelect(rTableCursor, bExpand); - return rTableCursor.UpDown(false, Count, nullptr, 0); + return rTableCursor.UpDown(false, Count, nullptr, 0, + *rUnoCursor.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()); } void SwXTextTableCursor::gotoStart(sal_Bool bExpand) |