sw/source/core/txtnode/attrcontentcontrol.cxx |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

New commits:
commit 080066c616cd63c200691d167a409180382403a3
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Thu Dec 15 09:26:02 2022 -0500
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Wed Dec 21 15:32:48 2022 +0000

    tdf#151548 sw ContentControls: use ResetAttrs with undo.
    
    My initial commit adding SwTextContentControls::Delete
    didn't put it into the undo stack. But this slightly obscure
    ResetAttrs function can take this one argument and do the
    same thing, but with undo.
    
    Change-Id: Ibfcb278186b17aa3c3d9f1970e55ceb0ec00ddc9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144238
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144685
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sw/source/core/txtnode/attrcontentcontrol.cxx 
b/sw/source/core/txtnode/attrcontentcontrol.cxx
index 034529ce37b2..f1279c9cc66d 100644
--- a/sw/source/core/txtnode/attrcontentcontrol.cxx
+++ b/sw/source/core/txtnode/attrcontentcontrol.cxx
@@ -714,16 +714,11 @@ void SwTextContentControl::Delete(bool bSaveContents)
     if (!GetTextNode())
         return;
 
+    SwPaM aPaM(*GetTextNode(), GetStart(), *GetTextNode(), *End());
     if (bSaveContents)
-    {
-        SwIndex aStart(GetTextNode(), GetStart());
-        GetTextNode()->RstTextAttr(aStart, *End() - GetStart(), 
RES_TXTATR_CONTENTCONTROL);
-    }
+        GetTextNode()->GetDoc().ResetAttrs(aPaM, /*bTextAttr=*/true, { 
RES_TXTATR_CONTENTCONTROL });
     else
-    {
-        SwPaM aPaM(*GetTextNode(), GetStart(), *GetTextNode(), *End());
         
GetTextNode()->GetDoc().getIDocumentContentOperations().DeleteAndJoin(aPaM);
-    }
 }
 
 SwTextNode* SwTextContentControl::GetTextNode() const

Reply via email to