summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <jluth@mail.com>2023-11-06 17:59:09 -0500
committerJustin Luth <jluth@mail.com>2023-11-15 20:05:23 +0100
commit33ec38c5333e0c71aa995292fbddc1a237979e32 (patch)
treefea1492f094d2a0f47ce7664d7e75fb83ef2981e
parentac0b3ff84522a388e0d44b09bf681af13a8288b2 (diff)
tdf#158031 editeng SID_HYPERLINK_GETLINK: use GetFieldAtSelection
This is just a clean-up commit to eliminate the pointless check of a field under the mouse pointer. It is up to the caller to make sure that the field is selected before calling the GETLINK function. GETLINK is primarily used to get the link from a field for the insert/edit hyperlink dialog. This function SHOULD NOT check before the cursor for the link, or else it will mess up the insert hyperlink if the user is inserting one field directly after another one. So, my changes here are just following what already existed in sw. Change-Id: Iaa7699d2e5f2fdf26996aede8b35bd4e18b21b98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159021 Reviewed-by: Justin Luth <jluth@mail.com> Tested-by: Jenkins
-rw-r--r--sc/source/ui/drawfunc/drtxtob.cxx3
-rw-r--r--sd/source/ui/view/drviewsf.cxx3
2 files changed, 4 insertions, 2 deletions
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index 863e97edc46b..78bafa27f63e 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -384,7 +384,8 @@ void ScDrawTextObjectBar::GetState( SfxItemSet& rSet )
if ( pOutView )
{
bool bField = false;
- const SvxFieldData* pField = pOutView->GetFieldAtCursor();
+ const SvxFieldItem* pFieldItem = pOutView->GetFieldAtSelection();
+ const SvxFieldData* pField = pFieldItem ? pFieldItem->GetField() : nullptr;
if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
{
aHLinkItem.SetName( pURLField->GetRepresentation() );
diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx
index 7a9d40bfc914..1844d796036d 100644
--- a/sd/source/ui/view/drviewsf.cxx
+++ b/sd/source/ui/view/drviewsf.cxx
@@ -88,7 +88,8 @@ void DrawViewShell::GetCtrlState(SfxItemSet &rSet)
if (pOLV)
{
- const SvxFieldData* pField = pOLV->GetFieldAtCursor();
+ const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
+ const SvxFieldData* pField = pFieldItem ? pFieldItem->GetField() : nullptr;
if( auto pUrlField = dynamic_cast< const SvxURLField *>( pField ) )
{
aHLinkItem.SetName(pUrlField->GetRepresentation());