sw/qa/core/layout/layout.cxx                 |    1 
 sw/qa/extras/layout/layout.cxx               |   57 ---------------------------
 sw/qa/extras/layout/layout2.cxx              |   15 -------
 sw/qa/extras/layout/layout3.cxx              |   15 -------
 sw/qa/extras/mailmerge/mailmerge.cxx         |    4 -
 sw/qa/extras/mailmerge/mailmerge2.cxx        |    6 +-
 sw/qa/extras/mailmerge/mailmergetestbase.cxx |   12 -----
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx   |    1 
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx     |    1 
 sw/qa/extras/uiwriter/uiwriter2.cxx          |   10 ----
 sw/qa/extras/uiwriter/uiwriter3.cxx          |    3 -
 sw/qa/extras/uiwriter/uiwriter4.cxx          |   16 -------
 sw/qa/extras/uiwriter/uiwriter5.cxx          |   51 ------------------------
 sw/qa/extras/uiwriter/uiwriter6.cxx          |    5 --
 sw/qa/extras/uiwriter/uiwriter8.cxx          |   19 ---------
 sw/qa/extras/uiwriter/uiwriter9.cxx          |    3 -
 sw/qa/inc/swmodeltestbase.hxx                |    8 +--
 sw/qa/unit/swmodeltestbase.cxx               |   25 +++++------
 18 files changed, 19 insertions(+), 233 deletions(-)

New commits:
commit 67d02a8fc91df1044a6d9715a07c258b6669659f
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Jul 26 16:52:26 2024 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Jul 29 22:52:11 2024 +0200

    sw: get rid of discardDumpedLayout
    
    Change parseLayoutDump to make it the
    only place where the layout is dumped
    and once it's not needed anymore, discard it
    
    Change-Id: Ia89ff569752e1e592209fa4ccb0b4753eee17e2b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171075
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx
index 11871b2b5f29..9b27151a976f 100644
--- a/sw/qa/core/layout/layout.cxx
+++ b/sw/qa/core/layout/layout.cxx
@@ -241,7 +241,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testTextBoxAutoGrowVertical)
     SdrObject* pShape = pPage->GetObj(0);
     tools::Rectangle aShapeRect = pShape->GetCurrentBoundRect();
 
-    discardDumpedLayout();
     xmlDocUniquePtr pLayout = parseLayoutDump();
     CPPUNIT_ASSERT(pLayout);
     sal_Int32 nFlyLeft
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 81d5511d065f..523bbbd478b5 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -40,7 +40,6 @@ protected:
 // this is a member because our test classes have protected members :(
 void SwLayoutWriter::CheckRedlineFootnotesHidden()
 {
-    discardDumpedLayout();
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged"_ostr, 
"paraPropsNodeIndex"_ostr,
                 u"24"_ustr);
@@ -102,7 +101,6 @@ void SwLayoutWriter::CheckRedlineFootnotesHidden()
 
 void SwLayoutWriter::CheckRedlineSectionsHidden()
 {
-    discardDumpedLayout();
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged"_ostr, 
"paraPropsNodeIndex"_ostr,
                 u"12"_ustr);
@@ -150,7 +148,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFootnotes)
 
     dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
-    discardDumpedLayout();
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
 
     // show: nothing is merged
@@ -340,7 +337,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFootnotes)
     // verify after hide
     dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
     CPPUNIT_ASSERT(pLayout->IsHideRedlines());
-    discardDumpedLayout();
     CheckRedlineFootnotesHidden();
 }
 
@@ -412,7 +408,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
-        discardDumpedLayout();
         xmlDocUniquePtr pXmlDoc = parseLayoutDump();
         assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged"_ostr, 
"paraPropsNodeIndex"_ostr,
                     u"14"_ustr);
@@ -435,7 +430,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
-        discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
 
         // show: nothing is merged
@@ -533,7 +527,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
-        discardDumpedLayout();
         xmlDocUniquePtr pXmlDoc = parseLayoutDump();
         assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged"_ostr, 
"paraPropsNodeIndex"_ostr,
                     u"14"_ustr);
@@ -549,7 +542,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
-        discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
 
         // show: nothing is merged
@@ -646,7 +638,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
-        discardDumpedLayout();
         xmlDocUniquePtr pXmlDoc = parseLayoutDump();
         assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged"_ostr, 
"paraPropsNodeIndex"_ostr,
                     u"14"_ustr);
@@ -669,7 +660,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
-        discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
 
         // show: nothing is merged
@@ -768,7 +758,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testFlyHiddenParagraph)
                 "height"_ostr, "0");
     assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly/infos/bounds"_ostr, "height"_ostr,
                 "448");
-    discardDumpedLayout();
 
     // the problem was that now the fly was the same height as before hiding
     dispatchCommand(mxComponent, ".uno:Fieldnames", {});
@@ -779,7 +768,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testFlyHiddenParagraph)
                 "height"_ostr, "828");
     assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly/infos/bounds"_ostr, "height"_ostr,
                 "1000");
-    discardDumpedLayout();
 
     dispatchCommand(mxComponent, ".uno:Fieldnames", {});
     Scheduler::ProcessEventsToIdle();
@@ -789,7 +777,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testFlyHiddenParagraph)
                 "height"_ostr, "0");
     assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly/infos/bounds"_ostr, "height"_ostr,
                 "448");
-    discardDumpedLayout();
 
     dispatchCommand(mxComponent, ".uno:Fieldnames", {});
     Scheduler::ProcessEventsToIdle();
@@ -799,7 +786,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testFlyHiddenParagraph)
                 "height"_ostr, "828");
     assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly/infos/bounds"_ostr, "height"_ostr,
                 "1000");
-    discardDumpedLayout();
 
     // other test like testTdf143239 and testTdf159101 depend on this;
     // seems getting the previous value is only possible with a listener
@@ -818,7 +804,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testFieldHideSection)
     assertXPath(pXmlDoc, "/root/page[1]/body/section/tab/row"_ostr, 1);
     assertXPath(pXmlDoc, "/root/page[2]/body/section/tab/row"_ostr, 1);
     assertXPath(pXmlDoc, "/root/page"_ostr, 2);
-    discardDumpedLayout();
 
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     ::std::unique_ptr<SwField> pField(pWrtShell->GetCurField()->CopyField());
@@ -838,7 +823,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testFieldHideSection)
     assertXPath(pXmlDoc, "/root/page[1]/body/section/infos/bounds"_ostr, 
"height"_ostr, "0");
     // the problem was that there were 3 pages now
     assertXPath(pXmlDoc, "/root/page"_ostr, 1);
-    discardDumpedLayout();
 
     pWrtShell->StartAllAction();
     manager.UpdateCurField(10000 /*(?)*/, "Foo", "0", std::move(pField));
@@ -849,7 +833,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testFieldHideSection)
     assertXPath(pXmlDoc, "/root/page[1]/body/section/tab/row"_ostr, 1);
     assertXPath(pXmlDoc, "/root/page[2]/body/section/tab/row"_ostr, 1);
     assertXPath(pXmlDoc, "/root/page"_ostr, 2);
-    discardDumpedLayout();
 }
 
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134272)
@@ -981,7 +964,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInHeader)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
-        discardDumpedLayout();
         xmlDocUniquePtr pXmlDoc = parseLayoutDump();
         assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout"_ostr,
                     "type"_ostr, u"PortionType::Para"_ustr);
@@ -1006,7 +988,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInHeader)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
-        discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
 
         // show: nothing is merged
@@ -1108,7 +1089,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInHeader)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
-        discardDumpedLayout();
         xmlDocUniquePtr pXmlDoc = parseLayoutDump();
         // now the frame has no Text portion? not sure why it's a 0-length one 
first and now none?
         //        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", 
"type", "PortionType::Para");
@@ -1127,7 +1107,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInHeader)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
-        discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
 
         // show: nothing is merged
