sc/qa/unit/ucalc_copypaste.cxx   |   14 ++++++--------
 sc/source/core/data/document.cxx |    7 ++-----
 2 files changed, 8 insertions(+), 13 deletions(-)

New commits:
commit e747986af4dbb6b48957092dadce26a95b910a82
Author:     Andreas Heinisch <andreas.heini...@yahoo.de>
AuthorDate: Sat Jul 20 21:45:34 2024 +0200
Commit:     Andreas Heinisch <andreas.heini...@yahoo.de>
CommitDate: Fri Aug 2 10:32:56 2024 +0200

    tdf#161189 - CopyFromClip: improve handling of deleting notes
    
    Instead of adding additional deletion flags, just remove the note 
deletetion flag when needed.
    
    Change-Id: Iba0dd4f922694c9fff98f4b74bccad1b8ee16d49
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170803
    Tested-by: Jenkins
    Reviewed-by: Andreas Heinisch <andreas.heini...@yahoo.de>

diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx
index cba06db1de22..a58698f1e18e 100644
--- a/sc/qa/unit/ucalc_copypaste.cxx
+++ b/sc/qa/unit/ucalc_copypaste.cxx
@@ -9350,11 +9350,10 @@ CPPUNIT_TEST_FIXTURE(TestCopyPaste, 
testCopyPasteSkipEmpty)
 
     // Check the content after the paste.
     {
-        // tdf#141440 - do not delete notes when pasting contents
         static const Check aChecks[] = {
-            { "Clip1", COL_YELLOW, true }, { "B", COL_BLUE, true },
-            { "Clip2", COL_YELLOW, true }, { "D", COL_BLUE, true },
-            { "Clip3", COL_YELLOW, true },
+            { "Clip1", COL_YELLOW, false }, { "B", COL_BLUE, true },
+            { "Clip2", COL_YELLOW, false }, { "D", COL_BLUE, true },
+            { "Clip3", COL_YELLOW, false },
         };
 
         bool bRes
@@ -9378,11 +9377,10 @@ CPPUNIT_TEST_FIXTURE(TestCopyPaste, 
testCopyPasteSkipEmpty)
     // Redo, and check the content again.
     aUndo.Redo();
     {
-        // tdf#141440 - do not delete notes when pasting contents
         static const Check aChecks[] = {
-            { "Clip1", COL_YELLOW, true }, { "B", COL_BLUE, true },
-            { "Clip2", COL_YELLOW, true }, { "D", COL_BLUE, true },
-            { "Clip3", COL_YELLOW, true },
+            { "Clip1", COL_YELLOW, false }, { "B", COL_BLUE, true },
+            { "Clip2", COL_YELLOW, false }, { "D", COL_BLUE, true },
+            { "Clip3", COL_YELLOW, false },
         };
 
         bool bRes
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index ceb1de82cc38..3830ed410cef 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2899,12 +2899,9 @@ void ScDocument::CopyFromClip(
         overwrite/delete existing cells but to insert the notes into
         these cells. In this case, just delete old notes from the
         destination area. */
-    InsertDeleteFlags nDelFlag = InsertDeleteFlags::NONE;
+    InsertDeleteFlags nDelFlag = nInsFlag;
     if ( (nInsFlag & (InsertDeleteFlags::CONTENTS | 
InsertDeleteFlags::ADDNOTES)) == (InsertDeleteFlags::NOTE | 
InsertDeleteFlags::ADDNOTES) )
-        nDelFlag |= InsertDeleteFlags::NOTE;
-    // tdf#141440 - do not delete notes when pasting contents (see 
InsertDeleteFlags::CONTENTS)
-    else if ( nInsFlag & (InsertDeleteFlags::CONTENTS & 
~InsertDeleteFlags::NOTE) )
-        nDelFlag |= InsertDeleteFlags::CONTENTS & ~InsertDeleteFlags::NOTE;
+        nDelFlag &= ~InsertDeleteFlags::NOTE;
 
     if (nInsFlag & InsertDeleteFlags::ATTRIB)
         nDelFlag |= InsertDeleteFlags::ATTRIB;

Reply via email to