From 3d213b3dc5130bdbacbd64be00867eecad6373e8 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 7 Mar 2017 20:33:43 +0000 Subject: make SfxGetpApp just get and move GetOrCreate to the periphery MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If3b22635e46dbccf0fad101f51bb653cbbcd3a32 Reviewed-on: https://gerrit.libreoffice.org/34957 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- cppcanvas/qa/extras/emfplus/emfplus.cxx | 2 ++ desktop/qa/desktop_lib/test_desktop_lib.cxx | 1 + include/sfx2/app.hxx | 2 +- sfx2/source/appl/module.cxx | 2 +- sfx2/source/notify/globalevents.cxx | 2 +- svx/CppunitTest_svx_unit.mk | 1 + svx/Executable_gengal.mk | 1 + svx/qa/unit/xoutdev.cxx | 7 +++++++ svx/source/gengal/gengal.cxx | 3 +++ sw/CppunitTest_sw_docbookexport.mk | 1 + sw/CppunitTest_sw_globalfilter.mk | 1 + sw/CppunitTest_sw_odfexport.mk | 1 + sw/CppunitTest_sw_odfimport.mk | 1 + sw/CppunitTest_sw_ooxmlexport8.mk | 1 + sw/CppunitTest_sw_ooxmlimport.mk | 1 + sw/CppunitTest_sw_rtfexport.mk | 1 + sw/CppunitTest_sw_rtfimport.mk | 1 + sw/CppunitTest_sw_ww8export2.mk | 1 + sw/CppunitTest_sw_ww8import.mk | 1 + sw/ooxmlexport_setup.mk | 1 + sw/qa/extras/inc/swmodeltestbase.hxx | 3 ++- 21 files changed, 31 insertions(+), 4 deletions(-) diff --git a/cppcanvas/qa/extras/emfplus/emfplus.cxx b/cppcanvas/qa/extras/emfplus/emfplus.cxx index 5ccbea12bc76..a3c6a674c855 100644 --- a/cppcanvas/qa/extras/emfplus/emfplus.cxx +++ b/cppcanvas/qa/extras/emfplus/emfplus.cxx @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -33,6 +34,7 @@ public: { UnoApiTest::setUp(); mxDesktop.set(frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory()))); + SfxApplication::GetOrCreate(); }; virtual void tearDown() override diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 1a9cd263b5d8..310fe237b5e2 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -58,6 +58,7 @@ public: { UnoApiTest::setUp(); mxDesktop.set(frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory()))); + SfxApplication::GetOrCreate(); }; virtual void tearDown() override diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx index 573504413c17..315e3aeaa767 100644 --- a/include/sfx2/app.hxx +++ b/include/sfx2/app.hxx @@ -246,7 +246,7 @@ public: inline SfxApplication* SfxGetpApp() { - return SfxApplication::GetOrCreate(); + return SfxApplication::Get(); } #endif diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx index 4705ba42939f..f26660abd87e 100644 --- a/sfx2/source/appl/module.cxx +++ b/sfx2/source/appl/module.cxx @@ -89,7 +89,7 @@ SfxModule::SfxModule( ResMgr* pMgrP, std::initializer_list pF void SfxModule::Construct_Impl() { - SfxApplication *pApp = SfxGetpApp(); + SfxApplication *pApp = SfxApplication::GetOrCreate(); pImpl = new SfxModule_Impl; pImpl->pSlotPool = new SfxSlotPool(&pApp->GetAppSlotPool_Impl()); diff --git a/sfx2/source/notify/globalevents.cxx b/sfx2/source/notify/globalevents.cxx index 8b8ae93da046..011d775fcd32 100644 --- a/sfx2/source/notify/globalevents.cxx +++ b/sfx2/source/notify/globalevents.cxx @@ -146,7 +146,7 @@ SfxGlobalEvents_Impl::SfxGlobalEvents_Impl( const uno::Reference < uno::XCompone , pImp (nullptr ) { m_refCount++; - SfxGetpApp(); + SfxApplication::GetOrCreate(); pImp = new GlobalEventConfig(); m_xEvents = pImp; m_refCount--; diff --git a/svx/CppunitTest_svx_unit.mk b/svx/CppunitTest_svx_unit.mk index 6563d60e4eaf..0bac905a9dc9 100644 --- a/svx/CppunitTest_svx_unit.mk +++ b/svx/CppunitTest_svx_unit.mk @@ -20,6 +20,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,svx_unit, \ $(eval $(call gb_CppunitTest_use_libraries,svx_unit, \ sal \ + sfx \ svxcore \ tl \ unotest \ diff --git a/svx/Executable_gengal.mk b/svx/Executable_gengal.mk index 49b3b34df987..0cecfa02357c 100644 --- a/svx/Executable_gengal.mk +++ b/svx/Executable_gengal.mk @@ -33,6 +33,7 @@ $(eval $(call gb_Executable_use_libraries,gengal,\ basegfx \ sal \ tl \ + sfx \ svl \ svt \ comphelper \ diff --git a/svx/qa/unit/xoutdev.cxx b/svx/qa/unit/xoutdev.cxx index 7b472b9628d7..f2bbb3c42440 100644 --- a/svx/qa/unit/xoutdev.cxx +++ b/svx/qa/unit/xoutdev.cxx @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -27,6 +28,12 @@ class XOutdevTest : public CppUnit::TestFixture public: void testPdfGraphicExport(); + virtual void setUp() override + { + CppUnit::TestFixture::setUp(); + SfxApplication::GetOrCreate(); + } + CPPUNIT_TEST_SUITE(XOutdevTest); CPPUNIT_TEST(testPdfGraphicExport); CPPUNIT_TEST_SUITE_END(); diff --git a/svx/source/gengal/gengal.cxx b/svx/source/gengal/gengal.cxx index ca84867918dd..e3fe915b9e3d 100644 --- a/svx/source/gengal/gengal.cxx +++ b/svx/source/gengal/gengal.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -274,6 +275,8 @@ int GalApp::Main() { try { + SfxApplication::GetOrCreate(); + OUString aPath, aDestDir; OUString aName( "Default name" ); std::vector aFiles; diff --git a/sw/CppunitTest_sw_docbookexport.mk b/sw/CppunitTest_sw_docbookexport.mk index d0c94720b3ee..9e5a45c41d1c 100644 --- a/sw/CppunitTest_sw_docbookexport.mk +++ b/sw/CppunitTest_sw_docbookexport.mk @@ -21,6 +21,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_docbookexport, \ cppuhelper \ i18nlangtag \ sal \ + sfx \ sw \ test \ tl \ diff --git a/sw/CppunitTest_sw_globalfilter.mk b/sw/CppunitTest_sw_globalfilter.mk index cb12badd22e4..347959f376dc 100644 --- a/sw/CppunitTest_sw_globalfilter.mk +++ b/sw/CppunitTest_sw_globalfilter.mk @@ -20,6 +20,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_globalfilter, \ cppu \ cppuhelper \ sal \ + sfx \ svt \ sw \ test \ diff --git a/sw/CppunitTest_sw_odfexport.mk b/sw/CppunitTest_sw_odfexport.mk index b9260b328b1a..18d06733cbec 100644 --- a/sw/CppunitTest_sw_odfexport.mk +++ b/sw/CppunitTest_sw_odfexport.mk @@ -20,6 +20,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_odfexport, \ cppu \ cppuhelper \ sal \ + sfx \ sw \ test \ tl \ diff --git a/sw/CppunitTest_sw_odfimport.mk b/sw/CppunitTest_sw_odfimport.mk index 36a16db9bdf6..651aef0b6150 100644 --- a/sw/CppunitTest_sw_odfimport.mk +++ b/sw/CppunitTest_sw_odfimport.mk @@ -21,6 +21,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_odfimport, \ cppuhelper \ sal \ svt \ + sfx \ sw \ test \ unotest \ diff --git a/sw/CppunitTest_sw_ooxmlexport8.mk b/sw/CppunitTest_sw_ooxmlexport8.mk index 8bf3f5dab8d7..81f758b83b12 100644 --- a/sw/CppunitTest_sw_ooxmlexport8.mk +++ b/sw/CppunitTest_sw_ooxmlexport8.mk @@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_ooxmlexport8, \ test \ unotest \ utl \ + sfx \ sw \ tl \ vcl \ diff --git a/sw/CppunitTest_sw_ooxmlimport.mk b/sw/CppunitTest_sw_ooxmlimport.mk index ae84e315339a..76f78f21b8ae 100644 --- a/sw/CppunitTest_sw_ooxmlimport.mk +++ b/sw/CppunitTest_sw_ooxmlimport.mk @@ -21,6 +21,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_ooxmlimport, \ cppu \ cppuhelper \ sal \ + sfx \ test \ unotest \ utl \ diff --git a/sw/CppunitTest_sw_rtfexport.mk b/sw/CppunitTest_sw_rtfexport.mk index 9e05e6fa3bfa..54f8014ab2e6 100644 --- a/sw/CppunitTest_sw_rtfexport.mk +++ b/sw/CppunitTest_sw_rtfexport.mk @@ -20,6 +20,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_rtfexport, \ cppu \ cppuhelper \ sal \ + sfx \ sw \ test \ unotest \ diff --git a/sw/CppunitTest_sw_rtfimport.mk b/sw/CppunitTest_sw_rtfimport.mk index 3be64d04b8aa..c2dbf8fc2785 100644 --- a/sw/CppunitTest_sw_rtfimport.mk +++ b/sw/CppunitTest_sw_rtfimport.mk @@ -20,6 +20,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_rtfimport, \ cppu \ cppuhelper \ sal \ + sfx \ i18nlangtag \ sw \ test \ diff --git a/sw/CppunitTest_sw_ww8export2.mk b/sw/CppunitTest_sw_ww8export2.mk index 214b5007b759..c09e528b0aa9 100644 --- a/sw/CppunitTest_sw_ww8export2.mk +++ b/sw/CppunitTest_sw_ww8export2.mk @@ -21,6 +21,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_ww8export2, \ cppuhelper \ $(if $(filter WNT-TRUE,$(OS)-$(DISABLE_ATL)),,emboleobj) \ sal \ + sfx \ test \ unotest \ utl \ diff --git a/sw/CppunitTest_sw_ww8import.mk b/sw/CppunitTest_sw_ww8import.mk index d3ae08a3d3e5..4b38dfd85a2f 100644 --- a/sw/CppunitTest_sw_ww8import.mk +++ b/sw/CppunitTest_sw_ww8import.mk @@ -22,6 +22,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_ww8import, \ sal \ test \ unotest \ + sfx \ sw \ utl \ $(gb_UWINAPI) \ diff --git a/sw/ooxmlexport_setup.mk b/sw/ooxmlexport_setup.mk index ae1b27f9cd84..d793575f13af 100644 --- a/sw/ooxmlexport_setup.mk +++ b/sw/ooxmlexport_setup.mk @@ -14,6 +14,7 @@ define sw_ooxmlexport_libraries cppu \ cppuhelper \ sal \ + sfx \ sw \ test \ tl \ diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index aad89d82ab14..8bb35fc707da 100644 --- a/sw/qa/extras/inc/swmodeltestbase.hxx +++ b/sw/qa/extras/inc/swmodeltestbase.hxx @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -197,8 +198,8 @@ public: virtual void setUp() override { test::BootstrapFixture::setUp(); - mxDesktop.set(css::frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory()))); + SfxApplication::GetOrCreate(); } virtual void tearDown() override -- cgit