Kaydet (Commit) d48ae6eb authored tarafından Michael Stahl's avatar Michael Stahl Kaydeden (comit) Thorsten Behrens

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
(cherry picked from commit 7481e8b5)
üst 938f8a6b
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <acorrect.hxx> #include <acorrect.hxx>
#include <swtable.hxx> #include <swtable.hxx>
#include <ndtxt.hxx> #include <ndtxt.hxx>
#include <txtfrm.hxx>
#include <swundo.hxx> #include <swundo.hxx>
#include <SwRewriter.hxx> #include <SwRewriter.hxx>
...@@ -265,9 +266,11 @@ void SwEditShell::AutoCorrect( SvxAutoCorrect& rACorr, bool bInsert, ...@@ -265,9 +266,11 @@ void SwEditShell::AutoCorrect( SvxAutoCorrect& rACorr, bool bInsert,
SwAutoCorrDoc aSwAutoCorrDoc( *this, *pCursor, cChar ); SwAutoCorrDoc aSwAutoCorrDoc( *this, *pCursor, cChar );
// FIXME: this _must_ be called with reference to the actual node text! // 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, rACorr.DoAutoCorrect( aSwAutoCorrDoc,
rNodeText, pCursor->GetPoint()->nContent.GetIndex(), rMergedText, sal_Int32(nPos),
cChar, bInsert, m_bNbspRunNext, GetWin() ); cChar, bInsert, m_bNbspRunNext, GetWin() );
if( cChar ) if( cChar )
SaveTableBoxContent( pCursor->GetPoint() ); SaveTableBoxContent( pCursor->GetPoint() );
...@@ -285,13 +288,14 @@ bool SwEditShell::GetPrevAutoCorrWord( SvxAutoCorrect const & rACorr, OUString& ...@@ -285,13 +288,14 @@ bool SwEditShell::GetPrevAutoCorrWord( SvxAutoCorrect const & rACorr, OUString&
bool bRet; bool bRet;
SwPaM* pCursor = getShellCursor( true ); SwPaM* pCursor = getShellCursor( true );
const sal_Int32 nPos = pCursor->GetPoint()->nContent.GetIndex();
SwTextNode* pTNd = pCursor->GetNode().GetTextNode(); SwTextNode* pTNd = pCursor->GetNode().GetTextNode();
if( pTNd && nPos ) if (pTNd)
{ {
SwAutoCorrDoc aSwAutoCorrDoc( *this, *pCursor, 0 ); 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, bRet = rACorr.GetPrevAutoCorrWord( aSwAutoCorrDoc,
pTNd->GetText(), nPos, rWord ); pFrame->GetText(), sal_Int32(nPos), rWord );
} }
else else
bRet = false; bRet = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment