diff options
author | Dennis Francis <dennis.francis@collabora.com> | 2021-11-02 12:51:30 +0530 |
---|---|---|
committer | Dennis Francis <dennis.francis@collabora.com> | 2021-11-10 07:55:31 +0100 |
commit | 42df36429bbb32cd75fa1661a31821a9446ef648 (patch) | |
tree | 4fc237c9e5356beb5f703621d2282ce65c28b90b /sc/source/ui/view/viewfun5.cxx | |
parent | 40e6ae66b893b86bdda7d414b4bd58bfc612566f (diff) |
sc: fix clip cell range for clip with no content
The problem was observed in LOK mode with the following step:
1. Select and copy a sheet area with no content.
2. Paste this into another document.
=> You get an error dialog saying "Protected cells cannot be modified".
The issue here is in ScViewFunc::PasteDataFormat, rSrcDoc.GetDataStart()
gives the correct cell indices of the clip selection, but GetCellArea()
truncates the range to empty range as there is no content. Since these
functions are used in many places which might depend on this behaviour,
it seems right to fix it just for this usecase.
Change-Id: Ibc85a8d7dd33b377a37298ea9a2a7ebb55eccf1d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124627
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
(cherry picked from commit 4ff08a1332e5150d7ef978572e747ac8da3a0820)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124671
Tested-by: Jenkins
Diffstat (limited to 'sc/source/ui/view/viewfun5.cxx')
-rw-r--r-- | sc/source/ui/view/viewfun5.cxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index 5fe89ae675cb..c370fe0bbe47 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -149,7 +149,13 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId, SCCOL nFirstCol, nLastCol; SCROW nFirstRow, nLastRow; if ( rSrcDoc.GetDataStart( nSrcTab, nFirstCol, nFirstRow ) ) + { rSrcDoc.GetCellArea( nSrcTab, nLastCol, nLastRow ); + if (nLastCol < nFirstCol) + nLastCol = nFirstCol; + if (nLastRow < nFirstRow) + nLastRow = nFirstRow; + } else { nFirstCol = nLastCol = 0; |