diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-11-28 17:27:39 +0100 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-12-01 08:44:45 +0100 |
commit | 7481e8b5500e86626be5f8eae1e7f48b7f51e21a (patch) | |
tree | 3d41d3937eb72dd4f9e9428f92b8b5113893e1c8 | |
parent | c03da6a4a429327244bbe27e32e2f6e82b18163d (diff) |
sw_redlinehide_4a: SwEditShell::AutoCorrect() etc.
The hope is that the AutoCorrect never deletes nodes, hence never
deletes SwTextFrames, hence we can pass in the SwTextFrame::GetText()
result and it will be updated via the SwTextFrame::SwClientNotify()
on editing operations.
Change-Id: Ib644d0373963119b9f7fe6767b028fd89724feb3
-rw-r--r-- | sw/source/core/edit/edws.cxx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx index 32770a346284..1b2e720d1821 100644 --- a/sw/source/core/edit/edws.cxx +++ b/sw/source/core/edit/edws.cxx @@ -30,6 +30,7 @@ #include <acorrect.hxx> #include <swtable.hxx> #include <ndtxt.hxx> +#include <txtfrm.hxx> #include <swundo.hxx> #include <SwRewriter.hxx> @@ -265,9 +266,11 @@ void SwEditShell::AutoCorrect( SvxAutoCorrect& rACorr, bool bInsert, SwAutoCorrDoc aSwAutoCorrDoc( *this, *pCursor, cChar ); // FIXME: this _must_ be called with reference to the actual node text! - OUString const& rNodeText(pTNd->GetText()); + SwTextFrame const*const pFrame(static_cast<SwTextFrame const*>(pTNd->getLayoutFrame(GetLayout()))); + TextFrameIndex const nPos(pFrame->MapModelToViewPos(*pCursor->GetPoint())); + OUString const& rMergedText(pFrame->GetText()); rACorr.DoAutoCorrect( aSwAutoCorrDoc, - rNodeText, pCursor->GetPoint()->nContent.GetIndex(), + rMergedText, sal_Int32(nPos), cChar, bInsert, m_bNbspRunNext, GetWin() ); if( cChar ) SaveTableBoxContent( pCursor->GetPoint() ); @@ -285,13 +288,14 @@ bool SwEditShell::GetPrevAutoCorrWord( SvxAutoCorrect const & rACorr, OUString& bool bRet; SwPaM* pCursor = getShellCursor( true ); - const sal_Int32 nPos = pCursor->GetPoint()->nContent.GetIndex(); SwTextNode* pTNd = pCursor->GetNode().GetTextNode(); - if( pTNd && nPos ) + if (pTNd) { SwAutoCorrDoc aSwAutoCorrDoc( *this, *pCursor, 0 ); + SwTextFrame const*const pFrame(static_cast<SwTextFrame const*>(pTNd->getLayoutFrame(GetLayout()))); + TextFrameIndex const nPos(pFrame->MapModelToViewPos(*pCursor->GetPoint())); bRet = rACorr.GetPrevAutoCorrWord( aSwAutoCorrDoc, - pTNd->GetText(), nPos, rWord ); + pFrame->GetText(), sal_Int32(nPos), rWord ); } else bRet = false; |