summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2019-03-08 22:35:46 +0100
committerLászló Németh <nemeth@numbertext.org>2019-03-11 10:01:52 +0100
commitb3265d6e11200a55a068902e2d78c2de374e973b (patch)
tree5a6a5cebfa1d3656922be8f926480a563521e5b5
parentc31e7723915a20e45698d8288816288ce9104af8 (diff)
tdf#123054 track changes: fix paragraph style regression
caused by the commit 173069a1f6ac060a06f04908a94a1a8420461795 "fix paragraph join with change tracking" and commit 1bbbe57dfc0b43d6b5444798d77dcdf5e4e76e49 "change tracking: show layout changes at paragraph join". Change-Id: I05203255b04094ae118fd4967398045d6e0ad9fa Reviewed-on: https://gerrit.libreoffice.org/68947 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf123054.docxbin0 -> 29457 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport11.cxx6
-rw-r--r--sw/source/core/doc/DocumentRedlineManager.cxx61
3 files changed, 38 insertions, 29 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf123054.docx b/sw/qa/extras/ooxmlexport/data/tdf123054.docx
new file mode 100644
index 000000000000..d857479d5add
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf123054.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index a8306385e12c..08e0480e1322 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -967,6 +967,12 @@ DECLARE_OOXMLIMPORT_TEST(testTdf121176, "tdf121176.docx")
CPPUNIT_ASSERT_EQUAL( OUString( "must" ), getRun( getParagraph( 1 ), 2 )->getString());
}
+DECLARE_OOXMLIMPORT_TEST(testTdf123054, "tdf123054.docx")
+{
+ CPPUNIT_ASSERT_EQUAL(OUString("No Spacing"),
+ getProperty<OUString>(getParagraph(20), "ParaStyleName"));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index e55b04bd5279..de113562139a 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1916,37 +1916,40 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
}
else
{
- if (pStt->nContent == 0)
+ if ( bCallDelete && nsRedlineType_t::REDLINE_DELETE == pNewRedl->GetType() )
{
- // tdf#54819 to keep the style of the paragraph
- // after the fully deleted paragraphs (normal behaviour
- // of editing without change tracking), we copy its style
- // to the first removed paragraph.
- SwTextNode* pDelNode = pStt->nNode.GetNode().GetTextNode();
- SwTextNode* pTextNode = pEnd->nNode.GetNode().GetTextNode();
- if (pDelNode != nullptr && pTextNode != nullptr && pDelNode != pTextNode)
- pTextNode->CopyCollFormat( *pDelNode );
- }
- else if ( bCallDelete && nsRedlineType_t::REDLINE_DELETE == pNewRedl->GetType() )
- {
- // tdf#119571 update the style of the joined paragraph
- // after a partially deleted paragraph to show its correct style
- // in "Show changes" mode, too. All removed paragraphs
- // get the style of the first (partially deleted) paragraph
- // to avoid text insertion with bad style in the deleted
- // area later.
- SwContentNode* pDelNd = pStt->nNode.GetNode().GetContentNode();
- SwContentNode* pTextNd = pEnd->nNode.GetNode().GetContentNode();
- SwTextNode* pDelNode = pStt->nNode.GetNode().GetTextNode();
- SwTextNode* pTextNode;
- SwNodeIndex aIdx( pEnd->nNode.GetNode() );
-
- while (pDelNode != nullptr && pTextNd != nullptr && pDelNd->GetIndex() < pTextNd->GetIndex())
+ if ( pStt->nContent == 0 )
{
- pTextNode = pTextNd->GetTextNode();
- if (pTextNode && pDelNode != pTextNode )
- pDelNode->CopyCollFormat( *pTextNode );
- pTextNd = SwNodes::GoPrevious( &aIdx );
+ // tdf#54819 to keep the style of the paragraph
+ // after the fully deleted paragraphs (normal behaviour
+ // of editing without change tracking), we copy its style
+ // to the first removed paragraph.
+ SwTextNode* pDelNode = pStt->nNode.GetNode().GetTextNode();
+ SwTextNode* pTextNode = pEnd->nNode.GetNode().GetTextNode();
+ if (pDelNode != nullptr && pTextNode != nullptr && pDelNode != pTextNode)
+ pTextNode->CopyCollFormat( *pDelNode );
+ }
+ else
+ {
+ // tdf#119571 update the style of the joined paragraph
+ // after a partially deleted paragraph to show its correct style
+ // in "Show changes" mode, too. All removed paragraphs
+ // get the style of the first (partially deleted) paragraph
+ // to avoid text insertion with bad style in the deleted
+ // area later.
+ SwContentNode* pDelNd = pStt->nNode.GetNode().GetContentNode();
+ SwContentNode* pTextNd = pEnd->nNode.GetNode().GetContentNode();
+ SwTextNode* pDelNode = pStt->nNode.GetNode().GetTextNode();
+ SwTextNode* pTextNode;
+ SwNodeIndex aIdx( pEnd->nNode.GetNode() );
+
+ while (pDelNode != nullptr && pTextNd != nullptr && pDelNd->GetIndex() < pTextNd->GetIndex())
+ {
+ pTextNode = pTextNd->GetTextNode();
+ if (pTextNode && pDelNode != pTextNode )
+ pDelNode->CopyCollFormat( *pTextNode );
+ pTextNd = SwNodes::GoPrevious( &aIdx );
+ }
}
}
bool const ret = mpRedlineTable->Insert( pNewRedl );