diff options
author | Eike Rathke <erack@redhat.com> | 2021-10-15 21:56:34 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-10-16 20:12:15 +0200 |
commit | 54a9b7c1db72459f95ed334de34a0e2289329bd2 (patch) | |
tree | 63b2503345c440631ae0e8e81d69cb7c80b2a7a2 /sc | |
parent | b5ec5a4b886a2ba224f4b7f5f2d92b007f199f57 (diff) |
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 <erack@redhat.com>
Tested-by: Jenkins
(cherry picked from commit 459f9de8a87373c826eadab142850cc3fa578fca)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123635
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/formulacell.cxx | 7 | ||||
-rw-r--r-- | sc/source/core/tool/interpr5.cxx | 19 |
2 files changed, 26 insertions, 0 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 0b8dfd9c6f9d..5250e5e9c59a 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -1101,6 +1101,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 1e16518ae8da..2c79e14a6a95 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 |