cui/source/factory/dlgfact.cxx |    2 +
 include/vcl/ColorDialog.hxx    |   23 +++++++++++------
 include/vcl/abstdlg.hxx        |    2 +
 include/vcl/weld.hxx           |    7 +++++
 vcl/inc/salinst.hxx            |    3 ++
 vcl/inc/salvtables.hxx         |   15 +++++++++++
 vcl/inc/strings.hrc            |    2 +
 vcl/inc/unx/gtk/gtkinst.hxx    |    2 +
 vcl/source/app/ColorDialog.cxx |   28 ++++++++++++++-------
 vcl/source/app/salvtables.cxx  |   31 +++++++++++++++++++++++
 vcl/unx/gtk3/gtkinst.cxx       |   54 ++++++++++++++++++++++++++++++++++++++++-
 11 files changed, 151 insertions(+), 18 deletions(-)

New commits:
commit c0721600c294ebc46217477a80a8eea34609e4bc
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Jul 25 14:55:34 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Jul 25 19:58:10 2025 +0200

    tdf#167669 gtk: Use native GtkColorChooserDialog
    
    Following
    
        Change-Id: I29380607cdf3abe739a245aeb25526f643dfa537
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Fri Jul 25 14:26:06 2025 +0200
    
            tdf#167669 weld: Introduce weld::ColorChooserDialog
    
    , switch the GTK implementation to use a native
    GtkColorChooserDialog [1] for the weld::ColorChooserDialog
    implementation instead of using LibreOffice's custom
    GtkColorChooserDialog.
    
    Set GtkColorChooserDialog::show-editor [2] to true in
    order to not show a set of preselected colors on start,
    but show the more advanced control (that can otherwise be
    opened by clicking the "+" button) right away.
    This one is more similar to the LO one, and e.g. the
    "Font Color" popup in the Writer Formatting toolbar already
    provides a set of predefined colors to select from, so
    not showing another set when clicking the "Custom Color"
    button seems reasonable.
    
    Besides providing a more uniform experience across applications,
    using the native GtkColorChooserDialog also provides a color
    picker to select a color from a pixel on screen, which the
    custom LO implementation doesn't have.
    
    In the ColorDialog ctor, explicitly set the dialog to modal.
    This is already the case for the custom dialog used so far
    (and still used by anything except gtk3/gtk4 after this commit)
    as defined in the .ui file (cui/uiconfig/ui/colorpickerdialog.ui),
    but it's not the case for GtkColorChooserDialog by default.
    
    [1] https://docs.gtk.org/gtk3/class.ColorChooserDialog.html
    [2] https://docs.gtk.org/gtk3/property.ColorChooserDialog.show-editor.html
    
    Change-Id: If5bfb453b55c905ffe332707e2fb261a48664c31
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188344
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/inc/strings.hrc b/vcl/inc/strings.hrc
index d8363504fb73..20693a71c617 100644
--- a/vcl/inc/strings.hrc
+++ b/vcl/inc/strings.hrc
@@ -135,4 +135,6 @@
 #define RID_STR_ACC_SCROLLBAR_NAME_HORIZONTAL       
NC_("RID_STR_ACC_SCROLLBAR_NAME_HORIZONTAL", "Horizontal scroll bar")
 #define RID_STR_ACC_PANEL_DESCRIPTION               
NC_("RID_STR_ACC_PANEL_DESCRIPTION", "Please press enter to go into child 
control for more operations")
 
+#define RID_STR_PICK_COLOR                          NC_("RID_STR_PICK_COLOR", 
"Pick a Color")
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/ColorDialog.cxx b/vcl/source/app/ColorDialog.cxx
index 32042bec9e5c..589af550dc88 100644
--- a/vcl/source/app/ColorDialog.cxx
+++ b/vcl/source/app/ColorDialog.cxx
@@ -29,6 +29,7 @@ ColorDialog::ColorDialog(weld::Window* pParent, 
vcl::ColorPickerMode eMode)
     std::unique_ptr<weld::ColorChooserDialog> pDialog
         = GetSalInstance()->CreateColorChooserDialog(pParent, eMode);
     assert(pDialog);
