diff options
author | László Németh <nemeth@numbertext.org> | 2019-06-12 13:26:16 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2019-06-12 21:00:05 +0200 |
commit | 0e27158c4f6a6a7676a77afb6b37dd30b3f6d100 (patch) | |
tree | 92690805a62542b837e7b17f6ed336736a4bf4ee /sw | |
parent | 6fd3eb533998c8f63430a43767b2a52aa5e71e3f (diff) |
tdf#89991 DOCX: import/export Show changes mode
handled by the optional w:revisionView OOXML setting.
Using disabled Show Changes mode, exported DOCX contains
<w:revisionView w:insDel="0" w:formatting="0"/>
as the documents exported from MSO with disabled Show Changes
and disabled Options -> Trust Center -> Trust Center Settings ->
Privacy Options -> Make hidden markup visible when opening or saving
(Note: this last setting needs also for opening the documents
really with disabled Show Changes in MSO).
Change-Id: I9f2c7df572f33838ae63185de21431102a7e139e
Reviewed-on: https://gerrit.libreoffice.org/73885
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw')
-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 |
7 files changed, 31 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) { |