summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEilidh McAdam <eilidh.mcadam@itomig.de>2015-03-18 02:00:28 +0000
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-04-01 12:29:50 +0000
commitbb96ad0f9a24f92c8553da566f0ebedc064a1318 (patch)
tree8756b667fa603597a65fa0dc65b8de48b1f55c2c
parentbd23cf009a7e3c63a066794d41ae0c97589c8891 (diff)
tdf#60060: DOCX export of section protection
Initial implementation - no password protection is saved. Specific sections are protected in OOXML by using form protection; that is, only form elements may be edited in protected sections. Change-Id: I294064bbc4e3c307d17001ebd21f1bd6f07de42c Reviewed-on: https://gerrit.libreoffice.org/14895 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx3
-rw-r--r--sw/source/filter/ww8/docxexport.cxx9
2 files changed, 11 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index c0dbda73431f..45b7bbfe1220 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5401,7 +5401,8 @@ void DocxAttributeOutput::EndSection()
void DocxAttributeOutput::SectionFormProtection( bool bProtected )
{
if ( bProtected )
- m_pSerializer->singleElementNS( XML_w, XML_formProt, FSEND );
+ m_pSerializer->singleElementNS( XML_w, XML_formProt,
+ FSNS( XML_w, XML_val ), "true", FSEND );
else
m_pSerializer->singleElementNS( XML_w, XML_formProt,
FSNS( XML_w, XML_val ), "false", FSEND );
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 96c8c7ca3ca3..30ea86731545 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -930,6 +930,15 @@ void DocxExport::WriteSettings()
}
}
+ // Section-specific write protection
+ if ( m_pSections->DocumentIsProtected() )
+ {
+ pFS->singleElementNS( XML_w, XML_documentProtection,
+ FSNS( XML_w, XML_enforcement ), "true",
+ FSNS( XML_w, XML_edit ), "forms",
+ FSEND );
+ }
+
pFS->endElementNS( XML_w, XML_settings );
}