sw/source/filter/ww8/rtfexport.cxx |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

New commits:
commit 87b9b9cbffd788c67b195e0ad54ca425ac259e0c
Author:     Michael Stahl <michael.st...@cib.de>
AuthorDate: Fri Nov 15 16:24:04 2019 +0100
Commit:     Michael Stahl <michael.st...@cib.de>
CommitDate: Sat Nov 16 19:09:15 2019 +0100

    sw: RTF export: only enable \formprot if there is actually a section
    
    ... that is protected; Writer can also protect the content of text
    frames, which doesn't(?) appear to be possible in Word.
    
    Form protection has annoying side effects like disabling field UI for
    the whole document, even inside sections that are unprotected via
    \sectunlocked1.
    
    Change-Id: I2bf9503202779f5cb7c6e27ea7f533b2e3acb9d2
    Reviewed-on: https://gerrit.libreoffice.org/82804
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@cib.de>

diff --git a/sw/source/filter/ww8/rtfexport.cxx 
b/sw/source/filter/ww8/rtfexport.cxx
index 9b98ce3bd4aa..787833bbac71 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -745,16 +745,12 @@ ErrCode RtfExport::ExportDocument_Impl()
     // enable it on a per-section basis. OTOH don't always enable it as it
     // breaks moving of drawings - so write it only in case there is really a
     // protected section in the document.
+    for (auto const& pSectionFormat : m_pDoc->GetSections())
     {
-        const SfxItemPool& rPool = m_pDoc->GetAttrPool();
-        for (const SfxPoolItem* pItem2 : rPool.GetItemSurrogates(RES_PROTECT))
+        if (!pSectionFormat->IsInUndo() && 
pSectionFormat->GetProtect().IsContentProtected())
         {
-            auto pProtect = dynamic_cast<const SvxProtectItem*>(pItem2);
-            if (pProtect && pProtect->IsContentProtected())
-            {
-                Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_FORMPROT);
-                break;
-            }
+            Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_FORMPROT);
+            break;
         }
     }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to