[Libreoffice-commits] core.git: include/unotest sc/qa sw/qa unotest/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Fri Jan 17 15:10:21 UTC 2020


 include/unotest/macros_test.hxx              |    5 +
 sc/qa/unit/tiledrendering/tiledrendering.cxx |   18 ----
 sw/qa/extras/htmlexport/htmlexport.cxx       |   16 ---
 sw/qa/extras/layout/layout.cxx               |   99 +++++++++--------------
 sw/qa/extras/uiwriter/uiwriter.cxx           |   54 ++++--------
 sw/qa/extras/uiwriter/uiwriter2.cxx          |  113 +++++++++++----------------
 unotest/source/cpp/macros_test.cxx           |   19 ++++
 7 files changed, 136 insertions(+), 188 deletions(-)

New commits:
commit c7f3ac890526306804ec2bdf1256ba15a4247f13
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Jan 17 14:32:49 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Jan 17 16:09:49 2020 +0100

    Clean up duplicated command dispatch test functionality
    
    Used in both Writer and Calc at 5 different places, so host it in
    unotest/.
    
    Change-Id: I013e6df471deb8693cf4ae62f0958b12e16fda7b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86972
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/include/unotest/macros_test.hxx b/include/unotest/macros_test.hxx
index 4dcf9427fbf9..c60ea1fe97ce 100644
--- a/include/unotest/macros_test.hxx
+++ b/include/unotest/macros_test.hxx
@@ -38,6 +38,11 @@ public:
     css::uno::Reference< css::lang::XComponent > loadFromDesktop(const OUString& rURL, const OUString& rDocService = OUString(),
         const css::uno::Sequence<css::beans::PropertyValue>& rExtra_args = css::uno::Sequence<css::beans::PropertyValue>() );
 
+    static void
+    dispatchCommand(const css::uno::Reference<css::lang::XComponent>& xComponent,
+                    const OUString& rCommand,
+                    const css::uno::Sequence<css::beans::PropertyValue>& rPropertyValues);
+
 protected:
     css::uno::Reference< css::frame::XDesktop2> mxDesktop;
 
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index c0386f16cd38..45c87e93d2c8 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -588,20 +588,6 @@ void ScTiledRenderingTest::testViewCursors()
     CPPUNIT_ASSERT(aView1.m_bViewCursorInvalidated);
 }
 
-void lcl_dispatchCommand(const uno::Reference<lang::XComponent>& xComponent, const OUString& rCommand, const uno::Sequence<beans::PropertyValue>& rArguments)
-{
-    uno::Reference<frame::XController> xController = uno::Reference<frame::XModel>(xComponent, uno::UNO_QUERY_THROW)->getCurrentController();
-    CPPUNIT_ASSERT(xController.is());
-    uno::Reference<frame::XDispatchProvider> xFrame(xController->getFrame(), uno::UNO_QUERY);
-    CPPUNIT_ASSERT(xFrame.is());
-
-    uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
-    uno::Reference<frame::XDispatchHelper> xDispatchHelper(frame::DispatchHelper::create(xContext));
-    CPPUNIT_ASSERT(xDispatchHelper.is());
-
-    xDispatchHelper->executeDispatch(xFrame, rCommand, OUString(), 0, rArguments);
-}
-
 void ScTiledRenderingTest::testTextViewSelection()
 {
     comphelper::LibreOfficeKit::setActive();
@@ -615,7 +601,7 @@ void ScTiledRenderingTest::testTextViewSelection()
 
     // Create a selection on two cells in the second view, that's a text selection in LOK terms.
     aView1.m_bTextViewSelectionInvalidated = false;
-    lcl_dispatchCommand(mxComponent, ".uno:GoRightSel", {});
+    dispatchCommand(mxComponent, ".uno:GoRightSel", {});
     Scheduler::ProcessEventsToIdle();
     // Make sure the first view got its notification.
     CPPUNIT_ASSERT(aView1.m_bTextViewSelectionInvalidated);
@@ -634,7 +620,7 @@ void ScTiledRenderingTest::testDocumentSizeChanged()
     {
         comphelper::makePropertyValue("ToPoint", OUString("$A$30")),
     };
-    lcl_dispatchCommand(mxComponent, ".uno:GoToCell", aPropertyValues);
+    dispatchCommand(mxComponent, ".uno:GoToCell", aPropertyValues);
     Scheduler::ProcessEventsToIdle();
     // Assert that the size in the payload is not 0.
     CPPUNIT_ASSERT(m_aDocumentSize.getWidth() > 0);
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index b5f50f1106aa..b5d2f0955aaa 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -786,20 +786,6 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testChinese)
     CPPUNIT_ASSERT(pDoc);
 }
 
-static void lcl_dispatchCommand(const uno::Reference<lang::XComponent>& xComponent, const OUString& rCommand, const uno::Sequence<beans::PropertyValue>& rPropertyValues)
-{
-    uno::Reference<frame::XController> xController = uno::Reference<frame::XModel>(xComponent, uno::UNO_QUERY_THROW)->getCurrentController();
-    CPPUNIT_ASSERT(xController.is());
-    uno::Reference<frame::XDispatchProvider> xFrame(xController->getFrame(), uno::UNO_QUERY);
-    CPPUNIT_ASSERT(xFrame.is());
-
-    uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
-    uno::Reference<frame::XDispatchHelper> xDispatchHelper(frame::DispatchHelper::create(xContext));
-    CPPUNIT_ASSERT(xDispatchHelper.is());
-
-    xDispatchHelper->executeDispatch(xFrame, rCommand, OUString(), 0, rPropertyValues);
-}
-
 CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifComment)
 {
     // Create a document with a comment in it.
@@ -809,7 +795,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifComment)
         {"Text", uno::makeAny(OUString("some text"))},
         {"Author", uno::makeAny(OUString("me"))},
     });
-    lcl_dispatchCommand(mxComponent, ".uno:InsertAnnotation", aPropertyValues);
+    dispatchCommand(mxComponent, ".uno:InsertAnnotation", aPropertyValues);
 
     // Export it.
     uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 4e3beb9cc3fb..f1ed1785532e 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -63,23 +63,6 @@ SwDoc* SwLayoutWriter::createDoc(const char* pName)
     return pTextDoc->GetDocShell()->GetDoc();
 }
 
