framework/source/loadenv/loadenv.cxx |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 7f9b3a0214e0c5d69e2becf2084fbf6e3defa090
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Apr 5 16:07:07 2023 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Apr 5 22:24:12 2023 +0200

    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 <caol...@redhat.com>

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<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&       ) {      }

Reply via email to