include/svx/svxids.hrc | 4 - officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu | 5 - officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu | 13 +++ sc/sdi/drtxtob.sdi | 4 - sc/sdi/editsh.sdi | 4 - sc/source/ui/drawfunc/drtxtob.cxx | 22 +++++- sc/source/ui/view/editsh.cxx | 20 +++++ sc/uiconfig/scalc/popupmenu/celledit.xml | 2 sc/uiconfig/scalc/popupmenu/drawtext.xml | 2 sd/inc/app.hrc | 2 sd/sdi/_drvwsh.sdi | 5 + sd/source/ui/view/drviews2.cxx | 18 +++++ sd/source/ui/view/drviewsf.cxx | 8 ++ sd/uiconfig/sdraw/popupmenu/drawtext.xml | 2 sd/uiconfig/simpress/popupmenu/drawtext.xml | 2 svx/sdi/svx.sdi | 36 ++++++++++ 16 files changed, 139 insertions(+), 10 deletions(-)
New commits: commit c7952cb2646f7c385b68f8e7acce5cf2713c567c Author: Gökay Şatır <gokaysa...@collabora.com> AuthorDate: Tue Oct 27 13:41:32 2020 +0300 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Fri Oct 30 14:56:30 2020 +0100 Calc & Impress & Draw: Hyperlink features are added into context menu. Change-Id: I9e7532d68469144ae104fabcff986a023544d076 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104866 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc index ba043ae4752c..53d662859fab 100644 --- a/include/svx/svxids.hrc +++ b/include/svx/svxids.hrc @@ -998,13 +998,15 @@ class SfxStringItem; #define SID_TOGGLE_RESOLVED_NOTES ( SID_SVX_START + 1189 ) +#define SID_EDIT_HYPERLINK ( SID_SVX_START + 1192 ) #define SID_COPY_HYPERLINK_LOCATION ( SID_SVX_START + 1193 ) +#define SID_REMOVE_HYPERLINK ( SID_SVX_START + 1194 ) // #define SID_SHOW_SIDEBAR ( SID_SVX_START + 1190 ) -> sfxsids.hrc // #define SID_HIDE_SIDEBAR ( SID_SVX_START + 1191 ) -> sfxsids.hrc // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id -#define SID_SVX_FIRSTFREE ( SID_HIDE_SIDEBAR + 1 ) +#define SID_SVX_FIRSTFREE ( SID_REMOVE_HYPERLINK + 1 ) // Overflow check for slot IDs #if SID_SVX_FIRSTFREE > SID_SVX_END diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu index 6390f895c2d9..28553f672a30 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu @@ -680,11 +680,6 @@ <value xml:lang="en-US">To C~ontour</value> </prop> </node> - <node oor:name=".uno:EditHyperlink" oor:op="replace"> - <prop oor:name="Label" oor:type="xs:string"> - <value xml:lang="en-US">~Hyperlink...</value> - </prop> - </node> <node oor:name=".uno:HideLastLevel" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">~Hide Last Level</value> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index 8f5af73972cf..0c46bd02366c 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -3250,11 +3250,24 @@ <value>1</value> </prop> </node> + <node oor:name=".uno:EditHyperlink" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">~Hyperlink</value> + </prop> + <prop oor:name="PopupLabel" oor:type="xs:string"> + <value xml:lang="en-US">Edit Hyperlink...</value> + </prop> + </node> <node oor:name=".uno:CopyHyperlinkLocation" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">Copy Hyperlink Location</value> </prop> </node> + <node oor:name=".uno:RemoveHyperlink" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Remove Hyperlink</value> + </prop> + </node> <node oor:name=".uno:OpenSmartTagMenuOnCursor" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">Smart Tags</value> diff --git a/sc/sdi/drtxtob.sdi b/sc/sdi/drtxtob.sdi index 3f42f7d05550..fc0fefff65c0 100644 --- a/sc/sdi/drtxtob.sdi +++ b/sc/sdi/drtxtob.sdi @@ -129,8 +129,10 @@ interface TableDrawText SID_HYPERLINK_SETLINK [ ExecMethod = Execute; Export = FALSE; ] SID_HYPERLINK_GETLINK [ StateMethod = GetState; Export = FALSE; ] - SID_OPEN_HYPERLINK [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] + SID_OPEN_HYPERLINK [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_COPY_HYPERLINK_LOCATION [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] + SID_EDIT_HYPERLINK [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] + SID_REMOVE_HYPERLINK [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_ENABLE_HYPHENATION [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_TEXTDIRECTION_LEFT_TO_RIGHT [ ExecMethod = Execute; StateMethod = GetAttrState; Export = FALSE; ] diff --git a/sc/sdi/editsh.sdi b/sc/sdi/editsh.sdi index 9cda7e3f5dd4..13d661f8b9a9 100644 --- a/sc/sdi/editsh.sdi +++ b/sc/sdi/editsh.sdi @@ -78,8 +78,10 @@ interface TableText SID_HYPERLINK_SETLINK [ ExecMethod = Execute; Export = FALSE; ] SID_HYPERLINK_GETLINK [ StateMethod = GetState; Export = FALSE; ] - SID_OPEN_HYPERLINK [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] + SID_OPEN_HYPERLINK [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_COPY_HYPERLINK_LOCATION [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] + SID_EDIT_HYPERLINK [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] + SID_REMOVE_HYPERLINK [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_TRANSLITERATE_SENTENCE_CASE [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] SID_TRANSLITERATE_TITLE_CASE [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] SID_TRANSLITERATE_TOGGLE_CASE [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index 550e64b4516c..1541f73d2def 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -35,6 +35,7 @@ #include <editeng/lrspitem.hxx> #include <editeng/lspcitem.hxx> #include <editeng/ulspitem.hxx> +#include <editeng/urlfieldhelper.hxx> #include <svx/hlnkitem.hxx> #include <svx/svdoutl.hxx> #include <editeng/unolingu.hxx> @@ -324,6 +325,14 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq ) } break; + case SID_EDIT_HYPERLINK: + { + // Ensure the field is selected first + pOutView->SelectFieldAtCursor(); + pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->Execute(SID_HYPERLINK_DIALOG); + } + break; + case SID_COPY_HYPERLINK_LOCATION: { const SvxFieldData* pField = pOutView->GetFieldAtCursor(); @@ -336,6 +345,13 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq ) } break; + case SID_REMOVE_HYPERLINK: + { + // Ensure the field is selected first + URLFieldHelper::RemoveURLField(pOutView->GetEditView()); + } + break; + case SID_ENABLE_HYPHENATION: case SID_TEXTDIRECTION_LEFT_TO_RIGHT: case SID_TEXTDIRECTION_TOP_TO_BOTTOM: @@ -415,7 +431,9 @@ void ScDrawTextObjectBar::GetState( SfxItemSet& rSet ) } if ( rSet.GetItemState( SID_OPEN_HYPERLINK ) != SfxItemState::UNKNOWN - || rSet.GetItemState(SID_COPY_HYPERLINK_LOCATION) != SfxItemState::UNKNOWN) + || rSet.GetItemState(SID_EDIT_HYPERLINK) != SfxItemState::UNKNOWN + || rSet.GetItemState(SID_COPY_HYPERLINK_LOCATION) != SfxItemState::UNKNOWN + || rSet.GetItemState(SID_REMOVE_HYPERLINK) != SfxItemState::UNKNOWN) { SdrView* pView = pViewData->GetScDrawView(); OutlinerView* pOutView = pView->GetTextEditOutlinerView(); @@ -433,6 +451,8 @@ void ScDrawTextObjectBar::GetState( SfxItemSet& rSet ) { rSet.DisableItem( SID_OPEN_HYPERLINK ); rSet.DisableItem( SID_COPY_HYPERLINK_LOCATION ); + rSet.DisableItem( SID_EDIT_HYPERLINK ); + rSet.DisableItem( SID_REMOVE_HYPERLINK ); } } diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index f03ff89f10e1..09589a2b2382 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -35,6 +35,7 @@ #include <editeng/flditem.hxx> #include <editeng/flstitem.hxx> #include <editeng/fontitem.hxx> +#include <editeng/urlfieldhelper.hxx> #include <svx/hlnkitem.hxx> #include <vcl/EnumContext.hxx> #include <editeng/postitem.hxx> @@ -45,6 +46,7 @@ #include <editeng/wghtitem.hxx> #include <sfx2/basedlgs.hxx> #include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> #include <sfx2/msg.hxx> #include <sfx2/objface.hxx> #include <sfx2/objsh.hxx> @@ -625,6 +627,16 @@ void ScEditShell::Execute( SfxRequest& rReq ) return; } break; + + case SID_EDIT_HYPERLINK: + { + // Ensure the field is selected first + pEditView->SelectFieldAtCursor(); + pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->Execute( + SID_HYPERLINK_DIALOG); + } + break; + case SID_COPY_HYPERLINK_LOCATION: { const SvxFieldData* pField = pEditView->GetFieldAtCursor(); @@ -644,6 +656,12 @@ void ScEditShell::Execute( SfxRequest& rReq ) } break; + case SID_REMOVE_HYPERLINK: + { + URLFieldHelper::RemoveURLField(*pEditView); + } + break; + case FN_INSERT_SOFT_HYPHEN: lclInsertCharacter( pTableView, pTopView, CHAR_SHY ); break; @@ -765,7 +783,9 @@ void ScEditShell::GetState( SfxItemSet& rSet ) break; case SID_OPEN_HYPERLINK: + case SID_EDIT_HYPERLINK: case SID_COPY_HYPERLINK_LOCATION: + case SID_REMOVE_HYPERLINK: { if ( !GetURLField() ) rSet.DisableItem( nWhich ); diff --git a/sc/uiconfig/scalc/popupmenu/celledit.xml b/sc/uiconfig/scalc/popupmenu/celledit.xml index bc111a951f49..26d9b78ce922 100644 --- a/sc/uiconfig/scalc/popupmenu/celledit.xml +++ b/sc/uiconfig/scalc/popupmenu/celledit.xml @@ -26,7 +26,9 @@ <menu:menuseparator/> <menu:menuitem menu:id=".uno:FontDialog"/> <menu:menuitem menu:id=".uno:OpenHyperlinkOnCursor"/> + <menu:menuitem menu:id=".uno:EditHyperlink"/> <menu:menuitem menu:id=".uno:CopyHyperlinkLocation"/> + <menu:menuitem menu:id=".uno:RemoveHyperlink"/> <menu:menuitem menu:id=".uno:ThesaurusFromContext"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:ResetAttributes"/> diff --git a/sc/uiconfig/scalc/popupmenu/drawtext.xml b/sc/uiconfig/scalc/popupmenu/drawtext.xml index 46aa721180cf..62a4f9141cee 100644 --- a/sc/uiconfig/scalc/popupmenu/drawtext.xml +++ b/sc/uiconfig/scalc/popupmenu/drawtext.xml @@ -24,7 +24,9 @@ <menu:menuitem menu:id=".uno:ParagraphDialog"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:OpenHyperlinkOnCursor"/> + <menu:menuitem menu:id=".uno:EditHyperlink"/> <menu:menuitem menu:id=".uno:CopyHyperlinkLocation"/> + <menu:menuitem menu:id=".uno:RemoveHyperlink"/> <menu:menuitem menu:id=".uno:ThesaurusFromContext"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:StandardTextAttributes"/> diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc index 9fc0f63a1f80..ac20c584e430 100644 --- a/sd/inc/app.hrc +++ b/sd/inc/app.hrc @@ -400,7 +400,7 @@ #define SID_CONVERT_TO_METAFILE (SID_SD_START+379) // FREE #define SID_CONVERT_TO_CONTOUR (SID_SD_START+381) -#define SID_EDIT_HYPERLINK (SID_SD_START+382) + // FREE #define ID_VAL_DUMMY1 (SID_SD_START+383) #define ID_VAL_DUMMY2 (SID_SD_START+384) #define ID_VAL_DUMMY3 (SID_SD_START+385) diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi index c6165d1e0456..cf4fa5abebf5 100644 --- a/sd/sdi/_drvwsh.sdi +++ b/sd/sdi/_drvwsh.sdi @@ -2267,6 +2267,11 @@ interface DrawView ExecMethod = FuTemporary ; StateMethod = GetMenuState ; ] + SID_REMOVE_HYPERLINK // ole : no, status : ? + [ + ExecMethod = FuTemporary ; + StateMethod = GetAttrState ; + ] SID_HIDE_LAST_LEVEL // ole : no, status : ? [ ExecMethod = FuTemporary ; diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index e49add9e34e5..ec1dda3cdb6e 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -45,6 +45,7 @@ #include <editeng/section.hxx> #include <editeng/editobj.hxx> #include <editeng/CustomPropertyField.hxx> +#include <editeng/urlfieldhelper.hxx> #include <o3tl/make_unique.hxx> #include <sal/log.hxx> @@ -2169,6 +2170,23 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) } break; + case SID_REMOVE_HYPERLINK: + { + if (mpDrawView->IsTextEdit()) + { + // First make sure the field is selected + OutlinerView* pOutView = mpDrawView->GetTextEditOutlinerView(); + if (pOutView) + { + pOutView->SelectFieldAtCursor(); + URLFieldHelper::RemoveURLField(pOutView->GetEditView()); + } + } + Cancel(); + rReq.Done (); + } + break; + case SID_OPEN_HYPERLINK: { OutlinerView* pOutView = mpDrawView->GetTextEditOutlinerView(); diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index a0f5909d5c36..f9f941e78cf5 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -60,6 +60,7 @@ #include <editeng/escapementitem.hxx> #include <editeng/numitem.hxx> #include <editeng/adjustitem.hxx> +#include <editeng/urlfieldhelper.hxx> #include <svx/nbdtmgfact.hxx> #include <svx/nbdtmg.hxx> #include <memory> @@ -514,6 +515,13 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) } break; + case SID_REMOVE_HYPERLINK: + { + if (!URLFieldHelper::IsCursorAtURLField(mpDrawView->GetTextEditOutlinerView())) + rSet.DisableItem(nWhich); + } + break; + case SID_STYLE_DRAGHIERARCHIE: { std::unique_ptr<SfxPoolItem> pItem; diff --git a/sd/uiconfig/sdraw/popupmenu/drawtext.xml b/sd/uiconfig/sdraw/popupmenu/drawtext.xml index 75fd87f33834..4e667653973f 100644 --- a/sd/uiconfig/sdraw/popupmenu/drawtext.xml +++ b/sd/uiconfig/sdraw/popupmenu/drawtext.xml @@ -19,7 +19,9 @@ <menu:menuitem menu:id=".uno:ParagraphDialog"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:OpenHyperlinkOnCursor"/> + <menu:menuitem menu:id=".uno:EditHyperlink"/> <menu:menuitem menu:id=".uno:CopyHyperlinkLocation"/> + <menu:menuitem menu:id=".uno:RemoveHyperlink"/> <menu:menuitem menu:id=".uno:ThesaurusFromContext"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:SetDefault"/> diff --git a/sd/uiconfig/simpress/popupmenu/drawtext.xml b/sd/uiconfig/simpress/popupmenu/drawtext.xml index f8d24606bd80..c353f4240373 100644 --- a/sd/uiconfig/simpress/popupmenu/drawtext.xml +++ b/sd/uiconfig/simpress/popupmenu/drawtext.xml @@ -18,7 +18,9 @@ <menu:menuitem menu:id=".uno:ParagraphDialog"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:OpenHyperlinkOnCursor"/> + <menu:menuitem menu:id=".uno:EditHyperlink"/> <menu:menuitem menu:id=".uno:CopyHyperlinkLocation"/> + <menu:menuitem menu:id=".uno:RemoveHyperlink"/> <menu:menuitem menu:id=".uno:ThesaurusFromContext"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:SetDefault"/> diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 04a0908e89a0..5890b9f1aca3 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -12105,6 +12105,42 @@ SfxVoidItem CopyHyperlinkLocation SID_COPY_HYPERLINK_LOCATION GroupId = SfxGroupId::Edit; ] +SfxVoidItem EditHyperlink SID_EDIT_HYPERLINK +() +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::Edit; +] + +SfxVoidItem RemoveHyperlink SID_REMOVE_HYPERLINK +() +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::Edit; +] + SfxVoidItem SpellCheckIgnore SID_SPELLCHECK_IGNORE (SfxStringItem Type FN_PARAM_1) [ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits