From d6b221568c3c2157fb417ab0cb0b049c1919467a Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 1 Jun 2018 22:22:48 +0200 Subject: sw_redlinehide: convert GetNode() in SwCursor::IsSelOvr() Change-Id: I3cca2091f4a3fe903bbd606c93a368662e997899 --- sw/source/core/crsr/swcrsr.cxx | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'sw') diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 91e9e2e61551..2b934cb6c576 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -351,18 +352,31 @@ bool SwCursor::IsSelOvr( SwCursorSelOverFlags eFlags ) } } - SwContentNode* pCNd = (pFrame != nullptr) ? const_cast(pFrame->GetNode()) : nullptr; - if ( pCNd != nullptr ) + if (pFrame != nullptr) { - // set this ContentNode as new position - rPtIdx = *pCNd; + if (pFrame->IsTextFrame()) + { + SwTextFrame const*const pTextFrame(static_cast(pFrame)); + *GetPoint() = pTextFrame->MapViewToModelPos(TextFrameIndex( + bGoNxt ? 0 : pTextFrame->GetText().getLength())); + } + else + { + assert(pFrame->IsNoTextFrame()); + SwContentNode *const pCNd = const_cast( + static_cast(pFrame)->GetNode()); + assert(pCNd); + + // set this ContentNode as new position + rPtIdx = *pCNd; + // assign corresponding ContentIndex + const sal_Int32 nTmpPos = bGoNxt ? 0 : pCNd->Len(); + GetPoint()->nContent.Assign( pCNd, nTmpPos ); + } - // assign corresponding ContentIndex - const sal_Int32 nTmpPos = bGoNxt ? 0 : pCNd->Len(); - GetPoint()->nContent.Assign( pCNd, nTmpPos ); if (rPtIdx.GetIndex() == m_vSavePos.back().nNode - && nTmpPos == m_vSavePos.back().nContent) + && GetPoint()->nContent.GetIndex() == m_vSavePos.back().nContent) { // new position equals saved one // --> trigger restore of saved pos by setting to NULL - see below -- cgit