cui/source/dialogs/SpellDialog.cxx | 9 +++++++-- cui/source/inc/SpellDialog.hxx | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-)
New commits: commit 7ead9ac54676ed62530d1f9181a1a9227d18e6dd Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Tue Mar 4 17:38:09 2025 +0000 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Wed Mar 5 09:29:00 2025 +0100 Resolves: tdf#163570 escape dictionary name for ui so _ doesn't get seen as a ui code, keep the original and map it with the itemid and avoid pitfalls of what happens to end up in the label itself. Change-Id: I25376adb797c1719ac52a59a4596f1c16cc665dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182497 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index bd30f650adad..bbc2bbe7527a 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -786,6 +786,7 @@ int SpellDialog::InitUserDicts() // list suitable dictionaries bool bEnable = false; m_xAddToDictMB->clear(); + m_aDictIdToName.clear(); sal_uInt16 nItemId = 1; // menu items should be enumerated from 1 and not 0 for (auto& xDicTmp : pImpl->aDics) { @@ -809,7 +810,11 @@ int SpellDialog::InitUserDicts() xSvcInfo->getImplementationName()); } - m_xAddToDictMB->append_item(OUString::number(nItemId), xDicTmp->getName(), aDictionaryImageUrl); + OUString sDictId = OUString::number(nItemId); + m_xAddToDictMB->append_item(sDictId, + m_xAddToDictMB->escape_ui_str(xDicTmp->getName()), + aDictionaryImageUrl); + m_aDictIdToName[sDictId] = xDicTmp->getName(); ++nItemId; } @@ -843,7 +848,7 @@ void SpellDialog::AddToDictionaryExecute(const OUString& rItemId) //manually changed const OUString aNewWord = m_xSentenceED->GetErrorText(); - OUString aDicName(m_xAddToDictMB->get_item_label(rItemId)); + OUString aDicName(m_aDictIdToName[rItemId]); uno::Reference< linguistic2::XDictionary > xDic; uno::Reference< linguistic2::XSearchableDictionaryList > xDicList( LinguMgr::GetDictionaryList() ); diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx index 81d68e214314..13212ac8cac2 100644 --- a/cui/source/inc/SpellDialog.hxx +++ b/cui/source/inc/SpellDialog.hxx @@ -150,6 +150,8 @@ private: css::uno::Reference< css::linguistic2::XSpellChecker1 > xSpell; + std::unordered_map<OUString, OUString> m_aDictIdToName; + std::unique_ptr<weld::Label> m_xAltTitle; std::unique_ptr<weld::Label> m_xResumeFT; std::unique_ptr<weld::Label> m_xNoSuggestionsFT;