diff options
author | Justin Luth <justin.luth@collabora.com> | 2020-03-10 19:18:41 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-03-19 12:20:54 +0100 |
commit | bc898e2c2784e36ad4d4cdf6d962e39069d2c82d (patch) | |
tree | ca53c5c2d4104f867423a9d13bcf434c6a087038 /writerfilter | |
parent | 34ea5c21a752364caef9727850ef34943ad5c752 (diff) |
writerfilter: DocProtect_enforcement defaults to false
If enforcement is not specified, then it defaults to off.
"If this attribute is omitted, then document protection settings
shall not be enforced by applications."
Since we cannot guarantee that NS_ooxml::LN_CT_DocProtect_enforcement
will be called, handle checking the various protection statuses after
the import has finished.
The unit test previously had an explicit enforcement="0".
Removing that was the only change I made.
This patch was inspired by a code-review of LO 6.4's tdf#106843 and
preparation for tdf#120852.
Change-Id: I702f5173fd796eb8bda1ea610411f8297d8889b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90302
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/SettingsTable.cxx | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx index 71bff9b68dab..824c627f436c 100644 --- a/writerfilter/source/dmapper/SettingsTable.cxx +++ b/writerfilter/source/dmapper/SettingsTable.cxx @@ -380,15 +380,6 @@ void SettingsTable::lcl_attribute(Id nName, Value & val) break; case NS_ooxml::LN_CT_DocProtect_enforcement: // 92039 m_pImpl->m_DocumentProtection.m_bEnforcement = (nIntValue != 0); - switch (m_pImpl->m_DocumentProtection.m_nEdit) - { - case NS_ooxml::LN_Value_doc_ST_DocProtect_trackedChanges: - m_pImpl->m_bRedlineProtection = (nIntValue != 0); - break; - case NS_ooxml::LN_Value_doc_ST_DocProtect_forms: - m_pImpl->m_bProtectForm = (nIntValue != 0); - break; - } break; case NS_ooxml::LN_CT_DocProtect_formatting: // 92038 m_pImpl->m_DocumentProtection.m_bFormatting = (nIntValue != 0); @@ -664,7 +655,7 @@ bool SettingsTable::GetDoNotExpandShiftReturn() const bool SettingsTable::GetProtectForm() const { - return m_pImpl->m_bProtectForm; + return m_pImpl->m_bProtectForm && m_pImpl->m_DocumentProtection.m_bEnforcement; } bool SettingsTable::GetNoHyphenateCaps() const @@ -734,7 +725,7 @@ void SettingsTable::ApplyProperties(uno::Reference<text::XTextDocument> const& x { xDocProps->setPropertyValue("RecordChanges", uno::makeAny( m_pImpl->m_bRecordChanges ) ); // Password protected Record changes - if ( m_pImpl->m_bRecordChanges && m_pImpl->m_bRedlineProtection ) + if ( m_pImpl->m_bRecordChanges && m_pImpl->m_bRedlineProtection && m_pImpl->m_DocumentProtection.m_bEnforcement ) { // use dummy protection key to forbid disabling of Record changes without a notice // (extending the recent GrabBag support) TODO support password verification... |