diff options
author | Czeber László Ádám <czeber.laszloadam@nisz.hu> | 2023-07-17 11:41:17 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2023-08-22 11:56:13 +0200 |
commit | cb141564733eef078347b89ea657e46e193bd140 (patch) | |
tree | f245e29996c952c2f22a71bc1a20a7bfa33e1f8b /sc/source | |
parent | bc3f6c3a47411a3b5dafadca4e5c55cd24e30662 (diff) |
tdf#103480 sc: fix lost hyperlink at merging an empty cell with its cell
Merging a cell containing a hyperlink with an empty cell
resulted the loss of the hyperlink, i.e. only the text
content was kept.
Change-Id: I5148ce55157e3ad7926f5b5a82a682b837a784ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154520
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/data/documen3.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 73cf516c4d49..b52deed7d85b 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -2030,6 +2030,7 @@ void ScDocument::DoMergeContents( SCCOL nStartCol, SCROW nStartRow, OUString aCellStr; SCCOL nCol; SCROW nRow; + ScCellValue aCell; for (nRow=nStartRow; nRow<=nEndRow; nRow++) for (nCol=nStartCol; nCol<=nEndCol; nCol++) { @@ -2039,12 +2040,18 @@ void ScDocument::DoMergeContents( SCCOL nStartCol, SCROW nStartRow, if (!aTotal.isEmpty()) aTotal.append(' '); aTotal.append(aCellStr); + ScAddress aPos(nCol, nRow, nTab); + if ((GetCellType(aPos) == CELLTYPE_EDIT) && aCell.isEmpty()) + aCell = ScRefCellValue(*this, aPos); } if (nCol != nStartCol || nRow != nStartRow) SetString(nCol,nRow,nTab,""); } - SetString(nStartCol,nStartRow,nTab,aTotal.makeStringAndClear()); + if (aCell.isEmpty() || !GetString(nStartCol, nStartRow, nTab).isEmpty()) + SetString(nStartCol, nStartRow, nTab, aTotal.makeStringAndClear()); + else + aCell.release(*this, ScAddress(nStartCol, nStartRow, nTab)); } void ScDocument::DoEmptyBlock( SCCOL nStartCol, SCROW nStartRow, |