diff options
author | rash419 <rashesh.padia@collabora.com> | 2022-09-15 18:02:06 +0530 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2022-12-02 08:33:57 +0000 |
commit | c88d891cead135731a18d025698c1213de98b573 (patch) | |
tree | 8564fc3e9d4ca1f048804ea2ee65e3e3a8001f33 /sw/source/uibase/shells | |
parent | 4affd6a5472c71d9070402d3b84b9b3d2865f9a7 (diff) |
svx: extended SvxHyperlinkItem to have a new property sReplacementText
this property is use to pass text that needs to be replaced when
executing uno:SetHyperlink command in online for inserting the mention
Signed-off-by: rash419 <rashesh.padia@collabora.com>
Change-Id: I48fba347bda0652f7b657524f23c2dd837cd8186
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140015
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143556
Tested-by: Jenkins
Diffstat (limited to 'sw/source/uibase/shells')
-rw-r--r-- | sw/source/uibase/shells/textfld.cxx | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index 90a620b1959f..80a955d2da16 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -1113,6 +1113,7 @@ void SwTextShell::InsertHyperlink(const SvxHyperlinkItem& rHlnkItem) const OUString& rName = rHlnkItem.GetName(); const OUString& rURL = rHlnkItem.GetURL(); const OUString& rTarget = rHlnkItem.GetTargetFrame(); + const OUString& rReplacementText = rHlnkItem.GetReplacementText(); sal_uInt16 nType = o3tl::narrowing<sal_uInt16>(rHlnkItem.GetInsertMode()); nType &= ~HLINK_HTMLMODE; const SvxMacroTableDtor* pMacroTable = rHlnkItem.GetMacroTable(); @@ -1151,7 +1152,19 @@ void SwTextShell::InsertHyperlink(const SvxHyperlinkItem& rHlnkItem) aINetFormat.SetMacro(SvMacroItemId::OnMouseOut, *pMacro); } rSh.SttSelect(); - rSh.InsertURL( aINetFormat, rName, true ); + // inserting mention + if (comphelper::LibreOfficeKit::isActive() && !rReplacementText.isEmpty()) + { + SwPaM* pCursorPos = rSh.GetCursor(); + // move cursor backwards to select @mention + for(int i=0; i < rReplacementText.getLength(); i++) + pCursorPos->Move(fnMoveBackward); + rSh.InsertURL( aINetFormat, rName, false ); + } + else + { + rSh.InsertURL( aINetFormat, rName, true ); + } rSh.EndSelect(); } break; |