diff options
author | Eike Rathke <erack@redhat.com> | 2019-06-26 18:33:07 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-06-27 10:03:23 +0200 |
commit | 364effd7143c31a6c0c49d08c81a08293a94667d (patch) | |
tree | 2751018afb850daa0d38024d268cf4ff898d4f7b /sc | |
parent | a860fe43880d0607936a16ac5dc1b1df2e9b202b (diff) |
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@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@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/conditio.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
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) |