sd/source/ui/unoidl/unomodel.cxx                         |    2 
 slideshow/source/engine/shapes/shapeimporter.cxx         |    2 
 stoc/source/inspect/introspection.cxx                    |    6 
 sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx |    4 
 sw/qa/core/attr/attr.cxx                                 |    3 
 sw/qa/core/crsr/crsr.cxx                                 |   18 -
 sw/qa/core/doc/doc.cxx                                   |   22 -
 sw/qa/core/draw/draw.cxx                                 |    4 
 sw/qa/core/edit/edit.cxx                                 |    8 
 sw/qa/core/fields/fields.cxx                             |    3 
 sw/qa/core/frmedt/frmedt.cxx                             |   10 
 sw/qa/core/layout/layout.cxx                             |   53 +--
 sw/qa/core/layout/paintfrm.cxx                           |    9 
 sw/qa/core/objectpositioning/objectpositioning.cxx       |    3 
 sw/qa/core/text/itrform2.cxx                             |    3 
 sw/qa/core/text/text.cxx                                 |   65 +---
 sw/qa/core/theme/ThemeTest.cxx                           |   10 
 sw/qa/core/txtnode/txtnode.cxx                           |   39 +-
 sw/qa/core/undo/undo.cxx                                 |   11 
 sw/qa/core/unocore/unocore.cxx                           |   28 --
 sw/qa/core/view/view.cxx                                 |    2 
 sw/qa/extras/autocorrect/autocorrect.cxx                 |    3 
 sw/qa/extras/htmlexport/htmlexport.cxx                   |   47 +--
 sw/qa/extras/htmlimport/htmlimport.cxx                   |    8 
 sw/qa/extras/layout/layout.cxx                           |   39 --
 sw/qa/extras/layout/layout2.cxx                          |  204 +++++----------
 sw/qa/extras/layout/layout3.cxx                          |   43 +--
 sw/qa/extras/layout/layout4.cxx                          |   20 -
 sw/qa/extras/mailmerge/mailmerge.cxx                     |    4 
 sw/qa/extras/mailmerge/mailmerge2.cxx                    |    2 
 sw/qa/extras/odfexport/odfexport2.cxx                    |    3 
 sw/qa/extras/odfimport/odfimport.cxx                     |   31 --
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx               |    4 
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx               |    3 
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx               |    3 
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx               |    3 
 sw/qa/extras/ooxmlexport/ooxmlexport20.cxx               |    4 
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx                |   16 -
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx                |    8 
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx                |   12 
 sw/qa/extras/rtfexport/rtfexport3.cxx                    |    6 
 sw/qa/extras/rtfexport/rtfexport4.cxx                    |    4 
 sw/qa/extras/txtimport/txtimport.cxx                     |    5 
 sw/qa/extras/uiwriter/uiwriter.cxx                       |  105 +++----
 sw/qa/extras/uiwriter/uiwriter2.cxx                      |  154 ++++-------
 sw/qa/extras/uiwriter/uiwriter3.cxx                      |   38 +-
 sw/qa/extras/uiwriter/uiwriter4.cxx                      |   88 ++----
 sw/qa/extras/uiwriter/uiwriter5.cxx                      |   87 ++----
 sw/qa/extras/uiwriter/uiwriter6.cxx                      |  162 +++++------
 sw/qa/extras/uiwriter/uiwriter7.cxx                      |   78 ++---
 sw/qa/extras/uiwriter/uiwriter8.cxx                      |   96 ++-----
 sw/qa/extras/uiwriter/uiwriter9.cxx                      |   21 -
 sw/qa/extras/unowriter/unowriter.cxx                     |   16 -
 sw/qa/extras/ww8export/ww8export.cxx                     |    7 
 sw/qa/extras/ww8import/ww8import.cxx                     |    4 
 sw/qa/filter/ascii/ascii.cxx                             |    6 
 sw/qa/filter/html/html.cxx                               |    9 
 sw/qa/filter/ww8/ww8.cxx                                 |    8 
 sw/qa/uibase/dialog/dialog.cxx                           |    3 
 sw/qa/uibase/dochdl/dochdl.cxx                           |    8 
 sw/qa/uibase/docvw/docvw.cxx                             |    8 
 sw/qa/uibase/fldui/fldui.cxx                             |   12 
 sw/qa/uibase/shells/shells.cxx                           |   45 +--
 sw/qa/uibase/uiview/uiview.cxx                           |    3 
 sw/qa/uibase/uno/uno.cxx                                 |   22 -
 sw/qa/uibase/wrtsh/wrtsh.cxx                             |   38 --
 sw/qa/unit/swmodeltestbase.cxx                           |    3 
 xmloff/source/draw/ximpstyl.cxx                          |    2 
 68 files changed, 682 insertions(+), 1118 deletions(-)

New commits:
commit fb41273bf460234a5636a37765bdba90860147d4
Author:     Xisco Fauli <[email protected]>
AuthorDate: Thu Oct 24 17:13:27 2024 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Fri Oct 25 09:23:21 2024 +0200

    sw/qa: use getSwDocShell() when possible
    
    Change-Id: Ia2e3dad4e62fb084c3a88564deb137cbcc7728b5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175573
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx 
b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
index d15eeaf70da9..9bc791a5db62 100644
--- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
+++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
@@ -268,7 +268,7 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testDeleteHeader)
     CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[6]->m_eIssueID);
     CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[7]->m_eIssueID);
 
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     CPPUNIT_ASSERT(pWrtShell);
 
     // modify header
@@ -370,7 +370,7 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testOnlineNodeSplitAppend)
     createSwDoc("OnlineCheck.odt");
     SwDoc* pDoc = getSwDoc();
     CPPUNIT_ASSERT(pDoc);
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     CPPUNIT_ASSERT(pWrtShell);
 
     // Enable online a11y checker
diff --git a/sw/qa/core/attr/attr.cxx b/sw/qa/core/attr/attr.cxx
index a1d35941d00b..fcb68493875f 100644
--- a/sw/qa/core/attr/attr.cxx
+++ b/sw/qa/core/attr/attr.cxx
@@ -33,8 +33,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSwAttrSet)
 {
     // Given a document with track changes and the whole document is selected:
     createSwDoc("attr-set.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pDocShell = pDoc->GetDocShell();
+    SwDocShell* pDocShell = getSwDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
     dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
     dispatchCommand(mxComponent, u".uno:Cut"_ustr, {});
diff --git a/sw/qa/core/crsr/crsr.cxx b/sw/qa/core/crsr/crsr.cxx
index 2fa7439626d2..9bd9391e2259 100644
--- a/sw/qa/core/crsr/crsr.cxx
+++ b/sw/qa/core/crsr/crsr.cxx
@@ -90,8 +90,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testFindReplace)
 CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testSelAllStartsWithTable)
 {
     createSwDoc("sel-all-starts-with-table.odt");
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pDocShell = pTextDoc->GetDocShell();
+    SwDocShell* pDocShell = getSwDocShell();
     SwDoc* pDoc = pDocShell->GetDoc();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
 
@@ -113,7 +112,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, 
testContentControlLineBreak)
 {
     // Given a document with a (rich text) content control:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
     uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, 
uno::UNO_QUERY);
     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, 
uno::UNO_QUERY);
     uno::Reference<text::XText> xText = xTextDocument->getText();
@@ -126,7 +124,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, 
testContentControlLineBreak)
     xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
 
     // When pressing "enter" in the middle of that content control:
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->SttEndDoc(/*bStt=*/true);
     // Go after "t".
     pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 2, 
/*bBasicCall=*/false);
@@ -145,7 +143,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, 
testContentControlReadOnly)
 {
     // Given a document with a checkbox content control:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
     uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, 
uno::UNO_QUERY);
     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, 
uno::UNO_QUERY);
     uno::Reference<text::XText> xText = xTextDocument->getText();
@@ -160,7 +157,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, 
testContentControlReadOnly)
     xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
 
     // When entering the content control:
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->SttEndDoc(/*bStt=*/true);
     pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
 
@@ -173,8 +170,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, 
testContentControlReadOnly)
 CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testTdf135451)
 {
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
 
     // Insert narrow no-break space and move the cursor right before it
     pWrtShell->Insert(u"a" + OUStringChar(CHAR_NNBSP) + "b");
@@ -194,8 +190,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, 
testDropdownContentControl)
 {
     // Given a document with a dropdown content control:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->InsertContentControl(SwContentControlType::DROP_DOWN_LIST);
 
     // When entering the content control:
@@ -212,8 +207,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, 
testContentControlProtectedSection)
 {
     // Given a document with a date content control in a protected section:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->InsertContentControl(SwContentControlType::DATE);
     pWrtShell->SelAll();
     OUString aSectionName = pWrtShell->GetUniqueSectionName();
diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx
index 80f149be88ac..4933451f4468 100644
--- a/sw/qa/core/doc/doc.cxx
+++ b/sw/qa/core/doc/doc.cxx
@@ -60,7 +60,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testMathInsertAnchorType)
     SwDoc* pDoc = getSwDoc();
 
     // When inserting an a math object.
