summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorGrzegorz Araminowicz <grzegorz.araminowicz@collabora.com>2019-10-29 21:56:16 +0100
committerMuhammet Kara <muhammet.kara@collabora.com>2020-02-28 19:08:41 +0100
commit79f1490f93c3ebe933baba52c6a3eacf1e37fb61 (patch)
tree79ae373b541a6de4dd5ad0ff4cb3b5946ffb6848 /editeng
parent93fe47e113628925b3caf33502326c7b136263a1 (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 6107f950608a..842119a5b4ae 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -40,6 +40,7 @@
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#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;
@@ -1105,7 +1106,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);
}
}