-static void lcl_dispatchCommand(const uno::Reference<lang::XComponent>& xComponent,
-                                const OUString& rCommand,
-                                const uno::Sequence<beans::PropertyValue>& rPropertyValues)
-{
-    uno::Reference<frame::XController> xController
-        = uno::Reference<frame::XModel>(xComponent, uno::UNO_QUERY_THROW)->getCurrentController();
-    CPPUNIT_ASSERT(xController.is());
-    uno::Reference<frame::XDispatchProvider> xFrame(xController->getFrame(), uno::UNO_QUERY);
-    CPPUNIT_ASSERT(xFrame.is());
-
-    uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
-    uno::Reference<frame::XDispatchHelper> xDispatchHelper(frame::DispatchHelper::create(xContext));
-    CPPUNIT_ASSERT(xDispatchHelper.is());
-
-    xDispatchHelper->executeDispatch(xFrame, rCommand, OUString(), 0, rPropertyValues);
-}
-
 // this is a member because our test classes have protected members :(
 void SwLayoutWriter::CheckRedlineFootnotesHidden()
 {
@@ -120,7 +103,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFootnotes)
     // verify after load
     CheckRedlineFootnotesHidden();
 
-    lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+    dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
     discardDumpedLayout();
     xmlDocPtr pXmlDoc = parseLayoutDump();
@@ -198,7 +181,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFootnotes)
     assertXPath(pXmlDoc, "/root/page[1]/ftncont/ftn[5]/txt[1]/Text[3]", "Portion", "o");
 
     // verify after hide
-    lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+    dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
     CPPUNIT_ASSERT(pLayout->IsHideRedlines());
     discardDumpedLayout();
     CheckRedlineFootnotesHidden();
@@ -237,7 +220,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody)
     pWrtShell->SplitNode(false);
     pWrtShell->Insert("ghi");
 
-    lcl_dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+    dispatchCommand(mxComponent, ".uno:TrackChanges", {});
     // delete redline inside fly
     pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 2, /*bBasicCall=*/false);
     pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 8, /*bBasicCall=*/false);
@@ -259,7 +242,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody)
             pDoc->SetAttr(anchor, *const_cast<SwFrameFormat*>(pFly));
         }
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
         discardDumpedLayout();
         xmlDocPtr pXmlDoc = parseLayoutDump();
@@ -273,7 +256,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody)
         assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Text[1]", "Portion",
                     "ahi");
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
         discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
@@ -335,7 +318,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody)
             pDoc->SetAttr(anchor, *const_cast<SwFrameFormat*>(pFly));
         }
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
         discardDumpedLayout();
         xmlDocPtr pXmlDoc = parseLayoutDump();
@@ -350,7 +333,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody)
             xmlXPathFreeObject(pXmlObj);
         }
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
         discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
@@ -411,7 +394,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody)
             pDoc->SetAttr(anchor, *const_cast<SwFrameFormat*>(pFly));
         }
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
         discardDumpedLayout();
         xmlDocPtr pXmlDoc = parseLayoutDump();
@@ -425,7 +408,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody)
         assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Text[1]", "Portion",
                     "ahi");
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
         discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
@@ -507,7 +490,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInHeader)
     pWrtShell->SplitNode(false);
     pWrtShell->Insert("ghi");
 
-    lcl_dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+    dispatchCommand(mxComponent, ".uno:TrackChanges", {});
     // delete redline inside fly
     pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 2, /*bBasicCall=*/false);
     pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 8, /*bBasicCall=*/false);
@@ -529,7 +512,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInHeader)
             pDoc->SetAttr(anchor, *const_cast<SwFrameFormat*>(pFly));
         }
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
         discardDumpedLayout();
         xmlDocPtr pXmlDoc = parseLayoutDump();
@@ -545,7 +528,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInHeader)
         assertXPath(pXmlDoc, "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/Text[1]",
                     "Portion", "ahi");
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
         discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
@@ -609,7 +592,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInHeader)
             pDoc->SetAttr(anchor, *const_cast<SwFrameFormat*>(pFly));
         }
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
         discardDumpedLayout();
         xmlDocPtr pXmlDoc = parseLayoutDump();
@@ -627,7 +610,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInHeader)
             xmlXPathFreeObject(pXmlObj);
         }
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
         discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
@@ -690,7 +673,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInHeader)
             pDoc->SetAttr(anchor, *const_cast<SwFrameFormat*>(pFly));
         }
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
         discardDumpedLayout();
         xmlDocPtr pXmlDoc = parseLayoutDump();
@@ -706,7 +689,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInHeader)
         assertXPath(pXmlDoc, "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/Text[1]",
                     "Portion", "ahi");
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
         discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
@@ -802,7 +785,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote)
     pWrtShell->SplitNode(false);
     pWrtShell->Insert("ghi");
 
-    lcl_dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+    dispatchCommand(mxComponent, ".uno:TrackChanges", {});
     // delete redline inside fly
     pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 2, /*bBasicCall=*/false);
     pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 8, /*bBasicCall=*/false);
@@ -832,7 +815,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote)
             pDoc->SetAttr(anchor, *const_cast<SwFrameFormat*>(pFly));
         }
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
         discardDumpedLayout();
         xmlDocPtr pXmlDoc = parseLayoutDump();
@@ -852,7 +835,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote)
                     "PortionType::FootnoteNum");
         assertXPath(pXmlDoc, "/root/page[1]/ftncont/ftn[1]/txt[1]/Special[1]", "rText", "1");
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
         discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
@@ -937,7 +920,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote)
             pDoc->SetAttr(anchor, *const_cast<SwFrameFormat*>(pFly));
         }
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
         discardDumpedLayout();
         xmlDocPtr pXmlDoc = parseLayoutDump();
@@ -959,7 +942,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote)
             xmlXPathFreeObject(pXmlObj);
         }
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
         discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
