sw/source/uibase/dochdl/swdtflvr.cxx |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

New commits:
commit 6d978385b1d34fe0703ca9cc841c7ea67abd47cc
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Sun Feb 16 21:12:35 2025 -0900
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Tue Feb 18 19:40:05 2025 +0100

    Resolves tdf#165223 SB Navigator 'Reminder' objects set in a block of
    
    text are copied and pasted with that text, corrupts the movement
    stack
    
    Change-Id: Icce2a96184099f62ccac1475cb57fdb9e6975847
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181759
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>
    Tested-by: Jenkins
    Reviewed-by: Vernon, Stuart Foote <vsfo...@libreoffice.org>

diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx 
b/sw/source/uibase/dochdl/swdtflvr.cxx
index 11847f90b53d..a5b5e191f3e6 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -879,22 +879,25 @@ void SwTransferable::DeleteSelection()
     m_pWrtShell->EndUndo( SwUndoId::END );
 }
 
-static void DeleteDDEMarks(SwDoc & rDest)
+static void DeleteDDEAndReminderMarks(SwDoc & rDest)
 {
     IDocumentMarkAccess *const pMarkAccess = rDest.getIDocumentMarkAccess();
-    std::vector< ::sw::mark::MarkBase* > vDdeMarks;
-    // find all DDE-Bookmarks
+    std::vector< ::sw::mark::MarkBase* > vMarks;
+    // find all DDE-Bookmarks and Navigator-Reminders
     for (auto ppMark = pMarkAccess->getAllMarksBegin();
         ppMark != pMarkAccess->getAllMarksEnd();
         ++ppMark)
     {
-        if (IDocumentMarkAccess::MarkType::DDE_BOOKMARK == 
IDocumentMarkAccess::GetType(**ppMark))
+        IDocumentMarkAccess::MarkType eMarkType = 
IDocumentMarkAccess::GetType(**ppMark);
+        if (eMarkType == IDocumentMarkAccess::MarkType::DDE_BOOKMARK
+            || eMarkType == IDocumentMarkAccess::MarkType::NAVIGATOR_REMINDER)
         {
-            vDdeMarks.push_back(*ppMark);
+            vMarks.push_back(*ppMark);
         }
     }
     // remove all DDE-Bookmarks, they are invalid inside the clipdoc!
-    for (const auto& rpMark : vDdeMarks)
+    // and remove all Navigator-Reminders (tdf#165223)
+    for (const auto& rpMark : vMarks)
     {
         pMarkAccess->deleteMark(rpMark);
     }
@@ -938,7 +941,7 @@ void SwTransferable::PrepareForCopyTextRange(SwPaM & rPaM)
         rDest.GetMetaFieldManager().copyDocumentProperties(rSrc);
     }
 
-    DeleteDDEMarks(rDest);
+    DeleteDDEAndReminderMarks(rDest);
 
     // a new one was created in core (OLE objects copied!)
     m_aDocShellRef = rDest.GetTmpDocShell();
@@ -1064,7 +1067,7 @@ int SwTransferable::PrepareForCopy( bool bIsCut )
         rTmpDoc.getIDocumentFieldsAccess().LockExpFields();     // Never 
update fields - leave text as is
         lclOverWriteDoc(*m_pWrtShell, rTmpDoc);
 
-        DeleteDDEMarks(rTmpDoc);
+        DeleteDDEAndReminderMarks(rTmpDoc);
 
         // a new one was created in CORE (OLE objects copied!)
         m_aDocShellRef = rTmpDoc.GetTmpDocShell();

Reply via email to