tdf#171670 for soc palettes names, UI names are stored instead of file names

Change-Id: I79857acd314af81b2507ea3c6154fd3621b3fac8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210451
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
This commit is contained in:
Julien Nabet
2026-09-03 08:29:50 +02:00
parent bf588c5d9a
commit 2aa35f1ba1
+27 -1
View File
@@ -49,6 +49,8 @@
#include <array>
#include <stack>
static OUString lcl_convertUINameToFileName(OUString& rStr);
PaletteManager::PaletteManager() :
mnMaxRecentColors(Application::GetSettings().GetStyleSettings().GetColorValueSetColumnCount()),
mnNumOfPalettes(3),
@@ -288,7 +290,8 @@ void PaletteManager::SetPalette(sal_Int32 nPos, bool bPosOnly)
XPropertyList::CreatePropertyListFromURL(
XPropertyListType::Color, GetSelectedPalettePath()));
auto name = GetPaletteName(); // may change pColorList
mpColorList->SetName(name);
OUString fileName = lcl_convertUINameToFileName(name);
mpColorList->SetName(fileName);
if(mpColorList->Load())
{
SfxObjectShell* pShell = SfxObjectShell::Current();
@@ -454,4 +457,27 @@ void PaletteManager::DispatchColorCommand(const OUString& aCommand, const NamedC
}
}
// tdf#171670 for soc palettes names, UI names are stored instead of file names
// so let's convert back to file names
static OUString lcl_convertUINameToFileName(OUString& rStr)
{
if (rStr == SvxResId(RID_SVXSTR_COLOR_PALETTE_STANDARD))
return u"standard"_ustr;
else if (rStr == SvxResId(RID_SVXSTR_COLOR_PALETTE_TONAL))
return u"tonal"_ustr;
else if (rStr == SvxResId(RID_SVXSTR_COLOR_PALETTE_HTML))
return u"html"_ustr;
else if (rStr == SvxResId(RID_SVXSTR_COLOR_PALETTE_CHARTPALETTES))
return u"chart-palettes"_ustr;
else if (rStr == SvxResId(RID_SVXSTR_COLOR_PALETTE_COMPATIBILITY))
return u"compatibility"_ustr;
else if (rStr == SvxResId(RID_SVXSTR_COLOR_PALETTE_MATERIAL))
return u"material"_ustr;
else if (rStr == "LibreOffice")
return u"libreoffice"_ustr;
else if (rStr == SvxResId(RID_SVXSTR_COLOR_PALETTE_FREECOLOURHLC))
return u"freecolour-hlc"_ustr;
return rStr;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */