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

New commits:
commit c6dde3ed42f26cb708a9ba936875bd839b859979
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: Tue Apr 15 11:04:14 2025 +0200

    tdf#166173: 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/+/184042
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit 29c7e73d132154ef7e83b15f6ff39938fb927fe5)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184169
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/writerfilter/source/dmapper/DocumentProtection.cxx 
b/writerfilter/source/dmapper/DocumentProtection.cxx
index dddf964c4022..212bb72f433b 100644
--- a/writerfilter/source/dmapper/DocumentProtection.cxx
+++ b/writerfilter/source/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 <<= OUString("1");
+            if (m_bEnforcement)
+                aValue.Value <<= OUString("1");
+            else
+                aValue.Value <<= OUString("0");
             documentProtection.push_back(aValue);
         }
 

Reply via email to