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] 5e45351c52

Change-Id: I2f03b3ab4bdbb77327388a754e1fc6f9d7413ba7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170732
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
This commit is contained in:
Rafael Lima 2024-07-19 23:03:12 +02:00
parent 7c5cf7578e
commit a7de9cc5e8
2 changed files with 10 additions and 2 deletions

View file

@ -3253,7 +3253,7 @@
<info>
<desc>Name of selected palette</desc>
</info>
<value>standard</value>
<value>Standard</value>
</prop>
<prop oor:name="CustomColor" oor:type="oor:int-list" oor:nillable="false">
<info>

View file

@ -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)