diff options
Diffstat (limited to 'sc/source/ui/view/gridwin.cxx')
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 15 |
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 ); |