-    SwWrtShell* pShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pShell = getSwDocShell()->GetWrtShell();
     SvGlobalName aGlobalName(SO3_SM_CLASSID);
     pShell->InsertObject(svt::EmbeddedObjectRef(), &aGlobalName);
 
@@ -100,8 +100,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, 
testTextboxTextRotateAngle)
 CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testNumDownIndent)
 {
     createSwDoc("num-down-indent.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pDocShell = pDoc->GetDocShell();
+    SwDocShell* pDocShell = getSwDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
     pWrtShell->Down(/*bSelect=*/false);
     SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin();
@@ -124,8 +123,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testBulletsOnSpaceOff)
     pAutoCorrect->GetSwFlags().bSetNumRuleAfterSpace = false;
 
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pDocShell = pDoc->GetDocShell();
+    SwDocShell* pDocShell = getSwDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
     pWrtShell->Down(/*bSelect=*/false);
     SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin();
@@ -148,8 +146,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testBulletsOnSpace)
     pAutoCorrect->GetSwFlags().bSetNumRuleAfterSpace = true;
 
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pDocShell = pDoc->GetDocShell();
+    SwDocShell* pDocShell = getSwDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
     pWrtShell->Down(/*bSelect=*/false);
     SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin();
@@ -169,8 +166,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testBulletsOnSpace)
 CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testLocaleIndependentTemplate)
 {
     createSwDoc("locale-independent-template.odt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pDocShell = pDoc->GetDocShell();
+    SwDocShell* pDocShell = getSwDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
     SfxItemSet aSet(pWrtShell->GetAttrPool(), svl::Items<RES_CHRATR_LANGUAGE, 
RES_CHRATR_LANGUAGE>);
     pWrtShell->GetCurAttr(aSet);
@@ -208,11 +204,10 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, 
testTextBoxMakeFlyFrame)
 {
     // Given a document with an as-char textbox (as-char draw format + at-char 
fly format):
     createSwDoc("textbox-makeflyframe.docx");
-    SwDoc* pDoc = getSwDoc();
 
     // When cutting the textbox and pasting it to a new document:
     selectShape(1);
-    SwDocShell* pDocShell = pDoc->GetDocShell();
+    SwDocShell* pDocShell = getSwDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
     rtl::Reference<SwTransferable> pTransfer = new SwTransferable(*pWrtShell);
     pTransfer->Cut();
@@ -246,7 +241,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testIMEGrouping)
     Scheduler::ProcessEventsToIdle();
 
     // When pressing two keys via IME:
-    SwDocShell* pDocShell = pDoc->GetDocShell();
+    SwDocShell* pDocShell = getSwDocShell();
     SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin();
     rEditWin.PostExtTextInputEvent(VclEventId::ExtTextInput, u"a"_ustr);
     rEditWin.PostExtTextInputEvent(VclEventId::EndExtTextInput, u""_ustr);
@@ -297,7 +292,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, 
testContentControlDelete)
 {
     // Given a document with a content control:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
     uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, 
uno::UNO_QUERY);
     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, 
uno::UNO_QUERY);
     uno::Reference<text::XText> xText = xTextDocument->getText();
@@ -310,7 +304,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, 
testContentControlDelete)
     xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
 
     // When deleting the dummy character at the end of the content control:
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->SttEndDoc(/*bStt=*/false);
     pWrtShell->DelLeft();
 
diff --git a/sw/qa/core/draw/draw.cxx b/sw/qa/core/draw/draw.cxx
index e796e7d3f392..5cefd05827ad 100644
--- a/sw/qa/core/draw/draw.cxx
+++ b/sw/qa/core/draw/draw.cxx
@@ -36,7 +36,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDrawTest, testTextboxDeleteAsChar)
     // Load a document with an as-char shape in it that has a textbox and an 
image in it.
     createSwDoc("as-char-textbox.docx");
     SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SdrPage* pPage = 
pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
     sal_Int32 nActual = pPage->GetObjCount();
     // 3 objects on the draw page: a shape + fly frame pair and a Writer image.
@@ -63,7 +63,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDrawTest, testTextboxUndoOrdNum)
     // - picture
     createSwDoc("textbox-undo-ordnum.docx");
     SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     const auto& rFormats = *pDoc->GetSpzFrameFormats();
     // Test the state before del + undo.
     for (const auto& pFormat : rFormats)
diff --git a/sw/qa/core/edit/edit.cxx b/sw/qa/core/edit/edit.cxx
index 71dcaae879a5..934cb6346d24 100644
--- a/sw/qa/core/edit/edit.cxx
+++ b/sw/qa/core/edit/edit.cxx
@@ -31,15 +31,14 @@ CPPUNIT_TEST_FIXTURE(Test, testRedlineHidden)
 {
     // Given a document with ShowRedlineChanges=false:
     createSwDoc("redline-hidden.fodt");
-    SwDoc* pDoc = getSwDoc();
 
     // When formatting a paragraph by setting the para adjust to center, then 
make sure setting the
     // new item set on the paragraph doesn't crash:
-    SwView* pView = pDoc->GetDocShell()->GetView();
+    SwView* pView = getSwDocShell()->GetView();
     SfxItemSet aSet(pView->GetPool(), svl::Items<RES_PARATR_ADJUST, 
RES_PARATR_ADJUST>);
     SvxAdjustItem aItem(SvxAdjust::Center, RES_PARATR_ADJUST);
     aSet.Put(aItem);
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->SetAttrSet(aSet, SetAttrMode::DEFAULT, nullptr, true);
 }
 
@@ -60,8 +59,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDeleteSelNormalize)
 {
     // Given a read-only document with a fillable form, the placeholder text 
is selected:
     createSwDoc("delete-sel-normalize.odt");
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->SttEndDoc(/*bStt=*/true);
     pWrtShell->GotoFormControl(/*bNext=*/true);
 
diff --git a/sw/qa/core/fields/fields.cxx b/sw/qa/core/fields/fields.cxx
index 5ecb2ba06e0e..fc0edc5d61ea 100644
--- a/sw/qa/core/fields/fields.cxx
+++ b/sw/qa/core/fields/fields.cxx
@@ -60,7 +60,6 @@ CPPUNIT_TEST_FIXTURE(Test, testAuthorityTooltip)
 {
     // Create a document with a bibliography reference in it.
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
     uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, 
uno::UNO_QUERY);
     uno::Reference<beans::XPropertySet> xField(
         
xFactory->createInstance(u"com.sun.star.text.TextField.Bibliography"_ustr), 
uno::UNO_QUERY);
@@ -78,7 +77,7 @@ CPPUNIT_TEST_FIXTURE(Test, testAuthorityTooltip)
     xText->insertTextContent(xCursor, xContent, /*bAbsorb=*/false);
 
     // Get the tooltip of the field.
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
     SwPaM* pCursor = pWrtShell->GetCursor();
     auto pField = dynamic_cast<SwAuthorityField*>(
diff --git a/sw/qa/core/frmedt/frmedt.cxx b/sw/qa/core/frmedt/frmedt.cxx
index d84ac6bffaa9..bfa776d98a86 100644
--- a/sw/qa/core/frmedt/frmedt.cxx
+++ b/sw/qa/core/frmedt/frmedt.cxx
@@ -51,7 +51,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testTextboxReanchor)
 
     // Select the shape of the textbox.
     Point aPoint;
-    SwWrtShell* pShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pShell = getSwDocShell()->GetWrtShell();
     pShell->SelectObj(aPoint, /*nFlag=*/0, pDrawShape);
 
     // Anchor the shape of the textbox into its own textframe.
@@ -97,8 +97,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, 
testVertPosFromBottomBoundingBox)
 
     // Calculate the allowed bounding box of the shape, e.g. the shape's 
position & size dialog uses
     // this to limit the vertical position to sensible values.
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SwRect aBoundRect;
     RndStdIds eAnchorType = RndStdIds::FLY_AT_CHAR;
     SwDoc* pDoc = getSwDoc();
@@ -124,8 +123,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, 
testPasteFlyInTextBox)
 {
     // Given a document that contains a textbox, which contains an sw image 
(fly frame)
     createSwDoc("paste-fly-in-textbox.docx");
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pDocShell = pTextDoc->GetDocShell();
+    SwDocShell* pDocShell = getSwDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
     SwDoc* pDoc = pDocShell->GetDoc();
     SdrPage* pPage = 
pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
@@ -160,7 +158,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, 
testTextBoxSelectCursorPos)
     SdrObject* pFlyObject = pPage->GetObj(1);
     SwContact* pFlyContact = 
