summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorGrzegorz Araminowicz <grzegorz.araminowicz@collabora.com>2019-10-21 12:59:12 +0200
committerJan Holesovsky <kendy@collabora.com>2019-10-31 12:38:55 +0100
commitda7d8464b19b7bcda08bdee2db5d2a2b7e8bde07 (patch)
tree5f1fa7048f9ab5cb1efc6c79fab390f90083c0f3 /sw/source
parenta7dd46575d10dfdfdfa8b51976de1d67210e81e7 (diff)
lok: send hyperlink text and address under cursor
Change-Id: I827c51ae859b3d3649ec9d293b5ae8eaf4cbd630 Reviewed-on: https://gerrit.libreoffice.org/81219 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/crsr/viscrs.cxx17
1 files changed, 15 insertions, 2 deletions
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 2b14ffa27093..a1c1555858aa 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -241,18 +241,31 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell const * pViewShell)
}
}
+ OString sHyperlink;
+ SwContentAtPos aContentAtPos(IsAttrAtPos::InetAttr);
+ if (const_cast<SwCursorShell*>(m_pCursorShell)->GetContentAtPos(aRect.Pos(), aContentAtPos))
+ {
+ const SwFormatINetFormat* pItem = static_cast<const SwFormatINetFormat*>(aContentAtPos.aFnd.pAttr);
+ boost::property_tree::ptree aTree;
+ aTree.put("text", aContentAtPos.sStr);
+ aTree.put("link", pItem->GetValue());
+ std::stringstream aStream;
+ boost::property_tree::write_json(aStream, aTree, false);
+ sHyperlink = OString(aStream.str().c_str()).trim();
+ }
+
if (pViewShell)
{
if (pViewShell == m_pCursorShell->GetSfxViewShell())
{
- SfxLokHelper::notifyVisCursorInvalidation(pViewShell, sRect, bIsWrong);
+ SfxLokHelper::notifyVisCursorInvalidation(pViewShell, sRect, bIsWrong, sHyperlink);
}
else
SfxLokHelper::notifyOtherView(m_pCursorShell->GetSfxViewShell(), pViewShell, LOK_CALLBACK_INVALIDATE_VIEW_CURSOR, "rectangle", sRect);
}
else
{
- SfxLokHelper::notifyVisCursorInvalidation(m_pCursorShell->GetSfxViewShell(), sRect, bIsWrong);
+ SfxLokHelper::notifyVisCursorInvalidation(m_pCursorShell->GetSfxViewShell(), sRect, bIsWrong, sHyperlink);
SfxLokHelper::notifyOtherViews(m_pCursorShell->GetSfxViewShell(), LOK_CALLBACK_INVALIDATE_VIEW_CURSOR, "rectangle", sRect);
}
}