@@ -1045,7 +1028,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote)
             pDoc->SetAttr(anchor, *const_cast<SwFrameFormat*>(pFly));
         }
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
         discardDumpedLayout();
         xmlDocPtr pXmlDoc = parseLayoutDump();
@@ -1065,7 +1048,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote)
                     "PortionType::FootnoteNum");
         assertXPath(pXmlDoc, "/root/page[1]/ftncont/ftn[1]/txt[1]/Special[1]", "rText", "1");
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
         discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
@@ -1178,7 +1161,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys)
     pWrtShell->SplitNode(false);
     pWrtShell->Insert("pqr");
 
-    lcl_dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+    dispatchCommand(mxComponent, ".uno:TrackChanges", {});
     // delete redline inside fly2
     pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 2, /*bBasicCall=*/false);
     pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 8, /*bBasicCall=*/false);
@@ -1211,7 +1194,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys)
             pDoc->SetAttr(anchor2, *const_cast<SwFrameFormat*>(pFly2));
         }
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
         discardDumpedLayout();
         xmlDocPtr pXmlDoc = parseLayoutDump();
@@ -1239,7 +1222,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys)
         assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", "PortionType::Para");
         assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", "foaz");
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
         discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
@@ -1353,7 +1336,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys)
             pDoc->SetAttr(anchor2, *const_cast<SwFrameFormat*>(pFly2));
         }
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
         discardDumpedLayout();
         xmlDocPtr pXmlDoc = parseLayoutDump();
@@ -1368,7 +1351,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys)
             xmlXPathFreeObject(pXmlObj);
         }
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
         discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
@@ -1480,7 +1463,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys)
             pDoc->SetAttr(anchor2, *const_cast<SwFrameFormat*>(pFly2));
         }
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(pLayout->IsHideRedlines());
         discardDumpedLayout();
         xmlDocPtr pXmlDoc = parseLayoutDump();
@@ -1508,7 +1491,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys)
         assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", "PortionType::Para");
         assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", "foaz");
 
-        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
         discardDumpedLayout();
         pXmlDoc = parseLayoutDump();
@@ -1642,7 +1625,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysAtFlys)
     pWrtShell->SplitNode(false);
     pWrtShell->Insert("pqr");
 
-    lcl_dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+    dispatchCommand(mxComponent, ".uno:TrackChanges", {});
     // delete redline inside fly2
     pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 2, /*bBasicCall=*/false);
     pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 8, /*bBasicCall=*/false);
@@ -1660,7 +1643,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysAtFlys)
     pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 7, /*bBasicCall=*/false);
     pWrtShell->Delete();
 
-    lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+    dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
     CPPUNIT_ASSERT(pLayout->IsHideRedlines());
     discardDumpedLayout();
     xmlDocPtr pXmlDoc = parseLayoutDump();
@@ -1685,7 +1668,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysAtFlys)
     assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", "PortionType::Para");
     assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", "foaz");
 
-    lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+    dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
     discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
@@ -1767,7 +1750,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysAtFlys)
     anchor1.SetAnchor(pWrtShell->GetCursor()->GetPoint());
     pDoc->SetAttr(anchor1, *const_cast<SwFrameFormat*>(pFly1));
 
-    lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+    dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
     CPPUNIT_ASSERT(pLayout->IsHideRedlines());
     discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
@@ -1782,7 +1765,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysAtFlys)
         xmlXPathFreeObject(pXmlObj);
     }
 
-    lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+    dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
     discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
@@ -1883,7 +1866,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineSections)
     // verify after load
     CheckRedlineSectionsHidden();
 
-    lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+    dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
     // why is this needed explicitly?
     pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
@@ -1931,7 +1914,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineSections)
     assertXPath(pXmlDoc, "/root/page[1]/body/section[2]/txt[3]/Text[2]", "Portion", "lah");
 
     // verify after hide
-    lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+    dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
     CPPUNIT_ASSERT(pLayout->IsHideRedlines());
     // why is this needed explicitly?
     pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
@@ -1955,7 +1938,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineTables)
     assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", "PortionType::Para");
     assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", "foar");
 
-    lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+    dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
     // why is this needed explicitly?
     pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
@@ -1992,7 +1975,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineTables)
     assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/Text[2]", "Portion", "ar");
 
     // verify after hide
-    lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+    dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
     CPPUNIT_ASSERT(pLayout->IsHideRedlines());
     // why is this needed explicitly?
     pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
@@ -2071,7 +2054,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineCharAttributes)
     // verify after load
     CheckRedlineCharAttributesHidden();
 
-    lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+    dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
     CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
     // why is this needed explicitly?
     pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
@@ -2161,7 +2144,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineCharAttributes)
     assertXPath(pXmlDoc, "/root/page[1]/body/txt[11]/Text[5]", "Portion", "baz");
 
     // verify after hide
-    lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+    dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
     CPPUNIT_ASSERT(pLayout->IsHideRedlines());
     // why is this needed explicitly?
     pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 8cbfc338e013..ed06527db080 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -4097,20 +4097,6 @@ void SwUiWriterTest::testShapeAnchorUndo()
     CPPUNIT_ASSERT_EQUAL(pObject->GetLogicRect(), aOrigLogicRect);
 }
 
-static void lcl_dispatchCommand(const uno::Reference<lang::XComponent>& xComponent, const OUString& rCommand, const uno::Sequence<beans::PropertyValue>& rPropertyValues)
-{
-    uno::Reference<frame::XController> xController = uno::Reference<frame::XModel>(xComponent, uno::UNO_QUERY_THROW)->getCurrentController();
-    CPPUNIT_ASSERT(xController.is());
-    uno::Reference<frame::XDispatchProvider> xFrame(xController->getFrame(), uno::UNO_QUERY);
-    CPPUNIT_ASSERT(xFrame.is());
-
-    uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
-    uno::Reference<frame::XDispatchHelper> xDispatchHelper(frame::DispatchHelper::create(xContext));
-    CPPUNIT_ASSERT(xDispatchHelper.is());
-
-    xDispatchHelper->executeDispatch(xFrame, rCommand, OUString(), 0, rPropertyValues);
-}
-
 void SwUiWriterTest::testDde()
 {
 #if HAVE_FEATURE_UI
@@ -4120,7 +4106,7 @@ void SwUiWriterTest::testDde()
     pWrtShell->Insert("asdf");
     pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 4, /*bBasicCall=*/false);
     uno::Sequence<beans::PropertyValue> aPropertyValues;
