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

New commits:
commit d6b881627cc1f6982129862e0221da65389d83bf
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Wed Jun 5 18:53:05 2024 +0200
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Tue Jun 11 00:50:23 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
    (cherry picked from commit 3e7478ef9706e74ac551c1f94090e163e74c7fd8)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168442
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 234ae799caeb..9ef1469687b3 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -256,7 +256,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