static_cast<SwContact*>(pFlyObject->GetUserCall());
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(RES_FLYFRMFMT), 
pFlyContact->GetFormat()->Which());
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->SelectObj(Point(), 0, pFlyObject);
 
     // Then make sure the cursor is the anchor of the draw format:
diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx
index 4f3bc3545d74..3a9e06de4caa 100644
--- a/sw/qa/core/layout/layout.cxx
+++ b/sw/qa/core/layout/layout.cxx
@@ -93,8 +93,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testBorderCollapseCompat)
     // Load a document with a border conflict: top cell has a dotted bottom 
border, bottom cell has
     // a solid upper border.
     createSwDoc("border-collapse-compat.docx");
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pShell = pTextDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
     MetafileXmlDump aDumper;
     xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
@@ -113,8 +112,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrTableRowSpan)
     // Load a document which has a table. The A1 cell has btlr text direction, 
and the A1..A3 cells
     // are merged.
     createSwDoc("btlr-table-row-span.odt");
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pShell = pTextDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
     MetafileXmlDump aDumper;
     xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
@@ -149,8 +147,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testTablesMoveBackwards)
 {
     // Load a document with 1 pages: empty content on first page, then 21 
tables on the second page.
     createSwDoc("tables-move-backwards.odt");
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pDocShell = pTextDoc->GetDocShell();
+    SwDocShell* pDocShell = getSwDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
 
     // Delete the content on the first page.
@@ -251,8 +248,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testTextboxModification)
 {
     // Load a document with a textbox in it: the layout will have to position 
the shape part.
     createSwDoc("textbox-modification.docx");
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pDocShell = pTextDoc->GetDocShell();
+    SwDocShell* pDocShell = getSwDocShell();
 
     // Without the accompanying fix in place, this test would have failed, as 
the document was
     // marked as modified right after the import.
@@ -375,7 +371,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testGutterMirrorMargin)
 {
     createSwDoc();
     SwDoc* pDoc = getSwDoc();
-    SwDocShell* pDocShell = pDoc->GetDocShell();
+    SwDocShell* pDocShell = getSwDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
     pWrtShell->InsertPageBreak();
     SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
@@ -435,7 +431,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testGutterMarginPageBorder)
 #if !defined(MACOSX) && !defined(_WIN32)
     // Given a document with a non-0 gutter margin.
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
     uno::Reference<beans::XPropertySet> xStandard(
         getStyles(u"PageStyles"_ustr)->getByName(u"Standard"_ustr), 
uno::UNO_QUERY);
     sal_Int32 nGutterMm100 = 2000;
@@ -448,7 +443,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testGutterMarginPageBorder)
     xStandard->setPropertyValue(u"LeftBorder"_ustr, uno::Any(aBorder));
 
     // Then make sure border is at the left edge of the text area.
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
     MetafileXmlDump dumper;
     xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
@@ -470,8 +465,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testVerticallyMergedCellBorder)
 {
     // Given a document with a table: 2 columns, 5 rows. B2 -> B5 is merged:
     createSwDoc("vmerge-cell-border.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // When rendering the table:
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -550,8 +544,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testLinkedBullet)
 {
     // Given a document with a graphic bullet, where the image is a linked one:
     createSwDoc("linked-bullet.odt");
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pShell = pTextDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // When rendering that document:
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -570,8 +563,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testInnerCellBorderIntersect)
 {
     // Given a table with both outer and inner borders:
     createSwDoc("inner-border.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // When rendering table borders:
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -686,8 +678,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testDoubleBorderVertical)
 {
     // Given a table with a left and right double border, outer is thick, 
inner is thin:
     createSwDoc("double-border-vertical.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // When rendering that document:
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -735,8 +726,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testDoubleBorderHorizontal)
 {
     // Given a table with a top and bottom double border, outer is thin, inner 
is thick:
     createSwDoc("double-border-horizontal.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // When rendering table borders:
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -784,8 +774,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testParaBorderInCellClip)
 {
     // Given a document which has outside-cell borders defined, which should 
not be visible:
     createSwDoc("para-border-in-cell-clip.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // When rendering those borders:
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -805,8 +794,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testDoublePageBorder)
 {
     // Given a page with a top and bottom double border, outer is thick, inner 
is thin:
     createSwDoc("double-page-border.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // When rendering that document:
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -859,8 +847,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testNegativePageBorder)
 
     // Given a document with a top margin and a negative border distance:
     createSwDoc();
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pDocShell = pTextDoc->GetDocShell();
+    SwDocShell* pDocShell = getSwDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
     pWrtShell->Insert(u"test"_ustr);
     uno::Reference<beans::XPropertySet> xPageStyle(
@@ -902,8 +889,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testNegativePageBorderNoMargin)
 
     // Given a document with no top margin and a negative border distance:
     createSwDoc();
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pDocShell = pTextDoc->GetDocShell();
+    SwDocShell* pDocShell = getSwDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
     pWrtShell->Insert(u"test"_ustr);
     uno::Reference<beans::XPropertySet> xPageStyle(
@@ -939,7 +925,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testFollowTextFlowWrapInBackground)
     createSwDoc();
     SwDoc* pDoc = getSwDoc();
     
pDoc->getIDocumentSettingAccess().set(DocumentSettingId::USE_FORMER_TEXT_WRAPPING,
 true);
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SwInsertTableOptions aTableOptions(SwInsertTableFlags::DefaultBorder, 0);
     pWrtShell->InsertTable(aTableOptions, 1, 1);
     pWrtShell->MoveTable(GotoPrevTable, fnTableStart);
@@ -972,13 +958,12 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testPageRemoveFlyTable)
 {
     // Given a document with a ToC and several tables, one table marked with a 
bookmark:
     createSwDoc("page-remove-fly-table.odt");
-    SwDoc* pDoc = getSwDoc();
 
     // When updating the ToC and incrementally formatting the document:
-    SwView* pView = pDoc->GetDocShell()->GetView();
+    SwView* pView = getSwDocShell()->GetView();
     SfxDispatcher& rDispatcher = *pView->GetViewFrame().GetDispatcher();
     rDispatcher.Execute(FN_UPDATE_TOX);
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->Reformat();
 
     // Then make sure that the 2nd table below the bookmark has no unwanted 
top margin:
@@ -1011,7 +996,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testNewFollowTextFlowWrapInBackground)
     // through and follow-text-flow set to true, legacy 
USE_FORMER_TEXT_WRAPPING is not set:
     createSwDoc();
     SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SwInsertTableOptions aTableOptions(SwInsertTableFlags::DefaultBorder, 0);
     pWrtShell->InsertTable(aTableOptions, 1, 1);
     pWrtShell->MoveTable(GotoPrevTable, fnTableStart);
diff --git a/sw/qa/core/layout/paintfrm.cxx b/sw/qa/core/layout/paintfrm.cxx
index e859cd293710..cddb43f4b80d 100644
--- a/sw/qa/core/layout/paintfrm.cxx
+++ b/sw/qa/core/layout/paintfrm.cxx
@@ -31,8 +31,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitTableBorder)
 {
     // Given a document with a split table, table borders are defined, but 
cell borders are not:
     createSwDoc("split-table-border.odt");
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pShell = pTextDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // When rendering that document:
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -74,8 +73,7 @@ CPPUNIT_TEST_FIXTURE(Test, testRTLBorderMerge)
 {
     // Given a document with an RTL table:
     createSwDoc("rtl-table.docx");
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pShell = pTextDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // When rendering that document:
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -115,8 +113,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitTableMergedBorder)
 {
     // Given a document with a split table, first row in frame 1 has merged 
cells:
     createSwDoc("split-table-merged-border.odt");
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pShell = pTextDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // When rendering that document:
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
diff --git a/sw/qa/core/objectpositioning/objectpositioning.cxx 
b/sw/qa/core/objectpositioning/objectpositioning.cxx
index ee2b090dba7e..565a3fe4fca6 100644
--- a/sw/qa/core/objectpositioning/objectpositioning.cxx
+++ b/sw/qa/core/objectpositioning/objectpositioning.cxx
@@ -57,8 +57,7 @@ CPPUNIT_TEST_FIXTURE(Test, testOverlapCrash)
                               
uno::Any(text::TextContentAnchorType_AT_CHARACTER));
 
     // Insert a new paragraph at the start.
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pDocShell = pTextDoc->GetDocShell();
+    SwDocShell* pDocShell = getSwDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
     // Without the accompanying fix in place, this test would have crashed.
     pWrtShell->SplitNode();
diff --git a/sw/qa/core/text/itrform2.cxx b/sw/qa/core/text/itrform2.cxx
index 79d017058095..dea8ddcc9489 100644
--- a/sw/qa/core/text/itrform2.cxx
+++ b/sw/qa/core/text/itrform2.cxx
@@ -207,8 +207,7 @@ CPPUNIT_TEST_FIXTURE(Test, 
testCheckedCheckboxContentControlPDF)
     SwExportFormFieldsGuard g;
     // Given a file with a checked checkbox content control:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->InsertContentControl(SwContentControlType::CHECKBOX);
     // Toggle it, so we get a checked one:
     SwTextContentControl* pTextContentControl = 
pWrtShell->CursorInsideContentControl();
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index 9aa6d279e84d..40bdcca07b5f 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -62,8 +62,7 @@ public:
 CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testFootnoteConnect)
 {
     createSwDoc("footnote-connect.fodt");
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     // Jump to the start of the next page.
     pWrtShell->SttNxtPg();
     // Remove the page break.
@@ -93,9 +92,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testSemiTransparentText)
     xTextRange->setString(u"x"_ustr);
 
     // Render the document to a metafile.
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    CPPUNIT_ASSERT(pTextDoc);
-    SwDocShell* pDocShell = pTextDoc->GetDocShell();
+    SwDocShell* pDocShell = getSwDocShell();
     CPPUNIT_ASSERT(pDocShell);
     std::shared_ptr<GDIMetaFile> xMetaFile = pDocShell->GetPreviewMetaFile();
     CPPUNIT_ASSERT(xMetaFile);
@@ -139,7 +136,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf156146)
                          getProperty<sal_Int32>(getParagraph(1), 
u"ParaRightMargin"_ustr));
 
     SwTextFrame* const pFrame(dynamic_cast<SwTextFrame*>(
-        
static_cast<SwPageFrame*>(getSwDoc()->GetDocShell()->GetWrtShell()->GetLayout()->GetLower())
+        
static_cast<SwPageFrame*>(getSwDocShell()->GetWrtShell()->GetLayout()->GetLower())
             ->FindFirstBodyContent()));
     CPPUNIT_ASSERT(pFrame);
     // this appears to be the only way to get the actual computed margins
@@ -171,7 +168,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf159903)
                          getProperty<sal_Int32>(getParagraph(1), 
u"ParaRightMargin"_ustr));
 
     SwTextFrame* const pFrame(dynamic_cast<SwTextFrame*>(
-        
static_cast<SwPageFrame*>(getSwDoc()->GetDocShell()->GetWrtShell()->GetLayout()->GetLower())
+        
static_cast<SwPageFrame*>(getSwDocShell()->GetWrtShell()->GetLayout()->GetLower())
             ->FindFirstBodyContent()));
     CPPUNIT_ASSERT(pFrame);
     // this appears to be the only way to get the actual computed margins
