sc/source/ui/docshell/docsh4.cxx | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
New commits: commit 2250d2922b9342221acd88b823de90af0e2e1c40 Author: Sahil Gautam <sahil.gau...@collabora.com> AuthorDate: Thu Jul 31 08:11:20 2025 +0530 Commit: Michael Stahl <michael.st...@collabora.com> CommitDate: Fri Aug 1 16:58:22 2025 +0200 tdf#123159 don't show 'open hyperlink' in context menu unneccessarily 14396a5361ef72afc99033d4cac29aaeb1ffa2d8 extended .uno:OpenHyperlinkOnCursor to open all the hyperlinks in the current cell if not in edit mode (to make hyperlinks keyboard accessible), but i forgot to add `SID_OPEN_HYPERLINK` entry to `ScDocShell::GetState()` which caused this bug. now we check for both the cases if the cell has hyperlink(s) or not and disable the slot if it doesn't so that we don't re-run the logic in the execute function unneccessary. Change-Id: I378996d776903ab53d6370d19ace9d3c730f3e85 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188620 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@collabora.com> (cherry picked from commit fe5518051d1446627818c6e9704e404f04d3eb42) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188736 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Michael Stahl <michael.st...@collabora.com> diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 27d956f1e9f6..02391ac649a9 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -112,6 +112,7 @@ #include <helpids.h> #include <editeng/eeitem.hxx> #include <editeng/langitem.hxx> +#include <editeng/urlfieldhelper.hxx> #include <officecfg/Office/Common.hxx> #include <svx/xdef.hxx> @@ -2484,6 +2485,34 @@ void ScDocShell::GetState( SfxItemSet &rSet ) } } break; + + case SID_OPEN_HYPERLINK: + { + ScViewData* pViewData = GetViewData(); + if (!pViewData) + { + rSet.DisableItem(nWhich); + break; + } + + if (ScModule::get()->IsEditMode()) + { + if (EditView* pEditView = pViewData->GetEditView(pViewData->GetActivePart())) + if (!URLFieldHelper::IsCursorAtURLField(*pEditView, true)) + rSet.DisableItem(nWhich); + } + else + { + if (ScGridWindow* pWin = pViewData->GetActiveWin()) + { + std::vector<UrlData> vUrls = pWin->GetEditUrls(pViewData->GetCurPos()); + if (vUrls.empty()) + rSet.DisableItem(nWhich); + } + } + } + break; + case SID_ATTR_CHAR_FONTLIST: rSet.Put(SvxFontListItem(m_pImpl->pFontList.get(), nWhich)); break;