[Libreoffice-commits] core.git: Branch 'private/mst/sw_redlinehide_3' - 3 commits - sw/qa sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Oct 17 15:41:26 UTC 2018


 sw/qa/extras/layout/layout.cxx                 |   30 ++++----
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   18 ++---
 sw/qa/extras/uiwriter/uiwriter.cxx             |   84 ++++++++++++-------------
 sw/qa/extras/uiwriter/uiwriter2.cxx            |   39 +++++++++++
 sw/source/core/doc/DocumentRedlineManager.cxx  |   10 ++
 sw/source/core/doc/list.cxx                    |    7 --
 sw/source/ui/misc/titlepage.cxx                |    2 
 sw/source/uibase/app/applab.cxx                |    8 +-
 sw/source/uibase/inc/wrtsh.hxx                 |    4 -
 sw/source/uibase/shells/txtcrsr.cxx            |    8 +-
 sw/source/uibase/uiview/view2.cxx              |    2 
 sw/source/uibase/uiview/viewsrch.cxx           |   12 +--
 sw/source/uibase/uno/unotxvw.cxx               |    4 -
 sw/source/uibase/wrtsh/move.cxx                |    4 -
 14 files changed, 138 insertions(+), 94 deletions(-)

New commits:
commit 788a9ecb30575d8c6c5586fb310c83cc685d32e6
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Oct 17 15:10:43 2018 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Oct 17 15:11:58 2018 +0200

    sw: replace delete with unique_ptr in SwListImpl
    
    Change-Id: I5ee0928bb5ce490b52005eb3f97b56ceb81db062

diff --git a/sw/source/core/doc/list.cxx b/sw/source/core/doc/list.cxx
index 46be497f77ad..a3c4e90dcc49 100644
--- a/sw/source/core/doc/list.cxx
+++ b/sw/source/core/doc/list.cxx
@@ -57,7 +57,7 @@ class SwListImpl
         OUString msDefaultListStyleName;
 
         // list trees for certain document ranges
-        typedef std::pair<SwNodeNum*, SwPaM*> tListTreeForRange;
+        typedef std::pair<std::unique_ptr<SwNodeNum>, std::unique_ptr<SwPaM>> tListTreeForRange;
         typedef std::vector<tListTreeForRange> tListTrees;
         tListTrees maListTrees;
 
@@ -82,8 +82,7 @@ SwListImpl::SwListImpl( const OUString& sListId,
 
         SwNodeNum* pNumberTreeRootNode = new SwNodeNum( &rDefaultListStyle );
         SwPaM* pPam = new SwPaM( *(aPam.Start()), *(aPam.End()) );
-        tListTreeForRange aListTreeForRange( pNumberTreeRootNode, pPam );
-        maListTrees.push_back( aListTreeForRange );
+        maListTrees.emplace_back(pNumberTreeRootNode, pPam);
 
         pNode = pNode->EndOfSectionNode();
         if (pNode != &rNodes.GetEndOfContent())
@@ -104,8 +103,6 @@ SwListImpl::~SwListImpl() COVERITY_NOEXCEPT_FALSE
           ++aNumberTreeIter )
     {
         SwNodeNum::HandleNumberTreeRootNodeDelete( *((*aNumberTreeIter).first) );
-        delete (*aNumberTreeIter).first;
-        delete (*aNumberTreeIter).second;
     }
 }
 
commit 7222e009f9ffa2c326f2b4ecfa3a45645c34fbaa
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Oct 17 13:42:44 2018 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Oct 17 13:44:36 2018 +0200

    sw: rename the misleading SwWrtShell::SttDoc/EndDoc
    
    ... to StartOfSection/EndOfSection, which corresponds more closely to
    where they actually move the cursor, in SwNodes::GoStartOfSection.
    
    SwCursorShell::SttEndDoc does what one would expect from these.
    
    Change-Id: I5005e3ebf230c903a4e63dcdda93892a8658e096

diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 97c693372940..37cc80f1cafb 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -267,7 +267,7 @@ void SwLayoutWriter::testRedlineFlysInBody()
     SfxItemSet flySet(pDoc->GetAttrPool(),
                       svl::Items<RES_FRM_SIZE, RES_FRM_SIZE, RES_ANCHOR, RES_ANCHOR>{});
     SwFormatAnchor anchor(RndStdIds::FLY_AT_CHAR);
-    pWrtShell->SttDoc(false);
+    pWrtShell->StartOfSection(false);
     pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false);
     anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint());
     flySet.Put(anchor);
@@ -364,7 +364,7 @@ void SwLayoutWriter::testRedlineFlysInBody()
     }
 
     // anchor to 2nd (deleted) paragraph
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     pWrtShell->Down(false, 1);
     anchor.SetType(RndStdIds::FLY_AT_CHAR);
     anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint());
@@ -441,7 +441,7 @@ void SwLayoutWriter::testRedlineFlysInBody()
     }
 
     // anchor to 3rd paragraph
-    pWrtShell->EndDoc();
+    pWrtShell->EndOfSection();
     anchor.SetType(RndStdIds::FLY_AT_CHAR);
     anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint());
     pDoc->SetAttr(anchor, *const_cast<SwFrameFormat*>(pFly));
