[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa sw/source writerfilter/source
László Németh (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jun 18 12:09:24 UTC 2019
sw/qa/extras/ooxmlexport/data/tdf89991.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 10 ++++++++++
sw/source/filter/ww8/docxexport.cxx | 11 ++++++++++-
sw/source/filter/ww8/docxexport.hxx | 1 +
sw/source/filter/ww8/wrtww8.cxx | 5 +++++
sw/source/filter/ww8/wrtww8.hxx | 1 +
sw/source/uibase/uno/unotxdoc.cxx | 8 ++++----
writerfilter/source/dmapper/SettingsTable.cxx | 17 +++++++++++++++++
8 files changed, 48 insertions(+), 5 deletions(-)
New commits:
commit 0620ccd4dc5422f8d3253c7b044a16043b00da35
Author: László Németh <nemeth at numbertext.org>
AuthorDate: Wed Jun 12 13:26:16 2019 +0200
Commit: Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Tue Jun 18 14:08:35 2019 +0200
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 at sil.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
Tested-by: László Németh <nemeth at numbertext.org>
(cherry picked from commit 0e27158c4f6a6a7676a77afb6b37dd30b3f6d100)
Reviewed-on: https://gerrit.libreoffice.org/74254
Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf89991.docx b/sw/qa/extras/ooxmlexport/data/tdf89991.docx
new file mode 100644
index 000000000000..a074d9679a19
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf89991.docx differ
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 28851886ded5..149648caa3a0 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 ) );
More information about the Libreoffice-commits
mailing list