[Libreoffice-commits] core.git: 2 commits - sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Jan 8 14:17:10 UTC 2019
sw/source/core/doc/DocumentRedlineManager.cxx | 40 +++++++++++++++-----------
sw/source/filter/ww8/wrtww8.cxx | 4 +-
sw/source/filter/ww8/ww8par.cxx | 11 +++++--
3 files changed, 35 insertions(+), 20 deletions(-)
New commits:
commit 2dda396f4de051cccf3442f17c84bf2ff5d1db1d
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Jan 8 13:32:05 2019 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Jan 8 15:16:50 2019 +0100
tdf#122452 sw_redlinehide: WW8 import/export sets layout show/hide mode
... and not SetRedlineFlags(), similar to the way the ODF filter does it.
The RTF/DOCX filters don't appear to be able to export the show/hide
flag currently, they can only handle the enabled flag.
Change-Id: I76bc19292882d7de5c28ea6afe0f81eadbd4a04f
Reviewed-on: https://gerrit.libreoffice.org/65966
Tested-by: Jenkins
Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 371912fba436..69be4bc2ce55 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -58,6 +58,7 @@
#include <fmtpdsc.hxx>
#include <fmtrowsplt.hxx>
#include <frmatr.hxx>
+#include <../../core/inc/rootfrm.hxx>
#include <doc.hxx>
#include <IDocumentSettingAccess.hxx>
#include <IDocumentDrawModelAccess.hxx>
@@ -3352,7 +3353,8 @@ ErrCode WW8Export::ExportDocument_Impl()
pDop.reset(new WW8Dop);
pDop->fRevMarking = bool( RedlineFlags::On & m_nOrigRedlineFlags );
- pDop->fRMView = bool( RedlineFlags::ShowDelete & m_nOrigRedlineFlags );
+ SwRootFrame const*const pLayout(m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout());
+ pDop->fRMView = pLayout == nullptr || !pLayout->IsHideRedlines();
pDop->fRMPrint = pDop->fRMView;
// set AutoHyphenation flag if found in default para style
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 4b4ca3df60d2..ed9754aee1e7 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -83,6 +83,7 @@
#include <IDocumentMarkAccess.hxx>
#include <IDocumentStylePoolAccess.hxx>
#include <IDocumentExternalData.hxx>
+#include <../../core/inc/DocumentRedlineManager.hxx>
#include <docufld.hxx>
#include <swfltopt.hxx>
#include <viewsh.hxx>
@@ -4981,7 +4982,7 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary const *pGloss)
SwNodeIndex aSttNdIdx( m_rDoc.GetNodes() );
SwRelNumRuleSpaces aRelNumRule(m_rDoc, m_bNewDoc);
- RedlineFlags eMode = RedlineFlags::ShowInsert;
+ RedlineFlags eMode = RedlineFlags::ShowInsert | RedlineFlags::ShowDelete;
m_xSprmParser.reset(new wwSprmParser(*m_xWwFib));
@@ -5281,12 +5282,13 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary const *pGloss)
}
}
+ bool isHideRedlines(false);
+
if (m_bNewDoc)
{
if( m_xWDop->fRevMarking )
eMode |= RedlineFlags::On;
- if( m_xWDop->fRMView )
- eMode |= RedlineFlags::ShowDelete;
+ isHideRedlines = !m_xWDop->fRMView;
}
m_aInsertedTables.DelAndMakeTableFrames();
@@ -5420,6 +5422,9 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary const *pGloss)
UpdatePageDescs(m_rDoc, nPageDescOffset);
+ // can't set it on the layout or view shell because it doesn't exist yet
+ m_rDoc.GetDocumentRedlineManager().SetHideRedlines(isHideRedlines);
+
return ERRCODE_NONE;
}
commit b15f1ed2a1df45a57b587ac90efa90c1c18866fc
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Jan 8 13:22:31 2019 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Jan 8 15:16:44 2019 +0100
sw_redlinehide: try harder to prevent SetRedlineFlags from messing things up
Rearrange the code added in 15f1555da8adfa81ea1d4b0d8b694164fddbb2ae
to set all layouts to non-hidden before moving redlines in the model.
tdf52550-1.doc contains lots of consecutive delete redlines that
when exported to ODF trigger asserts about wrong start nodes in
CheckParaRedlineMerge().
Change-Id: I89c3d4fefd26691a9632807b9899138eee895fff
Reviewed-on: https://gerrit.libreoffice.org/65965
Tested-by: Jenkins
Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 326b151da2a7..5eddd00f0ebf 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -839,6 +839,25 @@ void DocumentRedlineManager::SetRedlineFlags( RedlineFlags eMode )
CheckAnchoredFlyConsistency(m_rDoc);
CHECK_REDLINE( *this )
+ std::set<SwRootFrame *> hiddenLayouts;
+ if (eShowMode == (RedlineFlags::ShowInsert | RedlineFlags::ShowDelete))
+ {
+ // sw_redlinehide: the problem here is that MoveFromSection
+ // creates the frames wrongly (non-merged), because its own
+ // SwRangeRedline has wrong positions until after the nodes
+ // are all moved, so fix things up by force by re-creating
+ // all merged frames from scratch.
+ std::set<SwRootFrame *> const layouts(m_rDoc.GetAllLayouts());
+ for (SwRootFrame *const pLayout : layouts)
+ {
+ if (pLayout->IsHideRedlines())
+ {
+ pLayout->SetHideRedlines(false);
+ hiddenLayouts.insert(pLayout);
+ }
+ }
+ }
+
for (sal_uInt16 nLoop = 1; nLoop <= 2; ++nLoop)
for (size_t i = 0; i < mpRedlineTable->size(); ++i)
{
@@ -857,24 +876,13 @@ void DocumentRedlineManager::SetRedlineFlags( RedlineFlags eMode )
CheckAnchoredFlyConsistency(m_rDoc);
CHECK_REDLINE( *this )
- m_rDoc.SetInXMLImport( bSaveInXMLImportFlag );
- if (eShowMode == (RedlineFlags::ShowInsert | RedlineFlags::ShowDelete))
+
+ for (SwRootFrame *const pLayout : hiddenLayouts)
{
- // sw_redlinehide: the problem here is that MoveFromSection
- // creates the frames wrongly (non-merged), because its own
- // SwRangeRedline has wrong positions until after the nodes
- // are all moved, so fix things up by force by re-creating
- // all merged frames from scratch.
- std::set<SwRootFrame *> const layouts(m_rDoc.GetAllLayouts());
- for (SwRootFrame *const pLayout : layouts)
- {
- if (pLayout->IsHideRedlines())
- {
- pLayout->SetHideRedlines(false);
- pLayout->SetHideRedlines(true);
- }
- }
+ pLayout->SetHideRedlines(true);
}
+
+ m_rDoc.SetInXMLImport( bSaveInXMLImportFlag );
}
meRedlineFlags = eMode;
m_rDoc.getIDocumentState().SetModified();
More information about the Libreoffice-commits
mailing list