+    pDialog->set_modal(true);
     m_pColorChooserDialogController
         = std::make_shared<ColorChooserDialogController>(std::move(pDialog));
 }
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 2b8c4b539182..d90e834bd5e6 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -4489,6 +4489,11 @@ namespace
         return aColor;
     }
 
+    Color toVclColor(const GdkRGBA& rColor)
+    {
+        return Color(rColor.red * 255, rColor.green * 255, rColor.blue * 255);
+    }
+
     OUString get_label(GtkLabel* pLabel)
     {
         const gchar* pStr = gtk_label_get_label(pLabel);
@@ -7957,23 +7962,32 @@ public:
 class GtkInstanceColorChooserDialog : public GtkInstanceDialog,
                                       public virtual weld::ColorChooserDialog
 {
-    ScopedVclPtr<AbstractColorPickerDialog> m_pAbstractColorPickerDialog;
+    GtkColorChooserDialog* m_pColorChooserDialog;
 
 public:
-    GtkInstanceColorChooserDialog(AbstractColorPickerDialog* pColorDialog)
-        : GtkInstanceDialog(
-              
dynamic_cast<GtkInstanceDialog*>(pColorDialog->GetDialog())->getWindow(), 
nullptr,
-              false)
-        , m_pAbstractColorPickerDialog(pColorDialog)
+    GtkInstanceColorChooserDialog(GtkColorChooserDialog* pColorChooserDialog)
+        : GtkInstanceDialog(GTK_WINDOW(pColorChooserDialog), nullptr, true)
+        , m_pColorChooserDialog(pColorChooserDialog)
     {
+        assert(m_pColorChooserDialog);
+        
gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(m_pColorChooserDialog), 
false);
+
+        // directly show the advanced color editor
+        g_object_set(G_OBJECT(m_pColorChooserDialog), "show-editor", true, 
nullptr);
     }
 
     virtual void set_color(const Color& rColor) override
     {
-        m_pAbstractColorPickerDialog->SetColor(rColor);
+        GdkRGBA aColor = toGdkColor(rColor);
+        gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(m_pColorChooserDialog), 
&aColor);
     }
 
-    virtual Color get_color() const override { return 
m_pAbstractColorPickerDialog->GetColor(); }
+    virtual Color get_color() const override
+    {
+        GdkRGBA aColor;
+        gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(m_pColorChooserDialog), 
&aColor);
+        return toVclColor(aColor);
+    }
 };
 }
 
@@ -25160,13 +25174,12 @@ weld::MessageDialog* 
GtkInstance::CreateMessageDialog(weld::Widget* pParent, Vcl
 }
 
 std::unique_ptr<weld::ColorChooserDialog>
-GtkInstance::CreateColorChooserDialog(weld::Window* pParent, 
vcl::ColorPickerMode eMode)
+GtkInstance::CreateColorChooserDialog(weld::Window* pParent, 
vcl::ColorPickerMode)
 {
-    VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create();
-    assert(pFact);
-    VclPtr<AbstractColorPickerDialog> pDialog
-        = pFact->CreateColorPickerDialog(pParent, COL_BLACK, eMode);
-    assert(pDialog);
+    GtkInstanceWindow* pWindow = dynamic_cast<GtkInstanceWindow*>(pParent);
+    GtkWindow* pGtkParent = pWindow ? pWindow->getWindow() : nullptr;
+    GtkColorChooserDialog* pDialog = GTK_COLOR_CHOOSER_DIALOG(
+        
gtk_color_chooser_dialog_new(VclResId(RID_STR_PICK_COLOR).toUtf8().getStr(), 
pGtkParent));
     return std::make_unique<GtkInstanceColorChooserDialog>(pDialog);
 }
 
