Make "XML Filter Settings" dialog modal and set parent

So far, the "Tools" -> "XML Filter Settings" dialog
did not have a parent and was not modal.

As a consequence (tested on Plasma Wayland):

* With qt6 or gen, the dialog would just "disappear" behind
  the main Writer window when clicking on the main Writer window
  or moving focus there using Alt+Tab.
* With gtk3, the dialog would always stay on top of the Writer
  window, but would still allow to interact with the Writer window,
  so when typing text, the cursor could easily move to be behind
  the dialog.

Make the dialog modal and set a parent (using
XMLFilterDialogComponent::initialize) , which makes the dialog
consistently appear on top of the Writer main window and the
Writer window insensitive/disabled until the dialog gets closed again.

Change-Id: I79ebc20cc3c059f217de9a1a909a7c7a424ab5ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182034
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn
2025-02-23 10:14:17 +01:00
parent 0d291789e1
commit 485a87fd48
3 changed files with 21 additions and 1 deletions
+1
View File
@@ -17,6 +17,7 @@
<property name="border-width">6</property>
<property name="title" translatable="yes" context="xmlfiltersettings|XMLFilterSettingsDialog">XML Filter Settings</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="default-width">0</property>
<property name="default-height">0</property>
<property name="type-hint">dialog</property>
+1 -1
View File
@@ -154,7 +154,7 @@ protected:
void SetViewShell_Impl( SfxViewShell* pView );
SAL_DLLPRIVATE void Invalidate_Impl( SfxBindings& rBindings, sal_uInt16 nId );
static void HandleOpenXmlFilterSettings(SfxRequest &);
void HandleOpenXmlFilterSettings(SfxRequest &);
public:
+19
View File
@@ -19,6 +19,7 @@
#include <com/sun/star/embed/VerbDescriptor.hpp>
#include <com/sun/star/embed/VerbAttributes.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <officecfg/Office/Common.hxx>
#include <rtl/ustring.hxx>
#include <sal/log.hxx>
@@ -30,6 +31,7 @@
#include <svtools/asynclink.hxx>
#include <unotools/configmgr.hxx>
#include <comphelper/lok.hxx>
#include <comphelper/propertysequence.hxx>
#include <sfx2/shell.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
@@ -42,6 +44,7 @@
#include <statcach.hxx>
#include <sidebar/ContextChangeBroadcaster.hxx>
#include <com/sun/star/ui/dialogs/XSLTFilterDialog.hpp>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/debug.hxx>
#include <memory>
@@ -281,6 +284,22 @@ void SfxShell::HandleOpenXmlFilterSettings(SfxRequest & rReq)
try
{
uno::Reference < ui::dialogs::XExecutableDialog > xDialog = ui::dialogs::XSLTFilterDialog::create( ::comphelper::getProcessComponentContext() );
// set dialog parent
css::uno::Reference<com::sun::star::lang::XInitialization> xInit(xDialog,
css::uno::UNO_QUERY);
if (xInit.is())
{
if (SfxViewShell* pViewShell = GetViewShell())
{
css::uno::Reference<css::awt::XWindow> xDialogParent
= VCLUnoHelper::GetInterface(pViewShell->GetWindow());
css::uno::Sequence<css::uno::Any> aSeq(comphelper::InitAnyPropertySequence(
{ { "ParentWindow", uno::Any(xDialogParent) } }));
xInit->initialize(aSeq);
}
}
(void)xDialog->execute();
}
catch (const uno::Exception&)