@@ -549,7 +549,7 @@ void SwLayoutWriter::testRedlineFlysInHeader()
     SfxItemSet flySet(pDoc->GetAttrPool(),
                       svl::Items<RES_FRM_SIZE, RES_FRM_SIZE, RES_ANCHOR, RES_ANCHOR>{});
     SwFormatAnchor anchor(RndStdIds::FLY_AT_CHAR);
-    pWrtShell->SttDoc(false);
+    pWrtShell->StartOfSection(false);
     pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false);
     anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint());
     flySet.Put(anchor);
@@ -650,7 +650,7 @@ void SwLayoutWriter::testRedlineFlysInHeader()
     }
 
     // anchor to 2nd (deleted) paragraph
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     pWrtShell->Down(false, 1);
     anchor.SetType(RndStdIds::FLY_AT_CHAR);
     anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint());
@@ -732,7 +732,7 @@ void SwLayoutWriter::testRedlineFlysInHeader()
     }
 
     // anchor to 3rd paragraph
-    pWrtShell->EndDoc();
+    pWrtShell->EndOfSection();
     anchor.SetType(RndStdIds::FLY_AT_CHAR);
     anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint());
     pDoc->SetAttr(anchor, *const_cast<SwFrameFormat*>(pFly));
@@ -856,7 +856,7 @@ void SwLayoutWriter::testRedlineFlysInFootnote()
     pWrtShell->SplitNode(false);
     pWrtShell->Insert("baz");
 
-    pWrtShell->SttDoc(false);
+    pWrtShell->StartOfSection(false);
     CPPUNIT_ASSERT(pWrtShell->IsCursorInFootnote());
     pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false);
     anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint());
@@ -1079,11 +1079,11 @@ void SwLayoutWriter::testRedlineFlysInFootnote()
     }
 
     // anchor to 3rd paragraph
-    pWrtShell->EndDoc();
+    pWrtShell->EndOfSection();
     pWrtShell->SttEndDoc(false);
     pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false);
     pWrtShell->GotoFootnoteText();
-    pWrtShell->EndDoc();
+    pWrtShell->EndOfSection();
     anchor.SetType(RndStdIds::FLY_AT_CHAR);
     anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint());
     pDoc->SetAttr(anchor, *const_cast<SwFrameFormat*>(pFly));
@@ -1207,7 +1207,7 @@ void SwLayoutWriter::testRedlineFlysInFlys()
                       svl::Items<RES_FRM_SIZE, RES_FRM_SIZE, RES_ANCHOR, RES_ANCHOR>{});
     SwFormatFrameSize size(ATT_MIN_SIZE, 1000, 1000);
     flySet.Put(size); // set a size, else we get 1 char per line...
-    pWrtShell->SttDoc(false);
+    pWrtShell->StartOfSection(false);
     pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false);
     SwFormatAnchor anchor1(RndStdIds::FLY_AT_CHAR);
     anchor1.SetAnchor(pWrtShell->GetCursor()->GetPoint());
@@ -1223,7 +1223,7 @@ void SwLayoutWriter::testRedlineFlysInFlys()
     pWrtShell->Insert("ghi");
 
     SwFormatAnchor anchor2(RndStdIds::FLY_AT_CHAR);
-    pWrtShell->SttDoc(false); // start of fly...
+    pWrtShell->StartOfSection(false); // start of fly...
     anchor2.SetAnchor(pWrtShell->GetCursor()->GetPoint());
     flySet.Put(anchor2);
     SwFrameFormat const* pFly2 = pWrtShell->NewFlyFrame(flySet, /*bAnchValid=*/true);
@@ -1385,7 +1385,7 @@ void SwLayoutWriter::testRedlineFlysInFlys()
 
     // anchor to 2nd (deleted) paragraph
     // also, switch the in-fly anchoring to the other fly, for additional fun!
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     pWrtShell->Down(false, 1);
     anchor2.SetType(RndStdIds::FLY_AT_CHAR);
     anchor2.SetAnchor(pWrtShell->GetCursor()->GetPoint());
@@ -1518,7 +1518,7 @@ void SwLayoutWriter::testRedlineFlysInFlys()
     anchor1.SetAnchor(pWrtShell->GetCursor()->GetPoint());
     pDoc->SetAttr(anchor1, *const_cast<SwFrameFormat*>(pFly1));
     pWrtShell->GotoFly(pFly1->GetName(), FLYCNTTYPE_FRM, /*bSelFrame=*/false);
-    pWrtShell->EndDoc();
+    pWrtShell->EndOfSection();
     anchor2.SetType(RndStdIds::FLY_AT_CHAR);
     anchor2.SetAnchor(pWrtShell->GetCursor()->GetPoint());
     pDoc->SetAttr(anchor2, *const_cast<SwFrameFormat*>(pFly2));
@@ -1683,7 +1683,7 @@ void SwLayoutWriter::testRedlineFlysAtFlys()
                       svl::Items<RES_FRM_SIZE, RES_FRM_SIZE, RES_ANCHOR, RES_ANCHOR>{});
     SwFormatFrameSize size(ATT_MIN_SIZE, 1000, 1000);
     flySet.Put(size); // set a size, else we get 1 char per line...
-    pWrtShell->SttDoc(false);
+    pWrtShell->StartOfSection(false);
     pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false);
     SwFormatAnchor anchor1(RndStdIds::FLY_AT_CHAR);
     anchor1.SetAnchor(pWrtShell->GetCursor()->GetPoint());