@@ -572,8 +569,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testLineWidth)
 {
     // Given a document with an as-char image, width in twips not fitting into 
sal_uInt16:
     createSwDoc("line-width.fodt");
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     sal_Int32 nOldLeft = pWrtShell->GetCharRect().Left();
 
     // When moving the cursor to the right:
@@ -881,7 +877,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testAsCharImageDocModelFromViewPoint)
 {
     // Given a document with an as-char image:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
     uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, 
uno::UNO_QUERY);
     uno::Reference<beans::XPropertySet> xTextGraphic(
         xFactory->createInstance(u"com.sun.star.text.TextGraphicObject"_ustr), 
uno::UNO_QUERY);
@@ -893,7 +888,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testAsCharImageDocModelFromViewPoint)
     uno::Reference<text::XTextCursor> xCursor(xBodyText->createTextCursor());
     uno::Reference<text::XTextContent> xTextContent(xTextGraphic, 
uno::UNO_QUERY);
     xBodyText->insertTextContent(xCursor, xTextContent, false);
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SwRootFrame* pRootFrame = pWrtShell->GetLayout();
     SwFrame* pPageFrame = pRootFrame->GetLower();
     SwFrame* pBodyFrame = pPageFrame->GetLower();
@@ -926,7 +921,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testRedlineDelete)
     // Given a document with A4 paper size, some text, redlining on, but 
hidden:
     createSwDoc();
     SwDoc* pDoc = getSwDoc();
-    SwDocShell* pDocShell = pDoc->GetDocShell();
+    SwDocShell* pDocShell = getSwDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
     {
         // Set page size to A4.
@@ -966,11 +961,10 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testRedlineDelete)
 CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testTdf120715_CursorMoveWhenTypingSpaceAtCenteredLineEnd)
 {
     createSwDoc("tdf43100_tdf120715_cursorOnSpacesOverMargin.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
 
     // Make a paint to force the call of AddExtraBlankWidth, that calculate 
width for holePortions.
-    pDoc->GetDocShell()->GetPreviewBitmap();
+    getSwDocShell()->GetPreviewBitmap();
 
     // Move the cursor to the last character of the document.
     pWrtShell->EndOfSection();
@@ -989,11 +983,10 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testTdf43100_CursorMoveToSpacesOverMargin)
     // - alignment (left, center, right, justified),
     // - line count (1 line, 2 lines, blank line containing only spaces)
     createSwDoc("tdf43100_tdf120715_cursorOnSpacesOverMargin.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
 
     // Make a paint to force the call of AddExtraBlankWidth, that calculate 
width for holePortions.
-    pDoc->GetDocShell()->GetPreviewBitmap();
+    getSwDocShell()->GetPreviewBitmap();
 
     // Move the cursor to the 2. line.
     pWrtShell->Down(/*bSelect=*/false, 1, /*bBasicCall=*/false);
@@ -1042,8 +1035,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testContentControlPDF)
     SwExportFormFieldsGuard g;
     // Given a file with a content control:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->InsertContentControl(SwContentControlType::RICH_TEXT);
     pWrtShell->SttEndDoc(/*bStt=*/true);
     pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
@@ -1090,8 +1082,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testContentControlPlaceholderPDF)
     SwExportFormFieldsGuard g;
     // Given a file with a content control, in placeholder mode:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->InsertContentControl(SwContentControlType::RICH_TEXT);
 
     // When exporting to PDF:
@@ -1119,8 +1110,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testCheckboxContentControlPDF)
     SwExportFormFieldsGuard g;
     // Given a file with a checkbox content control:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->InsertContentControl(SwContentControlType::CHECKBOX);
 
     // When exporting to PDF:
@@ -1150,8 +1140,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testDropdownContentControlPDF)
     SwExportFormFieldsGuard g;
     // Given a file with a dropdown content control:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->InsertContentControl(SwContentControlType::DROP_DOWN_LIST);
 
     // When exporting to PDF:
@@ -1206,8 +1195,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testDateContentControlPDF)
     SwExportFormFieldsGuard g;
     // Given a file with a date content control:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->InsertContentControl(SwContentControlType::DATE);
 
     // When exporting to PDF:
@@ -1240,8 +1228,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testContentControlPDFFont)
     SwExportFormFieldsGuard g;
     // Given a document with a custom 24pt font size and a content control:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SfxItemSetFixed<RES_CHRATR_FONTSIZE, RES_CHRATR_FONTSIZE> 
aSet(pWrtShell->GetAttrPool());
     SvxFontHeightItem aItem(480, 100, RES_CHRATR_FONTSIZE);
     aSet.Put(aItem);
@@ -1273,8 +1260,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testComboContentControlPDF)
     SwExportFormFieldsGuard g;
     // Given a file with a combo box content control:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->InsertContentControl(SwContentControlType::COMBO_BOX);
 
     // When exporting to PDF:
@@ -1305,8 +1291,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testRichContentControlPDF)
     SwExportFormFieldsGuard g;
     // Given a file with a rich content control, its value set to 
"xxx<b>yyy</b>":
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->InsertContentControl(SwContentControlType::RICH_TEXT);
     pWrtShell->SttEndDoc(/*bStt=*/true);
     pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
@@ -1411,8 +1396,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testTdf41652NBSPWidth)
     // Measure the X position of sections after NBSPs in a legacy file (no 
option value set)
     {
         createSwDoc("tdf41652_legacy.fodt");
-        SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-        SwDocShell* pShell = pTextDoc->GetDocShell();
+        SwDocShell* pShell = getSwDocShell();
         std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
         MetafileXmlDump aDumper;
         xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
@@ -1424,8 +1408,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testTdf41652NBSPWidth)
     // Measure the X of sections after NBSPs in a file with the option enabled
     {
         createSwDoc("tdf41652_variableNBSPdisabled.fodt");
-        SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-        SwDocShell* pShell = pTextDoc->GetDocShell();
+        SwDocShell* pShell = getSwDocShell();
         std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
         MetafileXmlDump aDumper;
         xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
@@ -1439,8 +1422,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testTdf41652NBSPWidth)
     // Measure the X of the sections after NBSPs in a file with the option 
