Kaydet (Commit) 4054051c authored tarafından Serge Krot's avatar Serge Krot Kaydeden (comit) Thorsten Behrens

tdf#66398 Do not output document protection in docx twice

Change-Id: I16a5f2d3b8ef59e6edfdecd9d2bd19a2c10c80ea
Reviewed-on: https://gerrit.libreoffice.org/43158Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst 40f627c2
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment