[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - sc/source

Eike Rathke (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 27 08:04:09 UTC 2019


 sc/source/core/data/conditio.cxx |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 364effd7143c31a6c0c49d08c81a08293a94667d
Author:     Eike Rathke <erack at redhat.com>
AuthorDate: Wed Jun 26 18:33:07 2019 +0200
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Jun 27 10:03:23 2019 +0200

    Resolves: tdf#117899 update condition entries' source position on inter-copy
    
    Otherwise in the bug case it resulted in a source position
    pointing to the second sheet, which didn't exist in the clipboard
    target and thus writing the ODF format resulted in an empty
    base-cell-address which when read was source position 0,0,0 and
    with the [.$E3] reference yielded a relative row+2 offset instead
    of row+0 for a 2,0,0 base cell source position, effectively on row
    3 then referencing $E5 instead of $E3.
    
    Reviewed-on: https://gerrit.libreoffice.org/74747
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit 50cd4c73eba1ae2802a4897410bd3f75516d0dcb)
    
     Conflicts:
            sc/source/core/data/conditio.cxx
    
    Backported.
    
    Change-Id: I4d7b373aa69363bc5eeefc3987087972fcad1393
    Reviewed-on: https://gerrit.libreoffice.org/74766
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 92d5041c2b33..aa05207daff0 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1867,13 +1867,21 @@ void ScConditionalFormat::CompileXML()
 
 void ScConditionalFormat::UpdateReference( sc::RefUpdateContext& rCxt, bool bCopyAsMove )
 {
-    for(auto itr = maEntries.cbegin(); itr != maEntries.cend(); ++itr)
-        (*itr)->UpdateReference(rCxt);
-
     if (rCxt.meMode == URM_COPY && bCopyAsMove)
+    {
+        // ScConditionEntry::UpdateReference() obtains its aSrcPos from
+        // maRanges and does not update it on URM_COPY, but it's needed later
+        // for the moved position, so update maRanges beforehand.
         maRanges.UpdateReference(URM_MOVE, pDoc, rCxt.maRange, rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta);
+        for(auto itr = maEntries.cbegin(); itr != maEntries.cend(); ++itr)
+            (*itr)->UpdateReference(rCxt);
+    }
     else
+    {
+        for(auto itr = maEntries.cbegin(); itr != maEntries.cend(); ++itr)
+            (*itr)->UpdateReference(rCxt);
         maRanges.UpdateReference(rCxt.meMode, pDoc, rCxt.maRange, rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta);
+    }
 }
 
 void ScConditionalFormat::InsertRow(SCTAB nTab, SCCOL nColStart, SCCOL nColEnd, SCROW nRowPos, SCSIZE nSize)


More information about the Libreoffice-commits mailing list