tdf#124491 DOCX: import tracked changes of empty paragraphs

Formatting changes of empty paragraphs weren't imported.

Change-Id: Ife7c83d52549563ab4c3a00a3daff4d8f4fa8386
Reviewed-on: https://gerrit.libreoffice.org/78233
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
This commit is contained in:
László Németh
2019-08-29 18:24:47 +02:00
parent 41cd3e8e81
commit 00b3c2240b
6 changed files with 35 additions and 5 deletions

Binary file not shown.

View File

@@ -883,6 +883,16 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf126245, "tdf126245.docx")
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:pPrChange/w:pPr/w:numPr/w:numId", "val", "1");
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf124491, "tdf124491.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
// import format change of empty lines, FIXME: change w:r with w:pPr in export
assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/*/w:rPr/w:rPrChange");
// empty line without format change
assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/*/w:rPrChange", 0);
assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/*/*/w:rPrChange", 0);
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf105485, "tdf105485.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/document.xml");

View File

@@ -784,12 +784,25 @@ void SwRedlineExtraData_FormatColl::Reject( SwPaM& rPam ) const
SwPaM aPam( *rPam.GetMark(), *rPam.GetPoint() );
if ( !m_bFormatAll )
const SwPosition* pStt = rPam.Start(),
* pEnd = pStt == rPam.GetPoint() ? rPam.GetMark()
: rPam.GetPoint();
if ( !m_bFormatAll || pEnd->nContent == 0 )
{
// don't reject the format of the next paragraph (that is handled by the next redline)
aPam.GetPoint()->nNode--;
SwContentNode* pNode = aPam.GetPoint()->nNode.GetNode().GetContentNode();
aPam.GetPoint()->nContent.Assign( pNode, pNode->Len() );
if (aPam.GetPoint()->nNode > aPam.GetMark()->nNode)
{
aPam.GetPoint()->nNode--;
SwContentNode* pNode = aPam.GetPoint()->nNode.GetNode().GetContentNode();
aPam.GetPoint()->nContent.Assign( pNode, pNode->Len() );
}
else if (aPam.GetPoint()->nNode < aPam.GetMark()->nNode)
{
aPam.GetMark()->nNode--;
SwContentNode* pNode = aPam.GetMark()->nNode.GetNode().GetContentNode();
aPam.GetMark()->nContent.Assign( pNode, pNode->Len() );
}
}
if( pColl )

View File

@@ -2290,6 +2290,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext )
m_pImpl->StartParaMarkerChange( );
[[fallthrough]];
case NS_ooxml::LN_CT_PPr_pPrChange:
case NS_ooxml::LN_CT_ParaRPr_rPrChange:
case NS_ooxml::LN_trackchange:
case NS_ooxml::LN_EG_RPrContent_rPrChange:
case NS_ooxml::LN_EG_RangeMarkupElements_customXmlDelRangeStart:

View File

@@ -1526,6 +1526,10 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
else
xCur->gotoEnd( false );
xCur->goLeft( 1 , true );
// Extend the redline ranges for empty paragraphs
if ( !m_bParaChanged && m_previousRedline.get() )
CreateRedline( xCur, m_previousRedline );
m_previousRedline.clear();
CheckParaMarkerRedline( xCur );
}
@@ -2215,6 +2219,7 @@ void DomainMapper_Impl::StartParaMarkerChange( )
void DomainMapper_Impl::EndParaMarkerChange( )
{
m_bIsParaMarkerChange = false;
m_previousRedline = m_currentRedline;
m_currentRedline.clear();
}
@@ -5844,7 +5849,7 @@ void DomainMapper_Impl::AddNewRedline( sal_uInt32 sprmId )
GetTopContextOfType( CONTEXT_CHARACTER )->Redlines().push_back( pNew );
else if( sprmId == NS_ooxml::LN_CT_PPr_pPrChange )
GetTopContextOfType( CONTEXT_PARAGRAPH )->Redlines().push_back( pNew );
else
else if( sprmId != NS_ooxml::LN_CT_ParaRPr_rPrChange )
m_aRedlines.top().push_back( pNew );
}
else

View File

@@ -503,6 +503,7 @@ private:
std::stack< std::vector< RedlineParamsPtr > > m_aRedlines;
// The redline currently read, may be also stored by a context instead of m_aRedlines.
RedlineParamsPtr m_currentRedline;
RedlineParamsPtr m_previousRedline;
RedlineParamsPtr m_pParaMarkerRedline;
bool m_bIsParaMarkerChange;
// redline data of the terminating run, if it's a moveFrom deletion