[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sc/source

Tünde Tóth (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 20 11:29:33 UTC 2019


 sc/source/ui/view/gridwin.cxx |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

New commits:
commit 547dfdd56f52e779a795aefc56c78836fdb01ca4
Author:     Tünde Tóth <tundeth at gmail.com>
AuthorDate: Fri Jun 14 11:18:23 2019 +0200
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Thu Jun 20 13:28:43 2019 +0200

    tdf#125309 XLSX editing: fix hyperlink at numeric data
    
    Long Cell-level hyperlink was clickable in neighboring cells.
    
    Change-Id: I3e2a4db170975d997f3fe471188fd0ead593ad6e
    Reviewed-on: https://gerrit.libreoffice.org/74033
    Reviewed-by: László Németh <nemeth at numbertext.org>
    Tested-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit 711ccfbac1ef28fdf03ceea820be8d3e9f8a4009)
    Reviewed-on: https://gerrit.libreoffice.org/74420
    Tested-by: Jenkins
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index e043cfc4d857..178db0157efb 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5252,7 +5252,17 @@ bool ScGridWindow::GetEditUrl( const Point& rPos,
         if (sURL.isEmpty())
             pTextObj = aCell.mpFormula->CreateURLObject();
         else
-            pTextObj = ScEditUtil::CreateURLObjectFromURL(rDoc, sURL, sURL);
+        {
+            OUString aRepres = sURL;
+
+            // TODO: text content of formatted numbers can be different
+            if (aCell.hasNumeric())
+                aRepres = OUString::number(aCell.getValue());
+            else if (aCell.meType == CELLTYPE_FORMULA)
+                aRepres = aCell.mpFormula->GetString().getString();
+
+            pTextObj = ScEditUtil::CreateURLObjectFromURL(rDoc, sURL, aRepres);
+        }
 
         if (pTextObj)
             pEngine->SetText(*pTextObj);
@@ -5277,8 +5287,7 @@ bool ScGridWindow::GetEditUrl( const Point& rPos,
     // There is one glitch when dealing with a hyperlink cell and
     // the cell content is NUMERIC. This defaults to right aligned and
     // we need to adjust accordingly.
-    if (aCell.meType == CELLTYPE_FORMULA && aCell.mpFormula->IsValue() &&
-        eHorJust == SvxCellHorJustify::Standard)
+    if (aCell.hasNumeric() && eHorJust == SvxCellHorJustify::Standard)
     {
         aLogicEdit.SetRight( aLogicEdit.Left() + nThisColLogic - 1 );
         aLogicEdit.SetLeft(  aLogicEdit.Right() - nTextWidth );


More information about the Libreoffice-commits mailing list