sfx2/source/doc/objmisc.cxx |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 3e7478ef9706e74ac551c1f94090e163e74c7fd8
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Wed Jun 5 18:53:05 2024 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Thu Jun 6 10:15:38 2024 +0200

    tdf#157931 sfx2: fix modified status of Base forms
    
    The problem is that when a Base form is not in design mode, it's not
    expected that it will be stored.
    
    There are checks for m_bOpenInDesign in ODocumentDefinition::save() and
    ODocumentDefinition::saveAs() that were added in commit
    9cfe62966ff1e0039d95a07d0c613675a53e3075 "CWS dba201b" but removing
    these runs into another check in OCommonEmbeddedObject::storeOwn()
    of m_bReadOnly and then it still fails, presumably because the storage
    was opened readonly.
    
    Let's restore SfxObjectShell::IsEnableSetModified() to check
    IsReadOnly(), but only for Base form documents, which seems simplest.
    
    (regression from commit bde746141f9b382156a5ce79ebf82c5e32fc455b)
    
    Change-Id: I886389e2bd462d27ed5c46bfd2132893bb2d5a81
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168481
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Tested-by: Jenkins

diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 6d60e683770a..397b13c6bccc 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -258,7 +258,13 @@ bool SfxObjectShell::IsEnableSetModified() const
     // which the user didn't load or activate to modified.
     return pImpl->m_bEnableSetModified && !IsPreview()
         && eCreateMode != SfxObjectCreateMode::ORGANIZER
-        && eCreateMode != SfxObjectCreateMode::INTERNAL;
+        && eCreateMode != SfxObjectCreateMode::INTERNAL
+        // tdf#157931 form documents only in design mode
+        && ((pImpl->pBaseModel
+                && !pImpl->pBaseModel->impl_isDisposed()
+                && pImpl->pBaseModel->IsInitialized()
+                && pImpl->pBaseModel->getIdentifier() != 
"com.sun.star.sdb.FormDesign")
+            || !IsReadOnly());
 }
 
 

Reply via email to