enabled
     {
         createSwDoc("tdf41652_variableNBSPenabled.fodt");
-        SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-        SwDocShell* pShell = pTextDoc->GetDocShell();
+        SwDocShell* pShell = getSwDocShell();
         std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
         MetafileXmlDump aDumper;
         xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
@@ -1624,8 +1606,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf129810)
     createSwDoc("tdf129810.odt");
 
     // Render the document to a metafile.
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pShell = pTextDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
     CPPUNIT_ASSERT(xMetaFile);
 
diff --git a/sw/qa/core/theme/ThemeTest.cxx b/sw/qa/core/theme/ThemeTest.cxx
index a71ca9caad5d..e8c0daff71bc 100644
--- a/sw/qa/core/theme/ThemeTest.cxx
+++ b/sw/qa/core/theme/ThemeTest.cxx
@@ -416,7 +416,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testThemeChanging)
     createSwDoc("ThemeColorInHeading.docx");
     SwDoc* pDoc = getSwDoc();
     CPPUNIT_ASSERT(pDoc);
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     CPPUNIT_ASSERT(pWrtShell);
     SdrModel* pModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel();
     CPPUNIT_ASSERT(pModel);
@@ -440,7 +440,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testThemeChanging)
         // check that the theme colors are as expected
         CPPUNIT_ASSERT_EQUAL(u"LibreOffice"_ustr, pNewColorSet->getName());
 
-        sw::ThemeColorChanger aChanger(pDoc->GetDocShell());
+        sw::ThemeColorChanger aChanger(getSwDocShell());
         aChanger.apply(pNewColorSet);
     }
 
@@ -570,7 +570,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, 
testTdf162715_customTransferable)
     CPPUNIT_ASSERT_EQUAL(Color(0x008000), 
pTheme->GetColor(model::ThemeColorType::Dark2));
 
     // Select all and check the original text in the document:
-    auto pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    auto pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->SelAll();
     CPPUNIT_ASSERT_EQUAL(u"Theme foo"_ustr, pWrtShell->GetSelText());
 
@@ -617,7 +617,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, 
testTdf162715_ownTransferable)
         CPPUNIT_ASSERT_EQUAL(Color(0x800000), 
pTheme->GetColor(model::ThemeColorType::Dark2));
 
         // Select all and check the original text in the document:
-        auto pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+        auto pWrtShell = getSwDocShell()->GetWrtShell();
         pWrtShell->SelAll();
         CPPUNIT_ASSERT_EQUAL(u"Theme bar"_ustr, pWrtShell->GetSelText());
 
@@ -644,7 +644,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, 
testTdf162715_ownTransferable)
         CPPUNIT_ASSERT_EQUAL(Color(0x008000), 
pTheme->GetColor(model::ThemeColorType::Dark2));
 
         // Select all and check the original text in the second document:
-        auto pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+        auto pWrtShell = getSwDocShell()->GetWrtShell();
         pWrtShell->SelAll();
         CPPUNIT_ASSERT_EQUAL(u"Theme foo"_ustr, pWrtShell->GetSelText());
 
diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx
index 5d430400faf6..beea0c986c1e 100644
--- a/sw/qa/core/txtnode/txtnode.cxx
+++ b/sw/qa/core/txtnode/txtnode.cxx
@@ -59,8 +59,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testBtlrCellChinese)
     // tbrl ("Chinese") directions. Make sure that Chinese text is handled the 
same way in the btlr
     // case as it's handled in the Latin case.
     createSwDoc("btlr-cell-chinese.doc");
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pShell = pTextDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
     MetafileXmlDump dumper;
     xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
@@ -79,8 +78,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, 
testSpecialInsertAfterMergedCells)
     createSwDoc("special-insert-after-merged-cells.fodt");
     SwDoc* pDoc = getSwDoc();
     SwNodeOffset const nNodes(pDoc->GetNodes().Count());
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pShell = pTextDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
     SwWrtShell* pWrtShell = pShell->GetWrtShell();
     // go to the merged cell
     pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
@@ -101,8 +99,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, 
testSpecialInsertAfterMergedCells)
 CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTextBoxCopyAnchor)
 {
     createSwDoc("textbox-copy-anchor.docx");
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pShell = pTextDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
     SwWrtShell* pWrtShell = pShell->GetWrtShell();
     SwDoc aClipboard;
     pWrtShell->SelAll();
@@ -129,8 +126,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, 
testTextBoxCopyAnchor)
 CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTextBoxNodeSplit)
 {
     createSwDoc("textbox-node-split.docx");
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pShell = pTextDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
     SwWrtShell* pWrtShell = pShell->GetWrtShell();
     pWrtShell->SttEndDoc(/*bStart=*/false);
     // Without the accompanying fix in place, this would have crashed in
@@ -175,7 +171,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, 
testTitleFieldInvalidate)
     createSwDoc("title-field-invalidate.fodt");
     SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
     pTextDoc->initializeForTiledRendering({});
-    SwDocShell* pShell = pTextDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
     SwDoc* pDoc = pShell->GetDoc();
     SwWrtShell* pWrtShell = pShell->GetWrtShell();
     pWrtShell->SttEndDoc(/*bStt=*/false);
@@ -209,8 +205,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testFlyAnchorUndo)
 {
     // Given a document with a fly frame, anchored after the last char of the 
document:
     createSwDoc("fly-anchor-undo.odt");
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pShell = pTextDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
     SwDoc* pDoc = pShell->GetDoc();
     const auto& rSpz = *pDoc->GetSpzFrameFormats();
     sal_Int32 nExpected = rSpz[0]->GetAnchor().GetAnchorContentOffset();
@@ -234,8 +229,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, 
testSplitNodeSuperscriptCopy)
 {
     // Given a document with superscript text at the end of a paragraph:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->Insert(u"1st"_ustr);
     pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 2, 
/*bBasicCall=*/false);
     SfxItemSetFixed<RES_CHRATR_ESCAPEMENT, RES_CHRATR_ESCAPEMENT> 
aSet(pWrtShell->GetAttrPool());
@@ -271,7 +265,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, 
testSplitNodeSuperscriptCopy)
  *    dispatchCommand(mxComponent, ".uno:InsertField", aArgs);
  *
  *    SwDoc* pDoc = getSwDoc();
- *    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ *    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
  *    SwPosition& rCursor = *pWrtShell->GetCursor()->GetPoint();
  *    SwTextNode* pTextNode = rCursor.GetNode().GetTextNode();
  *    std::vector<SwTextAttr*> aAttrs
@@ -301,8 +295,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, 
testInsertDropDownContentControlTwice)
 {
     // Given an already selected dropdown content control:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->InsertContentControl(SwContentControlType::DROP_DOWN_LIST);
 
     // When trying to insert an inner one, make sure that we don't crash:
@@ -313,8 +306,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, 
testCheckboxContentControlKeyboard)
 {
     // Given an already selected checkbox content control:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->InsertContentControl(SwContentControlType::CHECKBOX);
     SwEditWin& rEditWin = pWrtShell->GetView().GetEditWin();
 
@@ -338,8 +330,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, 
testDropdownContentControlKeyboard)
 {
     // Given an already selected dropdown content control:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->InsertContentControl(SwContentControlType::DROP_DOWN_LIST);
 
     // When checking if alt-down should open a popup:
@@ -360,8 +351,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, 
testPictureContentControlKeyboard)
 {
     // Given an already selected picture content control:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->InsertContentControl(SwContentControlType::PICTURE);
     pWrtShell->GotoObj(/*bNext=*/true, GotoObjFlags::Any);
 
@@ -389,8 +379,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, 
testDateContentControlKeyboard)
 {
     // Given an already selected date content control:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->InsertContentControl(SwContentControlType::DATE);
 
     // When checking if alt-down should open a popup:
@@ -412,7 +401,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, 
testContentControlCopy)
     // Given a document with a content control:
     createSwDoc();
     SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->InsertContentControl(SwContentControlType::CHECKBOX);
 
     // When copying that content control:
