diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-07-12 10:37:41 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-07-15 08:53:22 +0200 |
commit | 86cb2a1f98c0585d2121e6ae34fe62f072ef9a63 (patch) | |
tree | 0942e25c030c99bf7d2efd2542b40483a2e348ef /sw | |
parent | 349c525fd30121ad2148f6061d155815b8c83303 (diff) |
tdf#112543 Add Edit/Remove hyperlink to text boxes/shapes in Writer
Change-Id: I9052387cf39135c2324b9db03662dc0365323400
Reviewed-on: https://gerrit.libreoffice.org/75479
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/sdi/drwtxtsh.sdi | 12 | ||||
-rw-r--r-- | sw/source/uibase/shells/drwtxtex.cxx | 25 | ||||
-rw-r--r-- | sw/uiconfig/swriter/popupmenu/drawtext.xml | 3 |
3 files changed, 39 insertions, 1 deletions
diff --git a/sw/sdi/drwtxtsh.sdi b/sw/sdi/drwtxtsh.sdi index 2046fdf585da..c5a0e6477c0e 100644 --- a/sw/sdi/drwtxtsh.sdi +++ b/sw/sdi/drwtxtsh.sdi @@ -546,6 +546,18 @@ interface TextDrawText [ StateMethod = StateInsert ; ] + FN_EDIT_HYPERLINK + [ + ExecMethod = Execute ; + StateMethod = GetState; + DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; + ] + FN_REMOVE_HYPERLINK + [ + ExecMethod = Execute ; + StateMethod = GetState; + DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; + ] SID_TRANSLITERATE_SENTENCE_CASE [ ExecMethod = ExecTransliteration; diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index 16f5ca169daf..898cc8743fe5 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -47,6 +47,7 @@ #include <editeng/contouritem.hxx> #include <editeng/postitem.hxx> #include <editeng/frmdiritem.hxx> +#include <editeng/urlfieldhelper.hxx> #include <svx/svdoutl.hxx> #include <sfx2/viewfrm.hxx> #include <svl/stritem.hxx> @@ -485,6 +486,21 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) } break; + case FN_EDIT_HYPERLINK: + { + // Ensure the field is selected first + pOLV->GetFieldAtCursor(); + GetView().GetViewFrame()->GetDispatcher()->Execute(SID_HYPERLINK_DIALOG); + } + break; + + case FN_REMOVE_HYPERLINK: + { + URLFieldHelper::RemoveURLField(pSdrView->GetTextEditOutliner(), + pOLV); + } + break; + case SID_TEXTDIRECTION_LEFT_TO_RIGHT: case SID_TEXTDIRECTION_TOP_TO_BOTTOM: // Shell switch! @@ -884,12 +900,19 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) rSet.DisableItem(nWhich); } break; + case FN_REMOVE_HYPERLINK: + case FN_EDIT_HYPERLINK: + { + if (!URLFieldHelper::IsCursorAtURLField(pOLV)) + rSet.DisableItem(nWhich); + } + break; default: nSlotId = 0; // don't know this slot break; } - if (nSlotId) + if (nSlotId && bFlag) rSet.Put(SfxBoolItem(nWhich, bFlag)); nWhich = aIter.NextWhich(); diff --git a/sw/uiconfig/swriter/popupmenu/drawtext.xml b/sw/uiconfig/swriter/popupmenu/drawtext.xml index e13990ca0af9..7536d60f7fd7 100644 --- a/sw/uiconfig/swriter/popupmenu/drawtext.xml +++ b/sw/uiconfig/swriter/popupmenu/drawtext.xml @@ -25,5 +25,8 @@ <menu:menuseparator/> <menu:menuitem menu:id=".uno:ThesaurusFromContext"/> <menu:menuseparator/> + <menu:menuitem menu:id=".uno:EditHyperlink"/> + <menu:menuitem menu:id=".uno:RemoveHyperlink"/> + <menu:menuseparator/> <menu:menuitem menu:id=".uno:ResetAttributes"/> </menu:menupopup> |