-    lcl_dispatchCommand(mxComponent, ".uno:Copy", aPropertyValues);
+    dispatchCommand(mxComponent, ".uno:Copy", aPropertyValues);
 
     // Go before the selection and paste as a DDE link.
     pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false);
@@ -4128,7 +4114,7 @@ void SwUiWriterTest::testDde()
     {
         {"SelectedFormat", uno::makeAny(static_cast<sal_uInt32>(SotClipboardFormatId::LINK))}
     });
-    lcl_dispatchCommand(mxComponent, ".uno:ClipboardFormatItems", aPropertyValues);
+    dispatchCommand(mxComponent, ".uno:ClipboardFormatItems", aPropertyValues);
 
     // Make sure that the document starts with a field now, and its expanded string value contains asdf.
     const uno::Reference< text::XTextRange > xField = getRun(getParagraph(1), 1);
@@ -4241,12 +4227,12 @@ void SwUiWriterTest::testUnicodeNotationToggle()
     sOriginalDocString = pWrtShell->GetCursor()->GetNode().GetTextNode()->GetText();
     CPPUNIT_ASSERT_EQUAL(OUString("uU+002b"), sOriginalDocString);
 
-    lcl_dispatchCommand(mxComponent, ".uno:UnicodeNotationToggle", aPropertyValues);
+    dispatchCommand(mxComponent, ".uno:UnicodeNotationToggle", aPropertyValues);
     sExpectedString = "u+";
     sDocString = pWrtShell->GetCursor()->GetNode().GetTextNode()->GetText();
     CPPUNIT_ASSERT_EQUAL( sDocString, sExpectedString );
 
-    lcl_dispatchCommand(mxComponent, ".uno:UnicodeNotationToggle", aPropertyValues);
+    dispatchCommand(mxComponent, ".uno:UnicodeNotationToggle", aPropertyValues);
     sDocString = pWrtShell->GetCursor()->GetNode().GetTextNode()->GetText();
     CPPUNIT_ASSERT_EQUAL( sDocString, sOriginalDocString );
 }
@@ -5107,12 +5093,12 @@ void SwUiWriterTest::testClassificationPaste()
 
     // Classified source, not classified destination.
     uno::Sequence<beans::PropertyValue> aInternalOnly = comphelper::InitPropertySequence({{"Name", uno::makeAny(OUString("Internal Only"))}});
-    lcl_dispatchCommand(xSourceComponent, ".uno:ClassificationApply", aInternalOnly);
+    dispatchCommand(xSourceComponent, ".uno:ClassificationApply", aInternalOnly);
     CPPUNIT_ASSERT_EQUAL(int(SfxClassificationCheckPasteResult::TargetDocNotClassified), checkShells(pSourceShell, pDestinationShell));
 
     // Classified source and classified destination -- internal only has a higher level than confidential.
     uno::Sequence<beans::PropertyValue> aConfidential = comphelper::InitPropertySequence({{"Name", uno::makeAny(OUString("Confidential"))}});
-    lcl_dispatchCommand(mxComponent, ".uno:ClassificationApply", aConfidential);
+    dispatchCommand(mxComponent, ".uno:ClassificationApply", aConfidential);
     CPPUNIT_ASSERT_EQUAL(int(SfxClassificationCheckPasteResult::DocClassificationTooLow), checkShells(pSourceShell, pDestinationShell));
 
     xSourceComponent->dispose();
@@ -5129,7 +5115,7 @@ void SwUiWriterTest::testSmallCaps()
     pWrtShell->SelAll();
 
     // Dispatch the command to make them formatted small capitals.
-    lcl_dispatchCommand(mxComponent, ".uno:SmallCaps", {});
+    dispatchCommand(mxComponent, ".uno:SmallCaps", {});
 
     // This was css::style::CaseMap::NONE as the shell didn't handle the command.
     CPPUNIT_ASSERT_EQUAL(css::style::CaseMap::SMALLCAPS, getProperty<sal_Int16>(getRun(getParagraph(1), 1), "CharCaseMap"));
@@ -5358,7 +5344,7 @@ void SwUiWriterTest::testRedlineParam()
     {
         {"NextTrackedChange", uno::makeAny(static_cast<sal_uInt16>(rTable[0]->GetId()))}
     }));
-    lcl_dispatchCommand(mxComponent, ".uno:NextTrackedChange", aPropertyValues);
+    dispatchCommand(mxComponent, ".uno:NextTrackedChange", aPropertyValues);
     Scheduler::ProcessEventsToIdle();
     SwShellCursor* pShellCursor = pWrtShell->getShellCursor(false);
     // This failed: the parameter wasn't handled so the next change (zzz) was
@@ -5371,7 +5357,7 @@ void SwUiWriterTest::testRedlineParam()
     {
         {"NextTrackedChange", uno::makeAny(static_cast<sal_uInt16>(rTable[1]->GetId()))}
     });
-    lcl_dispatchCommand(mxComponent, ".uno:NextTrackedChange", aPropertyValues);
+    dispatchCommand(mxComponent, ".uno:NextTrackedChange", aPropertyValues);
     Scheduler::ProcessEventsToIdle();
     pShellCursor = pWrtShell->getShellCursor(false);
     CPPUNIT_ASSERT_EQUAL(OUString("zzz"), pShellCursor->GetText());
@@ -5382,7 +5368,7 @@ void SwUiWriterTest::testRedlineParam()
     {
         {"RejectTrackedChange", uno::makeAny(static_cast<sal_uInt16>(rTable[1]->GetId()))}
     });
