From e9356f9ced3167cd927e98617bab54048cc63073 Mon Sep 17 00:00:00 2001 From: Gülşah Köse Date: Mon, 12 Dec 2022 14:22:53 +0300 Subject: tdf#152483 Fix the insert hyperlink behaviour on Calc Cursor invalidation message shouldn't carry a hyperlink info to online side if there is no hyperlink under the cursor Change-Id: Ibdb6e32d029e101212d03bc117a5a14a712822ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143986 Tested-by: Jenkins Reviewed-by: Dennis Francis --- editeng/source/editeng/impedit.cxx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'editeng') diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 1a425cbe64f4..1223d717f5e5 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -1415,19 +1416,17 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor ) // is cursor at a misspelled word ? Reference< linguistic2::XSpellChecker1 > xSpeller( pEditEngine->pImpEditEngine->GetSpeller() ); bool bIsWrong = xSpeller.is() && IsWrongSpelledWord(aPaM, /*bMarkIfWrong*/ false); + EditView* pActiveView = GetEditViewPtr(); boost::property_tree::ptree aHyperlinkTree; - if (const SvxFieldItem* pFld = GetField(aPos, nullptr, nullptr)) + if (URLFieldHelper::IsCursorAtURLField(*pActiveView)) { - if (auto pUrlField = dynamic_cast(pFld->GetField())) - { - aHyperlinkTree = getHyperlinkPropTree(pUrlField->GetRepresentation(), pUrlField->GetURL()); - } + if (const SvxFieldItem* pFld = GetField(aPos, nullptr, nullptr)) + if (auto pUrlField = dynamic_cast(pFld->GetField())) + aHyperlinkTree = getHyperlinkPropTree(pUrlField->GetRepresentation(), pUrlField->GetURL()); } else if (GetEditSelection().HasRange()) { - EditView* pActiveView = GetEditViewPtr(); - if (pActiveView) { const SvxFieldItem* pFieldItem = pActiveView->GetFieldAtSelection(); -- cgit