From f282a61be87004e6ddc3e1d00cb1812b1c1fd5cf Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 1 Jun 2018 18:59:39 +0200 Subject: sw_redlinehide: trivial GetNode() conversion in fields Change-Id: I69e438575e76f67701d951dfeab0fd7fdda0e66f --- sw/source/core/fields/expfld.cxx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'sw') diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index 6ac0df0f4a47..1b3637526a3d 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -151,9 +152,8 @@ SwTextNode* GetFirstTextNode( const SwDoc& rDoc, SwPosition& rPos, } else if ( !pCFrame->isFrameAreaDefinitionValid() ) { - pTextNode = const_cast(static_cast(pCFrame->GetNode())); - rPos.nNode = *pTextNode; - rPos.nContent.Assign( pTextNode, 0 ); + assert(pCFrame->IsTextFrame()); + rPos = static_cast(pCFrame)->MapViewToModelPos(TextFrameIndex(0)); } else { @@ -240,9 +240,11 @@ const SwTextNode* GetBodyTextNode( const SwDoc& rDoc, SwPosition& rPos, if( pContentFrame ) { - pTextNode = pContentFrame->GetNode()->GetTextNode(); - rPos.nNode = *pTextNode; - const_cast(pTextNode)->MakeEndIndex( &rPos.nContent ); + assert(pContentFrame->IsTextFrame()); + SwTextFrame const*const pFrame(static_cast(pContentFrame)); + rPos = pFrame->MapViewToModelPos(TextFrameIndex(pFrame->GetText().getLength())); + pTextNode = rPos.nNode.GetNode().GetTextNode(); + assert(pTextNode); } else { -- cgit