@@ -1230,7 +1209,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInHeader)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
-        discardDumpedLayout();
         xmlDocUniquePtr pXmlDoc = parseLayoutDump();
         assertXPath(pXmlDoc,
                     
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]"_ostr,
@@ -1259,7 +1237,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInHeader)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
-        discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
 
         // show: nothing is merged
@@ -1376,7 +1353,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf150606)
     pWrtShell->Down(false, 1);
     dispatchCommand(mxComponent, u".uno:DeleteTable"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
 
     assertXPath(pXmlDoc, "/root/page[1]/body/section/column/body/tab"_ostr, 0);
@@ -1385,7 +1361,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf150606)
     pWrtShell->Undo();
     Scheduler::ProcessEventsToIdle();
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
 
     assertXPath(pXmlDoc, "/root/page[1]/body/section/column[1]/body/tab"_ostr, 
1);
@@ -1580,7 +1555,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInFootnote)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
-        discardDumpedLayout();
         xmlDocUniquePtr pXmlDoc = parseLayoutDump();
         assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged"_ostr, 
"paraPropsNodeIndex"_ostr,
                     u"25"_ustr);
@@ -1616,7 +1590,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInFootnote)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
-        discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
 
         // show: nothing is merged
@@ -1762,7 +1735,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInFootnote)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
-        discardDumpedLayout();
         xmlDocUniquePtr pXmlDoc = parseLayoutDump();
 
         assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged"_ostr, 
"paraPropsNodeIndex"_ostr,
@@ -1789,7 +1761,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInFootnote)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
-        discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
 
         // show: nothing is merged
@@ -1936,7 +1907,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInFootnote)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
-        discardDumpedLayout();
         xmlDocUniquePtr pXmlDoc = parseLayoutDump();
         assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged"_ostr, 
"paraPropsNodeIndex"_ostr,
                     u"25"_ustr);
@@ -1970,7 +1940,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInFootnote)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
-        discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
 
         // show: nothing is merged
@@ -2127,7 +2096,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf143239)
         p3txt1Left = getXPath(
             pXmlDoc, 
"/root/page[3]/body/txt[1]/anchored/fly[1]/infos/bounds"_ostr, "left"_ostr);
         assertXPath(pXmlDoc, "/root/page"_ostr, 3);
-        discardDumpedLayout();
     }
 
     pWrtShell->SelAll();
@@ -2154,7 +2122,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf143239)
         assertXPath(pXmlDoc, 
"/root/page[3]/body/txt[1]/anchored/fly[1]/infos/bounds"_ostr,
                     "left"_ostr, p3txt1Left);
         assertXPath(pXmlDoc, "/root/page"_ostr, 3);
-        discardDumpedLayout();
     }
 }
 
@@ -2406,7 +2373,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInFlys)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
-        discardDumpedLayout();
         xmlDocUniquePtr pXmlDoc = parseLayoutDump();
         assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged"_ostr, 
"paraPropsNodeIndex"_ostr,
                     u"19"_ustr);
@@ -2446,7 +2412,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInFlys)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
-        discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
 
         // show: nothing is merged
@@ -2599,7 +2564,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInFlys)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
-        discardDumpedLayout();
         xmlDocUniquePtr pXmlDoc = parseLayoutDump();
         assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged"_ostr, 
"paraPropsNodeIndex"_ostr,
                     u"19"_ustr);
@@ -2615,7 +2579,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInFlys)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
-        discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
 
         // show: nothing is merged
@@ -2766,7 +2729,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInFlys)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
-        discardDumpedLayout();
         xmlDocUniquePtr pXmlDoc = parseLayoutDump();
         assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged"_ostr, 
"paraPropsNodeIndex"_ostr,
                     u"19"_ustr);
@@ -2806,7 +2768,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInFlys)
 
         dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
-        discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
 
         // show: nothing is merged
@@ -2997,7 +2958,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysAtFlys)
 
     dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
     CPPUNIT_ASSERT(pLayout->IsHideRedlines());
-    discardDumpedLayout();
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged"_ostr, 
"paraPropsNodeIndex"_ostr,
                 u"19"_ustr);
@@ -3036,7 +2996,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysAtFlys)
 
     dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
 
     // show: nothing is merged
@@ -3167,7 +3126,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysAtFlys)
 
     dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
     CPPUNIT_ASSERT(pLayout->IsHideRedlines());
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged"_ostr, 
"paraPropsNodeIndex"_ostr,
                 u"19"_ustr);
@@ -3183,7 +3141,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysAtFlys)
 
     dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
 
     // show: nothing is merged
@@ -3322,7 +3279,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineSections)
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
     // why is this needed explicitly?
     calcLayout();
-    discardDumpedLayout();
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
 
     // show: nothing is merged
@@ -3400,7 +3356,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineSections)
     CPPUNIT_ASSERT(pLayout->IsHideRedlines());
     // why is this needed explicitly?
     calcLayout();
-    discardDumpedLayout();
     CheckRedlineSectionsHidden();
 }
 
@@ -3430,7 +3385,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineTables)
     CPPUNIT_ASSERT(pLayout->IsHideRedlines());
 
     // verify after load
-    discardDumpedLayout();
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged"_ostr, 
"paraPropsNodeIndex"_ostr,
                 u"12"_ustr);
@@ -3445,7 +3399,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineTables)
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
     // why is this needed explicitly?
     calcLayout();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
 
     // show: nothing is merged
@@ -3505,7 +3458,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineTables)
     CPPUNIT_ASSERT(pLayout->IsHideRedlines());
     // why is this needed explicitly?
     calcLayout();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged"_ostr, 
"paraPropsNodeIndex"_ostr,
                 u"12"_ustr);
@@ -3525,7 +3477,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144057)
     SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc());
     SwRootFrame* pLayout(pDoc->getIDocumentLayoutAccess().GetCurrentLayout());
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
-    discardDumpedLayout();
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     // show tracked row deletions
     assertXPath(pXmlDoc, "/root/page"_ostr, 4);
@@ -3550,7 +3501,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144057)
     dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
     CPPUNIT_ASSERT(pLayout->IsHideRedlines());
     calcLayout();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
 
     // This was 4 (unhidden tracked table and table row deletions)
@@ -3566,7 +3516,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144057)
     dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
     calcLayout();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page"_ostr, 4);
     assertXPath(
@@ -3608,7 +3557,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144347)
         pEditShell->AcceptRedline(0);
 
     calcLayout();
-    discardDumpedLayout();
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     // show tracked row deletions
     assertXPath(pXmlDoc, "/root/page"_ostr, 2);
@@ -3622,7 +3570,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144347)
     dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
     dispatchCommand(mxComponent, u".uno:Delete"_ustr, {});
     calcLayout();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
 
     // table is deleted with change tracking: it still exists
@@ -3634,7 +3581,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144347)
         pEditShell->AcceptRedline(0);
 
     calcLayout();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
 
     assertXPath(pXmlDoc, "/root/page"_ostr, 1);
@@ -3662,7 +3608,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf155345)
     // delete table column with track changes
     dispatchCommand(mxComponent, u".uno:DeleteColumns"_ustr, {});
 
-    discardDumpedLayout();
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     // show tracked column deletions
     assertXPath(pXmlDoc, "/root/page"_ostr, 4);
@@ -3671,7 +3616,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf155345)
     dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
     CPPUNIT_ASSERT(pLayout->IsHideRedlines());
     calcLayout();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
 
     // This was 4 (unhidden tracked table column deletions)
@@ -3681,7 +3625,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf155345)
     dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
     calcLayout();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page"_ostr, 4);
 }
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index 08daf9024d5c..fcda464b6928 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -47,7 +47,6 @@ protected:
 // this mainly tests that splitting portions across redlines in SwAttrIter 
