summaryrefslogtreecommitdiff
path: root/sc/source/core/data/document.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core/data/document.cxx')
-rw-r--r--sc/source/core/data/document.cxx14
1 files changed, 10 insertions, 4 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index f825a794c663..92d1f7e03428 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2661,14 +2661,14 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
nDelFlag |= IDF_NOTE;
else if ( nInsFlag & IDF_CONTENTS )
nDelFlag |= IDF_CONTENTS;
- // With bSkipAttrForEmpty, don't remove attributes, copy
- // on top of existing attributes instead.
- if ( ( nInsFlag & IDF_ATTRIB ) && !bSkipAttrForEmpty )
+
+ if (nInsFlag & IDF_ATTRIB)
nDelFlag |= IDF_ATTRIB;
sc::CopyFromClipContext aCxt(*this, pRefUndoDoc, pClipDoc, nInsFlag, bAsLink, bSkipAttrForEmpty);
std::pair<SCTAB,SCTAB> aTabRanges = getMarkedTableRange(maTabs, rMark);
aCxt.setTabRange(aTabRanges.first, aTabRanges.second);
+ aCxt.setDeleteFlag(nDelFlag);
ScRangeList aLocalRangeList;
if (!pDestRanges)
@@ -2690,7 +2690,13 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
SCCOL nCol2 = pRange->aEnd.Col();
SCROW nRow2 = pRange->aEnd.Row();
- if (!bSkipAttrForEmpty)
+ if (bSkipAttrForEmpty)
+ {
+ // Delete cells in the destination only if their corresponding clip cells are not empty.
+ aCxt.setDestRange(nCol1, nRow1, nCol2, nRow2);
+ DeleteBeforeCopyFromClip(aCxt, rMark);
+ }
+ else
DeleteArea(nCol1, nRow1, nCol2, nRow2, rMark, nDelFlag);
if (CopyOneCellFromClip(aCxt, nCol1, nRow1, nCol2, nRow2))