sc/source/core/data/document.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 71de3699a30267d989ef78096477d9ecca329974
Author: Damjan Jovanovic <[email protected]>
Date:   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

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 2aefa7a..0ccf481 100644
--- a/sc/source/core/data/document.cxx
+++ b/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++)
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to