diff options
author | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2024-07-20 21:45:34 +0200 |
---|---|---|
committer | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2024-08-02 10:32:56 +0200 |
commit | e747986af4dbb6b48957092dadce26a95b910a82 (patch) | |
tree | 67e12dcb258f2441759faa9b6a90e3bda0746582 /sc | |
parent | d5ad9c0777602541fb39dea5da71e7bfd70595fb (diff) |
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.heinisch@yahoo.de>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/ucalc_copypaste.cxx | 14 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 7 |
2 files changed, 8 insertions, 13 deletions
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; |