works
 void SwLayoutWriter2::CheckRedlineCharAttributesHidden()
 {
-    discardDumpedLayout();
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged"_ostr, 
"paraPropsNodeIndex"_ostr,
                 u"9"_ustr);
@@ -215,7 +214,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf148897)
 
     dispatchCommand(mxComponent, u".uno:Delete"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
 
     assertXPath(pXmlDoc, "/root/page[1]/sorted_objs/fly"_ostr, 0);
@@ -234,7 +232,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf148897)
 
     dispatchCommand(mxComponent, u".uno:Undo"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
 
     assertXPath(pXmlDoc, "/root/page[1]/sorted_objs/fly"_ostr, 1);
@@ -254,7 +251,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf148897)
 
     dispatchCommand(mxComponent, u".uno:Redo"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
 
     assertXPath(pXmlDoc, "/root/page[1]/sorted_objs/fly"_ostr, 0);
@@ -288,7 +284,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testRedlineCharAttributes)
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
     // why is this needed explicitly?
     calcLayout();
-    discardDumpedLayout();
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
 
     // show: nothing is merged
@@ -555,7 +550,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testRedlineShowHideFootnotePagination)
     // hide redlines - all still visible footnotes move to page 1
     dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
 
     assertXPath(pXmlDoc, "/root/page[1]/ftncont/ftn"_ostr, 2);
@@ -564,7 +558,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testRedlineShowHideFootnotePagination)
     // show again - should now get the same result as on loading
     dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
 
     // check footnotes
@@ -855,7 +848,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testTdf149711_importDOCXMoveToParagraphMar
     CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(2), 
pEditShell->GetRedlineCount());
     pEditShell->RejectRedline(1);
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // This was 6 (not tracked paragraph mark of the moveTo list item)
     assertXPath(pXmlDoc, "/root/page[1]/body/txt"_ostr, 5);
@@ -874,7 +866,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf152872)
 
     dispatchCommand(mxComponent, u".uno:ControlCodes"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
 
     assertXPath(pXmlDoc, "/root/page[1]/body/txt"_ostr, 5);
@@ -895,7 +886,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf152872)
 
     dispatchCommand(mxComponent, u".uno:ControlCodes"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
 
     assertXPath(pXmlDoc, "/root/page[1]/body/txt"_ostr, 2);
@@ -918,7 +908,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf151954)
     CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(3), 
pEditShell->GetRedlineCount());
     pEditShell->AcceptRedline(0);
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // This was 1 (moveFrom was extended to the paragraph mark)
     assertXPath(pXmlDoc, "/root/page[1]/body/txt"_ostr, 2);
@@ -1108,7 +1097,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testRedlineMovingDOCX)
 
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTableCellInvalidate)
 {
-    discardDumpedLayout();
     if (mxComponent.is())
         mxComponent->dispose();
 
@@ -2621,7 +2609,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf127606)
     dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
     dispatchCommand(mxComponent, u".uno:Grow"_ustr, {});
     pViewShell->Reformat();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(
         pXmlDoc,
@@ -2797,7 +2784,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testUserFieldTypeLanguage)
         
"/root/page/body/txt/SwParaPortion/SwLineLayout/SwFieldPortion[@type='PortionType::Field']"_ostr,
         "expand"_ostr, u"1,234.56"_ustr);
 
-    discardDumpedLayout();
     // Now change the system locale to English (before this was failing, 
1234,56 -> 0.00)
     aOptions.SetLocaleConfigString(u"en-GB"_ustr);
     aOptions.Commit();
@@ -2812,7 +2798,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testUserFieldTypeLanguage)
         pXmlDoc,
         
"/root/page/body/txt/SwParaPortion/SwLineLayout/SwFieldPortion[@type='PortionType::Field']"_ostr,
         "expand"_ostr, u"1,234.56"_ustr);
-    discardDumpedLayout();
     // Now change the system locale to German
     aOptions.SetLocaleConfigString(u"de-DE"_ustr);
     aOptions.Commit();
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index 239647e60f3f..3e936abffc38 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -643,7 +643,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf155177)
         assertXPath(pXmlDoc, 
"/root/page[3]/body/txt[1]/SwParaPortion/SwLineLayout"_ostr, 3);
         assertXPath(pXmlDoc, 
"/root/page[3]/body/txt[1]/SwParaPortion/SwLineLayout[1]"_ostr,
                     "portion"_ostr, u"This paragraph is even longer so that 
"_ustr);
-        discardDumpedLayout();
     }
 
     // this should bring one line back
@@ -660,7 +659,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf155177)
         assertXPath(pXmlDoc, 
"/root/page[3]/body/txt[1]/SwParaPortion/SwLineLayout"_ostr, 2);
         assertXPath(pXmlDoc, 
"/root/page[3]/body/txt[1]/SwParaPortion/SwLineLayout[1]"_ostr,
                     "portion"_ostr, u"it is now three lines long though 
"_ustr);
-        discardDumpedLayout();
     }
 
     // this should bring second line back
@@ -679,7 +677,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf155177)
         assertXPath(pXmlDoc, 
"/root/page[3]/body/txt[1]/SwParaPortion/SwLineLayout"_ostr, 1);
         assertXPath(pXmlDoc, 
"/root/page[3]/body/txt[1]/SwParaPortion/SwLineLayout[1]"_ostr,
                     "portion"_ostr, u"containing a single sentence."_ustr);
-        discardDumpedLayout();
     }
 }
 
@@ -761,7 +758,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, 
testKeepWithNextPlusFlyFollowTextFlow)
         assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/infos/bounds"_ostr, 
"height"_ostr,
                     u"276"_ustr);
         assertXPath(pXmlDoc, "/root/page"_ostr, 1);
-        discardDumpedLayout();
     }
 
     dispatchCommand(mxComponent, u".uno:Fieldnames"_ustr, {});
@@ -783,7 +779,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, 
testKeepWithNextPlusFlyFollowTextFlow)
         assertXPath(pXmlDoc, "/root/page[2]/body/txt[2]/infos/bounds"_ostr, 
"height"_ostr,
                     u"276"_ustr);
         assertXPath(pXmlDoc, "/root/page"_ostr, 2);
-        discardDumpedLayout();
     }
 
     dispatchCommand(mxComponent, u".uno:Fieldnames"_ustr, {});
@@ -802,7 +797,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, 
testKeepWithNextPlusFlyFollowTextFlow)
         assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/infos/bounds"_ostr, 
"height"_ostr,
                     u"276"_ustr);
         assertXPath(pXmlDoc, "/root/page"_ostr, 1);
-        discardDumpedLayout();
     }
 }
 
@@ -826,7 +820,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf122607)
 
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf122607_regression)
 {
-    discardDumpedLayout();
     if (mxComponent.is())
         mxComponent->dispose();
 
@@ -871,7 +864,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, 
testTdf122607_regression)
 
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, TestTdf150616)
 {
-    discardDumpedLayout();
     if (mxComponent.is())
         mxComponent->dispose();
 
@@ -1720,7 +1712,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf128399)
 
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf156724)
 {
-    discardDumpedLayout();
     if (mxComponent.is())
         mxComponent->dispose();
 
@@ -1915,7 +1906,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf128959)
     createSwDoc("tdf128959.docx");
     SwDoc* pDocument = getSwDoc();
     CPPUNIT_ASSERT(pDocument);
-    discardDumpedLayout();
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
 
     // first two lines of the paragraph in the split table cell on the first 
page
@@ -2251,7 +2241,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, 
testTdf54465_ColumnsWithFootnoteDoNotOccup
     CPPUNIT_ASSERT_GREATER(1, xmlXPathNodeSetGetLength(pXmlNodes));
     xmlXPathFreeObject(pXmlObj);
 
-    discardDumpedLayout();
     createSwDoc("tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_New.odt");
     pDoc = getSwDoc();
     CPPUNIT_ASSERT(pDoc);
@@ -2788,7 +2777,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, 
testTdf160958_page_break)
     auto xSection = 