-    lcl_dispatchCommand(mxComponent, ".uno:RejectTrackedChange", aPropertyValues);
+    dispatchCommand(mxComponent, ".uno:RejectTrackedChange", aPropertyValues);
     Scheduler::ProcessEventsToIdle();
     pShellCursor = pWrtShell->getShellCursor(false);
 
@@ -5419,7 +5405,7 @@ void SwUiWriterTest::testRedlineViewAuthor()
     CPPUNIT_ASSERT_EQUAL(aAuthor, pRedline->GetAuthorString());
 
     // Insert a comment and assert that SwView::SetRedlineAuthor() affects this as well.
-    lcl_dispatchCommand(mxComponent, ".uno:.uno:InsertAnnotation", {});
+    dispatchCommand(mxComponent, ".uno:.uno:InsertAnnotation", {});
     uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
     uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
     uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
@@ -5520,7 +5506,7 @@ void SwUiWriterTest::testLandscape()
     uno::Sequence<beans::PropertyValue> aPropertyValues( comphelper::InitPropertySequence({
         { "AttributePage.Landscape", uno::Any(true) }
     }));
-    lcl_dispatchCommand(mxComponent, ".uno:AttributePage", aPropertyValues);
+    dispatchCommand(mxComponent, ".uno:AttributePage", aPropertyValues);
     Scheduler::ProcessEventsToIdle();
 
     // Assert that the document model was modified.
@@ -5869,7 +5855,7 @@ void SwUiWriterTest::testCreateDocxAnnotation()
         {"Text", uno::makeAny(aSomeText)},
         {"Author", uno::makeAny(OUString("me"))},
     });
-    lcl_dispatchCommand(mxComponent, ".uno:InsertAnnotation", aPropertyValues);
+    dispatchCommand(mxComponent, ".uno:InsertAnnotation", aPropertyValues);
 
     // Save it as DOCX & load it again
     reload("Office Open XML Text", "create-docx-annotation.docx");
@@ -5923,7 +5909,7 @@ void SwUiWriterTest::testTdf112025()
 
     OUString insertFileid = m_directories.getURLFromSrc(DATA_DIRECTORY) + "fdo112025-insert.docx";
     uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence({{ "Name", uno::makeAny(insertFileid) }}));
-    lcl_dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
+    dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
     // something has been inserted + an additional paragraph
     CPPUNIT_ASSERT_GREATER(numberOfParagraphs, getParagraphs());
 
@@ -5943,7 +5929,7 @@ void SwUiWriterTest::testTdf72942()
 
     OUString insertFileid = m_directories.getURLFromSrc(DATA_DIRECTORY) + "fdo72942-insert.docx";
     uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence({{ "Name", uno::makeAny(insertFileid) }}));
-    lcl_dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
+    dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
 
     // check styles of paragraphs added from [fdo72942.docx]
     const uno::Reference< text::XTextRange > xRun1 = getRun(getParagraph(1), 1);
@@ -6004,7 +5990,7 @@ void SwUiWriterTest::testTdf113877()
     {
         const OUString insertFileid = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf113877_insert_numbered_list.odt";
         uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence({ { "Name", uno::makeAny(insertFileid) } }));
-        lcl_dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
+        dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
     }
 
     const OUString listId1 = getProperty<OUString>(getParagraph(1), "ListId");
@@ -6037,7 +6023,7 @@ void SwUiWriterTest::testTdf113877NoMerge()
     {
         const OUString insertFileid = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf113877_insert_numbered_list_abcd.odt";
         uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence({ { "Name", uno::makeAny(insertFileid) } }));
-        lcl_dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
+        dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
     }
 
     const OUString listId1 = getProperty<OUString>(getParagraph(1), "ListId");
@@ -6076,7 +6062,7 @@ void SwUiWriterTest::testTdf113877_default_style()
     {
         const OUString insertFileid = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf113877_insert_numbered_list_abcd.odt";
         uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence({ { "Name", uno::makeAny(insertFileid) } }));
-        lcl_dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
+        dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
     }
 
     const OUString listId1 = getProperty<OUString>(getParagraph(1), "ListId");
@@ -6108,7 +6094,7 @@ void SwUiWriterTest::testTdf113877_Standard_style()
     {
         const OUString insertFileid = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf113877_insert_numbered_list_abcd.odt";
         uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence({ { "Name", uno::makeAny(insertFileid) } }));
-        lcl_dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
+        dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
     }
 
     const OUString listId1 = getProperty<OUString>(getParagraph(1), "ListId");
@@ -6516,7 +6502,7 @@ void SwUiWriterTest::testTdf108048()
         { "PageNumber", uno::makeAny(sal_uInt16(6)) }, // Even number to avoid auto-inserted blank page
         { "PageNumberFilled", uno::makeAny(true) },
     });
-    lcl_dispatchCommand(mxComponent, ".uno:InsertBreak", aPropertyValues);
+    dispatchCommand(mxComponent, ".uno:InsertBreak", aPropertyValues);
     CPPUNIT_ASSERT_EQUAL(2, getParagraphs());
     CPPUNIT_ASSERT_EQUAL(2, getPages());
 
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 31f095a2c0d3..0b25d4376741 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -81,23 +81,6 @@ protected:
     SwDoc* createDoc(const char* pName = nullptr);
 };
 
-static void lcl_dispatchCommand(const uno::Reference<lang::XComponent>& xComponent,
-                                const OUString& rCommand,
-                                const uno::Sequence<beans::PropertyValue>& rPropertyValues)
-{
-    uno::Reference<frame::XController> xController
-        = uno::Reference<frame::XModel>(xComponent, uno::UNO_QUERY_THROW)->getCurrentController();
-    CPPUNIT_ASSERT(xController.is());
-    uno::Reference<frame::XDispatchProvider> xFrame(xController->getFrame(), uno::UNO_QUERY);
-    CPPUNIT_ASSERT(xFrame.is());
-
-    uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
-    uno::Reference<frame::XDispatchHelper> xDispatchHelper(frame::DispatchHelper::create(xContext));
-    CPPUNIT_ASSERT(xDispatchHelper.is());
-
-    xDispatchHelper->executeDispatch(xFrame, rCommand, OUString(), 0, rPropertyValues);
-}
-
 SwDoc* SwUiWriterTest2::createDoc(const char* pName)
 {
     if (!pName)
@@ -122,7 +105,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf47471_paraStyleBackground)
     pWrtShell->EndPara(/*bSelect=*/true);
     pWrtShell->EndPara(/*bSelect=*/true);
     pWrtShell->EndPara(/*bSelect=*/true);
