Resolves: tdf#154308 if start center frame exists, use it as dialog parent

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 <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2023-04-05 16:07:07 +01:00
parent 8c3e219a83
commit 7f9b3a0214

View file

@ -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<css::frame::XFramesSupplier> xSupplier = css::frame::Desktop::create(i_rxContext);
FrameListAnalyzer aTasksAnalyzer(xSupplier, css::uno::Reference<css::frame::XFrame>(), FrameAnalyzerFlags::BackingComponent);
css::uno::Reference<css::awt::XWindow> 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& ) { }