xSections->getByName(u"Section1"_ustr).queryThrow<css::beans::XPropertySet>();
     xSection->setPropertyValue(u"IsVisible"_ustr, css::uno::Any(false));
 
-    discardDumpedLayout();
     calcLayout();
     pExportDump = parseLayoutDump();
     assertXPath(pExportDump, "//page"_ostr, 1);
@@ -2814,7 +2802,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, 
testTdf160958_page_break)
     xSection->setPropertyValue(u"IsVisible"_ustr, css::uno::Any(true));
 
     // Check that the layout has been restored
-    discardDumpedLayout();
     calcLayout();
     pExportDump = parseLayoutDump();
     assertXPath(pExportDump, "//page"_ostr, 2);
@@ -2879,7 +2866,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, 
testTdf160958_orphans)
     auto xSection = 
xSections->getByName(u"Section1"_ustr).queryThrow<css::beans::XPropertySet>();
     xSection->setPropertyValue(u"IsVisible"_ustr, css::uno::Any(false));
 
-    discardDumpedLayout();
     calcLayout();
     pExportDump = parseLayoutDump();
     assertXPath(pExportDump, "//page"_ostr, 1);
@@ -2891,7 +2877,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, 
testTdf160958_orphans)
     xSection->setPropertyValue(u"IsVisible"_ustr, css::uno::Any(true));
 
     // Check that the layout has been restored
-    discardDumpedLayout();
     calcLayout();
     pExportDump = parseLayoutDump();
     assertXPath(pExportDump, "//page"_ostr, 2);
diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx 
b/sw/qa/extras/mailmerge/mailmerge.cxx
index 9bea3ee4d9f9..ceda0d1ff908 100644
--- a/sw/qa/extras/mailmerge/mailmerge.cxx
+++ b/sw/qa/extras/mailmerge/mailmerge.cxx
@@ -133,7 +133,7 @@ DECLARE_FILE_MAILMERGE_TEST(test2Pages, 
"simple-mail-merge-2pages.odt", "10-test
         CPPUNIT_ASSERT_EQUAL( firstname, getRun( getParagraph( 6 ), 1 
)->getString());
         // Also verify the layout.
 
-        xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+        xmlDocUniquePtr pXmlDoc = 
parseLayoutDump(static_cast<SfxBaseModel*>(mxSwTextDocument.get()));
         assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwFieldPortion"_ostr, 
"expand"_ostr, lastname);
         assertXPathContent(pXmlDoc, "/root/page[1]/body/txt[1]"_ostr, u"Fixed 
text."_ustr);
         assertXPathContent(pXmlDoc, "/root/page[1]/body/txt[4]"_ostr, 
OUString());
@@ -244,7 +244,7 @@ DECLARE_SHELL_MAILMERGE_TEST(testBookmarkCondition, 
"bookmarkcondition.fodt", "b
 {
     executeMailMerge();
 
-    xmlDocUniquePtr pXmlDoc = parseMMLayoutDump();
+    xmlDocUniquePtr pXmlDoc = 
parseLayoutDump(static_cast<SfxBaseModel*>(mxSwTextDocument.get()));
     // check that conditions on sections and bookmarks are evaluated the same
     assertXPath(pXmlDoc, "/root/page"_ostr, 7);
     assertXPath(pXmlDoc, "/root/page[1]/body/section"_ostr, 1);
diff --git a/sw/qa/extras/mailmerge/mailmerge2.cxx 
b/sw/qa/extras/mailmerge/mailmerge2.cxx
index ff4b68d1dd3b..7f685ca5343f 100644
--- a/sw/qa/extras/mailmerge/mailmerge2.cxx
+++ b/sw/qa/extras/mailmerge/mailmerge2.cxx
@@ -50,7 +50,7 @@ DECLARE_SHELL_MAILMERGE_TEST(testTd78611_shell, 
"tdf78611.odt", "10-testing-addr
 
     // check: each page (one page is one sub doc) has different paragraphs and 
header paragraphs.
     // All header paragraphs should have numbering.
-    xmlDocUniquePtr pXmlDoc = parseMMLayoutDump();
+    xmlDocUniquePtr pXmlDoc = 
parseLayoutDump(static_cast<SfxBaseModel*>(mxSwTextDocument.get()));
 
     // check first page
     assertXPath(pXmlDoc,  
"/root/page[1]/body/txt[6]/SwParaPortion/SwLineLayout/SwFieldPortion"_ostr, 
"expand"_ostr, u"1"_ustr);
@@ -70,7 +70,7 @@ DECLARE_FILE_MAILMERGE_TEST(testTd78611_file, "tdf78611.odt", 
"10-testing-addres
     for (int doc = 0; doc < 10; ++doc)
     {
         loadMailMergeDocument( doc );
-        xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+        xmlDocUniquePtr pXmlDoc = 
parseLayoutDump(static_cast<SfxBaseModel*>(mxSwTextDocument.get()));
         assertXPath(pXmlDoc,  
"/root/page[1]/body/txt[6]/SwParaPortion/SwLineLayout/SwFieldPortion"_ostr, 
"expand"_ostr, u"1"_ustr);
         assertXPath(pXmlDoc,  
"/root/page[1]/body/txt[8]/SwParaPortion/SwLineLayout/SwFieldPortion"_ostr, 
"expand"_ostr, u"1.1"_ustr);
         assertXPath(pXmlDoc,  
"/root/page[1]/body/txt[10]/SwParaPortion/SwLineLayout/SwFieldPortion"_ostr, 
"expand"_ostr, u"1.2"_ustr);
@@ -275,7 +275,7 @@ DECLARE_SHELL_MAILMERGE_TEST(testTdf81750_shell, 
"tdf81750.odt", "10-testing-add
 
     // check several pages page
     OUString aExpected(u"Text: Foo "_ustr);
-    xmlDocUniquePtr pXmlDoc = parseMMLayoutDump();
+    xmlDocUniquePtr pXmlDoc = 
parseLayoutDump(static_cast<SfxBaseModel*>(mxSwTextDocument.get()));
     assertXPathContent(pXmlDoc, "/root/page[1]/body/txt[2]"_ostr, aExpected);
     assertXPathContent(pXmlDoc, "/root/page[3]/body/txt[2]"_ostr, aExpected);
     assertXPathContent(pXmlDoc, "/root/page[5]/body/txt[2]"_ostr, aExpected);
diff --git a/sw/qa/extras/mailmerge/mailmergetestbase.cxx 
b/sw/qa/extras/mailmerge/mailmergetestbase.cxx
index f23dfc851367..50edd6a34552 100644
--- a/sw/qa/extras/mailmerge/mailmergetestbase.cxx
+++ b/sw/qa/extras/mailmerge/mailmergetestbase.cxx
@@ -269,7 +269,6 @@ public:
         mnStartTime = osl_getGlobalTimer();
         mxComponent = loadFromDesktop(msMailMergeOutputURL + "/" + filename,
                                       u"com.sun.star.text.TextDocument"_ustr);
-        discardDumpedLayout();
         calcLayout();
     }
 
@@ -293,17 +292,6 @@ public:
         loadMailMergeDocument(name);
     }
 
-    /**
-     Resets currently opened layout of the original template,
-     and returns the layout dump of the document with N mails inside
-     (result run with text::MailMergeType::SHELL)
-    */
-    xmlDocUniquePtr parseMMLayoutDump()
-    {
-        dumpLayout(static_cast<SfxBaseModel*>(mxSwTextDocument.get()));
-        return parseLayoutDump();
-    }
-
     // Returns page number of the first page of a MM document inside the large 
MM document (used in the SHELL case).
     int documentStartPageNumber(int document) const
     { // See documentStartPageNumber() .
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index c98b85f241a9..35a0543fdfcd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -998,7 +998,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf125657)
 
 DECLARE_OOXMLEXPORT_TEST(testTdf125324, "tdf125324.docx")
 {
-    discardDumpedLayout();
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, 
"/root/page/body/txt[2]/anchored/fly/tab/infos/bounds"_ostr, "top"_ostr, 
u"4193"_ustr);
 }
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 4fb26cb80367..95b97b5b21b5 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -410,7 +410,6 @@ CPPUNIT_TEST_FIXTURE(Test, testN758883)
     // inserting the bookmark in paragraph
     xText->insertTextContent(xCursor, xBookmark, true);
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
 
     // check the bookmark portions are of the expected height
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 1ed402c2e02d..75b9daea5246 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -123,7 +123,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, 
testTdfChangeNumberingListAutoFormat)
     dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
     dispatchCommand(mxComponent, u".uno:Grow"_ustr, {});
     pViewShell->Reformat();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(
         pXmlDoc,
@@ -136,7 +135,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, 
testTdfChangeNumberingListAutoFormat)
     pViewShell
         = 
pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
     pViewShell->Reformat();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // this was 220
     assertXPath(
@@ -363,7 +361,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137318)
     pWrtShell->Undo();
 
     // the problem was that here the "A" showed up again
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/txt"_ostr, 2);
     assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion"_ostr, 0);
@@ -375,7 +372,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137318)
 
     pWrtShell->Undo();
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/txt"_ostr, 1);
     assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion"_ostr, 1);
@@ -387,7 +383,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137318)
     pWrtShell->Undo();
 
     // now the "A" is no longer deleted
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/txt"_ostr, 1);
     assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion"_ostr, 1);
@@ -697,7 +692,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf136453)
     // one paragraph deleted, section is gone
     CPPUNIT_ASSERT_EQUAL(nNodes - 3, pDoc->GetNodes().Count());
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/txt"_ostr, 3);
     assertXPath(pXmlDoc, "/root/page[1]/body/section"_ostr, 0);