diff --git a/sw/qa/core/undo/undo.cxx b/sw/qa/core/undo/undo.cxx
index 5c5d43212dac..0857f3c232de 100644
--- a/sw/qa/core/undo/undo.cxx
+++ b/sw/qa/core/undo/undo.cxx
@@ -32,8 +32,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTextboxCutSave)
 {
     // Load the document and select all.
     createSwDoc("textbox-cut-save.docx");
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pDocShell = pTextDoc->GetDocShell();
+    SwDocShell* pDocShell = getSwDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
     pWrtShell->SelAll();
 
@@ -58,8 +57,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTextboxCutSave)
 CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTextboxCutUndo)
 {
     createSwDoc("textbox-cut-undo.docx");
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pDocShell = pTextDoc->GetDocShell();
+    SwDocShell* pDocShell = getSwDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
     SwDoc* pDoc = pDocShell->GetDoc();
 
@@ -85,8 +83,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTableCopyRedline)
 {
     // Given a document with two table cells and redlining enabled:
     createSwDoc("table-copy-redline.odt");
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pDocShell = pTextDoc->GetDocShell();
+    SwDocShell* pDocShell = getSwDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
 
     // When doing select-all, copy, paste and undo:
@@ -104,7 +101,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, 
testImagePropsCreateUndoAndModifyDoc)
 {
     createSwDoc("image-as-character.odt");
     SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDocShell* pDocShell = pTextDoc->GetDocShell();
+    SwDocShell* pDocShell = getSwDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
     css::uno::Reference<css::beans::XPropertySet> xImage(
         pTextDoc->getGraphicObjects()->getByName(u"Image1"_ustr), 
css::uno::UNO_QUERY_THROW);
diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx
index 69e136b520dd..9e27428717b0 100644
--- a/sw/qa/core/unocore/unocore.cxx
+++ b/sw/qa/core/unocore/unocore.cxx
@@ -50,9 +50,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testTdf119081)
 {
     // Load a doc with a nested table in it.
     createSwDoc("tdf119081.odt");
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    CPPUNIT_ASSERT(pTextDoc);
-    SwDocShell* pDocShell = pTextDoc->GetDocShell();
+    SwDocShell* pDocShell = getSwDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
 
     // Enter outer A1.
@@ -271,7 +269,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testLineBreakInsert)
     xText->insertTextContent(xCursor, xLineBreak, /*bAbsorb=*/false);
 
     // Then make sure that both the line break and its matching text attribute 
is inserted:
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SwNodeOffset nIndex = pWrtShell->GetCursor()->GetPointNode().GetIndex();
     SwTextNode* pTextNode = pDoc->GetNodes()[nIndex]->GetTextNode();
     // Without the accompanying fix in place, this test would have failed with:
@@ -367,7 +365,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, 
testContentControlInsert)
     xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
 
     // Then make sure that the text attribute is inserted:
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SwNodeOffset nIndex = pWrtShell->GetCursor()->GetPointNode().GetIndex();
     SwTextNode* pTextNode = pDoc->GetNodes()[nIndex]->GetTextNode();
     SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, 
RES_TXTATR_CONTENTCONTROL);
@@ -420,7 +418,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, 
testContentControlTextPortionEnum)
 {
     // Given a document with a content control around one or more text 
portions:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
     uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, 
uno::UNO_QUERY);
     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, 
uno::UNO_QUERY);
     uno::Reference<text::XText> xText = xTextDocument->getText();
@@ -465,7 +462,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, 
testContentControlTextPortionEnum)
 
     // Also test the doc model, make sure that there is a dummy character at 
the start and end, so
     // the user can explicitly decide if they want to expand the content 
control or not:
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     OUString aText = 
pWrtShell->GetCursor()->GetPointNode().GetTextNode()->GetText();
     // Without the accompanying fix in place, this test would have failed with:
     // - Expected: ^Atest^A
@@ -478,7 +475,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, 
testContentControlCheckbox)
 {
     // Given an empty document:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
 
     // When inserting a checkbox content control:
     uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, 
uno::UNO_QUERY);
@@ -500,7 +496,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, 
testContentControlCheckbox)
     xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
 
     // Then make sure that the specified properties are set:
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SwTextNode* pTextNode = 
pWrtShell->GetCursor()->GetPointNode().GetTextNode();
     SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, 
RES_TXTATR_CONTENTCONTROL);
     auto pTextContentControl = 
static_txtattr_cast<SwTextContentControl*>(pAttr);
@@ -517,7 +513,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, 
testContentControlDropdown)
 {
     // Given an empty document:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
 
     // When inserting a dropdown content control:
     uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, 
uno::UNO_QUERY);
@@ -552,7 +547,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, 
testContentControlDropdown)
     xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
 
     // Then make sure that the specified properties are set:
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SwTextNode* pTextNode = 
pWrtShell->GetCursor()->GetPointNode().GetTextNode();
     SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, 
RES_TXTATR_CONTENTCONTROL);
     auto pTextContentControl = 
static_txtattr_cast<SwTextContentControl*>(pAttr);
@@ -595,7 +590,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, 
testContentControlPicture)
 {
     // Given an empty document:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
 
     // When inserting a picture content control:
     uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, 
uno::UNO_QUERY);
@@ -619,7 +613,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, 
testContentControlPicture)
     xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
 
     // Then make sure that the specified properties are set:
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SwTextNode* pTextNode = 
pWrtShell->GetCursor()->GetPointNode().GetTextNode();
     SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, 
RES_TXTATR_CONTENTCONTROL);
     auto pTextContentControl = 
static_txtattr_cast<SwTextContentControl*>(pAttr);
@@ -633,7 +627,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, 
testContentControlDate)
 {
     // Given an empty document:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
 
     // When inserting a date content control:
     uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, 
uno::UNO_QUERY);
@@ -672,7 +665,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, 
testContentControlDate)
     xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
 
     // Then make sure that the specified properties are set:
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SwTextNode* pTextNode = 
pWrtShell->GetCursor()->GetPointNode().GetTextNode();
     SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, 
RES_TXTATR_CONTENTCONTROL);
     auto pTextContentControl = 
static_txtattr_cast<SwTextContentControl*>(pAttr);
@@ -720,7 +713,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, 
testContentControlPlainText)
     xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
 
     // Then make sure that the text attribute is inserted:
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SwNodeOffset nIndex = pWrtShell->GetCursor()->GetPointNode().GetIndex();
     SwTextNode* pTextNode = pDoc->GetNodes()[nIndex]->GetTextNode();
     SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, 
RES_TXTATR_CONTENTCONTROL);
@@ -756,7 +749,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, 
testContentControlComboBox)
 {
     // Given an empty document:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
 
     // When inserting a combobox content control:
     uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, 
uno::UNO_QUERY);
@@ -792,7 +784,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, 
testContentControlComboBox)
     xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
 
     // Then make sure that the specified properties are set:
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SwTextNode* pTextNode = 
pWrtShell->GetCursor()->GetPointNode().GetTextNode();
     SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, 
RES_TXTATR_CONTENTCONTROL);
     auto pTextContentControl = 
static_txtattr_cast<SwTextContentControl*>(pAttr);
diff --git a/sw/qa/core/view/view.cxx b/sw/qa/core/view/view.cxx
index b130827deb8d..c7eb80762a8f 100644
--- a/sw/qa/core/view/view.cxx
+++ b/sw/qa/core/view/view.cxx
@@ -42,7 +42,7 @@ CPPUNIT_TEST_FIXTURE(Test, testUpdateOleObjectPreviews)
     // Given a document with two embedded objects, both with broken native 
data:
     createSwDoc("update-ole-object-previews.odt");
     SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
 
     // When updating the previews of those embedded objects (right after 
document load, before
     // painting the OLE objects):
