summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerge Krot <Serge.Krot@cib.de>2017-10-02 17:51:24 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2017-10-06 19:14:52 +0200
commit4054051cd5aee8cbc6cd2b3384b4ab3d6b6a6ace (patch)
treea2eb38f04c65119b2fc42b870f96ad0f65bf5713
parent40f627c28deb9c7eacd77c4a2c4e2eb919d5cf88 (diff)
tdf#66398 Do not output document protection in docx twice
Change-Id: I16a5f2d3b8ef59e6edfdecd9d2bd19a2c10c80ea Reviewed-on: https://gerrit.libreoffice.org/43158 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--sw/source/filter/ww8/docxexport.cxx22
1 files changed, 16 insertions, 6 deletions
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 8e6b8d5cce21..4ecd04f7d425 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -965,6 +965,7 @@ void DocxExport::WriteSettings()
// Has themeFontLang information
uno::Reference< beans::XPropertySet > xPropSet( m_pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW );
+ bool hasProtectionProperties = false;
uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
const OUString aGrabBagName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG;
if ( xPropSetInfo->hasPropertyByName( aGrabBagName ) )
@@ -1057,8 +1058,12 @@ void DocxExport::WriteSettings()
if (rAttributeList.getLength())
{
+ // we have document protection from from input DOCX file
+
sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList);
pFS->singleElementNS(XML_w, XML_documentProtection, xAttributeList);
+
+ hasProtectionProperties = true;
}
}
}
@@ -1066,13 +1071,18 @@ void DocxExport::WriteSettings()
// Protect form
// Section-specific write protection
- if (m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FORM) ||
- m_pSections->DocumentIsProtected())
+ if (! hasProtectionProperties)
{
- pFS->singleElementNS(XML_w, XML_documentProtection,
- FSNS(XML_w, XML_edit), "forms",
- FSNS(XML_w, XML_enforcement), "true",
- FSEND);
+ if (m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FORM) ||
+ m_pSections->DocumentIsProtected())
+ {
+ // we have form protection from Writer or from input ODT file
+
+ pFS->singleElementNS(XML_w, XML_documentProtection,
+ FSNS(XML_w, XML_edit), "forms",
+ FSNS(XML_w, XML_enforcement), "true",
+ FSEND);
+ }
}
// finish settings.xml