[Libreoffice-commits] core.git: editeng/source

Grzegorz Araminowicz (via logerrit) logerrit at kemper.freedesktop.org
Fri Feb 28 18:09:32 UTC 2020


 editeng/source/editeng/impedit.cxx |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 79f1490f93c3ebe933baba52c6a3eacf1e37fb61
Author:     Grzegorz Araminowicz <grzegorz.araminowicz at collabora.com>
AuthorDate: Tue Oct 29 21:56:16 2019 +0100
Commit:     Muhammet Kara <muhammet.kara at collabora.com>
CommitDate: Fri Feb 28 19:08:41 2020 +0100

    lok: send hyperlink info also in editeng
    
    Change-Id: I64691497778a59b519cafd656772d5e79cb132f3
    Reviewed-on: https://gerrit.libreoffice.org/81719
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89679
    Tested-by: Jenkins
    Reviewed-by: Muhammet Kara <muhammet.kara at collabora.com>

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);
             }
         }


More information about the Libreoffice-commits mailing list