diff --git a/sw/qa/extras/autocorrect/autocorrect.cxx 
b/sw/qa/extras/autocorrect/autocorrect.cxx
index 59935d54edc2..6f57a53b52f6 100644
--- a/sw/qa/extras/autocorrect/autocorrect.cxx
+++ b/sw/qa/extras/autocorrect/autocorrect.cxx
@@ -341,8 +341,7 @@ CPPUNIT_TEST_FIXTURE(SwAutoCorrectTest, testFieldMark)
     // getString also strips it out, use GetText instead
 
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell();
     SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
 
     // don't autocapitalize after a field mark
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index 7aa9f9cc4705..8a820edc950f 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -1377,8 +1377,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testMultiParaListItem)
 {
     // Create a document with 3 list items: A, B&C and D.
     createSwDoc();
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->Insert(u"A"_ustr);
     SwDoc* pDoc = pWrtShell->GetDoc();
     {
@@ -1514,8 +1513,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testListHeading)
 {
     // Given a document with a list heading:
     createSwDoc();
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->Insert(u"list header"_ustr);
     SwDoc* pDoc = pWrtShell->GetDoc();
     sal_uInt16 nPos = pDoc->MakeNumRule(pDoc->GetUniqueNumRuleName());
@@ -1545,8 +1543,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testPartiallyNumberedList)
 {
     // Given a document with a list, first para is numbered, second is not:
     createSwDoc();
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->Insert(u"list header"_ustr);
     SwDoc* pDoc = pWrtShell->GetDoc();
     sal_uInt16 nPos = pDoc->MakeNumRule(pDoc->GetUniqueNumRuleName());
@@ -1584,8 +1581,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testPartiallyNumberedListHTML)
 {
     // Given a document with a list, first para is numbered, second is not:
     createSwDoc();
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->Insert(u"list header"_ustr);
     SwDoc* pDoc = pWrtShell->GetDoc();
     sal_uInt16 nPos = pDoc->MakeNumRule(pDoc->GetUniqueNumRuleName());
@@ -1624,8 +1620,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testListHeaderAndItem)
 {
     // Given a document with a list, first para is not numbered, but the 
second is:
     createSwDoc();
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->Insert(u"not numbered"_ustr);
     SwDoc* pDoc = pWrtShell->GetDoc();
     sal_uInt16 nPos = pDoc->MakeNumRule(pDoc->GetUniqueNumRuleName());
@@ -2026,8 +2021,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testListsHeading)
 {
     // Given a document with lh, lh, li, li, lh and lh nodes:
     createSwDoc();
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->Insert(u"list 1, header 1"_ustr);
     pWrtShell->SplitNode();
     pWrtShell->Insert(u"list 1, header 2"_ustr);
@@ -2126,7 +2120,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testNestedBullets)
     // Given a documented with nested lists:
     createSwDoc();
     SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->Insert(u"first"_ustr);
     sal_uInt16 nPos = pDoc->MakeNumRule(pDoc->GetUniqueNumRuleName());
     SwNumRule* pNumRule = pDoc->GetNumRuleTable()[nPos];
@@ -2162,8 +2156,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testTrailingLineBreak)
 {
     // Given a document with a trailing line-break:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->Insert(u"test
"_ustr);
 
     // When exporting to reqif-xhtml:
@@ -2183,8 +2176,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testTrailingLineBreak)
     ImportFromReqif(maTempFile.GetURL());
 
     // Then make sure that line-break is not lost:
-    pDoc = getSwDoc();
-    pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    pWrtShell = getSwDocShell()->GetWrtShell();
     OUString aActual = 
pWrtShell->GetCursor()->GetPointNode().GetTextNode()->GetText();
     // Without the accompanying fix in place, this test would have failed, as 
the trailing
     // line-break was lost.
@@ -2195,8 +2187,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testLeadingTab)
 {
     // Given a document with leading tabs:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->Insert(u"        first"_ustr);
     pWrtShell->SplitNode();
     pWrtShell->Insert(u"                second"_ustr);
@@ -2228,8 +2219,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testLeadingTabHTML)
 {
     // Given a document with leading tabs:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->Insert(u"        test"_ustr);
 
     // When exporting to plain HTML, using LeadingTabWidth=2:
@@ -2296,8 +2286,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testTableBackground)
     // Given a document with two tables: first stable has a background, second 
table has a
     // background in its first row:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SwInsertTableOptions aInsertTableOptions(SwInsertTableFlags::DefaultBorder,
                                              /*nRowsToRepeat=*/0);
     pWrtShell->InsertTable(aInsertTableOptions, /*nRows=*/1, /*nCols=*/1);
@@ -2366,8 +2355,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testSectionDir)
 {
     // Given a document with a section:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->Insert(u"test"_ustr);
     pWrtShell->SelAll();
     SwSectionData aSectionData(SectionType::Content, u"mysect"_ustr);
@@ -2389,8 +2377,7 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testTdf114769)
     // Create document from scratch since relative urls to filesystem can be 
replaced
     // by absolute during save/load
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->Insert(u"Hyperlink1"_ustr);
     pWrtShell->SplitNode();
     pWrtShell->Insert(u"Hyperlink2"_ustr);
@@ -2761,8 +2748,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testHTML_PreserveSpaces)
 {
     // Given a document with leading, trailing, and repeating intermediate 
spaces:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     constexpr OUString paraText = u"    test    more  text     "_ustr;
     pWrtShell->Insert(paraText);
 
@@ -2791,8 +2777,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testReqIF_PreserveSpaces)
 {
     // Given a document with leading, trailing, and repeating intermediate 
spaces:
     createSwDoc();
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     constexpr OUString paraText = u"    test    more  text     "_ustr;
     pWrtShell->Insert(paraText);
 
diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx 
b/sw/qa/extras/htmlimport/htmlimport.cxx
index 312b978d99ad..ee6b24e264a1 100644
--- a/sw/qa/extras/htmlimport/htmlimport.cxx
+++ b/sw/qa/extras/htmlimport/htmlimport.cxx
@@ -182,9 +182,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testListStyleType)
 CPPUNIT_TEST_FIXTURE(HtmlImportTest, testMetaIsoDates)
 {
     createSwWebDoc("meta-ISO8601-dates.html");
-    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument 
*>(mxComponent.get());
-    CPPUNIT_ASSERT(pTextDoc);
-    SwDocShell* pDocShell(pTextDoc->GetDocShell());
+    SwDocShell* pDocShell(getSwDocShell());
     uno::Reference<document::XDocumentProperties> xDocProps;
 
     CPPUNIT_ASSERT(pDocShell);
@@ -224,9 +222,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testImageLazyRead)
 CPPUNIT_TEST_FIXTURE(HtmlImportTest, testChangedby)
 {
     createSwWebDoc("meta-changedby.html");
-    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument 
*>(mxComponent.get());
-    CPPUNIT_ASSERT(pTextDoc);
-    SwDocShell* pDocShell(pTextDoc->GetDocShell());
+    SwDocShell* pDocShell(getSwDocShell());
     uno::Reference<document::XDocumentProperties> xDocProps;
 
     CPPUNIT_ASSERT(pDocShell);
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index f9a932ff76e8..61da490a87d3 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -280,10 +280,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf136588)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody)
 {
     createSwDoc();
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    CPPUNIT_ASSERT(pTextDoc);
     SwDoc* pDoc(getSwDoc());
-    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SwRootFrame* pLayout(pWrtShell->GetLayout());
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
     pWrtShell->Insert(u"foo"_ustr);
@@ -722,7 +720,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testFieldHideSection)
     assertXPath(pXmlDoc, "/root/page[2]/body/section/tab/row", 1);
     assertXPath(pXmlDoc, "/root/page", 2);
 
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     ::std::unique_ptr<SwField> pField(pWrtShell->GetCurField()->CopyField());
     SwFieldMgr manager(pWrtShell);
 
@@ -765,7 +763,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestI94666)
             "portion", u"pulled off ");
     }
 
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->GotoPage(2, false);
     pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 11, 
/*bBasicCall=*/false);
     pWrtShell->SetMark();