-    lcl_dispatchCommand(mxComponent, ".uno:ResetAttributes", {});
+    dispatchCommand(mxComponent, ".uno:ResetAttributes", {});
 
     // the background color should revert to the color for 00Background style
     CPPUNIT_ASSERT_EQUAL(sal_Int32(14605542), getProperty<sal_Int32>(getParagraph(2), "FillColor"));
@@ -701,11 +684,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf64242_optimizeTable)
 
     pWrtShell->SelTable(); //select the whole table
 
-    lcl_dispatchCommand(mxComponent, ".uno:SetOptimalColumnWidth", {});
+    dispatchCommand(mxComponent, ".uno:SetOptimalColumnWidth", {});
     CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Table Width: optimize", origWidth,
                                          getProperty<double>(xTextTable, "Width"), nToleranceW);
 
-    lcl_dispatchCommand(mxComponent, ".uno:SetMinimalColumnWidth", {});
+    dispatchCommand(mxComponent, ".uno:SetMinimalColumnWidth", {});
     CPPUNIT_ASSERT_MESSAGE("Table Width: minimized",
                            (origWidth - nToleranceW) > getProperty<double>(xTextTable, "Width"));
 
@@ -713,12 +696,12 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf64242_optimizeTable)
     sal_Int32 nToleranceH = origRowHeight * .01;
     CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Row Height", double(3441), origRowHeight, nToleranceH);
 
-    lcl_dispatchCommand(mxComponent, ".uno:SetOptimalRowHeight", {});
+    dispatchCommand(mxComponent, ".uno:SetOptimalRowHeight", {});
     double optimalRowHeight = getProperty<double>(xTableRows->getByIndex(2), "Height");
     CPPUNIT_ASSERT_MESSAGE("Row Height: optimized",
                            (origRowHeight - nToleranceH) > optimalRowHeight);
 
-    lcl_dispatchCommand(mxComponent, ".uno:SetMinimalRowHeight", {});
+    dispatchCommand(mxComponent, ".uno:SetMinimalRowHeight", {});
     double minimalRowHeight = getProperty<double>(xTableRows->getByIndex(2), "Height");
     CPPUNIT_ASSERT_MESSAGE("Row Height: minimized",
                            (optimalRowHeight - nToleranceH) > minimalRowHeight);
@@ -745,7 +728,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf126784_distributeSelectedColumns)
     //Select column 1 and 2
     pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, /*bBasicCall=*/false);
 
-    lcl_dispatchCommand(mxComponent, ".uno:DistributeColumns", {});
+    dispatchCommand(mxComponent, ".uno:DistributeColumns", {});
 
     aSeq = getProperty<uno::Sequence<text::TableColumnSeparator>>(xTableRows->getByIndex(0),
                                                                   "TableColumnSeparators");
@@ -942,7 +925,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf105413)
         { "Style", uno::makeAny(OUString("Heading 1")) },
         { "FamilyName", uno::makeAny(OUString("ParagraphStyles")) },
     });
-    lcl_dispatchCommand(mxComponent, ".uno:StyleApply", aPropertyValues);
+    dispatchCommand(mxComponent, ".uno:StyleApply", aPropertyValues);
 
     CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"),
                          getProperty<OUString>(getParagraph(3), "ParaStyleName"));
@@ -1150,7 +1133,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122893)
     for (int i = 1; i < 4; ++i)
     {
         CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(getParagraph(i), "ParaAdjust"));
-        lcl_dispatchCommand(mxComponent, ".uno:SpacePara1", {});
+        dispatchCommand(mxComponent, ".uno:SpacePara1", {});
     }
 
     // turn on red-lining and show changes
@@ -1172,8 +1155,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122893)
     pWrtShell->Down(/*bSelect=*/false);
     pWrtShell->EndPara(/*bSelect=*/false);
 
-    lcl_dispatchCommand(mxComponent, ".uno:CenterPara", {});
-    lcl_dispatchCommand(mxComponent, ".uno:SpacePara2", {});
+    dispatchCommand(mxComponent, ".uno:CenterPara", {});
+    dispatchCommand(mxComponent, ".uno:SpacePara2", {});
 
     CPPUNIT_ASSERT_EQUAL(sal_Int32(3),
                          getProperty<sal_Int32>(getParagraph(3), "ParaAdjust")); // center-aligned
@@ -1226,7 +1209,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122901)
     pWrtShell->Down(/*bSelect=*/false);
     pWrtShell->EndPara(/*bSelect=*/false);
 
-    lcl_dispatchCommand(mxComponent, ".uno:ParaspaceIncrease", {});
+    dispatchCommand(mxComponent, ".uno:ParaspaceIncrease", {});
 
     CPPUNIT_ASSERT_EQUAL(sal_Int32(101), getProperty<sal_Int32>(getParagraph(3), "ParaTopMargin"));
     CPPUNIT_ASSERT_EQUAL(sal_Int32(101),
@@ -1289,7 +1272,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf52391)
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
 
-    lcl_dispatchCommand(mxComponent, ".uno:RejectAllTrackedChanges", {});
+    dispatchCommand(mxComponent, ".uno:RejectAllTrackedChanges", {});
 
     const uno::Reference<text::XTextRange> xRun = getRun(getParagraph(1), 1);
     // this was "Portion1", because the tracked background color of Portion1 was
@@ -1316,7 +1299,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf126206)
     }
 
     // reject tracked changes
-    lcl_dispatchCommand(mxComponent, ".uno:RejectAllTrackedChanges", {});
+    dispatchCommand(mxComponent, ".uno:RejectAllTrackedChanges", {});
 
     // bold text again
     xText = getParagraph(1)->getText();
@@ -1348,14 +1331,14 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf101873)
         { "SearchItem.SearchString", uno::makeAny(OUString("fig")) },
         { "SearchItem.Backward", uno::makeAny(false) },
     }));