@@ -706,7 +700,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf136453)
 
     CPPUNIT_ASSERT_EQUAL(nNodes, pDoc->GetNodes().Count());
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/txt"_ostr, 3);
     assertXPath(pXmlDoc, "/root/page[1]/body/section"_ostr, 1);
@@ -1806,7 +1799,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf147310)
     {
         xmlDocUniquePtr pXmlDoc = parseLayoutDump();
         assertXPath(pXmlDoc, "/root/page/body/tab"_ostr, 0);
-        discardDumpedLayout();
     }
     pWrtShell->Undo();
     // this did not create frames for the table
@@ -1815,14 +1807,12 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf147310)
         xmlDocUniquePtr pXmlDoc = parseLayoutDump();
         // there are 2 tables
         assertXPath(pXmlDoc, "/root/page/body/tab"_ostr, 2);
-        discardDumpedLayout();
     }
     pWrtShell->Redo();
     pWrtShell->Redo();
     {
         xmlDocUniquePtr pXmlDoc = parseLayoutDump();
         assertXPath(pXmlDoc, "/root/page/body/tab"_ostr, 0);
-        discardDumpedLayout();
     }
     pWrtShell->Undo();
     pWrtShell->Undo();
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 9f7f175b0485..ecd1f07a7d99 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -69,7 +69,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf151974)
 
     CPPUNIT_ASSERT_EQUAL(int(16), getParagraphs());
 
-    dumpLayout(mxComponent);
     pLayout = parseLayoutDump();
     for (size_t i = 1; i < 16; ++i)
     {
@@ -441,7 +440,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, 
testVariableFieldTableRowSplitHeader)
                 
"/root/page[5]/footer/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]"_ostr,
                 "expand"_ostr, u"4"_ustr);
 
-    discardDumpedLayout();
     // update and check again
     pDoc->getIDocumentFieldsAccess().UpdateFields(true);
     Scheduler::ProcessEventsToIdle();
@@ -601,7 +599,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf147126)
         Scheduler::ProcessEventsToIdle();
     }
 
-    dumpLayout(mxComponent);
     xmlDocUniquePtr pLayoutXML2 = parseLayoutDump();
 
     for (auto nFly = 1; nFly < 8; ++nFly)
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx 
b/sw/qa/extras/uiwriter/uiwriter4.cxx
index 5b27155c76bd..e1b724088957 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -509,7 +509,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf96536)
     calcLayout();
     sal_Int32 nSingleParaPageHeight
         = parseDump("/root/page[1]/infos/bounds"_ostr, 
"height"_ostr).toInt32();
-    discardDumpedLayout();
 
     // Insert a 2nd paragraph at the end of the first page, so the page height 
grows at least twice...
     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, 
uno::UNO_QUERY);
@@ -520,7 +519,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf96536)
     calcLayout();
     CPPUNIT_ASSERT(parseDump("/root/page[1]/infos/bounds"_ostr, 
"height"_ostr).toInt32()
                    >= 2 * nSingleParaPageHeight);
-    discardDumpedLayout();
 
     // ... and then delete the 2nd paragraph, which shrinks the page to the 
previous size.
     uno::Reference<lang::XComponent> xParagraph(getParagraph(2), 
uno::UNO_QUERY);
@@ -1677,26 +1675,22 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, 
testTableRemoveHasTextChangesOnly)
     IDocumentRedlineAccess& rIDRA(pDoc->getIDocumentRedlineAccess());
     rIDRA.AcceptAllRedline(/*bAccept=*/true);
     Scheduler::ProcessEventsToIdle();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row"_ostr, 3);
 
     // Undo: 4 rows again
     pDoc->GetIDocumentUndoRedo().Undo();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row"_ostr, 4);
 
     // Accepting again: 3 rows (Undo of HasTextChangesOnly is correct)
     rIDRA.AcceptAllRedline(/*bAccept=*/true);
     Scheduler::ProcessEventsToIdle();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row"_ostr, 3);
 
     // Undo: 4 rows again
     pDoc->GetIDocumentUndoRedo().Undo();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row"_ostr, 4);
 
@@ -1707,7 +1701,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, 
testTableRemoveHasTextChangesOnly)
     // Accepting again: 4 rows (extra text keeps the deleted row)
     rIDRA.AcceptAllRedline(/*bAccept=*/true);
     Scheduler::ProcessEventsToIdle();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row"_ostr, 4);
 
@@ -1723,7 +1716,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, 
testTableRemoveHasTextChangesOnly)
     dispatchCommand(mxComponent, u".uno:SwBackSpace"_ustr, {});
     rIDRA.AcceptAllRedline(/*bAccept=*/true);
     Scheduler::ProcessEventsToIdle();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // This was 3
     assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row"_ostr, 4);
@@ -1759,7 +1751,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, 
testTableRemoveHasTextChangesOnly2)
     pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
     Scheduler::ProcessEventsToIdle();
     dispatchCommand(mxComponent, u".uno:AcceptTrackedChange"_ustr, {});
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // Accepting tracked insertion results still 4 rows, but less redlines
     assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row"_ostr, 4);
@@ -1767,7 +1758,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, 
testTableRemoveHasTextChangesOnly2)
 
     // Undo: 4 rows again
     pDoc->GetIDocumentUndoRedo().Undo();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row"_ostr, 4);
     CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(14), 
pEditShell->GetRedlineCount());
@@ -1775,14 +1765,12 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, 
testTableRemoveHasTextChangesOnly2)
     // To check Undo of HasTextChangesOnly reject the same row results 3 rows
     dispatchCommand(mxComponent, u".uno:Escape"_ustr, {});
     dispatchCommand(mxComponent, u".uno:RejectTrackedChange"_ustr, {});
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // This was 4 (lost HasTextChangesOnly)
     assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row"_ostr, 3);
 
     // Undo: 4 rows again
     pDoc->GetIDocumentUndoRedo().Undo();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row"_ostr, 4);
     CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(14), 
