From 5a7157d319477830426797532e02ac39d3b859f4 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 11:29:03 +0200 Subject: Merging upstream version 4:24.2.1. Signed-off-by: Daniel Baumann --- sw/source/core/crsr/crsrsh.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'sw/source/core/crsr/crsrsh.cxx') diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 04b263cda7..173414ed4d 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -2936,6 +2936,7 @@ OUString SwCursorShell::GetSelText() const } /** get the nth character of the current SSelection + in the same paragraph as the start/end. @param bEnd Start counting from the end? From start otherwise. @param nOffset position of the character @@ -2951,8 +2952,14 @@ sal_Unicode SwCursorShell::GetChar( bool bEnd, tools::Long nOffset ) if( !pTextNd ) return 0; - const sal_Int32 nPos = pPos->GetContentIndex(); - const OUString& rStr = pTextNd->GetText(); + SwTextFrame const*const pFrame(static_cast(pTextNd->getLayoutFrame(GetLayout()))); + if (!pFrame) + { + return 0; + } + + const sal_Int32 nPos(sal_Int32(pFrame->MapModelToViewPos(*pPos))); + const OUString& rStr(pFrame->GetText()); sal_Unicode cCh = 0; if (((nPos+nOffset) >= 0 ) && (nPos+nOffset) < rStr.getLength()) -- cgit v1.2.3