summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTünde Tóth <tundeth@gmail.com>2019-06-14 11:18:23 +0200
committerLászló Németh <nemeth@numbertext.org>2019-06-19 16:53:39 +0200
commit711ccfbac1ef28fdf03ceea820be8d3e9f8a4009 (patch)
tree59ead6653b9e2ed513e93e94bb2ba98a36eba1f0
parent88debc87462996b2ed61cea8150cdc42e550c2db (diff)
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@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org>
-rw-r--r--sc/source/ui/view/gridwin.cxx15
1 files changed, 12 insertions, 3 deletions
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 85b2caa970b3..dce120c95779 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 );