You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ms...@apache.org on 2023/01/14 17:05:41 UTC

[openoffice] branch AOO41X updated: #i118023# Calc: Cut-and-paste between spreadsheets causes incorrect cell reference changes

This is an automated email from the ASF dual-hosted git repository.

mseidel pushed a commit to branch AOO41X
in repository https://gitbox.apache.org/repos/asf/openoffice.git


The following commit(s) were added to refs/heads/AOO41X by this push:
     new 466742980f #i118023# Calc: Cut-and-paste between spreadsheets causes incorrect cell reference changes
466742980f is described below

commit 466742980fd82414a3ec22b5eb8300a7dd8b3976
Author: Damjan Jovanovic <da...@apache.org>
AuthorDate: Wed Feb 17 00:03:50 2016 +0000

    #i118023# Calc: Cut-and-paste between spreadsheets causes incorrect cell reference changes
    
    When pasting cut cells, Calc updates references to their old positions
    to instead refer to their new positions. This is done using the tab index,
    row and column, however the document is not taken into account. As a result,
    when cutting and pasting between documents, cells in the target document
    end up getting changed instead of in the source, potentially leading to
    formula corruption, which is undoable but could easily go unnoticed,
    causing data loss when the document is saved.
    
    We don't really support inter-document reference updates anyway, so fix
    this bug by restricting reference updates to the intra-document cut and
    paste case only.
    
    Patch by: me
    Reviewed by: kschenk
    
    git-svn-id: https://svn.apache.org/repos/asf/openoffice/trunk@1730772 13f79535-47bb-0310-9956-ffa450edef68
    (cherry picked from commit faa11fa3567bc0a69178888650acd0c4c28386a8)
---
 main/sc/source/core/data/document.cxx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/main/sc/source/core/data/document.cxx b/main/sc/source/core/data/document.cxx
index ca8c3bc884..250dab2bb2 100644
--- a/main/sc/source/core/data/document.cxx
+++ b/main/sc/source/core/data/document.cxx
@@ -1965,7 +1965,8 @@ void ScDocument::CopyBlockFromClip( SCCOL nCol1, SCROW nRow1,
             nClipTab = (nClipTab+1) % (MAXTAB+1);
         }
     }
-    if ( pCBFCP->nInsFlag & IDF_CONTENTS )
+    if ( (pCBFCP->nInsFlag & IDF_CONTENTS) &&
+    		(pCBFCP->pClipDoc->GetClipParam().getSourceDocID() == GetDocumentID()) ) // #118023# only update references for *intra-document* cut and paste
 	{
 		nClipTab = 0;
 		for (SCTAB i = pCBFCP->nTabStart; i <= nTabEnd; i++)