diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-06-01 22:22:48 +0200 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-06-08 21:51:36 +0200 |
commit | d6b221568c3c2157fb417ab0cb0b049c1919467a (patch) | |
tree | 5ee6fa72057fabd013b42a01c4650408b3edb051 /sw | |
parent | fae9c9f42d1e3658d530b6f9f9f012c3f196ede8 (diff) |
sw_redlinehide: convert GetNode() in SwCursor::IsSelOvr()
Change-Id: I3cca2091f4a3fe903bbd606c93a368662e997899
Diffstat (limited to 'sw')
-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 91e9e2e61551..2b934cb6c576 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -39,6 +39,7 @@ #include <cntfrm.hxx> #include <rootfrm.hxx> #include <txtfrm.hxx> +#include <notxtfrm.hxx> #include <scriptinfo.hxx> #include <crstate.hxx> #include <docsh.hxx> @@ -351,18 +352,31 @@ bool SwCursor::IsSelOvr( SwCursorSelOverFlags eFlags ) } } - SwContentNode* pCNd = (pFrame != nullptr) ? const_cast<SwContentNode*>(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<SwTextFrame const*>(pFrame)); + *GetPoint() = pTextFrame->MapViewToModelPos(TextFrameIndex( + bGoNxt ? 0 : pTextFrame->GetText().getLength())); + } + else + { + assert(pFrame->IsNoTextFrame()); + SwContentNode *const pCNd = const_cast<SwContentNode*>( + static_cast<SwNoTextFrame const*>(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 <pFrame> to NULL - see below |