[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - editeng/source

Grzegorz Araminowicz (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 31 11:40:50 UTC 2019


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

New commits:
commit 5ebf83e24554b3a5a6c2398209d10f72d720c6d4
Author:     Grzegorz Araminowicz <grzegorz.araminowicz at collabora.com>
AuthorDate: Tue Oct 29 21:56:16 2019 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Oct 31 12:40:03 2019 +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>

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


More information about the Libreoffice-commits mailing list