sd/source/core/sdpage.cxx | 2 ++ sd/source/ui/view/sdview.cxx | 9 +++++++++ 2 files changed, 11 insertions(+)
New commits: commit bd6349d3fe1e2c9278aa333e2daf6a9e1a413075 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Sat Oct 12 10:19:29 2024 -0400 Commit: Justin Luth <jl...@mail.com> CommitDate: Wed Oct 16 00:42:33 2024 +0200 tdf#121741 sd: not modified when leaving an empty placeholder When you ENTER a placeholder, it removes the placeholder text. In that case it doesn't treat this as a change (because SdrObject::SetOutlinerParaObject is never called). However, when you LEAVE the placeholder, it puts the placeholder text back in. This was being treated as a modification event (x2). I tested what happens if you delete text and then leave the placeholder. The deleted text is already handled before we can leave the placeholder, so that doesn't cause any concern. TODO: an undo event is also created. Change-Id: I366eb7a174284dc07415342258fcf65e50641be6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174860 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index 4c524674b0f4..48b0ca4e6baa 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -2875,6 +2875,8 @@ bool SdPage::RestoreDefaultText( SdrObject* pObj ) ePresObjKind == PresObjKind::Notes || ePresObjKind == PresObjKind::Text) { + sd::ModifyGuard aGuard(static_cast<SdDrawDocument*>(&getSdrModelFromSdrPage())); + OUString aString( GetPresObjText(ePresObjKind) ); if (!aString.isEmpty()) diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index 79234a4c7d48..90bbbdc69511 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -783,11 +783,20 @@ SdrEndTextEditKind View::SdrEndTextEdit(bool bDontDeleteReally) SdrTextObj* xObj = GetTextEditObject(); bool bDefaultTextRestored = RestoreDefaultText( xObj ); + const bool bSaveSetModifiedEnabled = mpDocSh && mpDocSh->IsEnableSetModified(); + if (bDefaultTextRestored) + { + if (bSaveSetModifiedEnabled) + mpDocSh->EnableSetModified(false); + } SdrEndTextEditKind eKind = FmFormView::SdrEndTextEdit(bDontDeleteReally); if( bDefaultTextRestored ) { + if (bSaveSetModifiedEnabled) + mpDocSh->EnableSetModified(); + if( xObj && !xObj->IsEmptyPresObj() ) { xObj->SetEmptyPresObj( true );