summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx8
-rw-r--r--sw/source/core/edit/acorrect.cxx17
2 files changed, 12 insertions, 13 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 9f5967b5d2ff..9816e18574a5 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -7634,12 +7634,15 @@ void SwUiWriterTest::testRedlineAutoCorrect()
SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
- // show tracked deletion
+ // show tracked deletion with enabled change tracking
RedlineFlags const nMode(pWrtShell->GetRedlineFlags() | RedlineFlags::On);
CPPUNIT_ASSERT(nMode & (RedlineFlags::ShowDelete | RedlineFlags::ShowInsert));
pWrtShell->SetRedlineFlags(nMode);
CPPUNIT_ASSERT(nMode & RedlineFlags::ShowDelete);
+ CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+ pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
pWrtShell->AutoCorrect(corr, ' ');
sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex();
@@ -7666,7 +7669,8 @@ void SwUiWriterTest::testRedlineAutoCorrect()
nIndex = pWrtShell->GetCursor()->GetNode().GetIndex();
// This still keep the tracked deletion, capitalize only the visible text "s"
- sReplaced = "tS ";
+ // with tracked deletion of the original character
+ sReplaced = "tsS ";
CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText());
// repeat it with visible redlining and word auto replacement of "tset"
diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
index a45f1a7de11c..1a5ffe5ca762 100644
--- a/sw/source/core/edit/acorrect.cxx
+++ b/sw/source/core/edit/acorrect.cxx
@@ -259,17 +259,12 @@ bool SwAutoCorrDoc::ReplaceRange( sal_Int32 nPos, sal_Int32 nSourceLength, const
}
else
{
- if( nSourceLength != rText.getLength() )
- {
- pPam->SetMark();
- pPam->GetPoint()->nContent = std::min<sal_Int32>(
- pos.first->GetText().getLength(), pos.second + nSourceLength);
- pDoc->getIDocumentContentOperations().ReplaceRange( *pPam, rText, false );
- pPam->Exchange();
- pPam->DeleteMark();
- }
- else
- pDoc->getIDocumentContentOperations().Overwrite( *pPam, rText );
+ pPam->SetMark();
+ pPam->GetPoint()->nContent = std::min<sal_Int32>(
+ pos.first->GetText().getLength(), pos.second + nSourceLength);
+ pDoc->getIDocumentContentOperations().ReplaceRange( *pPam, rText, false );
+ pPam->Exchange();
+ pPam->DeleteMark();
}
if( m_bUndoIdInitialized )