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

New commits:
commit b137bde5c7c7a3ce223368adfd5195dbca559155
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Apr 5 16:07:07 2023 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Thu Apr 6 12:26:30 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/+/149989
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/framework/source/loadenv/loadenv.cxx 
b/framework/source/loadenv/loadenv.cxx
index 89feaa25d0ab..3cf0c8596223 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