Kaydet (Commit) 482eb7be authored tarafından Michael Stahl's avatar Michael Stahl

sw_redlinehide_3: adapt SwCursorShell::LRMargin/IsAtLRMargin

Change-Id: I4576a464b37e786178a3cb31a0be922f1b55db88
üst 2c7c8aa2
......@@ -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 );
......
......@@ -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 )
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment