From 7f9b3a0214e0c5d69e2becf2084fbf6e3defa090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Wed, 5 Apr 2023 16:07:07 +0100 Subject: [PATCH] Resolves: tdf#154308 if start center frame exists, use it as dialog parent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At least for the case the document is launched from the StartCenter, put that StartCenter as the parent for any dialogs that may appear during typedetection, this avoids such dialogs not getting associated with the start center and going behind the dialog if the start center is clicked while the dialog was appearing. The start center is always recycled to become the next document if it exists, so its window is the window the final document would appear in if successful. Change-Id: I75a92ff424aa0b9d5d6b808e2f7f1766a80fa50c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150058 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- framework/source/loadenv/loadenv.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 0d56944a3b17..0684c7b5fa69 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -322,7 +322,16 @@ void LoadEnv::initializeUIDefaults( const css::uno::Reference< css::uno::XCompon nUpdateMode = css::document::UpdateDocMode::ACCORDING_TO_CONFIG; try { - xInteractionHandler.set( css::task::InteractionHandler::createWithParent( i_rxContext, nullptr ), css::uno::UNO_QUERY_THROW ); + // tdf#154308 At least for the case the document is launched from the StartCenter, put that StartCenter as the + // parent for any dialogs that may appear during typedetection (once load starts a permanent frame will be set + // anyway and used as dialog parent, which will be this one if the startcenter was running) + css::uno::Reference xSupplier = css::frame::Desktop::create(i_rxContext); + FrameListAnalyzer aTasksAnalyzer(xSupplier, css::uno::Reference(), FrameAnalyzerFlags::BackingComponent); + css::uno::Reference xDialogParent(aTasksAnalyzer.m_xBackingComponent ? + aTasksAnalyzer.m_xBackingComponent->getContainerWindow() : + nullptr); + + xInteractionHandler.set( css::task::InteractionHandler::createWithParent(i_rxContext, xDialogParent), css::uno::UNO_QUERY_THROW ); } catch(const css::uno::RuntimeException&) {throw;} catch(const css::uno::Exception& ) { }