diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-12-10 13:04:09 +0100 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-12-18 18:02:58 +0100 |
commit | b82dcaabc5784181ecf297edb81fc7ef486e7b40 (patch) | |
tree | 49972304b8d8c36b2e70d4f20125b201ac04b2da | |
parent | 6d4397d4a7ed819ab9901efc127636414bd9d925 (diff) |
sw_redlinehide_4b: ODF import: drop empty delete redlines
moz55970-4.odt has a delete redline containing
<text:p text:style-name="Standard"> </text:p>
which the silly whitespace normalisation of course imports as an empty
SwTextNode.
A delete redline containing no text (or at least a fly?) appears quite
useless as the user can't do anything with it, so just delete it on import.
Change-Id: I657eeb627235adf90d7d7c1e44f505e2c6eacd46
(cherry picked from commit 59bdf21f4d933835e158b1f94f29d7b273a4b154)
-rw-r--r-- | sw/source/filter/xml/XMLRedlineImportHelper.cxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx index ce3573b7b946..cec28a9b596a 100644 --- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx +++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx @@ -27,6 +27,7 @@ #include <unotextcursor.hxx> #include <unotextrange.hxx> #include <unocrsr.hxx> +#include <ndtxt.hxx> #include <doc.hxx> #include <IDocumentContentOperations.hxx> #include <IDocumentStylePoolAccess.hxx> @@ -619,7 +620,9 @@ void XMLRedlineImportHelper::InsertIntoDocument(RedlineInfo* pRedlineInfo) // 2) check for: // a) bIgnoreRedline (e.g. insert mode) // b) illegal PaM range (CheckNodesRange()) + // c) redline with empty content section (quite useless) // 3) normal case: insert redline + SwTextNode const* pTempNode(nullptr); if( !aPaM.HasMark() && (pRedlineInfo->pContentIndex == nullptr) ) { // these redlines have no function, and will thus be ignored (just as @@ -628,7 +631,14 @@ void XMLRedlineImportHelper::InsertIntoDocument(RedlineInfo* pRedlineInfo) else if ( bIgnoreRedlines || !CheckNodesRange( aPaM.GetPoint()->nNode, aPaM.GetMark()->nNode, - true ) ) + true ) + || (pRedlineInfo->pContentIndex + && (pRedlineInfo->pContentIndex->GetIndex() + 2 + == pRedlineInfo->pContentIndex->GetNode().EndOfSectionIndex()) + && (pTempNode = pDoc->GetNodes()[pRedlineInfo->pContentIndex->GetIndex() + 1]->GetTextNode()) != nullptr + && pTempNode->GetText().isEmpty() + && !pTempNode->GetpSwpHints() + && !pTempNode->GetAnchoredFlys())) { // ignore redline (e.g. file loaded in insert mode): // delete 'deleted' redlines and forget about the whole thing |