@@ -1831,7 +1831,7 @@ void SwLayoutWriter::testRedlineFlysAtFlys()
     assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[2]", "Portion", "az");
 
     // anchor to 2nd (deleted) paragraph
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     pWrtShell->Down(false, 1);
     anchor1.SetType(RndStdIds::FLY_AT_CHAR);
     anchor1.SetAnchor(pWrtShell->GetCursor()->GetPoint());
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 65bfd7087058..06cd6bfa48b2 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1139,7 +1139,7 @@ void SwTiledRenderingTest::testUndoInvalidations()
 
     // Insert a character the end of the document.
     SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
-    pWrtShell->EndDoc();
+    pWrtShell->EndOfSection();
     pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'c', 0);
     pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'c', 0);
     Scheduler::ProcessEventsToIdle();
@@ -1173,7 +1173,7 @@ void SwTiledRenderingTest::testUndoLimiting()
 
     // Insert a character the end of the document in the second view.
     SwWrtShell* pWrtShell2 = pXTextDocument->GetDocShell()->GetWrtShell();
-    pWrtShell2->EndDoc();
+    pWrtShell2->EndOfSection();
     pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'c', 0);
     pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'c', 0);
     Scheduler::ProcessEventsToIdle();
@@ -1399,9 +1399,9 @@ void SwTiledRenderingTest::testTrackChanges()
     ViewCallback aView;
     SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
     pWrtShell->GetSfxViewShell()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView);
-    pWrtShell->EndDoc();
+    pWrtShell->EndOfSection();
     pWrtShell->Insert("zzz");
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
 
     // Get the redline just created
     const SwRedlineTable& rTable = pWrtShell->GetDoc()->getIDocumentRedlineAccess().GetRedlineTable();
@@ -1611,7 +1611,7 @@ void SwTiledRenderingTest::testRedlineColors()
     uno::Reference<beans::XPropertySet> xPropertySet(mxComponent, uno::UNO_QUERY);
     xPropertySet->setPropertyValue("RecordChanges", uno::makeAny(true));
     SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
-    pWrtShell->EndDoc();
+    pWrtShell->EndOfSection();
     pWrtShell->Insert("zzz");
 
     // Assert that info about exactly one author is returned.
@@ -1900,10 +1900,10 @@ void SwTiledRenderingTest::testAllTrackedChanges()
     SwWrtShell* pWrtShell2 = pView2->GetWrtShellPtr();
     // Insert text and reject all
     {
-        pWrtShell1->SttDoc();
+        pWrtShell1->StartOfSection();
         pWrtShell1->Insert("hxx");
 
-        pWrtShell2->EndDoc();
+        pWrtShell2->EndOfSection();
         pWrtShell2->Insert("cxx");
     }
 
@@ -1925,10 +1925,10 @@ void SwTiledRenderingTest::testAllTrackedChanges()
 
     // Insert text and accept all
     {
-        pWrtShell1->SttDoc();
+        pWrtShell1->StartOfSection();
         pWrtShell1->Insert("hyy");
 
-        pWrtShell2->EndDoc();
+        pWrtShell2->EndOfSection();
         pWrtShell2->Insert("cyy");
     }
 
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 48a0477cd67b..8255c6a6f392 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -753,7 +753,7 @@ void SwUiWriterTest::testTdf67238()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getRows()->getCount());
     CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getColumns()->getCount());
     //selecting the table
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     pWrtShell->SelTable();
     //making the table protected
     pWrtShell->ProtectCells();
@@ -792,7 +792,7 @@ void SwUiWriterTest::testTdf67238()
     CPPUNIT_ASSERT(((rTable.GetTableBox("C2"))->GetFrameFormat()->GetProtect()).IsContentProtected());
     CPPUNIT_ASSERT(((rTable.GetTableBox("C3"))->GetFrameFormat()->GetProtect()).IsContentProtected());
     //moving the cursor to the starting of the document
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     //making the table [un]protected
     pWrtShell->SelTable();
     pWrtShell->UnProtectCells();
