summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorGrzegorz Araminowicz <grzegorz.araminowicz@collabora.com>2019-10-29 21:56:16 +0100
committerAndras Timar <andras.timar@collabora.com>2020-05-17 10:40:01 +0200
commit91f306bdb27042615b7ccef78d7892932a6b6b2d (patch)
treeb1a59552fc7277e41bbb61a14b74e40ddcc0df2f /editeng
parenta13fa8df780f4270a744347f3ce7b0355abf394f (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> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89679 Tested-by: Jenkins Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/impedit.cxx17
1 files changed, 16 insertions, 1 deletions
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 575fc087e47d..ed67fcb887d3 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -43,6 +43,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <sfx2/lokhelper.hxx>
+#include <boost/property_tree/json_parser.hpp>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -1106,7 +1107,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);
}
}