diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index 6d39ef0265088..fe95f778f456a 100644 --- a/desktop/inc/app.hxx +++ b/desktop/inc/app.hxx @@ -125,6 +125,7 @@ class Desktop final : public Application private: void RegisterServices(); static void DeregisterServices(); + static void EnsureStartCenterFallbackMenubar(); public: static void CreateTemporaryDirectory(); diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index afbac3a732024..f02498623eb1e 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -2200,20 +2200,8 @@ void Desktop::OpenClients() xBox->run(); } -#ifdef MACOSX - // Related: tdf#41775 show Start Center before loading documents - // If LibreOffice is launched from the command line with a - // document path parameter, the Start Center doesn't get - // created when all of the document windows are closed. This - // causes the old "File only" menubar to be displayed - // instead of the Start Center's menubar. - if (!rArgs.IsQuickstart() && !rArgs.IsInvisible()) - { - SvtModuleOptions aOpt; - if (aOpt.IsModuleInstalled(SvtModuleOptions::EModule::STARTMODULE)) - ShowBackingComponent(nullptr); - } -#endif + EnsureStartCenterFallbackMenubar(); + // Process request DispatchRequestFlags eFlags = DispatchRequestFlags::NONE; aRequest.mpFlags = &eFlags; @@ -2235,21 +2223,7 @@ void Desktop::OpenClients() if ( rArgs.IsQuickstart() || rArgs.IsInvisible() || Application::AnyInput( VclInputFlags::APPEVENT ) ) { -#ifdef MACOSX - // Related: tdf#41775 show Start Center before loading documents - // If LibreOffice is launched from by opening a document from the - // Finder or dragging it onto the application's Dock icon, the - // the Start Center doesn't get created when all of the document - // windows are closed. This causes the old "File only" menubar - // to be displayed instead of the Start Center's menubar. - if (!rArgs.IsQuickstart() && !rArgs.IsInvisible()) - { - SvtModuleOptions aOpt; - if (aOpt.IsModuleInstalled(SvtModuleOptions::EModule::STARTMODULE)) - ShowBackingComponent(nullptr); - } -#endif - + EnsureStartCenterFallbackMenubar(); // soffice was started as tray icon ... return; } @@ -2257,6 +2231,26 @@ void Desktop::OpenClients() OpenDefault(); } +void Desktop::EnsureStartCenterFallbackMenubar() +{ +#ifdef MACOSX + // Related: tdf#41775 show Start Center before loading documents + // + // If LibreOffice is launched by opening a document from the Finder, or + // dragging a document onto its Dock icon, or from a command-line with a + // document path parameter, the Start Center doesn't get created when all + // of the document windows are closed. This causes the old "File only" + // menubar to be displayed instead of the Start Center's menubar. + const CommandLineArgs& rArgs = GetCommandLineArgs(); + if (!rArgs.IsQuickstart() && !rArgs.IsInvisible()) + { + SvtModuleOptions aOpt; + if (aOpt.IsModuleInstalled(SvtModuleOptions::EModule::STARTMODULE)) + ShowBackingComponent(nullptr); + } +#endif +} + void Desktop::OpenDefault() { OUString aName;