@@ -2409,7 +2409,7 @@ void SwUiWriterTest::testTdf72788()
     //Make selection to remove formatting in first paragraph
     //[this is text
     //]more text
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     //Start selection
     pCursor->SetMark();
     for (int i = 0; i < 13; i++) {
@@ -2576,20 +2576,20 @@ void SwUiWriterTest::testTdf77342()
     SwFieldType* pField = pWrtShell->GetFieldType(0, SwFieldIds::GetRef);
     SwGetRefFieldType* pRefType = static_cast<SwGetRefFieldType*>(pField);
     //moving cursor to the starting of document
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     //inserting reference field 1
     SwGetRefField aField1(pRefType, "", "", REF_FOOTNOTE, sal_uInt16(0), REF_CONTENT);
     pWrtShell->Insert(aField1);
     //inserting second footnote
     pWrtShell->InsertFootnote("");
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     pCursor->Move(fnMoveForward);
     //inserting reference field 2
     SwGetRefField aField2(pRefType, "", "", REF_FOOTNOTE, sal_uInt16(1), REF_CONTENT);
     pWrtShell->Insert(aField2);
     //inserting third footnote
     pWrtShell->InsertFootnote("");
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     pCursor->Move(fnMoveForward);
     pCursor->Move(fnMoveForward);
     //inserting reference field 3
@@ -2619,7 +2619,7 @@ void SwUiWriterTest::testTdf77342()
     uno::Any aAny;
     sal_uInt16 aFormat;
     //reference field 1
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     SwField* pRef1 = SwCursorShell::GetFieldAtCursor(pCursor, true);
     aFormat = pRef1->GetFormat();
     CPPUNIT_ASSERT_EQUAL(sal_uInt16(REF_CONTENT), aFormat);
@@ -2640,11 +2640,11 @@ void SwUiWriterTest::testTdf77342()
     pRef3->QueryValue(aAny, sal_uInt16(FIELD_PROP_SHORT1));
     CPPUNIT_ASSERT_EQUAL(uno::makeAny(sal_uInt16(2)), aAny);
     //moving cursor to the end of the document
-    pWrtShell->EndDoc();
+    pWrtShell->EndOfSection();
     //pasting the copied selection at current cursor position
     pWrtShell->Paste(xClpDoc.get());
     //checking the fields, both new and old, for proper values
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     //old reference field 1
     SwField* pOldRef11 = SwCursorShell::GetFieldAtCursor(pCursor, true);
     aFormat = pOldRef11->GetFormat();
@@ -2712,11 +2712,11 @@ void SwUiWriterTest::testTdf77342()
     SwTextFootnote* pTFNote4 = static_cast<SwTextFootnote*> (pFootnote4);
     CPPUNIT_ASSERT_EQUAL(sal_uInt16(3), pTFNote4->GetSeqRefNo());
     //moving the cursor to the starting of document
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     //pasting the selection again at current cursor position
     pWrtShell->Paste(xClpDoc.get());
     //checking the fields, both new and old, for proper values
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     //new reference field 1
     SwField* pNewRef21 = SwCursorShell::GetFieldAtCursor(pCursor, true);
     aFormat = pNewRef21->GetFormat();
@@ -2818,7 +2818,7 @@ void SwUiWriterTest::testTdf63553()
     pWrtShell->Insert(aSetField1);
     SwGetRefFieldType* pRefType = static_cast<SwGetRefFieldType*>(pWrtShell->GetFieldType(0, SwFieldIds::GetRef));
     //moving cursor to the starting of document
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     //inserting reference field 1
     SwGetRefField aGetField1(pRefType, "Illustration", "", REF_SEQUENCEFLD, sal_uInt16(0), REF_CONTENT);
     pWrtShell->Insert(aGetField1);
@@ -2829,7 +2829,7 @@ void SwUiWriterTest::testTdf63553()
     SwSetExpField aSetField2(pSeqType, "", SVX_NUM_ARABIC);
     pWrtShell->Insert(aSetField2);
     //moving the cursor
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     pCursor->Move(fnMoveForward);
     //inserting reference field 2
     SwGetRefField aGetField2(pRefType, "Illustration", "", REF_SEQUENCEFLD, sal_uInt16(1), REF_CONTENT);
@@ -2841,7 +2841,7 @@ void SwUiWriterTest::testTdf63553()
     //inserting sequence field 3
     SwSetExpField aSetField3(pSeqType, "", SVX_NUM_ARABIC);
     pWrtShell->Insert(aSetField3);
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     pCursor->Move(fnMoveForward);
     pCursor->Move(fnMoveForward);
     //inserting reference field 3
@@ -2858,7 +2858,7 @@ void SwUiWriterTest::testTdf63553()
     //selecting reference field 2 and 3 and sequence field 1 and 2
     //selection is such that more than one and not all sequence fields and reference fields are selected
     //ref1-[ref2-ref3-seq1-seq2]-seq3
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     pCursor->Move(fnMoveForward);
     //start marking
     pCursor->SetMark();
@@ -2874,7 +2874,7 @@ void SwUiWriterTest::testTdf63553()
     uno::Any aAny;
     sal_uInt16 aFormat;
     //reference field 1
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     SwField* pRef1 = SwCursorShell::GetFieldAtCursor(pCursor, true);
     aFormat = pRef1->GetFormat();
     CPPUNIT_ASSERT_EQUAL(sal_uInt16(REF_CONTENT), aFormat);
@@ -2910,11 +2910,11 @@ void SwUiWriterTest::testTdf63553()
     CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), pSeqF3->GetSeqNumber());
     CPPUNIT_ASSERT_EQUAL(OUString("Number range Illustration"), pSeqF3->GetFieldName());
     //moving cursor to the end of the document
-    pWrtShell->EndDoc();
+    pWrtShell->EndOfSection();
     //pasting the copied selection at current cursor position
     pWrtShell->Paste(xClpDoc.get());
     //checking the fields, both new and old, for proper values
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     //now we have ref1-ref2-ref3-seq1-seq2-seq3-nref1-nref2-nseq1-nseq2
     //old reference field 1
     SwField* pOldRef11 = SwCursorShell::GetFieldAtCursor(pCursor, true);
@@ -2976,11 +2976,11 @@ void SwUiWriterTest::testTdf63553()
     CPPUNIT_ASSERT_EQUAL(sal_uInt16(4), pNewSeq2->GetSeqNumber());
     CPPUNIT_ASSERT_EQUAL(OUString("Number range Illustration"), pNewSeq2->GetFieldName());
     //moving the cursor to the starting of document
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     //pasting the selection again at current cursor position
     pWrtShell->Paste(xClpDoc.get());
     //checking the fields, both new and old, for proper values
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     //now we have [nnref1-nnref2-nnseq1-nnseq2]-ref1-[ref2-ref3-seq1-seq2]-seq3-[nref1-nref2-nseq1-nseq2]
     //new reference field 1
     SwField* pNewRef21 = SwCursorShell::GetFieldAtCursor(pCursor, true);