commit ffb02496c5c7e11eacb9f0d369237ef38d7013dc
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Jul 25 14:48:03 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Jul 25 19:58:03 2025 +0200

    tdf#167669 gtk: Extract helper to convert VCL to GDK color
    
    This allow to reuse the logic in an upcoming commit.
    
    Change-Id: Ib366a1d419e80642aa54a4b760b1212c5daedaac
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188343
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 77c7b5385651..2b8c4b539182 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -4482,6 +4482,13 @@ namespace
         return OUStringToOString(rStr.replaceFirst("~", "_"), 
RTL_TEXTENCODING_UTF8);
     }
 
+    GdkRGBA toGdkColor(const Color& rColor)
+    {
+        GdkRGBA aColor{ rColor.GetRed() / 255.0f, rColor.GetGreen() / 255.0f,
+                        rColor.GetBlue() / 255.0f, 0 };
+        return aColor;
+    }
+
     OUString get_label(GtkLabel* pLabel)
     {
         const gchar* pStr = gtk_label_get_label(pLabel);
@@ -14891,7 +14898,7 @@ private:
             m_Setter(m_pTreeModel, const_cast<GtkTreeIter*>(&iter), m_nIdCol + 
1, nullptr, -1);
         else
         {
-            GdkRGBA aColor{rColor.GetRed()/255.0f, rColor.GetGreen()/255.0f, 
rColor.GetBlue()/255.0f, 0};
+            GdkRGBA aColor = toGdkColor(rColor);
             m_Setter(m_pTreeModel, const_cast<GtkTreeIter*>(&iter), m_nIdCol + 
1, &aColor, -1);
         }
     }
commit dae9472b27914807ec08062e8293a091e90cffb6
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Jul 25 14:26:06 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Jul 25 19:57:57 2025 +0200

    tdf#167669 weld: Introduce weld::ColorChooserDialog
    
    Toolkits like GTK and Qt, as well as other platforms
    provide a native color chooser dialog
    (like GtkColorChooserDialog [1] or QColorDialog [2]).
    
    So far, these have not been used by LibreOffice, but
    the custom LibreOffice color picker
    (logic implemented in cui class ColorPickerDialog,
    wrapped by vcl class ColorDialog and created via
    a dialog factory to avoid dependency cycles) has
    always been used.
    
    In order to prepare for supporting native color choosers,
    introduce a new weld class/interface weld::ColorChooserDialog
    (following the convention to name after the GTK equivalent,
    GtkColorChooserDialog).
    
    Adjust the existing vcl ColorDialog class to wrap
    the new weld::ColorChooserDialog instead of wrapping
    the custom LO implementation directly.
    
    Similar to SalInstance::CreateMessageDialog, add a
    new SalInstance::CreateColorChooserDialog to create
    an instance of weld::ColorChooserDialog. This will
    allow to return a toolkit/platform specific implementation
    in the future.
    
    Initially, let both SalInstance and GtkInstance
    return a weld::ColorChooserDialog implementation
    that wraps the existing ColorPickerDialog.
    (GTK needs a separate implementation because
    the VCL implementation expects that the weld::Window
    parent is a SalInstanceWindow, while it is a
    GtkInstanceWindow for the GTK case.)
    
    No change in user-observed behavior is intended yet
    by introducing this extra layer of weld abstraction,
    but this prepares for switching the GTK
    implementation to use a native GtkColorChooserDialog
    in an upcoming commit.
    
    [1] https://docs.gtk.org/gtk3/class.ColorChooserDialog.html
    [2] https://doc.qt.io/qt-6/qcolordialog.html
    
    Change-Id: I29380607cdf3abe739a245aeb25526f643dfa537
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188342
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index e929b74e6375..e24b1538f176 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -1433,6 +1433,8 @@ public:
     virtual void SetColor(const Color& rColor) override { 
m_pDlg->SetColor(rColor); }
 
     virtual Color GetColor() const override { return m_pDlg->GetColor(); }
+
+    virtual weld::Dialog* GetDialog() const override { return 
m_pDlg->getDialog(); }
 };
 }
 
