https://bugs.documentfoundation.org/show_bug.cgi?id=173221
--- Comment #2 from BogdanB <[email protected]> --- This is the code involved in this. Can you mention if there is something special when you click on hyperlink, you select first the hyperlink, or click before it, or something like this?... const SvxFieldItem* EditView::GetFieldAtSelection(bool bAlsoCheckBeforeCursor) const { bool* pIsBeforeCursor = bAlsoCheckBeforeCursor ? &bAlsoCheckBeforeCursor : nullptr; return GetFieldAtSelection(pIsBeforeCursor); } // If pIsBeforeCursor != nullptr, the position before the cursor will also be checked for a field // and pIsBeforeCursor will return true if that fallback field is returned. // If no field is returned, the value in pIsBeforeCursor is meaningless. const SvxFieldItem* EditView::GetFieldAtSelection(bool* pIsBeforeCursor) const { // a field is a dummy character - so it cannot span nodes or be a selection larger than 1 EditSelection aSel( getImpl().GetEditSelection() ); if (aSel.Min().GetNode() != aSel.Max().GetNode()) return nullptr; // normalize: min < max aSel.Adjust(getEditEngine().GetEditDoc()); const sal_Int32 nMinIndex = aSel.Min().GetIndex(); const sal_Int32 nMaxIndex = aSel.Max().GetIndex(); if (nMaxIndex > nMinIndex + 1) return nullptr; // Only when cursor is in font of field, no selection, // or only selecting field bool bAlsoCheckBeforeCursor = false; if (pIsBeforeCursor) { *pIsBeforeCursor = false; bAlsoCheckBeforeCursor = nMaxIndex == nMinIndex; } const SvxFieldItem* pFoundBeforeCursor = nullptr; const CharAttribList::AttribsType& rAttrs = aSel.Min().GetNode()->GetCharAttribs().GetAttribs(); for (const auto& rAttr: rAttrs) { if (rAttr->Which() == EE_FEATURE_FIELD) { DBG_ASSERT(dynamic_cast<const SvxFieldItem*>(rAttr->GetItem()), "No FieldItem..."); if (rAttr->GetStart() == nMinIndex) return static_cast<const SvxFieldItem*>(rAttr->GetItem()); // perhaps the cursor is behind the field? if (nMinIndex && rAttr->GetStart() == nMinIndex - 1) pFoundBeforeCursor = static_cast<const SvxFieldItem*>(rAttr->GetItem()); } } if (bAlsoCheckBeforeCursor) { *pIsBeforeCursor = /*(bool)*/pFoundBeforeCursor; return pFoundBeforeCursor; } return nullptr; } -- You are receiving this mail because: You are the assignee for the bug.
