sc/source/core/data/formulacell.cxx | 7 +++++++ sc/source/core/tool/interpr5.cxx | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+)
New commits: commit 459f9de8a87373c826eadab142850cc3fa578fca Author: Eike Rathke <er...@redhat.com> AuthorDate: Fri Oct 15 21:56:34 2021 +0200 Commit: Eike Rathke <er...@redhat.com> CommitDate: Sat Oct 16 01:52:51 2021 +0200 Resolves: tdf#145085 HYPERLINK() do not force a 2nd row URL cell in array mode ... but fake a 1-row result dimension instead. However, keep the behaviour that if a 2-rows array was entered the 2nd row displays the URL and not the repeated cell text. Change-Id: I4800715a4028c647b763c6d729759ff4c099748f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123680 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Jenkins diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 74eae869966f..740e5fe02157 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -1075,6 +1075,13 @@ void ScFormulaCell::GetResultDimensions( SCSIZE& rCols, SCSIZE& rRows ) if (pMat) { pMat->GetDimensions( rCols, rRows ); + if (pCode->IsHyperLink()) + { + // Row 2 element is the URL that is not to be displayed and the + // result dimension not to be extended. + assert(rRows == 2); + rRows = 1; + } return; } } diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index d8b58618a0c0..74807696e055 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -3239,6 +3239,25 @@ void ScInterpreter::ScMatRef() pMat->GetDimensions( nCols, nRows ); SCSIZE nC = static_cast<SCSIZE>(aPos.Col() - aAdr.Col()); SCSIZE nR = static_cast<SCSIZE>(aPos.Row() - aAdr.Row()); +#if 0 + // XXX: this could be an additional change for tdf#145085 to not + // display the URL in a voluntary entered 2-rows array context. + // However, that might as well be used on purpose to implement a check + // on the URL, which existing documents may have done, the more that + // before the accompanying change of + // ScFormulaCell::GetResultDimensions() the cell array was forced to + // two rows. Do not change without compelling reason. Note that this + // repeating top cell is what Excel implements, but it has no + // additional value so probably isn't used there. Exporting to and + // using in Excel though will lose this capability. + if (aCell.mpFormula->GetCode()->IsHyperLink()) + { + // Row 2 element is the URL that is not to be displayed, fake a + // 1-row cell-text-only matrix that is repeated. + assert(nRows == 2); + nR = 0; + } +#endif if ((nCols <= nC && nCols != 1) || (nRows <= nR && nRows != 1)) PushNA(); else