include/sfx2/AdditionsDialogHelper.hxx       |   22 ++++++++++++++++++++++
 sfx2/Library_sfx.mk                          |    1 +
 sfx2/source/appl/appserv.cxx                 |   11 ++---------
 sfx2/source/dialog/AdditionsDialogHelper.cxx |   21 +++++++++++++++++++++
 vcl/qt5/QtBuilder.cxx                        |    6 ++++++
 vcl/qt5/QtInstanceBuilder.cxx                |    2 ++
 6 files changed, 54 insertions(+), 9 deletions(-)

New commits:
commit 6d22ef41f51d97871cd182d26b89c44497b4fd1a
Author:     Michael Weghorn <[email protected]>
AuthorDate: Tue Oct 7 01:19:03 2025 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Tue Oct 7 08:27:08 2025 +0200

    additions dialog: Extract sfx2 helper to run the dialog
    
    Extract the existing logic to create and asynchronously
    run the AdditionsDialog from SfxApplication::OfaExec_Impl
    to a new static helper class AdditionsDialogHelper.
    
    This will allow directly calling the helper method
    from elsewhere in an upcoming commit instead of
    using SfxApplication::OfaExec_Impl (by dispatching
    the ".uno:AdditionsDialog" UNO command), in order
    to pass a proper parent window.
    
    Change-Id: I41c9d9d639bc6e9f523ed2eb74975e2e829836d9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191990
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/include/sfx2/AdditionsDialogHelper.hxx 
b/include/sfx2/AdditionsDialogHelper.hxx
new file mode 100644
index 000000000000..b29ed8b14009
--- /dev/null
+++ b/include/sfx2/AdditionsDialogHelper.hxx
@@ -0,0 +1,22 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <vcl/weld.hxx>
+
+class AdditionsDialogHelper
+{
+public:
+    AdditionsDialogHelper() = delete;
+
+    static void RunAdditionsDialog(weld::Window* pParent, const OUString& 
rAdditionsTag);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 66e51be7f87e..9dd671effc22 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -173,6 +173,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
     sfx2/source/devtools/DocumentModelTreeHandler \
     sfx2/source/devtools/ObjectInspectorTreeHandler \
     sfx2/source/devtools/ObjectInspectorWidgets \
+    sfx2/source/dialog/AdditionsDialogHelper \
     sfx2/source/dialog/basedlgs \
     sfx2/source/dialog/checkin \
     sfx2/source/dialog/dialoghelper \
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 9c4a6765b885..53c4c9e9f5cb 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -78,6 +78,7 @@
 #include <com/sun/star/frame/ModuleManager.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 
+#include <sfx2/AdditionsDialogHelper.hxx>
 #include <sfx2/app.hxx>
 #include <sfx2/request.hxx>
 #include <sfx2/dispatch.hxx>
@@ -1704,15 +1705,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
             if (pStringArg)
                 sAdditionsTag = pStringArg->GetValue();
 
-            VclAbstractDialogFactory* pFact = 
VclAbstractDialogFactory::Create();
-            VclPtr<AbstractAdditionsDialog> pDialog(
-                pFact->CreateAdditionsDialog(rReq.GetFrameWeld(), 
sAdditionsTag));
-            pDialog->StartExecuteAsync(
-                [pDialog] (sal_Int32 /*nResult*/)->void
-                {
-                    pDialog->disposeOnce();
-                }
-                );
+            AdditionsDialogHelper::RunAdditionsDialog(rReq.GetFrameWeld(), 
sAdditionsTag);
             break;
         }
 
