diff options
Diffstat (limited to 'sw/source/core/edit')
-rw-r--r-- | sw/source/core/edit/acorrect.cxx | 45 |
1 files changed, 6 insertions, 39 deletions
diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx index d7003ccfbaed..a1c06e0442d1 100644 --- a/sw/source/core/edit/acorrect.cxx +++ b/sw/source/core/edit/acorrect.cxx @@ -42,6 +42,7 @@ #include <editeng/acorrcfg.hxx> #include <redline.hxx> #include <IDocumentRedlineAccess.hxx> +#include <rootfrm.hxx> using namespace ::com::sun::star; @@ -231,31 +232,10 @@ bool SwAutoCorrDoc::ReplaceRange( sal_Int32 nPos, sal_Int32 nSourceLength, const // tdf#83419 avoid bad autocorrect with visible redlines // e.g. replacing the first letter of the tracked deletion // with its capitalized (and not deleted) version. - if ( bDoReplace ) + if ( bDoReplace && !pFrame->getRootFrame()->IsHideRedlines() && + m_rEditSh.GetDoc()->getIDocumentRedlineAccess().HasRedline( *pPam, RedlineType::Delete, /*bStartOrEndInRange=*/false ) ) { - const OUString& rOrigText = pos.first->GetText(); - // GetRedlineText() doesn't contain dummy characters, so handle them - sal_Int32 nLengthCorrection = 0; - for (sal_Int32 n = 0; n < rOrigText.getLength(); ++n) - { - sal_Unicode const Char = rOrigText[n]; - if ( CH_TXTATR_BREAKWORD == Char || CH_TXTATR_INWORD == Char ) - ++nLengthCorrection; - } - sal_Int32 nDelChars = rOrigText.getLength() - nLengthCorrection - - pos.first->GetRedlineText().getLength(); - // Are there tracked deletions before the correction point? - if ( nDelChars > 0 && pos.first->GetRedlineText().compareTo( nLengthCorrection == 0 - ? rOrigText - : rOrigText.replaceAll(OUString(CH_TXTATR_INWORD), "") - .replaceAll(OUString(CH_TXTATR_BREAKWORD), ""), - pos.second + nSourceLength + nDelChars ) != 0 && - // and are they visible? - pFrame->GetText().compareTo( - rOrigText, pos.second + nSourceLength + nDelChars + nLengthCorrection) == 0 ) - { - bDoReplace = false; - } + bDoReplace = false; } if ( bDoReplace ) @@ -434,22 +414,9 @@ bool SwAutoCorrDoc::ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos, SwPaM aPam(aStartPos, aEndPos); // don't replace, if a redline starts or ends within the original text - for ( SwRedlineTable::size_type nAct = - pDoc->getIDocumentRedlineAccess().GetRedlinePos( m_rCursor.GetNode(), RedlineType::Any ); - nAct < pDoc->getIDocumentRedlineAccess().GetRedlineTable().size(); ++nAct ) + if ( pDoc->getIDocumentRedlineAccess().HasRedline( aPam, RedlineType::Any, /*bStartOrEndInRange=*/true ) ) { - const SwRangeRedline* pRed = pDoc->getIDocumentRedlineAccess().GetRedlineTable()[ nAct ]; - - if ( pRed->Start()->nNode > pTextNd->GetIndex() ) - break; - - // redline over the original text - if ( aStartPos < *pRed->End() && *pRed->Start() < aEndPos && - // starting or ending within the original text - ( aStartPos < *pRed->Start() || *pRed->End() < aEndPos ) ) - { - return bRet; - } + return bRet; } if( pFnd->IsTextOnly() ) |