@@ -3115,7 +3115,7 @@ void SwUiWriterTest::testTdf80663()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount());
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getColumns()->getCount());
     //Deleting the first row
-    pWrtShell->SttDoc(); //moves the cursor to the start of Doc
+    pWrtShell->StartOfSection(); //moves the cursor to the start of Doc
     pWrtShell->SelTableRow(); //selects the first row
     pWrtShell->DeleteRow();
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount());
@@ -3151,7 +3151,7 @@ void SwUiWriterTest::testTdf80663()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount());
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getColumns()->getCount());
     //Deleting the first column
-    pWrtShell->SttDoc(); //moves the cursor to the start of Doc
+    pWrtShell->StartOfSection(); //moves the cursor to the start of Doc
     pWrtShell->SelTableCol(); //selects first column
     pWrtShell->DeleteCol();
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount());
@@ -3169,7 +3169,7 @@ void SwUiWriterTest::testTdf80663()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount());
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getColumns()->getCount());
     //Deleting the second column
-    pWrtShell->SttDoc(); //moves the cursor to the start of Doc
+    pWrtShell->StartOfSection(); //moves the cursor to the start of Doc
     pWrtShell->GoNextCell(); //moves the cursor to next cell
     pWrtShell->SelTableCol(); //selects second column
     pWrtShell->DeleteCol();
@@ -3202,7 +3202,7 @@ void SwUiWriterTest::testTdf57197()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount());
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumns()->getCount());
     //Inserting one row before the existing row
-    pWrtShell->SttDoc(); //moves the cursor to the start of Doc
+    pWrtShell->StartOfSection(); //moves the cursor to the start of Doc
     pWrtShell->InsertRow(1, false);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount());
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumns()->getCount());
@@ -3219,7 +3219,7 @@ void SwUiWriterTest::testTdf57197()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount());
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumns()->getCount());
     //Inserting one row after the existing row
-    pWrtShell->SttDoc(); //moves the cursor to the start of Doc
+    pWrtShell->StartOfSection(); //moves the cursor to the start of Doc
     pWrtShell->InsertRow(1, true);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount());
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumns()->getCount());
@@ -3236,7 +3236,7 @@ void SwUiWriterTest::testTdf57197()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount());
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumns()->getCount());
     //Inserting one column before the existing column
-    pWrtShell->SttDoc(); //moves the cursor to the start of Doc
+    pWrtShell->StartOfSection(); //moves the cursor to the start of Doc
     pWrtShell->InsertCol(1, false);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount());
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getColumns()->getCount());
@@ -3253,7 +3253,7 @@ void SwUiWriterTest::testTdf57197()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount());
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumns()->getCount());
     //Inserting one column after the existing column
-    pWrtShell->SttDoc(); //moves the cursor to the start of Doc
+    pWrtShell->StartOfSection(); //moves the cursor to the start of Doc
     pWrtShell->InsertCol(1, true);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount());
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getColumns()->getCount());
@@ -3557,7 +3557,7 @@ void SwUiWriterTest::testTableBackgroundColor()
     uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getRows()->getCount());
     CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getColumns()->getCount());
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     pWrtShell->SelTableRow(); //Selecting First Row
     pWrtShell->ClearMark();
     //Modifying the color of Table Box
