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>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf123054.docx b/sw/qa/extras/ooxmlexport/data/tdf123054.docx
new file mode 100644
index 0000000..d857479
--- /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 a830638..08e0480 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -967,6 +967,12 @@
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 e55b04b..de11356 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1916,37 +1916,40 @@
}
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 );