pEditShell->GetRedlineCount());
@@ -1809,7 +1797,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, 
testTdf147182_AcceptAllChangesInTableSelec
     dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
     dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
     dispatchCommand(mxComponent, u".uno:AcceptTrackedChange"_ustr, {});
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // Accepting tracked changes in the selected table results 3 rows
     // This was 4 (only text changes of the first selected cell were accepted)
@@ -1818,7 +1805,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, 
testTdf147182_AcceptAllChangesInTableSelec
 
     // Undo: 4 rows again
     pDoc->GetIDocumentUndoRedo().Undo();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row"_ostr, 4);
     CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(14), 
pEditShell->GetRedlineCount());
@@ -1828,14 +1814,12 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, 
testTdf147182_AcceptAllChangesInTableSelec
     dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
     dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
     dispatchCommand(mxComponent, u".uno:RejectTrackedChange"_ustr, {});
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // This was 4 (only text changes of the first selected cell were rejected)
     assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row"_ostr, 3);
 
     // Undo: 4 rows again
     pDoc->GetIDocumentUndoRedo().Undo();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row"_ostr, 4);
     CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(14), 
pEditShell->GetRedlineCount());
diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx 
b/sw/qa/extras/uiwriter/uiwriter5.cxx
index 7786227dfe7e..ad8b78251bd0 100644
--- a/sw/qa/extras/uiwriter/uiwriter5.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter5.cxx
@@ -1759,7 +1759,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf118311)
     dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
     dispatchCommand(mxComponent, u".uno:Cut"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr, 0);
 }
@@ -1790,7 +1789,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableRowDeletion)
     dispatchCommand(mxComponent, u".uno:DeleteRows"_ustr, {});
 
     // This was deleted without change tracking
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
 
@@ -1801,7 +1799,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableRowDeletion)
     pEditShell->AcceptRedline(0);
 
     // table row was still not deleted
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
 
@@ -1809,7 +1806,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableRowDeletion)
     pEditShell->AcceptRedline(0);
 
     // table row (and the 1-row table) was deleted finally
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr, 0);
 
@@ -1821,7 +1817,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableRowDeletion)
     dispatchCommand(mxComponent, u".uno:Undo"_ustr, {});
 
     // table exists again
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
 
@@ -1830,7 +1825,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableRowDeletion)
     dispatchCommand(mxComponent, u".uno:Delete"_ustr, {});
 
     // Table row still exists
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
 
@@ -1839,7 +1833,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableRowDeletion)
     pEditShell->AcceptRedline(0);
 
     // table row was still not deleted
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
 
@@ -1848,7 +1841,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableRowDeletion)
 
     // table row (and the 1-row table) still exists
     // (HasTextChangesOnly property wasn't set for table row deletion)
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
 
@@ -1859,7 +1851,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableRowDeletion)
     dispatchCommand(mxComponent, u".uno:Undo"_ustr, {});
 
     // table exists again
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
 
@@ -1874,7 +1865,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableRowDeletion)
     dispatchCommand(mxComponent, u".uno:DeleteRows"_ustr, {});
 
     // the table (row) was deleted
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr, 0);
 }
@@ -1903,7 +1893,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf150976)
     // delete table row with enabled change tracking
     dispatchCommand(mxComponent, u".uno:DeleteRows"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
 
@@ -1927,7 +1916,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf150976)
     // accept all tracked changes
     dispatchCommand(mxComponent, u".uno:AcceptAllTrackedChanges"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
 
     // tdf#151658 This was 1: not deleted table row (and table)
@@ -1957,7 +1945,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf151657)
     // delete table row with enabled change tracking
     dispatchCommand(mxComponent, u".uno:DeleteRows"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
 
@@ -1981,7 +1968,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf151657)
     // accept all tracked changes
     dispatchCommand(mxComponent, u".uno:AcceptAllTrackedChanges"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
 
     // tdf#151658 This was 1: not deleted table row (and table)
@@ -2004,7 +1990,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testSelectRowWithNestedTable)
     // convert selected text content to uppercase
     dispatchCommand(mxComponent, u".uno:ChangeCaseToUpper"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPathContent(pXmlDoc, 
"//page[1]//body/tab/row/cell[2]/tab/row/cell[1]/txt"_ostr,
                        u"NESTED-A1"_ustr);
@@ -2112,7 +2097,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableRowDeletionWithExport)
 
     // Deleted text content with change tracking,
     // but not table deletion
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
 
@@ -2135,7 +2119,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableRowDeletionWithExport)
 
     // table row (and the 1-row table) was deleted finally
     // (working export/import of HasTextChangesOnly)
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr, 0);
 }
@@ -2167,7 +2150,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableRowDeletionWithDOCXExport)
 
     // Deleted text content with change tracking,
     // but not table deletion
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
 
@@ -2192,7 +2174,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableRowDeletionWithDOCXExport)
 
     // table row (and the 1-row table) was deleted finally
     // (working export/import of HasTextChangesOnly)
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr, 0);
 }
@@ -2701,7 +2682,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableColumnDeletion)
     // (HasTextChangesOnly property of the cell will be false)
     dispatchCommand(mxComponent, u".uno:DeleteColumns"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     // This was 1 (deleted cell without change tracking)
@@ -2713,7 +2693,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableColumnDeletion)
     CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(1), 
pEditShell->GetRedlineCount());
     pEditShell->AcceptRedline(0);
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     // deleted column
@@ -2726,7 +2705,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableColumnDeletion)
     dispatchCommand(mxComponent, u".uno:Undo"_ustr, {});
 
     // first column exists again
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell"_ostr, 2);
@@ -2736,7 +2714,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableColumnDeletion)
     dispatchCommand(mxComponent, u".uno:Delete"_ustr, {});
 
     // Table column still exists
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell"_ostr, 2);
@@ -2746,7 +2723,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableColumnDeletion)
     pEditShell->AcceptRedline(0);
 
     // table column was still not deleted
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell"_ostr, 2);
@@ -2757,7 +2733,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableColumnDeletion)
     dispatchCommand(mxComponent, u".uno:Undo"_ustr, {});
 
     // table exists again
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell"_ostr, 2);
@@ -2773,7 +2748,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableColumnDeletion)
     dispatchCommand(mxComponent, u".uno:DeleteColumns"_ustr, {});
 
     // the table column was deleted
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell"_ostr, 1);
@@ -2872,7 +2846,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, tdf156475)
     // Without the fix in place, this couldn't work
     dispatchCommand(mxComponent, u".uno:AcceptTrackedChange"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     assertXPath(pXmlDoc, "//page[1]//body/tab/row"_ostr, 2);
@@ -2965,7 +2938,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf156544)
     // (HasTextChangesOnly property of the cell will be false)
     dispatchCommand(mxComponent, u".uno:DeleteColumns"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     assertXPath(pXmlDoc, "//page[1]//body/tab/row"_ostr, 1);
@@ -2976,7 +2948,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf156544)
     // accept the deletion of the empty column
     dispatchCommand(mxComponent, u".uno:AcceptTrackedChange"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     assertXPath(pXmlDoc, "//page[1]//body/tab/row"_ostr, 1);
@@ -2985,7 +2956,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf156544)
     // test Undo/Redo
     dispatchCommand(mxComponent, u".uno:Undo"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     assertXPath(pXmlDoc, "//page[1]//body/tab/row"_ostr, 1);
@@ -2993,7 +2963,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf156544)
 
     dispatchCommand(mxComponent, u".uno:Redo"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     assertXPath(pXmlDoc, "//page[1]//body/tab/row"_ostr, 1);
@@ -3073,7 +3042,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testTdf150673_RedlineTableColumnDeletionWi
 
     // Deleted text content with change tracking,
     // but not table deletion
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell"_ostr, 2);
@@ -3090,7 +3058,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testTdf150673_RedlineTableColumnDeletionWi
 
     // first table column was deleted finally
     // (working export/import of HasTextChangesOnly)
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell"_ostr, 1);
@@ -3101,7 +3068,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testTdf150673_RedlineTableColumnDeletionWi
     dispatchCommand(mxComponent, u".uno:Undo"_ustr, {});
 
     // table column exists again
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell"_ostr, 2);
@@ -3116,7 +3082,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testTdf150673_RedlineTableColumnDeletionWi
     dispatchCommand(mxComponent, u".uno:Delete"_ustr, {});
 
     // Table column still exists
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell"_ostr, 2);
@@ -3126,7 +3091,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testTdf150673_RedlineTableColumnDeletionWi
     pEditShell->AcceptRedline(0);
 
     // table column is still not deleted
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell"_ostr, 2);
@@ -3158,7 +3122,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableColumnDeletionWithDOCXExpo
 
     // Deleted text content with change tracking,
     // but not table deletion
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell"_ostr, 2);
@@ -3177,7 +3140,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableColumnDeletionWithDOCXExpo
 
     // table column was deleted
     // (working export/import of HasTextChangesOnly of table cells)
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell"_ostr, 1);
@@ -3207,7 +3169,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testTdf155341_RedlineTableColumnInsertionW
     dispatchCommand(mxComponent, u".uno:InsertColumnsAfter"_ustr, {});
 
     // text content with change tracking (dummy redline)
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell"_ostr, 3);
@@ -3224,7 +3185,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testTdf155341_RedlineTableColumnInsertionW
 
     // inserted table column was deleted
     // (working export/import of HasTextChangesOnly)
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell"_ostr, 2);
@@ -3287,7 +3247,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableRowDeletionWithReject)
 
     // Deleted text content with change tracking,
     // but not table deletion
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
 
