diff options
author | László Németh <nemeth@numbertext.org> | 2019-10-11 09:21:18 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2019-10-12 09:29:44 +0200 |
commit | d416250f4f1766e2d596ea3feef6a94b7adf29f4 (patch) | |
tree | 5edb01b3e3a5b1e251cf04fcaa86a6543e2ccca8 /writerfilter | |
parent | 2b729c8fac2b3fb9da06b8a2e3c6a57251cc00d1 (diff) |
tdf#106843 DOCX: forbid disabling protected Record Changes
Password protection of enabled record changes has been grab-
bagged, yet, but it was possible to disable the protection
without password verification, eg. by a simple click on
Record Track Changes. Now it's forbidden to disable the
protected Record Changes, using a dummy password temporarily.
Change-Id: Ibc1c9016ea164ebb588265579fb9fa589ddee114
Reviewed-on: https://gerrit.libreoffice.org/80643
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/SettingsTable.cxx | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx index 665f61568109..5e14f3c1b7be 100644 --- a/writerfilter/source/dmapper/SettingsTable.cxx +++ b/writerfilter/source/dmapper/SettingsTable.cxx @@ -115,7 +115,7 @@ namespace dmapper bool isNone() const { return m_nEdit == NS_ooxml::LN_Value_doc_ST_DocProtect_none; }; // bool isReadOnly() const { return m_nEdit == NS_ooxml::LN_Value_doc_ST_DocProtect_readOnly; }; // bool isComments() const { return m_nEdit == NS_ooxml::LN_Value_doc_ST_DocProtect_comments; }; - // bool isTrackChanges() const { return m_nEdit == NS_ooxml::LN_Value_doc_ST_DocProtect_trackedChanges; }; + bool isTrackChanges() const { return m_nEdit == NS_ooxml::LN_Value_doc_ST_DocProtect_trackedChanges; }; bool isForms() const { return m_nEdit == NS_ooxml::LN_Value_doc_ST_DocProtect_forms; }; }; @@ -253,6 +253,7 @@ struct SettingsTable_Impl bool m_bMirrorMargin; bool m_bDoNotExpandShiftReturn; bool m_bProtectForm; + bool m_bRedlineProtection; bool m_bDisplayBackgroundShape; uno::Sequence<beans::PropertyValue> m_pThemeFontLangProps; @@ -284,6 +285,7 @@ struct SettingsTable_Impl , m_bMirrorMargin(false) , m_bDoNotExpandShiftReturn(false) , m_bProtectForm(false) + , m_bRedlineProtection(false) , m_bDisplayBackgroundShape(false) , m_pThemeFontLangProps(3) , m_pCurrentCompatSetting(3) @@ -348,10 +350,12 @@ void SettingsTable::lcl_attribute(Id nName, Value & val) case NS_ooxml::LN_CT_DocProtect_edit: // 92037 m_pImpl->m_DocumentProtection.m_nEdit = nIntValue; m_pImpl->m_bProtectForm = m_pImpl->m_DocumentProtection.isForms(); + m_pImpl->m_bRedlineProtection = m_pImpl->m_DocumentProtection.isTrackChanges(); break; case NS_ooxml::LN_CT_DocProtect_enforcement: // 92039 m_pImpl->m_DocumentProtection.m_bEnforcement = (nIntValue != 0); m_pImpl->m_bProtectForm &= static_cast<bool>(nIntValue); + m_pImpl->m_bRedlineProtection &= static_cast<bool>(nIntValue); break; case NS_ooxml::LN_CT_DocProtect_formatting: // 92038 m_pImpl->m_DocumentProtection.m_bFormatting = (nIntValue != 0); @@ -660,7 +664,18 @@ void SettingsTable::ApplyProperties(uno::Reference<text::XTextDocument> const& x // Record changes value if (xDocProps.is()) + { xDocProps->setPropertyValue("RecordChanges", uno::makeAny( m_pImpl->m_bRecordChanges ) ); + // Password protected Record changes + if ( m_pImpl->m_bRecordChanges && m_pImpl->m_bRedlineProtection ) + { + // use dummy protection key to forbid disabling of Record changes (extending the recent GrabBag support) + // TODO support password verification and DOCX export of RedlineProtectionKey... + css::uno::Sequence<sal_Int8> aDummyKey(1); + aDummyKey[0] = 1; + xDocProps->setPropertyValue("RedlineProtectionKey", uno::makeAny( aDummyKey )); + } + } // Auto hyphenation: turns on hyphenation by default, <w:suppressAutoHyphens/> may still disable it at a paragraph level. // Situation is similar for RTF_WIDOWCTRL, which turns on widow / orphan control by default. |