From a7de9cc5e89cd0d0c2f6363b2c0cc265c528b121 Mon Sep 17 00:00:00 2001 From: Rafael Lima Date: Fri, 19 Jul 2024 23:03:12 +0200 Subject: [PATCH] tdf#162104 Make sure the standard palette gets selected in a clear profile Commit [1] introduced localization of color palette names. However, the name defined in Common.xcs is not localized, so we need to make sure that the standard palette gets selected on a clear profile. [1] 5e45351c52584fb116d2cc54da969734e5effab9 Change-Id: I2f03b3ab4bdbb77327388a754e1fc6f9d7413ba7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170732 Tested-by: Jenkins Reviewed-by: Heiko Tietze --- .../registry/schema/org/openoffice/Office/Common.xcs | 2 +- svx/source/tbxctrls/tbcontrl.cxx | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index a6c5c6e631fe..01482b557274 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -3253,7 +3253,7 @@ Name of selected palette - standard + Standard diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 718759e4168f..95631463bd21 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -2119,7 +2119,15 @@ ColorWindow::ColorWindow(OUString rCommand, for (const auto& rPalette : aPaletteList) mxPaletteListBox->append_text(rPalette); mxPaletteListBox->thaw(); - OUString aPaletteName( officecfg::Office::Common::UserColors::PaletteName::get() ); + + // tdf#162104 If the current palette does not exist, select the equivalent to the localized "Standard" palette + // This is required because the names are now localized and in Common.xcs the "Standard" (in English) + // palette is selected by default + OUString aPaletteName(officecfg::Office::Common::UserColors::PaletteName::get()); + auto it = std::find(aPaletteList.begin(), aPaletteList.end(), aPaletteName); + if (it == aPaletteList.end()) + aPaletteName = SvxResId(RID_SVXSTR_COLOR_PALETTE_STANDARD); + mxPaletteListBox->set_active_text(aPaletteName); const int nSelectedEntry(mxPaletteListBox->get_active()); if (nSelectedEntry != -1)