@@ -3316,7 +3275,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableRowDeletionWithReject)
 
     // This was table row deletion instead of remaining the empty row
     // (HasTextChangesOnly was false)
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
 
@@ -3332,7 +3290,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableRowDeletionWithReject)
         pEditShell->AcceptRedline(0);
 
     // table row (and the 1-row table) was deleted finally
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr, 0);
 }
@@ -3368,7 +3325,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableRowInsertionWithReject)
     // This was 0 (not tracked row insertion)
     CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(2), 
pEditShell->GetRedlineCount());
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     assertXPath(pXmlDoc, "//page[1]//body/tab/row"_ostr, 3);
@@ -3377,7 +3333,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableRowInsertionWithReject)
     pEditShell->RejectRedline(0);
     pEditShell->RejectRedline(0);
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
     // This was 3 (not rejected row insertion)
@@ -3416,7 +3371,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testTdf145089_RedlineTableRowInsertionDOCX
     SwViewShell* pViewShell
         = 
pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
     pViewShell->Reformat();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
 
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
@@ -3430,8 +3384,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testTdf145089_RedlineTableRowInsertionDOCX
     pEditShell->RejectRedline(0);
     pEditShell->RejectRedline(0);
 
-    discardDumpedLayout();
-
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
 
@@ -3606,7 +3558,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf145091)
     SwViewShell* pViewShell
         = 
pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
     pViewShell->Reformat();
-    discardDumpedLayout();
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
 
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
@@ -3615,8 +3566,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf145091)
     // accept all redlines
     dispatchCommand(mxComponent, u".uno:AcceptAllTrackedChanges"_ustr, {});
 
-    discardDumpedLayout();
-
     pXmlDoc = parseLayoutDump();
     // This was false (deleted table with accepting deletions)
     assertXPath(pXmlDoc, "//page[1]//body/tab"_ostr);
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 82edebf87bec..723cccdfa954 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -200,7 +200,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, 
testLinesMoveBackwardsInSectionInTable)
     pWrtShell->DelLeft();
 
     // Assert that paragraph "5" is now moved back to page 1 and is the last 
paragraph there.
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     SwNodeOffset nPage1LastNode(
         getXPath(pXmlDoc, 
"/root/page[1]/body/tab/row/cell[1]/section/txt[last()]"_ostr,
@@ -306,7 +305,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf113445)
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     pWrtShell->StartOfSection();
     pWrtShell->SplitNode();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
 
     // Make sure that Table2:C5 and Table2:D5 has its section frame inside the 
cell frame.
@@ -366,7 +364,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf113686)
     pWrtShell->DelLeft();
 
     // Assert that the second page is removed.
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // This was still 2, content from 2nd page was not moved.
     assertXPath(pXmlDoc, "/root/page"_ostr, 1);
@@ -490,7 +487,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, 
testSectionInTableInTable4)
     pWrtShell->DelLeft();
 
     // Assert that the page is removed.
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // This was 3, page 2 was emptied, but it wasn't removed.
     assertXPath(pXmlDoc, "/root/page"_ostr, 2);
@@ -529,7 +525,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf112160)
     pWrtShell->SplitNode();
 
     // Assert that after A2 got extended, D2 stays on page 1.
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     sal_uInt32 nD2CellNode
         = getXPath(pXmlDoc, 
"/root/page[1]/body/tab/row[2]/cell[last()]/section/txt[last()]"_ostr,
diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx 
b/sw/qa/extras/uiwriter/uiwriter8.cxx
index 2309983bb75a..b70a2fbaf5d9 100644
--- a/sw/qa/extras/uiwriter/uiwriter8.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter8.cxx
@@ -221,7 +221,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf146962)
     dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
     CPPUNIT_ASSERT(!pWrtShell->GetLayout()->IsHideRedlines());
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // 2 rows are visible now
     assertXPath(pXmlDoc, "/root/page[1]/body/tab/row"_ostr, 2);
@@ -231,7 +230,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf146962)
     dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
     CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines());
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // only a single row is visible again
     assertXPath(pXmlDoc, "/root/page[1]/body/tab/row"_ostr, 1);
@@ -239,7 +237,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf146962)
     // tdf#148227 check Undo of tracked table row deletion
 
     dispatchCommand(mxComponent, u".uno:Undo"_ustr, {});
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // This was 1
     assertXPath(pXmlDoc, "/root/page[1]/body/tab/row"_ostr, 2);
@@ -331,7 +328,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf147347)
     dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
     CPPUNIT_ASSERT(!pWrtShell->GetLayout()->IsHideRedlines());
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // 2 rows are visible now
     assertXPath(pXmlDoc, "/root/page[1]/body/tab/row"_ostr, 2);
@@ -341,7 +337,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf147347)
     dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
     CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines());
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // no visible row again
     assertXPath(pXmlDoc, "/root/page[1]/body/tab/row"_ostr, 0);
@@ -349,7 +344,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf147347)
     // tdf#148228 check Undo of tracked table deletion
 
     dispatchCommand(mxComponent, u".uno:Undo"_ustr, {});
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // This was 0
     assertXPath(pXmlDoc, "/root/page[1]/body/tab/row"_ostr, 2);
@@ -408,7 +402,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf148345)
     dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
     CPPUNIT_ASSERT(!pWrtShell->GetLayout()->IsHideRedlines());
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // 2 rows are visible now
     assertXPath(pXmlDoc, "/root/page[1]/body/tab/row"_ostr, 2);
@@ -418,7 +411,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf148345)
     dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
     CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines());
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // only a single row is visible again
     assertXPath(pXmlDoc, "/root/page[1]/body/tab/row"_ostr, 1);
@@ -426,7 +418,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf148345)
     // tdf#148227 check Reject All of tracked table row deletion
 
     dispatchCommand(mxComponent, u".uno:RejectAllTrackedChanges"_ustr, {});
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // This was 1
     assertXPath(pXmlDoc, "/root/page[1]/body/tab/row"_ostr, 2);
@@ -463,7 +454,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf141391)
     // Undo
 
     dispatchCommand(mxComponent, u".uno:Undo"_ustr, {});
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // 2 rows again, no copied text content
     assertXPath(pXmlDoc, "/root/page[1]/body/tab/row"_ostr, 2);
