diff options
author | László Németh <nemeth@numbertext.org> | 2019-10-14 17:50:47 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2019-10-16 12:15:16 +0200 |
commit | 2756ed9317e3474003c11ffe7d1e2f087c1412bf (patch) | |
tree | 3c8952f94809a5bf8a4ad660935c46bba8bcfec8 /writerfilter/source | |
parent | 4a96fb8ec0130e1036913093836bcf28bc37a49b (diff) |
tdf#106843 DOCX: export/import change tracking protection
Now change tracking protection from Writer or from ODT files
is exported to DOCX.
In Writer it's always possible to disable change tracking
protection without password in File->Properties->Security page->
Record Changes after confirmation.
Now Writer uses the same confirmation to remove change
tracking protection imported from DOCX, for example clicking
on Record Track Changes. Disabled protection removes the
export of the grab-bagged change tracking protection, too,
to avoid of creating bad DOCX with enabled change tracking
protection and disabled Record change tracking.
See also commit d416250f4f1766e2d596ea3feef6a94b7adf29f4
"tdf#106843 DOCX: forbid disabling protected Record Changes"
Change-Id: Ida4d72c57dbe5450ea22028bbed69d413f5a786d
Reviewed-on: https://gerrit.libreoffice.org/80784
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'writerfilter/source')
-rw-r--r-- | writerfilter/source/dmapper/SettingsTable.cxx | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx index 5e14f3c1b7be..337b250ebc20 100644 --- a/writerfilter/source/dmapper/SettingsTable.cxx +++ b/writerfilter/source/dmapper/SettingsTable.cxx @@ -113,10 +113,6 @@ 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 isForms() const { return m_nEdit == NS_ooxml::LN_Value_doc_ST_DocProtect_forms; }; }; css::uno::Sequence<css::beans::PropertyValue> DocumentProtection_Impl::toSequence() const @@ -254,6 +250,7 @@ struct SettingsTable_Impl bool m_bDoNotExpandShiftReturn; bool m_bProtectForm; bool m_bRedlineProtection; + OUString m_sRedlineProtectionKey; bool m_bDisplayBackgroundShape; uno::Sequence<beans::PropertyValue> m_pThemeFontLangProps; @@ -286,6 +283,7 @@ struct SettingsTable_Impl , m_bDoNotExpandShiftReturn(false) , m_bProtectForm(false) , m_bRedlineProtection(false) + , m_sRedlineProtectionKey() , m_bDisplayBackgroundShape(false) , m_pThemeFontLangProps(3) , m_pCurrentCompatSetting(3) @@ -349,13 +347,30 @@ void SettingsTable::lcl_attribute(Id nName, Value & val) break; 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(); + switch (nIntValue) + { + case NS_ooxml::LN_Value_doc_ST_DocProtect_trackedChanges: + { + m_pImpl->m_bRedlineProtection = true; + m_pImpl->m_sRedlineProtectionKey = m_pImpl->m_DocumentProtection.m_sHash; + break; + } + case NS_ooxml::LN_Value_doc_ST_DocProtect_forms: + m_pImpl->m_bProtectForm = true; + break; + } 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); + 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); @@ -669,8 +684,8 @@ void SettingsTable::ApplyProperties(uno::Reference<text::XTextDocument> const& x // 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... + // use dummy protection key to forbid disabling of Record changes without a notice + // (extending the recent GrabBag support) TODO support password verification... css::uno::Sequence<sal_Int8> aDummyKey(1); aDummyKey[0] = 1; xDocProps->setPropertyValue("RedlineProtectionKey", uno::makeAny( aDummyKey )); |