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

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Wed Jan 22 12:54:12 UTC 2020


 sw/qa/extras/ooxmlexport/data/tdf77417.docx       |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx        |    9 +++++++--
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   18 ++++++++++++++++++
 3 files changed, 25 insertions(+), 2 deletions(-)

New commits:
commit 0c84c60f48cf681daf467c0678a768711f22e5c3
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Tue Jan 21 13:15:20 2020 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Wed Jan 22 13:53:38 2020 +0100

    tdf#77419 DOCX table import: ignore right white space
    
    in table paragraphs in MSO 2010 compatibility mode.
    
    Change-Id: I99f11c6a9f7a5735cce06fac433d5acab704cb04
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87136
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf77417.docx b/sw/qa/extras/ooxmlexport/data/tdf77417.docx
new file mode 100644
index 000000000000..4b4fb20fee67
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf77417.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 9cb1474c5603..1bb287351c87 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -1039,14 +1039,19 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf81100, "tdf81100.docx")
 
 DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf88496, "tdf88496.docx")
 {
-    xmlDocPtr pXmlDoc = parseExport("word/styles.xml");
-    CPPUNIT_ASSERT(pXmlDoc);
     // Switch off repeating header, there is no place for it.
     // Now there are only 3 pages with complete table content
     // instead of a 51-page long table only with header.
     CPPUNIT_ASSERT_EQUAL(3, getPages());
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf77417, "tdf77417.docx")
+{
+    // MSO 2010 compatibility mode: terminating white spaces are ignored in tables.
+    // This was 3 pages with the first invisible blank page.
+    CPPUNIT_ASSERT_EQUAL(2, getPages());
+}
+
 DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf121597TrackedDeletionOfMultipleParagraphs, "tdf121597.odt")
 {
     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index eaa720d91565..1ae5c4998bed 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1703,6 +1703,24 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
                         xCur->gotoRange( rAppendContext.xInsertPosition, false );
                     else
                         xCur->gotoEnd( false );
+
+                    // tdf#77417 trim right white spaces in table cells in 2010 compatibility mode
+                    sal_Int32 nMode = GetSettingsTable()->GetWordCompatibilityMode();
+                    if ( m_nTableDepth > 0 && nMode > 0 && nMode <= 14 )
+                    {
+                        // skip new line
+                        xCur->goLeft(1, false);
+                        while ( xCur->goLeft(1, true) )
+                        {
+                            OUString sChar = xCur->getString();
+                            if ( sChar == " " || sChar == "\t" || sChar == OUStringChar(u'\x00A0') )
+                                xCur->setString("");
+                            else
+                                break;
+                        }
+                        xCur->goRight(2, false);
+                    }
+
                     xCur->goLeft( 1 , true );
                     // Extend the redline ranges for empty paragraphs
                     if ( !m_bParaChanged && m_previousRedline.get() )


More information about the Libreoffice-commits mailing list