summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-11-06 14:29:08 +0100
committerMichael Stahl <Michael.Stahl@cib.de>2018-11-10 19:47:00 +0100
commitba0d21259b0c77bfc5244215d6d62276bb60cb31 (patch)
treeebeea62b173b5649bee62a3dac2035f5f4719369
parent4612aa5aa83ee08127170edd90516e3304415c51 (diff)
sw_redlinehide_3: adapt SwCursorShell::LRMargin/IsAtLRMargin
Change-Id: I4576a464b37e786178a3cb31a0be922f1b55db88
-rw-r--r--sw/inc/swcrsr.hxx4
-rw-r--r--sw/source/core/crsr/crsrsh.cxx8
-rw-r--r--sw/source/core/crsr/swcrsr.cxx16
3 files changed, 15 insertions, 13 deletions
diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx
index 6eccacf8f1e3..5c9214dc2d00 100644
--- a/sw/inc/swcrsr.hxx
+++ b/sw/inc/swcrsr.hxx
@@ -159,8 +159,8 @@ public:
bool bAllowVisual, bool bSkipHidden, bool bInsertCursor,
SwRootFrame const* pLayout);
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 LeftRightMargin(SwRootFrame const& rLayout, bool bLeftMargin, bool bAPI);
+ bool IsAtLeftRightMargin(SwRootFrame const& rLayout, bool bLeftMargin, bool bAPI) const;
bool SttEndDoc( bool bSttDoc );
bool GoPrevNextCell( bool bNext, sal_uInt16 nCnt );
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 8f0c822798c3..125c85d4642f 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -524,14 +524,14 @@ bool SwCursorShell::LRMargin( bool bLeft, bool bAPI)
if( m_pBlockCursor )
m_pBlockCursor->clearPoints();
- const bool bWasAtLM =
- ( 0 == GetCursor_()->GetPoint()->nContent.GetIndex() );
+ const bool bWasAtLM = GetCursor_()->IsAtLeftRightMargin(*GetLayout(), true, bAPI);
- bool bRet = pTmpCursor->LeftRightMargin( bLeft, bAPI );
+ bool bRet = pTmpCursor->LeftRightMargin(*GetLayout(), bLeft, bAPI);
if ( bLeft && !bTableMode && bRet && bWasAtLM && !GetCursor_()->HasMark() )
{
const SwTextNode * pTextNd = GetCursor_()->GetNode().GetTextNode();
+ assert(sw::GetParaPropsNode(*GetLayout(), GetCursor_()->GetPoint()->nNode) == pTextNd);
if ( pTextNd && pTextNd->HasVisibleNumberingOrBullet() )
SetInFrontOfLabel( true );
}
@@ -550,7 +550,7 @@ bool SwCursorShell::LRMargin( bool bLeft, bool bAPI)
bool SwCursorShell::IsAtLRMargin( bool bLeft, bool bAPI ) const
{
const SwShellCursor* pTmpCursor = getShellCursor( true );
- return pTmpCursor->IsAtLeftRightMargin( bLeft, bAPI );
+ return pTmpCursor->IsAtLeftRightMargin(*GetLayout(), bLeft, bAPI);
}
bool SwCursorShell::SttEndDoc( bool bStt )
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 8dfb8521eb17..798ca463b69e 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -2032,12 +2032,12 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt,
return bRet;
}
-bool SwCursor::LeftRightMargin( bool bLeft, bool bAPI )
+bool SwCursor::LeftRightMargin(SwRootFrame const& rLayout, bool bLeft, bool bAPI)
{
Point aPt;
std::pair<Point, bool> const tmp(aPt, true);
- SwContentFrame *const pFrame = GetContentNode()->getLayoutFrame(
- GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), GetPoint(), &tmp);
+ SwContentFrame const*const pFrame = GetContentNode()->getLayoutFrame(
+ &rLayout, GetPoint(), &tmp);
// calculate cursor bidi level
if ( pFrame )
@@ -2049,13 +2049,13 @@ bool SwCursor::LeftRightMargin( bool bLeft, bool bAPI )
&& !IsSelOvr( SwCursorSelOverFlags::Toggle | SwCursorSelOverFlags::ChangePos );
}
-bool SwCursor::IsAtLeftRightMargin( bool bLeft, bool bAPI ) const
+bool SwCursor::IsAtLeftRightMargin(SwRootFrame const& rLayout, bool bLeft, bool bAPI) const
{
bool bRet = false;
Point aPt;
std::pair<Point, bool> const tmp(aPt, true);
- SwContentFrame *const pFrame = GetContentNode()->getLayoutFrame(
- GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), GetPoint(), &tmp);
+ SwContentFrame const*const pFrame = GetContentNode()->getLayoutFrame(
+ &rLayout, GetPoint(), &tmp);
if( pFrame )
{
SwPaM aPam( *GetPoint() );
@@ -2063,7 +2063,9 @@ bool SwCursor::IsAtLeftRightMargin( bool bLeft, bool bAPI ) const
--aPam.GetPoint()->nContent;
bRet = (bLeft ? pFrame->LeftMargin( &aPam )
: pFrame->RightMargin( &aPam, bAPI ))
- && *aPam.GetPoint() == *GetPoint();
+ && (!pFrame->IsTextFrame()
+ || static_cast<SwTextFrame const*>(pFrame)->MapModelToViewPos(*aPam.GetPoint())
+ == static_cast<SwTextFrame const*>(pFrame)->MapModelToViewPos(*GetPoint()));
}
return bRet;
}