@@ -864,10 +862,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf88496)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInHeader)
 {
     createSwDoc();
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    CPPUNIT_ASSERT(pTextDoc);
     SwDoc* pDoc(getSwDoc());
-    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SwRootFrame* pLayout(pWrtShell->GetLayout());
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
     pWrtShell->ChangeHeaderOrFooter(u"Default Page Style", /*bHeader*/ true, 
/*bOn*/ true, false);
@@ -1281,9 +1277,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf150606)
 {
     createSwDoc("tdf150606-1-min.odt");
 
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    CPPUNIT_ASSERT(pTextDoc);
-    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
 
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
 
@@ -1432,10 +1426,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf137025)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote)
 {
     createSwDoc();
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    CPPUNIT_ASSERT(pTextDoc);
     SwDoc* pDoc(getSwDoc());
-    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SwRootFrame* pLayout(pWrtShell->GetLayout());
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
     pWrtShell->InsertFootnote(u""_ustr);
@@ -2021,8 +2013,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInFootnote)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf143239)
 {
     createSwDoc("tdf143239-1-min.odt");
-    SwDoc* pDoc = getSwDoc();
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
 
     // These are unstable on macOS and Win64 builds,
     // so only test that they restore original values for now
@@ -2107,9 +2098,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testTableOverlapFooterFly)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134277)
 {
     createSwDoc("tdf134277.docx");
-    SwDoc* pDoc = getSwDoc();
-    CPPUNIT_ASSERT(pDoc);
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
     MetafileXmlDump dumper;
@@ -2123,8 +2112,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134277)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116486)
 {
     createSwDoc("tdf116486.docx");
-    SwDoc* pDoc = getSwDoc();
-    CPPUNIT_ASSERT(pDoc);
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     OUString aTop = getXPath(
         pXmlDoc,
@@ -2166,8 +2153,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf152106)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128198)
 {
     createSwDoc("tdf128198-1.docx");
-    SwDoc* pDoc = getSwDoc();
-    CPPUNIT_ASSERT(pDoc);
     xmlDocUniquePtr pLayout = parseLayoutDump();
     // the problem was that line 5 was truncated at "this  "
     // due to the fly anchored in previous paragraph
@@ -2234,10 +2219,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf106153)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys)
 {
     createSwDoc();
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    CPPUNIT_ASSERT(pTextDoc);
     SwDoc* pDoc(getSwDoc());
-    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SwRootFrame* pLayout(pWrtShell->GetLayout());
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
     pWrtShell->Insert(u"foo"_ustr);
@@ -2831,10 +2814,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInFlys)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysAtFlys)
 {
     createSwDoc();
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    CPPUNIT_ASSERT(pTextDoc);
     SwDoc* pDoc(getSwDoc());
-    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SwRootFrame* pLayout(pWrtShell->GetLayout());
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
     pWrtShell->Insert(u"foo"_ustr);
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index 187305d9de6c..8c9c20e02687 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -513,8 +513,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf150790)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129357)
 {
     createSwDoc("tdf129357.fodt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -530,8 +529,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129357)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumberInNumbering)
 {
     createSwDoc("tdf42748.fodt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -555,8 +553,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testRedlineNumberInNumbering)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumbering)
 {
     createSwDoc("tdf115523.fodt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -577,8 +574,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumbering)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumbering2)
 {
     createSwDoc("tdf115524.fodt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -599,12 +595,9 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testRedlineNumbering2)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf149710_RedlineNumberingEditing)
 {
     createSwDoc("tdf149710.fodt");
-    SwDoc* pDoc = getSwDoc();
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    CPPUNIT_ASSERT(pTextDoc);
 
     // Show Changes
-    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SwRootFrame* pLayout(pWrtShell->GetLayout());
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
 
@@ -614,7 +607,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testTdf149710_RedlineNumberingEditing)
     dispatchCommand(mxComponent, u".uno:Delete"_ustr, {});
 
     // Dump the rendering of the first page as an XML file.
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
     MetafileXmlDump dumper;
 
@@ -642,12 +635,9 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testTdf149710_RedlineNumberingEditing)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf149709_RedlineNumberingLevel)
 {
     createSwDoc("tdf149709.fodt");
-    SwDoc* pDoc = getSwDoc();
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    CPPUNIT_ASSERT(pTextDoc);
 
     // Show Changes
-    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SwRootFrame* pLayout(pWrtShell->GetLayout());
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
 
@@ -657,7 +647,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testTdf149709_RedlineNumberingLevel)
     pWrtShell->SplitNode(false);
 
     // Dump the rendering of the first page as an XML file.
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
     MetafileXmlDump dumper;
 
@@ -844,8 +834,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testTdf158885_not_compound_remain)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumberInFootnote)
 {
     createSwDoc("tdf85610.fodt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -864,7 +853,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineMoving)
 {
     createSwDoc("tdf42748.fodt");
     SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // create a 3-element list without change tracking
     SwEditShell* const pEditShell(pDoc->GetEditShell());
@@ -893,7 +882,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineMoving2)
 {
     createSwDoc("tdf42748.fodt");
     SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // create a 3-element list without change tracking
     SwEditShell* const pEditShell(pDoc->GetEditShell());
@@ -905,7 +894,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineMoving2)
     // at least 6 characters with an inner space after stripping white spaces
     // of the redline
     dispatchCommand(mxComponent, u".uno:GoToStartOfDoc"_ustr, {});
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     pWrtShell->Insert(u"An Item"_ustr);
 
     // move down first list item with track changes
@@ -928,7 +917,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineMovingDOCX)
 {
     createSwDoc("tdf104797.docx");
     SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     SwEditShell* const pEditShell(pDoc->GetEditShell());
     CPPUNIT_ASSERT(pEditShell);
@@ -994,8 +983,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testTableCellInvalidate)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf145719)
 {
     createSwDoc("tdf145719.odt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1011,8 +999,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf145719)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testChangedTableRows)
 {
     createSwDoc("changed_table_rows.fodt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1031,8 +1018,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testChangedTableRows)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf155187_TableInTextChange)
 {
     createSwDoc("table_in_text_change.fodt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1050,8 +1036,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testTdf145225_RedlineMovingWithBadInsertio
 {
     createSwDoc("tdf42748.fodt");
     SwDoc* pDoc = getSwDoc();
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    CPPUNIT_ASSERT(pTextDoc);
 
     // create a 3-element list without change tracking
     // (because the fixed problem depends on the own changes)
@@ -1062,7 +1046,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testTdf145225_RedlineMovingWithBadInsertio
     CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(0), 
pEditShell->GetRedlineCount());
 
     // Show Changes
-    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SwRootFrame* pLayout(pWrtShell->GetLayout());
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
 
@@ -1087,8 +1071,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testTdf146964_ReappearingMovedTextInHideCh
 {
     createSwDoc("tdf54819.fodt");
     SwDoc* pDoc = getSwDoc();
-    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    CPPUNIT_ASSERT(pTextDoc);
 
     // enable Record Changes
     dispatchCommand(mxComponent, u".uno:TrackChanges"_ustr, {});
@@ -1097,7 +1079,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testTdf146964_ReappearingMovedTextInHideCh
 
     // set Hide Changes mode
     dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
-    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     SwRootFrame* pLayout(pWrtShell->GetLayout());
     CPPUNIT_ASSERT(pLayout->IsHideRedlines());
 
@@ -1120,8 +1102,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testTdf146964_ReappearingMovedTextInHideCh
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf125300)
 {
     createSwDoc("tdf125300.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1144,8 +1125,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf125300)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf116830)
 {
     createSwDoc("tdf116830.odt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1172,8 +1152,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf116830)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf114163)
 {
     createSwDoc("tdf114163.odt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1198,8 +1177,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf131707)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf122225)
 {
     createSwDoc("tdf122225.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1224,8 +1202,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf122225)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf125335)
 {
     createSwDoc("tdf125335.odt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1240,8 +1217,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf125335)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134247)
 {
     createSwDoc("legend-itemorder-min.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1256,8 +1232,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134247)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf75659)
 {
     createSwDoc("tdf75659.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1274,8 +1249,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf75659)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf136816)
 {
     createSwDoc("tdf136816.odt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1290,8 +1264,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf136816)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf126425)
 {
     createSwDoc("long_legendentry.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1324,8 +1297,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testUnusedOLEprops)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf123268)
 {
     createSwDoc("tdf123268.odt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1343,8 +1315,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf123268)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf133005)
 {
     createSwDoc("tdf133005.odt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1370,8 +1341,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf133005)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf115630)
 {
     createSwDoc("tdf115630.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1396,8 +1366,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf115630)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf108021)
 {
     createSwDoc("tdf108021.odt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1412,8 +1381,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf108021)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf125334)
 {
     createSwDoc("tdf125334.odt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1429,8 +1397,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf125334)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf122800)
 {
     createSwDoc("tdf122800.odt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1445,8 +1412,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf122800)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTruncatedAxisLabel)
 {
     createSwDoc("testTruncatedAxisLabel.odt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1464,8 +1430,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testTruncatedAxisLabel)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf128996)
 {
     createSwDoc("tdf128996.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1479,8 +1444,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf128996)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf126244)
 {
     createSwDoc("tdf126244.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1502,8 +1466,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf126244)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf127304)
 {
     createSwDoc("tdf127304.odt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1523,8 +1486,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf127304)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testHorizontal_multilevel)
 {
     createSwDoc("horizontal_multilevel.odt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1616,8 +1578,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf116256)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf138194)
 {
     createSwDoc("xaxis-labelbreak.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1655,8 +1616,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf146272)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf138773)
 {
     createSwDoc("tdf138773.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1674,8 +1634,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf138773)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf124796)
 {
     createSwDoc("tdf124796.odt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1693,8 +1652,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf124796)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf72727)
 {
     createSwDoc("tdf72727.odt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1713,8 +1671,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf72727)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf130969)
 {
     createSwDoc("tdf130969.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1729,8 +1686,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf130969)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf40260)
 {
     createSwDoc("tdf40260.odt");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
     MetafileXmlDump dumper;
@@ -1748,8 +1704,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf40260)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129054)
 {
     createSwDoc("tdf129054.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1775,8 +1730,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129054)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129173)
 {
     createSwDoc("testAreaChartNumberFormat.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1791,8 +1745,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129173)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134866)
 {
     createSwDoc("tdf134866.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1807,8 +1760,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134866)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf137116)
 {
     createSwDoc("tdf137116.docx");
-    SwDoc* pDoc = getSwDoc();
-    SwDocShell* pShell = pDoc->GetDocShell();
+    SwDocShell* pShell = getSwDocShell();
 
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
@@ -1828,8 +1780,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf137116)
-e 
... etc. - the rest is truncated

Reply via email to