sw/source/uibase/lingu/olmenu.cxx | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
New commits: commit 2ce644117859138121869ff6146822c153ea60f0 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Fri Dec 20 12:52:57 2024 +0000 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Thu Jan 9 10:25:07 2025 +0100 expose Add to Dictionary menu entries to kit Change-Id: If9a072afef339110a4d44366b1f2e515e6feb55a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178917 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx index d92920521d2b..4292aa285bb0 100644 --- a/sw/source/uibase/lingu/olmenu.cxx +++ b/sw/source/uibase/lingu/olmenu.cxx @@ -361,6 +361,7 @@ SwSpellPopup::SwSpellPopup( } } } + m_xPopupMenu->EnableItem(m_nAddMenuId, (nItemId - MN_DICTIONARIES_START) > 1); m_xPopupMenu->EnableItem(m_nAddId, (nItemId - MN_DICTIONARIES_START) == 1); @@ -595,9 +596,8 @@ void SwSpellPopup::InitItemCommands(const css::uno::Sequence< OUString >& aSugge m_xPopupMenu->SetItemCommand(nItemId, sCommandString); } - PopupMenu *pMenu = m_xPopupMenu->GetPopupMenu(m_nLangSelectionMenuId); m_xPopupMenu->SetItemCommand(m_nLangSelectionMenuId, ".uno:SetSelectionLanguageMenu"); - if(pMenu) + if (PopupMenu *pMenu = m_xPopupMenu->GetPopupMenu(m_nLangSelectionMenuId)) { for (const auto& item : m_aLangTable_Text) { @@ -610,9 +610,8 @@ void SwSpellPopup::InitItemCommands(const css::uno::Sequence< OUString >& aSugge pMenu->SetItemCommand(MN_SET_SELECTION_MORE, ".uno:FontDialog?Page:string=font"); } - pMenu = m_xPopupMenu->GetPopupMenu(m_nLangParaMenuId); m_xPopupMenu->SetItemCommand(m_nLangParaMenuId, ".uno:SetParagraphLanguageMenu"); - if(pMenu) + if (PopupMenu* pMenu = m_xPopupMenu->GetPopupMenu(m_nLangParaMenuId)) { for (const auto& item : m_aLangTable_Paragraph) { @@ -624,6 +623,20 @@ void SwSpellPopup::InitItemCommands(const css::uno::Sequence< OUString >& aSugge pMenu->SetItemCommand(MN_SET_PARA_RESET, ".uno:LanguageStatus?Language:string=Paragraph_RESET_LANGUAGES"); pMenu->SetItemCommand(MN_SET_PARA_MORE, ".uno:FontDialogForParagraph"); } + + OUString sCommandString = ".uno:AddToWordbook?Wordbook:string=" + m_aDicNameSingle; + m_xPopupMenu->SetItemCommand(m_nAddId, sCommandString); + m_xPopupMenu->SetItemCommand(m_nAddMenuId, sCommandString); + if (PopupMenu *pMenu = m_xPopupMenu->GetPopupMenu(m_nAddMenuId)) + { + for (sal_uInt16 i = 0, nItemCount = pMenu->GetItemCount(); i < nItemCount; ++i) + { + sal_uInt16 nItemId = pMenu->GetItemId(i); + OUString sDict = pMenu->GetItemText(nItemId); + sCommandString = ".uno:AddToWordbook?Wordbook:string=" + sDict; + pMenu->SetItemCommand(nItemId, sCommandString); + } + } } void SwSpellPopup::checkRedline()