@@ -4904,16 +4904,16 @@ void SwUiWriterTest::testRedlineParam()
     // Turn on track changes, and add changes to the start and end of the document.
     uno::Reference<beans::XPropertySet> xPropertySet(mxComponent, uno::UNO_QUERY);
     xPropertySet->setPropertyValue("RecordChanges", uno::makeAny(true));
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     pWrtShell->Insert("aaa");
-    pWrtShell->EndDoc();
+    pWrtShell->EndOfSection();
     pWrtShell->Insert("zzz");
 
     const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
     CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(2), rTable.size());
 
     // Select the first redline.
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
     {
         {"NextTrackedChange", uno::makeAny(static_cast<sal_uInt16>(rTable[0]->GetId()))}
@@ -4926,7 +4926,7 @@ void SwUiWriterTest::testRedlineParam()
     CPPUNIT_ASSERT_EQUAL(OUString("aaa"), pShellCursor->GetText());
 
     // Select the second redline.
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     aPropertyValues = comphelper::InitPropertySequence(
     {
         {"NextTrackedChange", uno::makeAny(static_cast<sal_uInt16>(rTable[1]->GetId()))}
@@ -4937,7 +4937,7 @@ void SwUiWriterTest::testRedlineParam()
     CPPUNIT_ASSERT_EQUAL(OUString("zzz"), pShellCursor->GetText());
 
     // Move the cursor to the start again, and reject the second change.
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     aPropertyValues = comphelper::InitPropertySequence(
     {
         {"RejectTrackedChange", uno::makeAny(static_cast<sal_uInt16>(rTable[1]->GetId()))}
@@ -4968,7 +4968,7 @@ void SwUiWriterTest::testRedlineViewAuthor()
     // Turn on track changes, and add changes to the start of the document.
     uno::Reference<beans::XPropertySet> xPropertySet(mxComponent, uno::UNO_QUERY);
     xPropertySet->setPropertyValue("RecordChanges", uno::makeAny(true));
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     pWrtShell->Insert("aaa");
 
     // Now assert that SwView::SetRedlineAuthor() had an effect.
@@ -5028,15 +5028,15 @@ void SwUiWriterTest::testRedlineTimestamp()
     // the document.
     uno::Reference<beans::XPropertySet> xPropertySet(mxComponent, uno::UNO_QUERY);
     xPropertySet->setPropertyValue("RecordChanges", uno::makeAny(true));
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     pWrtShell->Insert("aaa");
     osl::Thread::wait(std::chrono::seconds(1));
-    pWrtShell->EndDoc();
+    pWrtShell->EndOfSection();
     pWrtShell->Insert("zzz");
 
     // Inserting additional characters at the start changed the table size to
     // 3, i.e. the first and the second "aaa" wasn't combined.
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     pWrtShell->Insert("aaa");
 
     // Now assert that at least one of the seconds are not 0.
@@ -5118,10 +5118,10 @@ void SwUiWriterTest::testTdf104032()
     sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
     SwDoc aClipboard;
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, /*bBasicCall=*/false);
     pWrtShell->Copy(&aClipboard);
-    pWrtShell->EndDoc();
+    pWrtShell->EndOfSection();
     pWrtShell->Paste(&aClipboard);
     rUndoManager.Undo();
 }
@@ -5777,7 +5777,7 @@ void SwUiWriterTest::testTdf113445()
 
     // Insert a new paragraph at the start of the document.
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     pWrtShell->SplitNode();
     discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
@@ -6147,14 +6147,14 @@ void SwUiWriterTest::testTdf115132()
 
     // Create an empty paragraph that will separate first table from the rest
     pWrtShell->SplitNode();
-    pWrtShell->SttDoc();
+    pWrtShell->StartOfSection();
     // Create a table at the start of document body
     SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0);
     const SwTable* pTable = &pWrtShell->InsertTable(TableOpt, 2, 3);
     const SwTableFormat* pFormat = pTable->GetFrameFormat();
     CPPUNIT_ASSERT(pFormat);
     vTestTableNames.push_back(pFormat->GetName());
-    pWrtShell->EndDoc();
+    pWrtShell->EndOfSection();
     // Create a table after a paragraph
     pTable = &pWrtShell->InsertTable(TableOpt, 2, 3);
     pFormat = pTable->GetFrameFormat();
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 209f755b332c..205d46b98fe0 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -59,7 +59,7 @@ void SwUiWriterTest2::testRedlineMoveInsertInDelete()
     pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, /*bBasicCall=*/false);
     pWrtShell->Delete(); // the footnote
     // second delete redline, following the first one
-    pWrtShell->EndDoc(false);
+    pWrtShell->EndOfSection(false);
     pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 3, /*bBasicCall=*/false);
     pWrtShell->Delete(); // "foo"
 
diff --git a/sw/source/ui/misc/titlepage.cxx b/sw/source/ui/misc/titlepage.cxx
index 0fbb74ad874f..5ae2c30ed62b 100644
--- a/sw/source/ui/misc/titlepage.cxx
+++ b/sw/source/ui/misc/titlepage.cxx
@@ -181,7 +181,7 @@ SwTitlePageDlg::SwTitlePageDlg(weld::Window *pParent)
     mpIndexDesc = mpSh->GetPageDescFromPool(RES_POOLPAGE_REGISTER);
     mpNormalDesc = mpSh->GetPageDescFromPool(RES_POOLPAGE_STANDARD);
 
-    mpSh->SttDoc();
+    mpSh->StartOfSection();
     if (lcl_GetPageDesc( mpSh, nSetPage, &mpPageFormatDesc ))
     {
         if (mpPageFormatDesc->GetPageDesc() == mpTitleDesc)
diff --git a/sw/source/uibase/app/applab.cxx b/sw/source/uibase/app/applab.cxx
index 5c9ca1819568..9cc87905358b 100644
--- a/sw/source/uibase/app/applab.cxx
+++ b/sw/source/uibase/app/applab.cxx
@@ -321,12 +321,12 @@ void SwModule::InsertLab(SfxRequest& rReq, bool bLabel)
                             // if there is no content in the fly then
                             // don't leave the fly!!!
                             pSh->Push();
-                            pSh->SttDoc();
+                            pSh->StartOfSection();
                             bool bInFly = nullptr != pSh->WizardGetFly();
                             pSh->Pop(bInFly ? SwCursorShell::PopMode::DeleteStack : SwCursorShell::PopMode::DeleteCurrent);
 
                             if( bInFly )
-                                pSh->EndDoc(true);  // select all content
+                                pSh->EndOfSection(true); // select all content
                                                     // in the fly
                             else
                                 pSh->SetMark();     // set only the mark
@@ -346,8 +346,8 @@ void SwModule::InsertLab(SfxRequest& rReq, bool bLabel)
                         aSect.SetLinkFileName(sLinkName.makeStringAndClear());
                         aSect.SetProtectFlag(true);
                         pSh->Insert(".");   // Dummytext to allocate the Section
-                        pSh->SttDoc();
-                        pSh->EndDoc(true);  // Select everything in the frame
+                        pSh->StartOfSection();
+                        pSh->EndOfSection(true); // Select everything in the frame
                         pSh->InsertSection(aSect);
                     }
                     pSh->Pop(SwCursorShell::PopMode::DeleteCurrent);
diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx
index 0c7272221002..8e5717e5e045 100644
--- a/sw/source/uibase/inc/wrtsh.hxx
+++ b/sw/source/uibase/inc/wrtsh.hxx
@@ -206,8 +206,8 @@ typedef bool (SwWrtShell:: *FNSimpleMove)();
     bool LeftMargin ( bool bSelect, bool bBasicCall );
     bool RightMargin( bool bSelect, bool bBasicCall );
 
-    bool SttDoc     ( bool bSelect = false );
-    bool EndDoc     ( bool bSelect = false );
+    bool StartOfSection( bool bSelect = false );
+    bool EndOfSection  ( bool bSelect = false );
 
     bool SttNxtPg   ( bool bSelect = false );
     void SttPrvPg   ( bool bSelect = false );
diff --git a/sw/source/uibase/shells/txtcrsr.cxx b/sw/source/uibase/shells/txtcrsr.cxx
index 3ecf385bd9f3..8fc063975abb 100644
--- a/sw/source/uibase/shells/txtcrsr.cxx
+++ b/sw/source/uibase/shells/txtcrsr.cxx
@@ -140,16 +140,16 @@ void SwTextShell::ExecMove(SfxRequest &rReq)
             bRet = rSh.RightMargin( false, false );
             break;
         case FN_START_OF_DOCUMENT_SEL:
-            bRet = rSh.SttDoc( true );
+            bRet = rSh.StartOfSection( true );
             break;
         case FN_START_OF_DOCUMENT:
-            bRet = rSh.SttDoc();
+            bRet = rSh.StartOfSection();
             break;
         case FN_END_OF_DOCUMENT_SEL:
-            bRet = rSh.EndDoc( true );
+            bRet = rSh.EndOfSection( true );
             break;
         case FN_END_OF_DOCUMENT:
-            bRet = rSh.EndDoc();
+            bRet = rSh.EndOfSection();
             break;
         case FN_SELECT_WORD:
             bRet = rSh.SelNearestWrd();
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 8d2b1e91eabc..78d10a9a2e2d 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -1141,7 +1141,7 @@ void SwView::Execute(SfxRequest &rReq)
             if( xDictionary.is() )
                 xDictionary->clear();
             // put cursor to the start of the document
-            m_pWrtShell->SttDoc();
+            m_pWrtShell->StartOfSection();
             SAL_FALLTHROUGH; // call spell/grammar dialog
         }
         case FN_SPELL_GRAMMAR_DIALOG:
diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
index 6bd0cf3d6d82..bbab416bfbdb 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -367,11 +367,11 @@ void SwView::ExecSearch(SfxRequest& rReq)
                             m_pWrtShell->Push();
                             if (SwDocPositions::Start == aOpts.eEnd)
                             {
-                                m_pWrtShell->EndDoc();
+                                m_pWrtShell->EndOfSection();
                             }
                             else
                             {
-                                m_pWrtShell->SttDoc();
+                                m_pWrtShell->StartOfSection();
                             }
                         }
                         nFound = FUNC_Search( aOpts );
@@ -519,9 +519,9 @@ bool SwView::SearchAndWrap(bool bApi)
     if( m_eLastSearchCommand == SvxSearchCmd::FIND_ALL )
     {
         if( SwDocPositions::Start == aOpts.eEnd )
-            m_pWrtShell->EndDoc();
+            m_pWrtShell->EndOfSection();
         else
-            m_pWrtShell->SttDoc();
+            m_pWrtShell->StartOfSection();
     }
 
     // fdo#65014 : Ensure that the point of the cursor is at the extremity of the
@@ -657,9 +657,9 @@ bool SwView::SearchAll()
         m_pWrtShell->KillSelection(nullptr, false);
 
         if( SwDocPositions::Start == aOpts.eEnd )
-            m_pWrtShell->EndDoc();
+            m_pWrtShell->EndOfSection();
         else
-            m_pWrtShell->SttDoc();
+            m_pWrtShell->StartOfSection();
     }
     m_bExtra = false;
     sal_uInt16 nFound = static_cast<sal_uInt16>(FUNC_Search( aOpts ));
diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx
index 96f2a6de666b..c1a6a21ca224 100644
--- a/sw/source/uibase/uno/unotxvw.cxx
+++ b/sw/source/uibase/uno/unotxvw.cxx
@@ -1143,7 +1143,7 @@ void SwXTextViewCursor::gotoStart(sal_Bool bExpand)
     if (!IsTextSelection())
         throw  uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
 
-    m_pView->GetWrtShell().SttDoc( bExpand );
+    m_pView->GetWrtShell().StartOfSection( bExpand );
 
 }
 
@@ -1157,7 +1157,7 @@ void SwXTextViewCursor::gotoEnd(sal_Bool bExpand)
     if (!IsTextSelection())
         throw  uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
 
-    m_pView->GetWrtShell().EndDoc( bExpand );
+    m_pView->GetWrtShell().EndOfSection( bExpand );
 
 }
 