@@ -476,7 +466,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf141391)
     pWrtShell->Insert(u"Some text..."_ustr);
     pWrtShell->SplitNode();
     Scheduler::ProcessEventsToIdle();
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/tab/row"_ostr, 2);
     assertXPath(pXmlDoc, "/root/page[1]/body/tab/row[2]/cell[1]/txt"_ostr, 2);
@@ -488,7 +477,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf141391)
 
     // insert the table, as a nested one in cell "A2"
     dispatchCommand(mxComponent, u".uno:Paste"_ustr, {});
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page[1]/body/tab/row"_ostr, 2);
     assertXPath(pXmlDoc, "/root/page[1]/body/tab/row[2]/cell[1]/tab"_ostr, 1);
@@ -497,7 +485,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf141391)
     // Undo
 
     dispatchCommand(mxComponent, u".uno:Undo"_ustr, {});
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // 2 rows again, no copied text content
     assertXPath(pXmlDoc, "/root/page[1]/body/tab/row"_ostr, 2);
@@ -512,7 +499,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf141391)
     pWrtShell->Insert(u"and some text again in the first paragraph to be 
sure..."_ustr);
     dispatchCommand(mxComponent, u".uno:Paste"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
 
     // 3-row, overwriting cells of the second row and inserting a new row
@@ -585,7 +571,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf148791)
     pWrtShell->Up(/*bSelect=*/false);
     dispatchCommand(mxComponent, u".uno:PasteRowsBefore"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // This was 5 (inserting only a single row for the 4-row clipboard 
content, and
     // overwriting 3 existing rows)
@@ -616,7 +601,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf148791)
         pWrtShell->Up(/*bSelect=*/false);
     dispatchCommand(mxComponent, u".uno:PasteRowsBefore"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // rows of the nested table doesn't effect row number of the main table
     assertXPath(pXmlDoc, "/root/page[1]/body/tab/row"_ostr, 16);
@@ -640,7 +624,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf148791)
         pWrtShell->Up(/*bSelect=*/false);
     dispatchCommand(mxComponent, u".uno:PasteRowsBefore"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // repeating table header (and its thead/tbody indentation) doesn't effect 
row number
     assertXPath(pXmlDoc, "/root/page[1]/body/tab/row"_ostr, 32);
@@ -1100,13 +1083,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf107427)
     // Delete the header
     pWrtShell->ChangeHeaderOrFooter(u"Default Page Style", true, false, false);
 
-    discardDumpedLayout();
     pLayout = parseLayoutDump();
     assertXPath(pLayout, "/root/page[1]/header"_ostr, 0);
 
     dispatchCommand(mxComponent, u".uno:Undo"_ustr, {});
 
-    discardDumpedLayout();
     pLayout = parseLayoutDump();
     assertXPath(pLayout, "/root/page[1]/header/tab/row"_ostr, 2);
 }
diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx 
b/sw/qa/extras/uiwriter/uiwriter9.cxx
index caf480873072..f7bcf7e2af1a 100644
--- a/sw/qa/extras/uiwriter/uiwriter9.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter9.cxx
@@ -361,7 +361,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf139631)
 
     // Reset to initial string
     dispatchCommand(mxComponent, u".uno:Undo"_ustr, {});
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion"_ostr,
                 "portion"_ostr, "New World!\"");
@@ -372,7 +371,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf139631)
     pWrtShell->Left(SwCursorSkipMode::Chars, true, 1, false);
     pWrtShell->Delete();
     pWrtShell->Insert(u"."_ustr);
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion"_ostr,
                 "portion"_ostr, "New World.\"");
@@ -382,7 +380,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf139631)
     pWrtShell->Left(SwCursorSkipMode::Chars, true, 5, false);
     dispatchCommand(mxComponent, u".uno:Cut"_ustr, {});
 
-    discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
     // Without the test in place, the leading space before "World" is not also 
cut.
     // Expected: New."
diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx
index e4fff44da2bc..322b25f9582b 100644
--- a/sw/qa/inc/swmodeltestbase.hxx
+++ b/sw/qa/inc/swmodeltestbase.hxx
@@ -111,10 +111,6 @@ protected:
         CPPUNIT_FAIL( "verify method must be overridden" );
     }
 
-    void dumpLayout(const css::uno::Reference< css::lang::XComponent > & 
rComponent);
-
-    void discardDumpedLayout();
-
     void calcLayout();
 
     /// Get the body text of the whole document.
@@ -127,7 +123,7 @@ protected:
     css::uno::Reference<css::style::XAutoStyleFamily> getAutoStyles(const 
OUString& aFamily);
 
     /// Similar to parseExport(), but this gives the xmlDocPtr of the layout 
dump.
-    xmlDocUniquePtr parseLayoutDump();
+    xmlDocUniquePtr parseLayoutDump(const css::uno::Reference< 
css::lang::XComponent >& xComponent = nullptr);
 
     /**
      * Extract a value from the layout dump using an XPath expression and an 
attribute name.
@@ -277,6 +273,8 @@ protected:
 
 private:
     void loadURL(OUString const& rURL, const char* pPassword = nullptr);
+
+    void dumpLayout(const css::uno::Reference< css::lang::XComponent > & 
rComponent);
 };
 
 /**
diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx
index e22fb0f43e6a..58500587660b 100644
--- a/sw/qa/unit/swmodeltestbase.cxx
+++ b/sw/qa/unit/swmodeltestbase.cxx
@@ -105,15 +105,6 @@ void SwModelTestBase::dumpLayout(const 
uno::Reference<lang::XComponent>& rCompon
     xmlFreeTextWriter(pXmlWriter);
 }
 
-void SwModelTestBase::discardDumpedLayout()
-{
-    if (mpXmlBuffer)
-    {
-        xmlBufferFree(mpXmlBuffer);
-        mpXmlBuffer = nullptr;
-    }
-}
-
 void SwModelTestBase::calcLayout()
 {
     getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
@@ -160,14 +151,22 @@ uno::Reference<style::XAutoStyleFamily> 
SwModelTestBase::getAutoStyles(const OUS
     return xAutoStyleFamily;
 }
 
-xmlDocUniquePtr SwModelTestBase::parseLayoutDump()
+xmlDocUniquePtr SwModelTestBase::parseLayoutDump(const 
uno::Reference<lang::XComponent>& xComponent)
 {
-    if (!mpXmlBuffer)
+    if (xComponent)
+        dumpLayout(xComponent);
+    else
         dumpLayout(mxComponent);
 
     auto pBuffer = reinterpret_cast<const 
char*>(xmlBufferContent(mpXmlBuffer));
     SAL_INFO("sw.qa", "SwModelTestBase::parseLayoutDump: pBuffer is '" << 
pBuffer << "'");
-    return xmlDocUniquePtr(xmlParseMemory(pBuffer, 
xmlBufferLength(mpXmlBuffer)));
+    xmlDocUniquePtr pXmlDoc(xmlParseMemory(pBuffer, 
xmlBufferLength(mpXmlBuffer)));
+
+    // Discard dumped layout
+    xmlBufferFree(mpXmlBuffer);
+    mpXmlBuffer = nullptr;
+
+    return pXmlDoc;
 }
 
 OUString SwModelTestBase::parseDump(const OString& aXPath, const OString& 
aAttribute)
@@ -444,7 +443,6 @@ void SwModelTestBase::loadURL(OUString const& rURL, const 
char* pPassword)
 
     CPPUNIT_ASSERT(!getSwDocShell()->GetMedium()->GetWarningError());
 
-    discardDumpedLayout();
     calcLayout();
 }
 
@@ -473,7 +471,6 @@ void SwModelTestBase::finish()
 {
     sal_uInt32 nEndTime = osl_getGlobalTimer();
     std::cout << (nEndTime - mnStartTime) << std::endl;
-    discardDumpedLayout();
 }
 
 int SwModelTestBase::getPages() const

Reply via email to