-    lcl_dispatchCommand(mxComponent, ".uno:ExecuteSearch", aFirst);
-    lcl_dispatchCommand(mxComponent, ".uno:ExecuteSearch", aFirst);
+    dispatchCommand(mxComponent, ".uno:ExecuteSearch", aFirst);
+    dispatchCommand(mxComponent, ".uno:ExecuteSearch", aFirst);
 
     uno::Sequence<beans::PropertyValue> aSecond(comphelper::InitPropertySequence({
         { "SearchItem.SearchString", uno::makeAny(OUString("something")) },
         { "SearchItem.Backward", uno::makeAny(false) },
     }));
-    lcl_dispatchCommand(mxComponent, ".uno:ExecuteSearch", aSecond);
+    dispatchCommand(mxComponent, ".uno:ExecuteSearch", aSecond);
 
     // Without the accompanying fix in place, this test would have failed with "Expected: something;
     // Actual:", i.e. searching for "something" failed, even if it was inserted above.
@@ -1389,7 +1372,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTextFormFieldInsertion)
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount());
 
     // Insert a text form field
-    lcl_dispatchCommand(mxComponent, ".uno:TextFormField", {});
+    dispatchCommand(mxComponent, ".uno:TextFormField", {});
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
 
     // Check whether the fieldmark is created
@@ -1405,13 +1388,13 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTextFormFieldInsertion)
     CPPUNIT_ASSERT_EQUAL(OUString(vEnSpaces, 5), xPara->getString());
 
     // Undo insertion
-    lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+    dispatchCommand(mxComponent, ".uno:Undo", {});
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount());
     xPara.set(getParagraph(1));
     CPPUNIT_ASSERT(xPara->getString().isEmpty());
 
     // Redo insertion
-    lcl_dispatchCommand(mxComponent, ".uno:Redo", {});
+    dispatchCommand(mxComponent, ".uno:Redo", {});
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
     xPara.set(getParagraph(1));
     CPPUNIT_ASSERT_EQUAL(OUString(vEnSpaces, 5), xPara->getString());
@@ -1427,7 +1410,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testCheckboxFormFieldInsertion)
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount());
 
     // Insert a checkbox form field
-    lcl_dispatchCommand(mxComponent, ".uno:CheckBoxFormField", {});
+    dispatchCommand(mxComponent, ".uno:CheckBoxFormField", {});
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
 
     // Check whether the fieldmark is created
@@ -1443,11 +1426,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testCheckboxFormFieldInsertion)
     CPPUNIT_ASSERT(!pCheckBox->IsChecked());
 
     // Undo insertion
-    lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+    dispatchCommand(mxComponent, ".uno:Undo", {});
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount());
 
     // Redo insertion
-    lcl_dispatchCommand(mxComponent, ".uno:Redo", {});
+    dispatchCommand(mxComponent, ".uno:Redo", {});
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
     aIter = pMarkAccess->getAllMarksBegin();
     CPPUNIT_ASSERT(aIter != pMarkAccess->getAllMarksEnd());
@@ -1466,7 +1449,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testDropDownFormFieldInsertion)
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount());
 
     // Insert a drop-down form field
-    lcl_dispatchCommand(mxComponent, ".uno:DropDownFormField", {});
+    dispatchCommand(mxComponent, ".uno:DropDownFormField", {});
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
 
     // Check whether the fieldmark is created
@@ -1483,11 +1466,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testDropDownFormFieldInsertion)
     CPPUNIT_ASSERT(bool(pResult == pParameters->end()));
 
     // Undo insertion
-    lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+    dispatchCommand(mxComponent, ".uno:Undo", {});
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount());
 
     // Redo insertion
-    lcl_dispatchCommand(mxComponent, ".uno:Redo", {});
+    dispatchCommand(mxComponent, ".uno:Redo", {});
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
     aIter = pMarkAccess->getAllMarksBegin();
     CPPUNIT_ASSERT(aIter != pMarkAccess->getAllMarksEnd());
@@ -1506,21 +1489,21 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testMixedFormFieldInsertion)
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount());
 
     // Insert fields
-    lcl_dispatchCommand(mxComponent, ".uno:TextFormField", {});
-    lcl_dispatchCommand(mxComponent, ".uno:CheckBoxFormField", {});
-    lcl_dispatchCommand(mxComponent, ".uno:DropDownFormField", {});
+    dispatchCommand(mxComponent, ".uno:TextFormField", {});
+    dispatchCommand(mxComponent, ".uno:CheckBoxFormField", {});
+    dispatchCommand(mxComponent, ".uno:DropDownFormField", {});
     CPPUNIT_ASSERT_EQUAL(sal_Int32(3), pMarkAccess->getAllMarksCount());
 
     // Undo insertion
-    lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
-    lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
-    lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+    dispatchCommand(mxComponent, ".uno:Undo", {});
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount());
 
     // Redo insertion
-    lcl_dispatchCommand(mxComponent, ".uno:Redo", {});
-    lcl_dispatchCommand(mxComponent, ".uno:Redo", {});
-    lcl_dispatchCommand(mxComponent, ".uno:Redo", {});
+    dispatchCommand(mxComponent, ".uno:Redo", {});
+    dispatchCommand(mxComponent, ".uno:Redo", {});
+    dispatchCommand(mxComponent, ".uno:Redo", {});
     CPPUNIT_ASSERT_EQUAL(sal_Int32(3), pMarkAccess->getAllMarksCount());
 }
 
@@ -1761,7 +1744,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf106843)
     SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
 
     // try to turn off red-lining
-    lcl_dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+    dispatchCommand(mxComponent, ".uno:TrackChanges", {});
 
     // but the protection doesn't allow it
     CPPUNIT_ASSERT_MESSAGE("redlining should be on",
@@ -1961,7 +1944,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf120338)
                          getProperty<OUString>(getParagraph(11), "ParaStyleName"));
 
     // reject tracked paragraph adjustments
