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

Muhammet Kara (via logerrit) logerrit at kemper.freedesktop.org
Sat Feb 29 16:22:45 UTC 2020


 editeng/source/editeng/impedit.cxx |   41 +++++++++++++++++++++++++++++++------
 1 file changed, 35 insertions(+), 6 deletions(-)

New commits:
commit 7ce29004934ae7b75dce492bde5602358eb3dc5f
Author:     Muhammet Kara <muhammet.kara at collabora.com>
AuthorDate: Thu Dec 19 08:32:57 2019 +0300
Commit:     Muhammet Kara <muhammet.kara at collabora.com>
CommitDate: Sat Feb 29 17:22:07 2020 +0100

    lok: Resolves: Calc - selecting a hyperlink doesn't show link in dialog
    
    Change-Id: Ic4264fad8035029ba6593c91fa57efa772d394ca
    Reviewed-on: https://gerrit.libreoffice.org/85468
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89705
    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 842119a5b4ae..53900c16aa76 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -869,6 +869,23 @@ void ImpEditView::CalcAnchorPoint()
     }
 }
 
+namespace
+{
+
+// Build JSON message to be sent to Online
+OString buildHyperlinkJSON(const OUString& sText, const OUString& sLink)
+{
+    boost::property_tree::ptree aTree;
+    aTree.put("text", sText);
+    aTree.put("link", sLink);
+    std::stringstream aStream;
+    boost::property_tree::write_json(aStream, aTree, false);
+
+    return OString(aStream.str().c_str()).trim();
+}
+
+} // End of anon namespace
+
 void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
 {
     // No ShowCursor in an empty View ...
@@ -1111,12 +1128,24 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
                 {
                     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();
+                        sHyperlink = buildHyperlinkJSON(pUrlField->GetRepresentation(), pUrlField->GetURL());
+                    }
+                }
+                else if (GetEditSelection().HasRange())
+                {
+                    EditView* pActiveView = GetEditViewPtr();
+
+                    if (pActiveView)
+                    {
+                        const SvxFieldItem* pFieldItem = pActiveView->GetFieldAtSelection();
+                        if (pFieldItem)
+                        {
+                            const SvxFieldData* pField = pFieldItem->GetField();
+                            if ( auto pUrlField = dynamic_cast<const SvxURLField*>( pField) )
+                            {
+                                sHyperlink = buildHyperlinkJSON(pUrlField->GetRepresentation(), pUrlField->GetURL());
+                            }
+                        }
                     }
                 }
 


More information about the Libreoffice-commits mailing list