Kaydet (Commit) 2cdc870a authored tarafından László Németh's avatar László Németh

tdf#115521 DOCX export: keep empty paragraphs in tracked deletion

of a paragraph sequence by inspecting every paragraph in a
"redline" range. Before this fix, all empty paragraphs of
a multiparagraph deletion reappeared as normal text in the DOCX
export.

Change-Id: I928504bdbd8c04673698e8f34c0b608eb3ecc5fc
Reviewed-on: https://gerrit.libreoffice.org/60503
Tested-by: Jenkins
Reviewed-by: 's avatarLászló Németh <nemeth@numbertext.org>
üst 6fc90bcb
...@@ -721,6 +721,16 @@ DECLARE_OOXMLEXPORT_TEST(testTrackChangesDeletedEmptyParagraph, "testTrackChange ...@@ -721,6 +721,16 @@ DECLARE_OOXMLEXPORT_TEST(testTrackChangesDeletedEmptyParagraph, "testTrackChange
assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:pPr/w:rPr/w:del"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:pPr/w:rPr/w:del");
} }
DECLARE_OOXMLEXPORT_TEST(testTrackChangesEmptyParagraphsInADeletion, "testTrackChangesEmptyParagraphsInADeletion.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc)
return;
for (int i = 1; i < 12; ++i)
assertXPath(pXmlDoc, "/w:document/w:body/w:p[" + OString::number(i) + "]/w:pPr/w:rPr/w:del");
}
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -5480,21 +5480,33 @@ const SwRedlineData* AttributeOutputBase::GetParagraphMarkerRedline( const SwTex ...@@ -5480,21 +5480,33 @@ const SwRedlineData* AttributeOutputBase::GetParagraphMarkerRedline( const SwTex
const SwPosition* pCheckedStt = pRedl->Start(); const SwPosition* pCheckedStt = pRedl->Start();
const SwPosition* pCheckedEnd = pRedl->End(); const SwPosition* pCheckedEnd = pRedl->End();
sal_uLong uStartNodeIndex = pCheckedStt->nNode.GetIndex();
sal_uLong uStartCharIndex = pCheckedStt->nContent.GetIndex();
sal_uLong uEndNodeIndex = pCheckedEnd->nNode.GetIndex();
sal_uLong uEndCharIndex = pCheckedEnd->nContent.GetIndex();
sal_uLong uNodeIndex = rNode.GetIndex();
if( pCheckedStt->nNode == rNode ) if( uStartNodeIndex <= uNodeIndex && uNodeIndex < uEndNodeIndex )
{ {
if ( !pCheckedEnd ) if ( !pCheckedEnd )
continue; continue;
sal_uLong uStartNodeIndex = pCheckedStt->nNode.GetIndex();
sal_uLong uStartCharIndex = pCheckedStt->nContent.GetIndex();
sal_uLong uEndNodeIndex = pCheckedEnd->nNode.GetIndex();
sal_uLong uEndCharIndex = pCheckedEnd->nContent.GetIndex();
// Maybe add here a check that also the start & end of the redline is the entire paragraph // Maybe add here a check that also the start & end of the redline is the entire paragraph
if ( ( uStartNodeIndex == uEndNodeIndex - 1 ) && if ( ( uStartNodeIndex < uEndNodeIndex ) &&
( uStartCharIndex == static_cast<sal_uLong>(rNode.Len()) ) && // check start:
( uEndCharIndex == 0) // 1. start in the same node
(( uStartNodeIndex == uNodeIndex &&
uStartCharIndex == static_cast<sal_uLong>(rNode.Len()) ) ||
// 2. or in a previous node
uStartNodeIndex < uNodeIndex
) &&
// check end:
// 1. end in the same node
(( uEndNodeIndex == (uNodeIndex + 1) &&
uEndCharIndex == 0) ||
// 2. or end in after that
uEndNodeIndex > (uNodeIndex + 1)
)
) )
{ {
return &( pRedl->GetRedlineData() ); return &( pRedl->GetRedlineData() );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment