cui/source/options/optgdlg.cxx | 29 ++++++---- cui/source/options/optgdlg.hxx | 3 - cui/uiconfig/ui/optgeneralpage.ui | 37 +++++++++++-- officecfg/registry/data/org/openoffice/Office/Common.xcu | 2 officecfg/registry/schema/org/openoffice/Office/Common.xcs | 9 +++ vcl/source/app/ColorDialog.cxx | 9 +++ 6 files changed, 73 insertions(+), 16 deletions(-)
New commits: commit 911c64072910c19da3bd5e7d38173e651f21e2d2 Author: Michael Weghorn <[email protected]> AuthorDate: Fri Dec 5 17:43:00 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Mon Dec 8 07:46:37 2025 +0100 tdf#169505 Add checkbox to enable/disable native color dialog Add a checkbox in the option dialog's "General" tab to allow to easily enable/disable the use of the custom LibreOffice color picker dialog instead of a native one. This makes the option newly introduced in previous commit Change-Id: I99c5f1e350c36aa3cb70f26724cce9263160f945 Author: Michael Weghorn <[email protected]> Date: Fri Dec 5 16:59:14 2025 +0100 tdf#169505 Allow disabling native color pickers settable via a checkbox in that tab page of the dialog instead of only via expert settings. Add the checkbox to the existing frame that provides such an option for the file dialogs already, and tweak the wording/visibility a bit. Change-Id: Icf3746d5936d9df6e52554b5c232632689c2729d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195105 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> (cherry picked from commit c0d3205c4686680a6eea00286fa49cc3d51be672) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195153 diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 9f9ece1304d8..ec19175b6eac 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -162,9 +162,10 @@ OfaMiscTabPage::OfaMiscTabPage(weld::Container* pPage, weld::DialogController* p , m_xPopUpNoHelpImg(m_xBuilder->weld_widget(u"lockpopupnohelp"_ustr)) , m_xShowTipOfTheDay(m_xBuilder->weld_check_button(u"cbShowTipOfTheDay"_ustr)) , m_xShowTipOfTheDayImg(m_xBuilder->weld_widget(u"lockcbShowTipOfTheDay"_ustr)) - , m_xFileDlgFrame(m_xBuilder->weld_widget(u"filedlgframe"_ustr)) , m_xFileDlgROImage(m_xBuilder->weld_widget(u"lockimage"_ustr)) , m_xFileDlgCB(m_xBuilder->weld_check_button(u"filedlg"_ustr)) + , m_xColorDlgROImage(m_xBuilder->weld_widget(u"locksystemcolordialogs"_ustr)) + , m_xColorDlgCB(m_xBuilder->weld_check_button(u"systemcolordialogs"_ustr)) , m_xDocStatusCB(m_xBuilder->weld_check_button(u"docstatus"_ustr)) , m_xDocStatusImg(m_xBuilder->weld_widget(u"lockdocstatus"_ustr)) , m_xYearFrame(m_xBuilder->weld_widget(u"yearframe"_ustr)) @@ -261,6 +262,12 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet ) bModified = true; } + if (m_xColorDlgCB->get_state_changed_from_saved()) + { + officecfg::Office::Common::Misc::UseSystemColorDialog::set(!m_xColorDlgCB->get_active(), batch); + bModified = true; + } + if ( m_xFileDlgCB->get_state_changed_from_saved() ) { officecfg::Office::Common::Misc::UseSystemFileDialog::set( !m_xFileDlgCB->get_active(), batch ); @@ -330,15 +337,17 @@ void OfaMiscTabPage::Reset( const SfxItemSet* rSet ) m_xShowTipOfTheDayImg->set_visible(!bEnable); m_xShowTipOfTheDay->save_state(); - if (!lcl_HasSystemFilePicker()) - m_xFileDlgFrame->hide(); - else - { - bEnable = !officecfg::Office::Common::Misc::UseSystemFileDialog::isReadOnly(); - m_xFileDlgCB->set_sensitive(bEnable); - m_xFileDlgROImage->set_visible(!bEnable); - } - m_xFileDlgCB->set_active(!officecfg::Office::Common::Misc::UseSystemFileDialog::get()); + bEnable = !officecfg::Office::Common::Misc::UseSystemColorDialog::isReadOnly(); + m_xColorDlgCB->set_sensitive(bEnable); + m_xColorDlgROImage->set_visible(!bEnable); + m_xColorDlgCB->set_active(!officecfg::Office::Common::Misc::UseSystemColorDialog::get()); + m_xColorDlgCB->save_state(); + + const bool bReadOnly = officecfg::Office::Common::Misc::UseSystemFileDialog::isReadOnly(); + bEnable = !bReadOnly && lcl_HasSystemFilePicker(); + m_xFileDlgCB->set_sensitive(bEnable); + m_xFileDlgROImage->set_visible(bReadOnly); + m_xFileDlgCB->set_active(!lcl_HasSystemFilePicker() || !officecfg::Office::Common::Misc::UseSystemFileDialog::get()); m_xFileDlgCB->save_state(); bEnable = !officecfg::Office::Common::Print::PrintingModifiesDocument::isReadOnly(); diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx index 30d8c081241c..4bebe067cd41 100644 --- a/cui/source/options/optgdlg.hxx +++ b/cui/source/options/optgdlg.hxx @@ -35,9 +35,10 @@ private: std::unique_ptr<weld::Widget> m_xPopUpNoHelpImg; std::unique_ptr<weld::CheckButton> m_xShowTipOfTheDay; std::unique_ptr<weld::Widget> m_xShowTipOfTheDayImg; - std::unique_ptr<weld::Widget> m_xFileDlgFrame; std::unique_ptr<weld::Widget> m_xFileDlgROImage; std::unique_ptr<weld::CheckButton> m_xFileDlgCB; + std::unique_ptr<weld::Widget> m_xColorDlgROImage; + std::unique_ptr<weld::CheckButton> m_xColorDlgCB; std::unique_ptr<weld::CheckButton> m_xDocStatusCB; std::unique_ptr<weld::Widget> m_xDocStatusImg; std::unique_ptr<weld::Widget> m_xYearFrame; diff --git a/cui/uiconfig/ui/optgeneralpage.ui b/cui/uiconfig/ui/optgeneralpage.ui index 57e7f0dfc2d3..20cf7d07ea1a 100644 --- a/cui/uiconfig/ui/optgeneralpage.ui +++ b/cui/uiconfig/ui/optgeneralpage.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.38.2 --> +<!-- Generated with glade 3.40.0 --> <interface domain="cui"> <requires lib="gtk+" version="3.24"/> <object class="GtkAdjustment" id="adjustment1"> @@ -134,13 +134,13 @@ </packing> </child> <child> - <object class="GtkFrame" id="filedlgframe"> + <object class="GtkFrame" id="customdialogsframe"> <property name="visible">True</property> <property name="can-focus">False</property> <property name="label-xalign">0</property> <property name="shadow-type">none</property> <child> - <!-- n-columns=2 n-rows=1 --> + <!-- n-columns=2 n-rows=2 --> <object class="GtkGrid" id="grid4"> <property name="visible">True</property> <property name="can-focus">False</property> @@ -149,7 +149,7 @@ <property name="column-spacing">6</property> <child> <object class="GtkCheckButton" id="filedlg"> - <property name="label" translatable="yes" context="optgeneralpage|filedlg">_Use %PRODUCTNAME dialogs</property> + <property name="label" translatable="yes" context="optgeneralpage|filedlg">_Use %PRODUCTNAME open/save dialogs</property> <property name="visible">True</property> <property name="can-focus">True</property> <property name="receives-default">False</property> @@ -174,13 +174,40 @@ <property name="top-attach">0</property> </packing> </child> + <child> + <object class="GtkImage" id="locksystemcolordialogs"> + <property name="can-focus">False</property> + <property name="no-show-all">True</property> + <property name="halign">center</property> + <property name="valign">center</property> + <property name="icon-name">res/lock.png</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="systemcolordialogs"> + <property name="label" translatable="yes" context="optgeneralpage|filedlg">U_se %PRODUCTNAME color dialog</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">1</property> + </packing> + </child> </object> </child> <child type="label"> <object class="GtkLabel" id="label2"> <property name="visible">True</property> <property name="can-focus">False</property> - <property name="label" translatable="yes" context="optgeneralpage|label2">Open/Save Dialogs</property> + <property name="label" translatable="yes" context="optgeneralpage|label2">Dialogs</property> <attributes> <attribute name="weight" value="bold"/> </attributes> commit 41a64827813cba241da052e885ada2d7f8f52536 Author: Michael Weghorn <[email protected]> AuthorDate: Fri Dec 5 16:59:14 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Mon Dec 8 07:46:31 2025 +0100 tdf#169505 Allow disabling native color pickers Similar to the existing option that allows disabling system/toolkit file pickers (officecfg::Office::Common::Misc::UseSystemFileDialog), also add an option (officecfg::Office::Common::Misc::UseSystemColorDialog::get) to disable the system/toolkit color pickers, which were unconditionally enabled for the GTK and Qt based VCL plugins in commits commit dae9472b27914807ec08062e8293a091e90cffb6 Author: Michael Weghorn <[email protected]> Date: Fri Jul 25 14:26:06 2025 +0200 tdf#167669 weld: Introduce weld::ColorChooserDialog and commit c0721600c294ebc46217477a80a8eea34609e4bc Author: Michael Weghorn <[email protected]> Date: Fri Jul 25 14:55:34 2025 +0200 tdf#167669 gtk: Use native GtkColorChooserDialog and commit 072010169bb4668f3c624a9f379e8a79e4e3e57a Author: Michael Weghorn <[email protected]> Date: Fri Jul 25 15:09:25 2025 +0200 tdf#167669 tdf#130857 qt: Use native QColorDialog For users that prefer the custom LibreOffice dialog instead of the native toolkit ones, this allows switching back to the former one as follows: * "Tools" -> "Options" * "LibreOffice(Dev)" -> "Advanced" * press "Open Expert Configuration" button * search for "UseSystemColorDialog" and toggle the value of the corresponding setting to false A checkbox in the "General" tab of the options dialog to make toggling this easier will be added in a separate upcoming commit. Change-Id: I99c5f1e350c36aa3cb70f26724cce9263160f945 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195104 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins (cherry picked from commit 5bb41f2a588caff88b2fd957af9c9e94d8cdf2e0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195152 diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu index 54cd6c148d83..22224887cff4 100644 --- a/officecfg/registry/data/org/openoffice/Office/Common.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu @@ -402,6 +402,8 @@ </node> </node> <node oor:name="Misc"> + <prop oor:name="UseSystemColorDialog"> + </prop> <prop oor:name="UseSystemFileDialog"> </prop> <prop oor:name="UseSystemPrintDialog" install:module="macosx"> diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 766de1514ddb..cd3ba8cc88f4 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -5320,6 +5320,15 @@ </info> <value>true</value> </prop> + <prop oor:name="UseSystemColorDialog" oor:type="xs:boolean" oor:nillable="false"> + <info> + <desc>Determines if the system's color pickers should be + used. If false, the proprietary color picker implementation + will be used. Relevant on platforms where color picker + integration is implemented.</desc> + </info> + <value>true</value> + </prop> <prop oor:name="UseSystemFileDialog" oor:type="xs:boolean" oor:nillable="false"> <info> <desc>Determines if the system's file and folder pickers should be diff --git a/vcl/source/app/ColorDialog.cxx b/vcl/source/app/ColorDialog.cxx index b231fce639a5..7b9b8f90ef04 100644 --- a/vcl/source/app/ColorDialog.cxx +++ b/vcl/source/app/ColorDialog.cxx @@ -17,9 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <colorpicker.hxx> #include <salinst.hxx> #include <svdata.hxx> +#include <officecfg/Office/Common.hxx> #include <vcl/ColorDialog.hxx> #include <vcl/abstdlg.hxx> #include <vcl/weld.hxx> @@ -49,6 +51,13 @@ private: ColorDialog::ColorDialog(weld::Window* pParent, vcl::ColorPickerMode eMode) { + if (!officecfg::Office::Common::Misc::UseSystemColorDialog::get()) + { + // use custom LibreOffice color picker dialog + m_pColorDialogController = std::make_shared<ColorPickerDialog>(pParent, COL_BLACK, eMode); + return; + } + std::unique_ptr<weld::ColorChooserDialog> pDialog = GetSalInstance()->CreateColorChooserDialog(pParent, eMode); assert(pDialog);