diff --git a/sfx2/source/dialog/AdditionsDialogHelper.cxx 
b/sfx2/source/dialog/AdditionsDialogHelper.cxx
new file mode 100644
index 000000000000..ec75b44199af
--- /dev/null
+++ b/sfx2/source/dialog/AdditionsDialogHelper.cxx
@@ -0,0 +1,21 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <sfx2/AdditionsDialogHelper.hxx>
+#include <vcl/abstdlg.hxx>
+
+void AdditionsDialogHelper::RunAdditionsDialog(weld::Window* pParent, const 
OUString& rAdditionsTag)
+{
+    VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create();
+    VclPtr<AbstractAdditionsDialog> pDialog = 
pFact->CreateAdditionsDialog(pParent, rAdditionsTag);
+    pDialog->StartExecuteAsync(
+        [pDialog](sal_Int32 /*nResult*/) -> void { pDialog->disposeOnce(); });
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
commit 801f20c4022a3e17d46d73cf535cb8e108bb5cfd
Author:     Michael Weghorn <[email protected]>
AuthorDate: Tue Oct 7 00:25:09 2025 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Tue Oct 7 08:27:00 2025 +0200

    tdf#130857 qt weld: Support additions dialog
    
    This means that native Qt widgets are used for that dialog
    now when using the qt5 or qt6 VCL plugin and starting LO with
    environment variable SAL_VCL_QT_USE_WELDED_WIDGETS=1 set.
    
    The dialog can be triggered as follows:
    
    * start Writer
    * "Format" -> "Page Style"
    * in the "Area" tab, enable "Color"
    * click on the "Add color palettes via extension"
      button in the "Colors" section to open the dialog
    
    This depends on the logic introduced in previous commits
    up to commit
    
        Change-Id: Ib4e51e41c0259bcdad4312e927c37103d83a410e
        Author: Michael Weghorn <[email protected]>
        Date:   Tue Oct 7 00:12:24 2025 +0200
    
            tdf#130857 qt weld: Evaluate width and height request properties
    
    Change-Id: I8dd65c74d4c6c3dd068a2f915688531d24842846
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191988
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx
index 531fa673859e..ed7ef1ff5899 100644
--- a/vcl/qt5/QtInstanceBuilder.cxx
+++ b/vcl/qt5/QtInstanceBuilder.cxx
@@ -67,6 +67,7 @@ bool QtInstanceBuilder::IsUIFileSupported(const OUString& 
rUIFile, const weld::W
     // weld API at once.
     static std::unordered_set<OUString> aSupportedUIFiles = {
         u"cui/ui/aboutdialog.ui"_ustr,
+        u"cui/ui/additionsdialog.ui"_ustr,
         u"cui/ui/breaknumberoption.ui"_ustr,
         u"cui/ui/certdialog.ui"_ustr,
         u"cui/ui/editdictionarydialog.ui"_ustr,
@@ -228,6 +229,7 @@ bool QtInstanceBuilder::IsUIFileSupported(const OUString& 
rUIFile, const weld::W
 
     // These UI files are only supported inside native Qt dialogs/widgets
     static std::unordered_set<OUString> aSupportedWithQtParent = {
+        u"cui/ui/additionsfragment.ui"_ustr,
         u"cui/ui/appearance.ui"_ustr,
         u"cui/ui/graphictestentry.ui"_ustr,
         u"cui/ui/lineendstabpage.ui"_ustr,
commit afee6697b055d27d40c699a33cc7bc8f7ca4ed2e
Author:     Michael Weghorn <[email protected]>
AuthorDate: Tue Oct 7 00:12:24 2025 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Tue Oct 7 08:26:53 2025 +0200

    tdf#130857 qt weld: Evaluate width and height request properties
    
    In QtBuilder evaluate the GtkWidget::width-request [1]
    and GtkWidget::height-request [2] properties and
    set the corresponding width/height as the minimum
    width/height for the QWidget.
    
    This matches what QtInstanceWidget::set_size_request
    currently does.
    
    This will e.g. be needed to support the AdditionsDialog/
    AdditionsItem, i.e. the dialog to install additional
    extensions like color themes.
    (Those properties are set for the "imageScreenshot" GtkImage
    in cui/uiconfig/ui/additionsfragment.ui.)
    
    Sample way to trigger that dialog (for which support
    for using native Qt widgets is not declared yet, but
    this commit prepares for that):
    
    * start Writer
    * "Format" -> "Page Style"
    * in the "Area" tab, enable "Color"
    * click on the "Add color palettes via extension"
      button in the "Colors" section to open the dialog
    
    [1] https://docs.gtk.org/gtk3/property.Widget.width-request.html
    [2] https://docs.gtk.org/gtk3/property.Widget.height-request.html
    
    Change-Id: Ib4e51e41c0259bcdad4312e927c37103d83a410e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191987
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx
index d5027c3b636a..5fe12226a242 100644
--- a/vcl/qt5/QtBuilder.cxx
+++ b/vcl/qt5/QtBuilder.cxx
@@ -1104,9 +1104,15 @@ void QtBuilder::setTextViewProperties(QPlainTextEdit& 
rTextEdit, stringmap& rPro
 
 void QtBuilder::setWidgetProperties(QWidget& rWidget, stringmap& rProps)
 {
+    auto aHeightRequest = rProps.find(u"height-request"_ustr);
+    if (aHeightRequest != rProps.end())
+        rWidget.setMinimumHeight(aHeightRequest->second.toInt32());
     auto aSensitiveIt = rProps.find(u"sensitive"_ustr);
     if (aSensitiveIt != rProps.end())
         rWidget.setEnabled(toBool(aSensitiveIt->second));
+    auto aWidthRequestIt = rProps.find(u"width-request"_ustr);
+    if (aWidthRequestIt != rProps.end())
+        rWidget.setMinimumWidth(aWidthRequestIt->second.toInt32());
 }
 
 QWidget* QtBuilder::windowForObject(QObject* pObject)

Reply via email to