diff --git a/sw/source/uibase/wrtsh/move.cxx b/sw/source/uibase/wrtsh/move.cxx
index afcdd9d7f58e..d28554afd64e 100644
--- a/sw/source/uibase/wrtsh/move.cxx
+++ b/sw/source/uibase/wrtsh/move.cxx
@@ -295,13 +295,13 @@ bool SwWrtShell::GoEnd(bool bKeepArea, const bool *pMoveTable)
            SwCursorShell::SttEndDoc(false);
 }
 
-bool SwWrtShell::SttDoc( bool bSelect )
+bool SwWrtShell::StartOfSection(bool const bSelect)
 {
     ShellMoveCursor aTmp( this, bSelect );
     return GoStart(false, nullptr, bSelect );
 }
 
-bool SwWrtShell::EndDoc( bool bSelect)
+bool SwWrtShell::EndOfSection(bool const bSelect)
 {
     ShellMoveCursor aTmp( this, bSelect );
     return GoEnd();
commit d513d5489a5bca65e1a9da9be0da23d1ce592b4b
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Oct 17 12:58:05 2018 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Oct 17 12:58:05 2018 +0200

    sw_redlinehide_3: fix SetRedlineFlags() skipping over redlines
    
    If there's a insert redline inside a footnote whose anchor is in a
    delete redline, the nested redline will be copied by the first
    iteration of the loop in SetRedlineFlags() and then deleted in the
    second iteration, while handling the outer delete redline.
    
    This causes the redline immediately following the outer delete
    redline to be skipped in the 2nd iteration.
    
    Change-Id: Iba5c3a7b0d6d8a0d76a6ab6c7066cc4b059edb75

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 91e8a8b5576d..209f755b332c 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -12,6 +12,7 @@
 #include <swdtflvr.hxx>
 #include <wrtsh.hxx>
 #include <redline.hxx>
+#include <ndtxt.hxx>
 
 namespace
 {
@@ -22,12 +23,14 @@ char const DATA_DIRECTORY[] = "/sw/qa/extras/uiwriter/data2/";
 class SwUiWriterTest2 : public SwModelTestBase
 {
 public:
+    void testRedlineMoveInsertInDelete();
     void testTdf101534();
     void testTdf54819();
     void testTdf119571();
     void testTdf119019();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest2);
+    CPPUNIT_TEST(testRedlineMoveInsertInDelete);
     CPPUNIT_TEST(testTdf101534);
     CPPUNIT_TEST(testTdf54819);
     CPPUNIT_TEST(testTdf119571);
@@ -35,6 +38,42 @@ public:
     CPPUNIT_TEST_SUITE_END();
 };
 
+void SwUiWriterTest2::testRedlineMoveInsertInDelete()
+{
+    loadURL("private:factory/swriter", nullptr);
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    SwWrtShell* const pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+
+    pWrtShell->Insert(" foo");
+    pWrtShell->SttEndDoc(true);
+    pWrtShell->InsertFootnote("");
+    CPPUNIT_ASSERT(pWrtShell->IsCursorInFootnote());
+    RedlineFlags const mode(pWrtShell->GetRedlineFlags() | RedlineFlags::On);
+    CPPUNIT_ASSERT(mode & (RedlineFlags::ShowDelete | RedlineFlags::ShowInsert));
+    pWrtShell->SetRedlineFlags(mode);
+    // insert redline
+    pWrtShell->Insert("bar");
+    // first delete redline, logically containing the insert redline
+    // (note: Word apparently allows similar things...)
+    pWrtShell->SttEndDoc(true);
+    pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, /*bBasicCall=*/false);
+    pWrtShell->Delete(); // the footnote
+    // second delete redline, following the first one
+    pWrtShell->EndDoc(false);
+    pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 3, /*bBasicCall=*/false);
+    pWrtShell->Delete(); // "foo"
+
+    // hiding used to copy the 2nd delete redline "foo", but not delete it
+    pWrtShell->SetRedlineFlags(mode & ~RedlineFlags::ShowDelete); // hide
+    CPPUNIT_ASSERT_EQUAL(
+        OUString(" "),
+        pWrtShell->GetCursor()->GetPoint()->nNode.GetNode().GetTextNode()->GetText());
+    pWrtShell->SetRedlineFlags(mode); // show again
+    CPPUNIT_ASSERT_EQUAL(
+        OUString(u"\u0001 foo"),
+        pWrtShell->GetCursor()->GetPoint()->nNode.GetNode().GetTextNode()->GetText());
+}
+
 void SwUiWriterTest2::testTdf101534()
 {
     // Copy the first paragraph of the document.
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index bd14dd415f06..b5e3f39ccf50 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -756,7 +756,15 @@ void DocumentRedlineManager::SetRedlineFlags( RedlineFlags eMode )
             {
                 for (sal_uInt16 nLoop = 1; nLoop <= 2; ++nLoop)
                     for (size_t i = 0; i < mpRedlineTable->size(); ++i)
-                        ((*mpRedlineTable)[i]->*pFnc)(nLoop, i);
+                    {
+                        SwRangeRedline *const pRedline((*mpRedlineTable)[i]);
+                        (pRedline->*pFnc)(nLoop, i);
+                        while (mpRedlineTable->size() <= i
+                            || (*mpRedlineTable)[i] != pRedline)
+                        {        // ensure current position
+                            --i; // a previous redline may have been deleted
+                        }
+                    }
 
                 //SwRangeRedline::MoveFromSection routinely changes
                 //the keys that mpRedlineTable is sorted by


More information about the Libreoffice-commits mailing list