sc/source/ui/docshell/docsh4.cxx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
New commits: commit fe5518051d1446627818c6e9704e404f04d3eb42 Author: Sahil Gautam <sahil.gau...@collabora.com> AuthorDate: Thu Jul 31 08:11:20 2025 +0530 Commit: Sahil Gautam <sahil.gau...@collabora.com> CommitDate: Thu Jul 31 22:55:54 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> diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 230327f357d3..a4f7d23359bb 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -110,6 +110,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> @@ -2293,6 +2294,33 @@ 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;