diff options
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf89991.docx | bin | 0 -> 5543 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxexport.cxx | 11 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxexport.hxx | 1 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.hxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 8 | ||||
-rw-r--r-- | writerfilter/source/dmapper/SettingsTable.cxx | 17 |
8 files changed, 48 insertions, 5 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf89991.docx b/sw/qa/extras/ooxmlexport/data/tdf89991.docx Binary files differnew file mode 100644 index 000000000000..a074d9679a19 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf89991.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index 8e96d05506cd..fde09e123f9f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -1012,6 +1012,16 @@ DECLARE_OOXMLEXPORT_TEST(tdf66398_permissions, "tdf66398_permissions.docx") CPPUNIT_ASSERT(xBookmarksByName->hasByName("permission-for-group:267014232:everyone")); } +DECLARE_OOXMLEXPORT_TEST(tdf89991_revisionView, "tdf89991.docx") +{ + // check revisionView (Show Changes) import and export + if (xmlDocPtr pXmlSettings = parseExport("word/settings.xml")) + { + assertXPath(pXmlSettings, "/w:settings/w:revisionView", "insDel", "0"); + assertXPath(pXmlSettings, "/w:settings/w:revisionView", "formatting", "0"); + } +} + DECLARE_OOXMLEXPORT_TEST(tdf122201_editUnprotectedText, "tdf122201_editUnprotectedText.odt") { // get the document diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index f0db6407c55d..6d6dd78ad1c9 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -508,7 +508,8 @@ void DocxExport::OutputDML(uno::Reference<drawing::XShape> const & xShape) ErrCode DocxExport::ExportDocument_Impl() { - // Set the 'Track Revisions' flag in the settings structure + // Set the 'Reviewing' flags in the settings structure + m_aSettings.revisionView = m_bOrigShowChanges; m_aSettings.trackRevisions = bool( RedlineFlags::On & m_nOrigRedlineFlags ); InitStyles(); @@ -955,6 +956,11 @@ void DocxExport::WriteSettings() } // Track Changes + if ( !m_aSettings.revisionView ) + pFS->singleElementNS( XML_w, XML_revisionView, + FSNS( XML_w, XML_insDel ), "0", + FSNS( XML_w, XML_formatting ), "0" ); + if ( m_aSettings.trackRevisions ) pFS->singleElementNS(XML_w, XML_trackRevisions); @@ -1662,6 +1668,7 @@ DocxExport::~DocxExport() DocxSettingsData::DocxSettingsData() : evenAndOddHeaders( false ) , defaultTabStop( 0 ) +, revisionView( true ) , trackRevisions( false ) { } @@ -1672,6 +1679,8 @@ bool DocxSettingsData::hasData() const return true; if( defaultTabStop != 0 ) return true; + if ( !revisionView ) + return true; if ( trackRevisions ) return true; diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx index 5b906debb0e9..1de037fb7662 100644 --- a/sw/source/filter/ww8/docxexport.hxx +++ b/sw/source/filter/ww8/docxexport.hxx @@ -60,6 +60,7 @@ struct DocxSettingsData bool hasData() const; /// returns true if there are any non-default settings (i.e. something to write) bool evenAndOddHeaders; int defaultTabStop; + bool revisionView; // don't show tracked changes bool trackRevisions; // Should 'Track Revisions' be set }; diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 09bf616a090b..bf8fb4665528 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3198,6 +3198,10 @@ ErrCode MSWordExportBase::ExportDocument( bool bWriteAll ) m_aFrames = GetFrames( *m_pDoc, bWriteAll? nullptr : m_pOrigPam ); m_nOrigRedlineFlags = m_pDoc->getIDocumentRedlineAccess().GetRedlineFlags(); + + SwRootFrame const*const pLayout(m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout()); + m_bOrigShowChanges = pLayout == nullptr || !pLayout->IsHideRedlines(); + if ( !m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().empty() ) { //restored to original state by SwWriter::Write @@ -3595,6 +3599,7 @@ MSWordExportBase::MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM , m_nUniqueList(0) , m_nHdFtIndex(0) , m_nOrigRedlineFlags(RedlineFlags::NONE) + , m_bOrigShowChanges(true) , m_pCurrentPageDesc(nullptr) , m_bPrevTextNodeIsEmpty(false) , m_bFirstTOCNodeWithSection(false) diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 1be70995ca50..f72302f88538 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -480,6 +480,7 @@ public: unsigned int m_nHdFtIndex; RedlineFlags m_nOrigRedlineFlags; ///< Remember the original redline mode + bool m_bOrigShowChanges; ///< Remember the original Show Changes mode public: /* implicit bookmark vector containing pairs of node indexes and bookmark names */ diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index a71a8a95690e..78f7ab1adadd 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -180,6 +180,7 @@ #include <memory> #include <fchrfmt.hxx> #include <redline.hxx> +#include <DocumentRedlineManager.hxx> #define TWIPS_PER_PIXEL 15 @@ -1877,10 +1878,9 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, const Any& RedlineFlags eMode = pDocShell->GetDoc()->getIDocumentRedlineAccess().GetRedlineFlags(); if(WID_DOC_CHANGES_SHOW == pEntry->nWID) { - eMode &= ~RedlineFlags(RedlineFlags::ShowInsert | RedlineFlags::ShowDelete); - eMode |= RedlineFlags::ShowInsert; - if( bSet ) - eMode |= RedlineFlags::ShowDelete; + eMode |= RedlineFlags(RedlineFlags::ShowInsert | RedlineFlags::ShowDelete); + if( !bSet ) + pDocShell->GetDoc()->GetDocumentRedlineManager().SetHideRedlines(true); } else if(WID_DOC_CHANGES_RECORD == pEntry->nWID) { diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx index 76601e49eae2..609173eefd0b 100644 --- a/writerfilter/source/dmapper/SettingsTable.cxx +++ b/writerfilter/source/dmapper/SettingsTable.cxx @@ -234,6 +234,8 @@ struct SettingsTable_Impl int m_nDefaultTabStop; bool m_bRecordChanges; + bool m_bShowInsDelChanges; + bool m_bShowFormattingChanges; bool m_bLinkStyles; sal_Int16 m_nZoomFactor; sal_Int16 m_nZoomType = 0; @@ -263,6 +265,8 @@ struct SettingsTable_Impl SettingsTable_Impl() : m_nDefaultTabStop( 720 ) //default is 1/2 in , m_bRecordChanges(false) + , m_bShowInsDelChanges(true) + , m_bShowFormattingChanges(true) , m_bLinkStyles(false) , m_nZoomFactor(0) , m_nView(0) @@ -373,6 +377,12 @@ void SettingsTable::lcl_attribute(Id nName, Value & val) case NS_ooxml::LN_AG_Password_salt: // 92036 m_pImpl->m_DocumentProtection.m_sSalt = sStringValue; break; + case NS_ooxml::LN_CT_TrackChangesView_insDel: + m_pImpl->m_bShowInsDelChanges = (nIntValue != 0); + break; + case NS_ooxml::LN_CT_TrackChangesView_formatting: + m_pImpl->m_bShowFormattingChanges = (nIntValue != 0); + break; default: { #ifdef DBG_UTIL @@ -440,6 +450,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm) m_pImpl->m_bRecordChanges = bool(rSprm.getValue( )->getInt( ) ); } break; + case NS_ooxml::LN_CT_Settings_revisionView: + resolveSprmProps(*this, rSprm); + break; case NS_ooxml::LN_CT_Settings_documentProtection: resolveSprmProps(*this, rSprm); break; @@ -633,6 +646,10 @@ void SettingsTable::ApplyProperties(uno::Reference<text::XTextDocument> const& x { uno::Reference< beans::XPropertySet> xDocProps( xDoc, uno::UNO_QUERY ); + // Show changes value + if (xDocProps.is()) + xDocProps->setPropertyValue("ShowChanges", uno::makeAny( m_pImpl->m_bShowInsDelChanges || m_pImpl->m_bShowFormattingChanges ) ); + // Record changes value if (xDocProps.is()) xDocProps->setPropertyValue("RecordChanges", uno::makeAny( m_pImpl->m_bRecordChanges ) ); |