[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Mon Sep 2 05:48:06 UTC 2019


 sw/qa/extras/ooxmlexport/data/tdf124491.docx      |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx        |   10 ++++++++++
 sw/source/core/doc/docredln.cxx                   |   21 +++++++++++++++++----
 writerfilter/source/dmapper/DomainMapper.cxx      |    1 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    7 ++++++-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |    1 +
 6 files changed, 35 insertions(+), 5 deletions(-)

New commits:
commit 00b3c2240bb2f86299e3ddeea75a16e8e9877489
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Thu Aug 29 18:24:47 2019 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Mon Sep 2 07:47:29 2019 +0200

    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 at numbertext.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf124491.docx b/sw/qa/extras/ooxmlexport/data/tdf124491.docx
new file mode 100644
index 000000000000..dad4d7c54ba4
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf124491.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index fc933a67df9c..54e2002bd12d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -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");
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 2585b1208751..8eb527eb519f 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -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 )
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 871d84735059..f2cd94906405 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -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:
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 79f711668a5c..ad8147a9ba6f 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -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
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index ec1a25bf5b17..d4e4420506d0 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -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


More information about the Libreoffice-commits mailing list