summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editeng/source/editeng/editview.cxx10
-rw-r--r--editeng/source/misc/urlfieldhelper.cxx13
-rw-r--r--editeng/source/outliner/outlvw.cxx5
-rw-r--r--include/editeng/editview.hxx1
-rw-r--r--include/editeng/outliner.hxx4
-rw-r--r--sc/source/ui/drawfunc/drtxtob.cxx6
-rw-r--r--sc/source/ui/view/editsh.cxx4
-rw-r--r--sd/source/ui/view/drviews2.cxx6
-rw-r--r--sw/source/uibase/shells/drwtxtex.cxx4
9 files changed, 35 insertions, 18 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 250f77ffc68a..654f5f34077f 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -1225,7 +1225,7 @@ const SvxFieldItem* EditView::GetFieldAtSelection() const
return nullptr;
}
-const SvxFieldData* EditView::GetFieldAtCursor()
+void EditView::SelectFieldAtCursor()
{
const SvxFieldItem* pFieldItem = GetFieldAtSelection();
if (pFieldItem)
@@ -1246,9 +1246,15 @@ const SvxFieldData* EditView::GetFieldAtCursor()
{
aSel.nStartPos--;
SetSelection(aSel);
- pFieldItem = GetFieldAtSelection();
}
}
+}
+
+const SvxFieldData* EditView::GetFieldAtCursor()
+{
+ const SvxFieldItem* pFieldItem = GetFieldUnderMousePointer();
+ if (!pFieldItem)
+ pFieldItem = GetFieldAtSelection();
return pFieldItem ? pFieldItem->GetField() : nullptr;
}
diff --git a/editeng/source/misc/urlfieldhelper.cxx b/editeng/source/misc/urlfieldhelper.cxx
index ce7217612ead..ea1a4f02336f 100644
--- a/editeng/source/misc/urlfieldhelper.cxx
+++ b/editeng/source/misc/urlfieldhelper.cxx
@@ -31,15 +31,10 @@ bool URLFieldHelper::IsCursorAtURLField(OutlinerView* pOLV)
if (!pOLV)
return false;
- const SvxFieldItem* pFieldItem = pOLV->GetFieldUnderMousePointer();
- if (!pFieldItem)
- pFieldItem = pOLV->GetFieldAtSelection();
- if (pFieldItem)
- {
- const SvxFieldData* pField = pFieldItem->GetField();
- if (dynamic_cast<const SvxURLField*>(pField))
- return true;
- }
+ const SvxFieldData* pField = pOLV->GetFieldAtCursor();
+ if (dynamic_cast<const SvxURLField*>(pField))
+ return true;
+
return false;
}
diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx
index 670807932277..19bcfe31688f 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -1322,6 +1322,11 @@ const SvxFieldData* OutlinerView::GetFieldAtCursor()
return pEditView->GetFieldAtCursor();
}
+void OutlinerView::SelectFieldAtCursor()
+{
+ pEditView->SelectFieldAtCursor();
+}
+
void OutlinerView::SetInvalidateMore( sal_uInt16 nPixel )
{
pEditView->SetInvalidateMore( nPixel );
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index 9adb6bacdca8..a47da81cb8a4 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -279,6 +279,7 @@ public:
const SvxFieldItem* GetFieldAtSelection() const;
/// Select and return the field at the current cursor position
const SvxFieldData* GetFieldAtCursor();
+ void SelectFieldAtCursor();
void SetInvalidateMore( sal_uInt16 nPixel );
sal_uInt16 GetInvalidateMore() const;
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index 9d4037d6885c..787434031b33 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -301,8 +301,10 @@ public:
void InsertField( const SvxFieldItem& rFld );
const SvxFieldItem* GetFieldUnderMousePointer() const;
const SvxFieldItem* GetFieldAtSelection() const;
- /// Select and return the field at the current cursor position
+ /// Return the field at the current cursor position or nullptr if no field found
const SvxFieldData* GetFieldAtCursor();
+ /// Select the field at the current cursor position
+ void SelectFieldAtCursor();
/** enables bullets for the selected paragraphs if the bullets/numbering of the first paragraph is off
or disables bullets/numbering for the selected paragraphs if the bullets/numbering of the first paragraph is on
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index 334f1933a88b..92910b2dea87 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -274,7 +274,7 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq )
bool bDone = false;
if (eMode == HLINK_DEFAULT || eMode == HLINK_FIELD)
{
- pOutView->GetFieldAtCursor();
+ pOutView->SelectFieldAtCursor();
// insert new field
SvxURLField aURLField( rURL, rName, SvxURLFormat::Repr );
@@ -306,7 +306,7 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq )
case SID_EDIT_HYPERLINK:
{
// Ensure the field is selected first
- pOutView->GetFieldAtCursor();
+ pOutView->SelectFieldAtCursor();
pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->Execute(SID_HYPERLINK_DIALOG);
}
break;
@@ -325,6 +325,8 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq )
case SID_REMOVE_HYPERLINK:
{
+ // Ensure the field is selected first
+ pOutView->SelectFieldAtCursor();
URLFieldHelper::RemoveURLField(pOutliner, pOutView);
}
break;
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 932bc0d6fda6..8cda154cd702 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -627,7 +627,7 @@ void ScEditShell::Execute( SfxRequest& rReq )
case SID_EDIT_HYPERLINK:
{
// Ensure the field is selected first
- pEditView->GetFieldAtCursor();
+ pEditView->SelectFieldAtCursor();
pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->Execute(
SID_HYPERLINK_DIALOG);
}
@@ -646,7 +646,7 @@ void ScEditShell::Execute( SfxRequest& rReq )
case SID_REMOVE_HYPERLINK:
{
// Ensure the field is selected first
- pEditView->GetFieldAtCursor();
+ pEditView->SelectFieldAtCursor();
const SvxURLField* pURLField = GetURLField();
if (pURLField)
{
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index ed6ca12113e3..e81ff4b62bce 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -1154,6 +1154,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
{
if (mpDrawView->IsTextEdit())
{
+ // First make sure the field is selected
+ OutlinerView* pOutView = mpDrawView->GetTextEditOutlinerView();
+ if (pOutView)
+ pOutView->SelectFieldAtCursor();
URLFieldHelper::RemoveURLField(mpDrawView->GetTextEditOutliner(),
mpDrawView->GetTextEditOutlinerView());
}
@@ -2119,7 +2123,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
// Ensure the field is selected first
OutlinerView* pOutView = mpDrawView->GetTextEditOutlinerView();
if (pOutView)
- pOutView->GetFieldAtCursor();
+ pOutView->SelectFieldAtCursor();
GetViewFrame()->GetDispatcher()->Execute( SID_HYPERLINK_DIALOG );
diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx
index 2f5ae1a43019..2354f2a58489 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -490,13 +490,15 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
case SID_EDIT_HYPERLINK:
{
// Ensure the field is selected first
- pOLV->GetFieldAtCursor();
+ pOLV->SelectFieldAtCursor();
GetView().GetViewFrame()->GetDispatcher()->Execute(SID_HYPERLINK_DIALOG);
}
break;
case SID_REMOVE_HYPERLINK:
{
+ // Ensure the field is selected first
+ pOLV->SelectFieldAtCursor();
URLFieldHelper::RemoveURLField(pSdrView->GetTextEditOutliner(),
pOLV);
}