diff options
author | Grzegorz Araminowicz <grzegorz.araminowicz@collabora.com> | 2019-10-29 21:56:16 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2019-10-31 12:40:03 +0100 |
commit | 5ebf83e24554b3a5a6c2398209d10f72d720c6d4 (patch) | |
tree | 4608050025b7d5497aa9f00e374bd7d14cb0b3f1 /editeng | |
parent | da7d8464b19b7bcda08bdee2db5d2a2b7e8bde07 (diff) |
lok: send hyperlink info also in editeng
Change-Id: I64691497778a59b519cafd656772d5e79cb132f3
Reviewed-on: https://gerrit.libreoffice.org/81719
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/impedit.cxx | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 8fd2c913c93e..6e4b2082c831 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -40,6 +40,7 @@ #include <comphelper/string.hxx> #include <comphelper/lok.hxx> #include <sfx2/lokhelper.hxx> +#include <boost/property_tree/json_parser.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -1122,7 +1123,21 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor ) Reference< linguistic2::XSpellChecker1 > xSpeller( pEditEngine->pImpEditEngine->GetSpeller() ); bool bIsWrong = xSpeller.is() && IsWrongSpelledWord(aPaM, /*bMarkIfWrong*/ false); - SfxLokHelper::notifyVisCursorInvalidation(mpViewShell, sRect, bIsWrong); + OString sHyperlink; + if (const SvxFieldItem* pFld = GetField(aPos, nullptr, nullptr)) + { + if (auto pUrlField = dynamic_cast<const SvxURLField*>(pFld->GetField())) + { + boost::property_tree::ptree aTree; + aTree.put("text", pUrlField->GetRepresentation()); + aTree.put("link", pUrlField->GetURL()); + std::stringstream aStream; + boost::property_tree::write_json(aStream, aTree, false); + sHyperlink = OString(aStream.str().c_str()).trim(); + } + } + + SfxLokHelper::notifyVisCursorInvalidation(mpViewShell, sRect, bIsWrong, sHyperlink); mpViewShell->NotifyOtherViews(LOK_CALLBACK_INVALIDATE_VIEW_CURSOR, "rectangle", sRect); } } |