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 <jluth@mail.com>
This commit is contained in:
@@ -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())
|
||||
|
||||
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user