desktop/source/app/app.cxx | 54 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+)
New commits: commit c8c25b6a16177f9e2cee99463dcf17edbc761a48 Author: Patrick Luby <guibmac...@gmail.com> AuthorDate: Sun Mar 9 16:54:11 2025 -0400 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Mon Mar 10 08:20:31 2025 +0100 Related: tdf#41775 show Start Center when loading a document at launch This is the second attempt to implement a fix for tdf#41775 after reverting commit 9e3d8d0176bb1e95414e4a578065c2e1035a8dd6. On macOS, the Start Center's menubar is the "no windows open" menubar. This is done by making a native copy of the Start Center's menubar each time it is opened (note: on macOS the Start Center window can be closed and reopened repeatedly) so pre-populate the "no windows open" menubar by opening the Start Center even if a document is going to be loaded. But if LibreOffice is launched by opening a document from the Finder, dragging it onto the application's Dock icon, or from the command line with a module or document path parameter, 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 "no windows open" menubar. Change-Id: Ide079014b4a7db390ae4d084b45af922f0422525 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182702 Reviewed-by: Patrick Luby <guibomac...@gmail.com> Tested-by: Jenkins (cherry picked from commit 331ea32ec181aff739eaebee328281b190cad003) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182705 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index cb4a4de7db9e..0bfe37622308 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -2199,6 +2199,20 @@ 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 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 // Process request if ( RequestHandler::ExecuteCmdLineRequests(aRequest, false) ) { @@ -2214,8 +2228,25 @@ void Desktop::OpenClients() return; 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 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 + // soffice was started as tray icon ... return; + } OpenDefault(); } @@ -2271,6 +2302,16 @@ void Desktop::OpenDefault() return; } +#ifdef MACOSX + // Related: tdf#41775 show Start Center before loading documents + // If LibreOffice is launched from the command line with a module + // argument, the Start Center doesn't get created when all of the + // document windows are closed. This causes the the old "File only" + // menubar to be displayed instead of the Start Center's menubar. + if (aOpt.IsModuleInstalled(SvtModuleOptions::EModule::STARTMODULE)) + ShowBackingComponent(nullptr); +#endif + ProcessDocumentsRequest aRequest(rArgs.getCwdUrl()); aRequest.aOpenList.push_back(aName); RequestHandler::ExecuteCmdLineRequests(aRequest, false); @@ -2622,6 +2663,19 @@ void Desktop::ShowBackingComponent(Desktop * progress) { progress->CloseSplashScreen(); } +#ifdef MACOSX + else + { + // Related: tdf#41775 don't display the Start Center when loading + // modules or documents by unsetting the backing frame's component. + // This makes the Start Center's window empty so that loading large + // documents don't have the Start Center content displayed while the + // the document loads. + xBackingFrame->setComponent(css::uno::Reference<css::awt::XWindow>(), css::uno::Reference<css::frame::XController>()); + return; + } +#endif + xContainerWindow->setVisible(true); }