-    lcl_dispatchCommand(mxComponent, ".uno:RejectAllTrackedChanges", {});
+    dispatchCommand(mxComponent, ".uno:RejectAllTrackedChanges", {});
 
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0),
                          getProperty<sal_Int32>(getParagraph(2), "ParaAdjust")); // left
@@ -2001,7 +1984,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf120338_multiple_paragraph_join)
                          getProperty<OUString>(getParagraph(3), "ParaStyleName"));
 
     // reject tracked paragraph styles
-    lcl_dispatchCommand(mxComponent, ".uno:RejectAllTrackedChanges", {});
+    dispatchCommand(mxComponent, ".uno:RejectAllTrackedChanges", {});
 
     CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"),
                          getProperty<OUString>(getParagraph(1), "ParaStyleName"));
@@ -2066,7 +2049,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testDateFormFieldInsertion)
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount());
 
     // Insert a date form field
-    lcl_dispatchCommand(mxComponent, ".uno:DatePickerFormField", {});
+    dispatchCommand(mxComponent, ".uno:DatePickerFormField", {});
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
 
     // Check whether the fieldmark is created
@@ -2082,11 +2065,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testDateFormFieldInsertion)
     CPPUNIT_ASSERT_EQUAL(OUString(vEnSpaces, 5), xPara->getString());
 
     // Undo insertion
-    lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+    dispatchCommand(mxComponent, ".uno:Undo", {});
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount());
 
     // Redo insertion
-    lcl_dispatchCommand(mxComponent, ".uno:Redo", {});
+    dispatchCommand(mxComponent, ".uno:Redo", {});
     aIter = pMarkAccess->getAllMarksBegin();
     CPPUNIT_ASSERT(aIter != pMarkAccess->getAllMarksEnd());
     pFieldmark = dynamic_cast<::sw::mark::IFieldmark*>(*aIter);
@@ -2103,7 +2086,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testDateFormFieldContentOperations)
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount());
 
     // Insert a date form field
-    lcl_dispatchCommand(mxComponent, ".uno:DatePickerFormField", {});
+    dispatchCommand(mxComponent, ".uno:DatePickerFormField", {});
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
 
     // Check whether the fieldmark is created
@@ -2136,7 +2119,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testDateFormFieldCurrentDateHandling)
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount());
 
     // Insert a date form field
-    lcl_dispatchCommand(mxComponent, ".uno:DatePickerFormField", {});
+    dispatchCommand(mxComponent, ".uno:DatePickerFormField", {});
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
 
     // Check whether the fieldmark is created
@@ -2190,7 +2173,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testDateFormFieldCurrentDateInvalidation)
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount());
 
     // Insert a date form field
-    lcl_dispatchCommand(mxComponent, ".uno:DatePickerFormField", {});
+    dispatchCommand(mxComponent, ".uno:DatePickerFormField", {});
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
 
     // Check whether the fieldmark is created
@@ -2318,17 +2301,17 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf118311)
         { "SearchItem.SearchString", uno::makeAny(OUString("a")) },
         { "SearchItem.Backward", uno::makeAny(false) },
     }));
-    lcl_dispatchCommand(mxComponent, ".uno:ExecuteSearch", aSearch);
+    dispatchCommand(mxComponent, ".uno:ExecuteSearch", aSearch);
 
     //  .uno:Cut doesn't remove the table, only the selected content of the first cell
-    lcl_dispatchCommand(mxComponent, ".uno:Cut", {});
+    dispatchCommand(mxComponent, ".uno:Cut", {});
 
     xmlDocPtr pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page[1]//body/tab");
 
     // .uno:SelectAll selects the whole table, and UNO command Cut cuts it
-    lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {});
-    lcl_dispatchCommand(mxComponent, ".uno:Cut", {});
+    dispatchCommand(mxComponent, ".uno:SelectAll", {});
+    dispatchCommand(mxComponent, ".uno:Cut", {});
 
     discardDumpedLayout();
     pXmlDoc = parseLayoutDump();
@@ -2437,7 +2420,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf90069)
 
     sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex();
 
-    lcl_dispatchCommand(mxComponent, ".uno:InsertRowsAfter", {});
+    dispatchCommand(mxComponent, ".uno:InsertRowsAfter", {});
     pWrtShell->Down(false);
     pWrtShell->Insert("foo");
 
diff --git a/unotest/source/cpp/macros_test.cxx b/unotest/source/cpp/macros_test.cxx
index 758dcc707347..5b5804c309ab 100644
--- a/unotest/source/cpp/macros_test.cxx
+++ b/unotest/source/cpp/macros_test.cxx
@@ -13,11 +13,14 @@
 
 #include <com/sun/star/frame/XComponentLoader.hpp>
 #include <com/sun/star/document/MacroExecMode.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/frame/DispatchHelper.hpp>
 
 #include <basic/basrdll.hxx>
 #include <cppunit/TestAssert.h>
 #include <rtl/ustrbuf.hxx>
 #include <comphelper/sequence.hxx>
+#include <comphelper/processfactory.hxx>
 
 using namespace css;
 
@@ -59,6 +62,22 @@ uno::Reference<css::lang::XComponent> MacrosTest::loadFromDesktop(const OUString
     return xComponent;
 }
 
+void MacrosTest::dispatchCommand(const uno::Reference<lang::XComponent>& xComponent,
+                                 const OUString& rCommand,
+                                 const uno::Sequence<beans::PropertyValue>& rPropertyValues)
+{
+    uno::Reference<frame::XController> xController
+        = uno::Reference<frame::XModel>(xComponent, uno::UNO_QUERY_THROW)->getCurrentController();
+    CPPUNIT_ASSERT(xController.is());
+    uno::Reference<frame::XDispatchProvider> xFrame(xController->getFrame(), uno::UNO_QUERY);
+    CPPUNIT_ASSERT(xFrame.is());
+
+    uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
+    uno::Reference<frame::XDispatchHelper> xDispatchHelper(frame::DispatchHelper::create(xContext));
+    CPPUNIT_ASSERT(xDispatchHelper.is());
+
+    xDispatchHelper->executeDispatch(xFrame, rCommand, OUString(), 0, rPropertyValues);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list