diff --git a/include/vcl/ColorDialog.hxx b/include/vcl/ColorDialog.hxx
index f27e1be8473b..a55ecf47cec9 100644
--- a/include/vcl/ColorDialog.hxx
+++ b/include/vcl/ColorDialog.hxx
@@ -20,22 +20,30 @@
 #pragma once
 
 #include <tools/color.hxx>
-#include <tools/link.hxx>
 #include <vcl/dllapi.h>
-#include <vcl/vclptr.hxx>
+#include <vcl/weld.hxx>
 
 #include <functional>
 
-class AbstractColorPickerDialog;
-
-namespace weld { class Window; }
-
 namespace vcl
 {
     // Select is the default.
     enum class ColorPickerMode { Select, Modify };
 }
 
+class ColorChooserDialogController : public weld::DialogController
+{
+    std::unique_ptr<weld::ColorChooserDialog> m_pColorChooserDialog;
+
+public:
+    ColorChooserDialogController(std::unique_ptr<weld::ColorChooserDialog> 
pColorChooserDialog)
+        : m_pColorChooserDialog(std::move(pColorChooserDialog))
+    {
+    }
+
+    virtual weld::ColorChooserDialog* getDialog() override { return 
m_pColorChooserDialog.get(); }
+};
+
 class VCL_DLLPUBLIC ColorDialog final
 {
 public:
@@ -49,8 +57,7 @@ public:
     void            ExecuteAsync(const std::function<void(sal_Int32)>& func);
 
 private:
-    ScopedVclPtr<AbstractColorPickerDialog> m_pDialog;
-    std::function<void(sal_Int32)> m_aResultFunc;
+    std::shared_ptr<ColorChooserDialogController> 
m_pColorChooserDialogController;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/abstdlg.hxx b/include/vcl/abstdlg.hxx
index 61d3ea9f5f04..52a558ae11fc 100644
--- a/include/vcl/abstdlg.hxx
+++ b/include/vcl/abstdlg.hxx
@@ -106,6 +106,8 @@ protected:
 public:
     virtual void SetColor(const Color& rColor) = 0;
     virtual Color GetColor() const = 0;
+
+    virtual weld::Dialog* GetDialog() const = 0;
 };
 
 class VCL_DLLPUBLIC AbstractPasswordToOpenModifyDialog : public 
VclAbstractDialog
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 5c54a5242b9d..cdd4f7647319 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -2790,6 +2790,13 @@ public:
     }
 };
 
+class VCL_DLLPUBLIC ColorChooserDialog : virtual public Dialog
+{
+public:
+    virtual void set_color(const Color& rColor) = 0;
+    virtual Color get_color() const = 0;
+};
+
 class VCL_DLLPUBLIC SizeGroup
 {
 public:
diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx
index a31e09cd6530..2c41f0ee2215 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -21,6 +21,7 @@
 
 #include <sal/types.h>
 #include <rtl/ref.hxx>
+#include <vcl/ColorDialog.hxx>
 #include <vcl/dllapi.h>
 #include <vcl/salgtype.hxx>
 #include <vcl/vclenum.hxx>
@@ -176,6 +177,8 @@ public:
                                                 bool bAllowCycleFocusOut, 
sal_uInt64 nLOKWindowId = 0);
     virtual weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent, 
VclMessageType eMessageType,
                                                      VclButtonsType 
eButtonType, const OUString& rPrimaryMessage);
+    virtual std::unique_ptr<weld::ColorChooserDialog>
+    CreateColorChooserDialog(weld::Window* pParent, vcl::ColorPickerMode 
eMode);
     virtual weld::Window* GetFrameWeld(const 
css::uno::Reference<css::awt::XWindow>& rWindow);
 
     // methods for DisplayConnectionDispatch
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 1ee4c3b30d53..a1f1ca65eb16 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -550,6 +550,8 @@ public:
     virtual void set_default_response(int nResponse) override;
 
     virtual std::unique_ptr<weld::Container> weld_content_area() override;
+
+    ::Dialog* getDialog() { return m_xDialog; }
 };
 
 class SalInstanceAssistant : public SalInstanceDialog, public virtual 
weld::Assistant
@@ -2328,4 +2330,17 @@ public:
     virtual ~SalInstanceVerticalNotebook() override;
 };
 
+class SalInstanceColorChooserDialog : public SalInstanceDialog,
+                                      public virtual weld::ColorChooserDialog
+{
+    ScopedVclPtr<AbstractColorPickerDialog> m_pAbstractColorPickerDialog;
+
+public:
+    SalInstanceColorChooserDialog(AbstractColorPickerDialog* pColorDialog);
+    virtual ~SalInstanceColorChooserDialog() override;
+
+    virtual void set_color(const Color& rColor) override;
+    virtual Color get_color() const override;
+};
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index 02528e12d699..2ff4255621a6 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -282,6 +282,8 @@ public:
     virtual std::unique_ptr<weld::Builder> CreateInterimBuilder(vcl::Window* 
pParent, const OUString& rUIRoot, const OUString& rUIFile,
                                                 bool bAllowCycleFocusOut, 
sal_uInt64 nLOKWindowId = 0) override;
     virtual weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent, 
VclMessageType eMessageType, VclButtonsType eButtonType, const OUString 
&rPrimaryMessage) override;
+    std::unique_ptr<weld::ColorChooserDialog>
+    CreateColorChooserDialog(weld::Window* pParent, vcl::ColorPickerMode 
eMode) override;
     virtual weld::Window* GetFrameWeld(const 
css::uno::Reference<css::awt::XWindow>& rWindow) override;
 
     virtual const cairo_font_options_t* GetCairoFontOptions() override;
diff --git a/vcl/source/app/ColorDialog.cxx b/vcl/source/app/ColorDialog.cxx
index e739ba381692..32042bec9e5c 100644
--- a/vcl/source/app/ColorDialog.cxx
+++ b/vcl/source/app/ColorDialog.cxx
@@ -17,30 +17,39 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <salinst.hxx>
+#include <svdata.hxx>
+
 #include <vcl/ColorDialog.hxx>
 #include <vcl/abstdlg.hxx>
 #include <vcl/weld.hxx>
 
 ColorDialog::ColorDialog(weld::Window* pParent, vcl::ColorPickerMode eMode)
 {
-    VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create();
-    assert(pFact);
-    m_pDialog = pFact->CreateColorPickerDialog(pParent, COL_BLACK, eMode);
-    assert(m_pDialog);
+    std::unique_ptr<weld::ColorChooserDialog> pDialog
+        = GetSalInstance()->CreateColorChooserDialog(pParent, eMode);
+    assert(pDialog);
+    m_pColorChooserDialogController
+        = std::make_shared<ColorChooserDialogController>(std::move(pDialog));
 }
 
 ColorDialog::~ColorDialog() {}
 
-void ColorDialog::SetColor(const Color& rColor) { m_pDialog->SetColor(rColor); 
}
+void ColorDialog::SetColor(const Color& rColor)
+{
+    m_pColorChooserDialogController->getDialog()->set_color(rColor);
+}
 
-Color ColorDialog::GetColor() const { return m_pDialog->GetColor(); }
+Color ColorDialog::GetColor() const
+{
+    return m_pColorChooserDialogController->getDialog()->get_color();
+}
 
