diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-12-10 13:04:09 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-12-18 22:30:14 +0100 |
commit | 9da6aabe989ae5a04a5eac315ee78a1abc6fbd5d (patch) | |
tree | b27f85abf651caab54a3b00b98d63f5988cfe591 /sw | |
parent | 109063f44c805eb7dc51b5296b61ce167b2d8c43 (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)
Diffstat (limited to 'sw')
-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 |