diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2024-06-17 14:31:20 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2024-06-17 10:24:11 +0200 |
commit | 23052214e026745fc5d8e780b91630e1f8dea205 (patch) | |
tree | 15812b8a09f8d2c1e84366a1f1f9e1c062c2ea3c /sd/source/ui/annotations | |
parent | 40ddb619cfc88d161cb74a1f516dd39196658d50 (diff) |
annot: add undo to annotations inserter when synching
Change-Id: If4b8ddcbee9468655944effb931347c8077abc3c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168976
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sd/source/ui/annotations')
-rw-r--r-- | sd/source/ui/annotations/annotationmanager.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index 296a6f5a3ac2..a6918f9e15d8 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -73,6 +73,7 @@ #include <drawdoc.hxx> #include <svx/annotation/TextAPI.hxx> #include <svx/annotation/AnnotationObject.hxx> +#include <svx/annotation/Annotation.hxx> #include <svx/annotation/ObjectAnnotationData.hxx> #include <optsitem.hxx> #include <sdmod.hxx> @@ -1003,6 +1004,7 @@ void AnnotationManagerImpl::SyncAnnotationObjects() return; sal_Int32 nIndex = 1; + bool bAnnotatonInserted = false; for (auto const& xAnnotation : mxCurrentPage->getAnnotations()) { SdrObject* pObject = findAnnotationObjectMatching(xAnnotation); @@ -1010,6 +1012,11 @@ void AnnotationManagerImpl::SyncAnnotationObjects() if (pObject) continue; + if (!bAnnotatonInserted && mpDoc->IsUndoEnabled()) + mpDoc->BegUndo(SdResId(STR_ANNOTATION_UNDO_INSERT)); + + bAnnotatonInserted = true; + auto const& rInfo = xAnnotation->getCreationInfo(); auto* pView = xViewShell->GetView(); @@ -1112,6 +1119,9 @@ void AnnotationManagerImpl::SyncAnnotationObjects() nIndex++; } + + if (bAnnotatonInserted && mpDoc->IsUndoEnabled()) + mpDoc->EndUndo(); } void AnnotationManagerImpl::addListener() |