-short ColorDialog::Execute() { return m_pDialog->Execute(); }
+short ColorDialog::Execute() { return m_pColorChooserDialogController->run(); }
 
 void ColorDialog::ExecuteAsync(const std::function<void(sal_Int32)>& func)
 {
-    m_aResultFunc = func;
-    m_pDialog->StartExecuteAsync(m_aResultFunc);
+    weld::DialogController::runAsync(m_pColorChooserDialogController, func);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 28bc54a48fa6..c20a3da2aa57 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -7091,6 +7091,26 @@ void SalInstancePopover::resize_to_request()
 
 IMPL_LINK_NOARG(SalInstancePopover, PopupModeEndHdl, FloatingWindow*, void) { 
signal_closed(); }
 
+SalInstanceColorChooserDialog::SalInstanceColorChooserDialog(
+    AbstractColorPickerDialog* pColorDialog)
+    : 
SalInstanceDialog(dynamic_cast<SalInstanceDialog*>(pColorDialog->GetDialog())->getDialog(),
+                        nullptr, false)
+    , m_pAbstractColorPickerDialog(pColorDialog)
+{
+}
+
+SalInstanceColorChooserDialog::~SalInstanceColorChooserDialog() {}
+
+void SalInstanceColorChooserDialog::set_color(const Color& rColor)
+{
+    m_pAbstractColorPickerDialog->SetColor(rColor);
+}
+
+Color SalInstanceColorChooserDialog::get_color() const
+{
+    return m_pAbstractColorPickerDialog->GetColor();
+}
+
 SalInstanceBuilder::SalInstanceBuilder(vcl::Window* pParent, 
std::u16string_view sUIRoot,
                                        const OUString& rUIFile,
                                        const 
css::uno::Reference<css::frame::XFrame>& rFrame)
@@ -7573,6 +7593,17 @@ weld::MessageDialog* 
SalInstance::CreateMessageDialog(weld::Widget* pParent,
     return new SalInstanceMessageDialog(xMessageDialog, nullptr, true);
 }
 
+std::unique_ptr<weld::ColorChooserDialog>
+SalInstance::CreateColorChooserDialog(weld::Window* pParent, 
vcl::ColorPickerMode eMode)
+{
+    VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create();
+    assert(pFact);
+    VclPtr<AbstractColorPickerDialog> pDialog
+        = pFact->CreateColorPickerDialog(pParent, COL_BLACK, eMode);
+    assert(pDialog);
+    return std::make_unique<SalInstanceColorChooserDialog>(pDialog);
+}
+
 weld::Window* SalInstance::GetFrameWeld(const 
css::uno::Reference<css::awt::XWindow>& rWindow)
 {
     UnoWrapperBase* pWrapper = UnoWrapperBase::GetUnoWrapper();
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index f09c11d41d8e..77c7b5385651 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -7947,6 +7947,27 @@ public:
     }
 };
 
+class GtkInstanceColorChooserDialog : public GtkInstanceDialog,
+                                      public virtual weld::ColorChooserDialog
+{
+    ScopedVclPtr<AbstractColorPickerDialog> m_pAbstractColorPickerDialog;
+
+public:
+    GtkInstanceColorChooserDialog(AbstractColorPickerDialog* pColorDialog)
+        : GtkInstanceDialog(
+              
dynamic_cast<GtkInstanceDialog*>(pColorDialog->GetDialog())->getWindow(), 
nullptr,
+              false)
+        , m_pAbstractColorPickerDialog(pColorDialog)
+    {
+    }
+
+    virtual void set_color(const Color& rColor) override
+    {
+        m_pAbstractColorPickerDialog->SetColor(rColor);
+    }
+
+    virtual Color get_color() const override { return 
m_pAbstractColorPickerDialog->GetColor(); }
+};
 }
 
 static GType immobilized_viewport_get_type();
@@ -25131,6 +25152,17 @@ weld::MessageDialog* 
GtkInstance::CreateMessageDialog(weld::Widget* pParent, Vcl
     return new GtkInstanceMessageDialog(pMessageDialog, nullptr, true);
 }
 
+std::unique_ptr<weld::ColorChooserDialog>
+GtkInstance::CreateColorChooserDialog(weld::Window* pParent, 
vcl::ColorPickerMode eMode)
+{
+    VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create();
+    assert(pFact);
+    VclPtr<AbstractColorPickerDialog> pDialog
+        = pFact->CreateColorPickerDialog(pParent, COL_BLACK, eMode);
+    assert(pDialog);
+    return std::make_unique<GtkInstanceColorChooserDialog>(pDialog);
+}
+
 weld::Window* GtkInstance::GetFrameWeld(const 
css::uno::Reference<css::awt::XWindow>& rWindow)
 {
     if (SalGtkXWindow* pGtkXWindow = 
dynamic_cast<SalGtkXWindow*>(rWindow.get()))

Reply via email to