sw/source/writerfilter/dmapper/DocumentProtection.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 6799930ff1705794f04b9b8bccd62c47b6745120
Author:     Bayram Çiçek <bayram.ci...@collabora.com>
AuthorDate: Fri Apr 11 15:53:44 2025 +0300
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Fri Apr 11 16:38:46 2025 +0200

    sw: always export enforcement attribute of documentProtection
    
    otherwise: (in word/settings.xml)
    - if a docx document has w:enforcement="0", LO will not
    import it. Hence, LO will not export it, too.
    - this will cause a lack of enforcement attr. - which
    will make the docx "protected" after export from LO - in MSO Word.
    
    Therefore, we have to import enforcement attr. even if it's
    value is "0".
    
    Change-Id: I30cf3cd8725151ea5bd9d4e484757e36602707e5
    Signed-off-by: Bayram Çiçek <bayram.ci...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184051
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sw/source/writerfilter/dmapper/DocumentProtection.cxx 
b/sw/source/writerfilter/dmapper/DocumentProtection.cxx
index 33f439405ad8..6cba1fd3f5d1 100644
--- a/sw/source/writerfilter/dmapper/DocumentProtection.cxx
+++ b/sw/source/writerfilter/dmapper/DocumentProtection.cxx
@@ -154,11 +154,13 @@ uno::Sequence<beans::PropertyValue> 
DocumentProtection::toSequence() const
         }
 
         // w:enforcement
-        if (m_bEnforcement)
         {
             beans::PropertyValue aValue;
             aValue.Name = "enforcement";
-            aValue.Value <<= u"1"_ustr;
+            if (m_bEnforcement)
+                aValue.Value <<= u"1"_ustr;
+            else
+                aValue.Value <<= u"0"_ustr;
             documentProtection.push_back(aValue);
         }
 

Reply via email to