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

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Fri Jan 22 13:41:42 UTC 2021


 sw/qa/extras/ooxmlexport/data/tdf121669_equalColumns.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx                |    9 +++++
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx             |    2 -
 sw/source/filter/ww8/ww8atr.cxx                           |   24 ++++++++------
 4 files changed, 24 insertions(+), 11 deletions(-)

New commits:
commit 9e41002701285dc89a4dc8c91619a51071995172
Author:     Justin Luth <justin_luth at sil.org>
AuthorDate: Thu Jan 21 16:19:35 2021 +0300
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Jan 22 14:40:58 2021 +0100

    tdf#121669 ww8 export: use the "we have equal columns" flag
    
    If the columns are marked as AutoWidth, then there is
    no need to go to the remarkably poor layout code
    to determine if the columns should be exported as equal.
    
    In this case, it appears as if the layout engine hadn't
    really identified the full width, or evaluated the
    wish values of each column.
    
    This fixes DOCX, DOC, and RTF.
    
    Change-Id: I1a1193b65d01e654b3bfbfaee7d8c02a683ae2c0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109762
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf121669_equalColumns.docx b/sw/qa/extras/ooxmlexport/data/tdf121669_equalColumns.docx
new file mode 100644
index 000000000000..4f962e1bddf6
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf121669_equalColumns.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 997bf888e403..574b925a07aa 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -586,6 +586,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135343_columnSectionBreak_c15, "tdf135343_column
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Fits on two pages", 2, getPages());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf121669_equalColumns, "tdf121669_equalColumns.docx")
+{
+    uno::Reference<beans::XPropertySet> xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(1), "TextSection");
+    CPPUNIT_ASSERT(xTextSection.is());
+    uno::Reference<text::XTextColumns> xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns");
+    // The property was ignored when deciding at export whether the columns were equal or not. Layout isn't reliable.
+    CPPUNIT_ASSERT(getProperty<bool>(xTextColumns, "IsAutomatic"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf132149_pgBreak, "tdf132149_pgBreak.odt")
 {
     // This 5 page document is designed to visually exaggerate the problems
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 0e2fea644244..9c5f05e51534 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -255,7 +255,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlphabeticalIndex_MultipleColumns,"alpha
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:sectPr/w:type","val","continuous");
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:pPr/w:sectPr/w:type","val","continuous");
     // check for "w:space" attribute for the columns in Section Properties
-    assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:pPr/w:sectPr/w:cols/w:col[1]","space","720");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:pPr/w:sectPr/w:cols","space","720");
 }
 
 DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPageref, "testPageref.docx")
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index e6501dc34ca3..5b7e0a3b9a45 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -4673,18 +4673,22 @@ void AttributeOutputBase::FormatColumns( const SwFormatCol& rCol )
     }
 
     // look if all columns are equal
-    bool bEven = true;
-    sal_uInt16 n;
-    sal_uInt16 nColWidth = rCol.CalcPrtColWidth( 0, static_cast<sal_uInt16>(nPageSize) );
-    for ( n = 1; n < nCols; n++ )
+    bool bEven = rCol.IsOrtho();
+    if (!bEven)
     {
-        short nDiff = nColWidth -
-            rCol.CalcPrtColWidth( n, static_cast<sal_uInt16>(nPageSize) );
-
-        if ( nDiff > 10 || nDiff < -10 )      // Tolerance: 10 tw
+        bEven = true;
+        sal_uInt16 n;
+        sal_uInt16 nColWidth = rCol.CalcPrtColWidth( 0, static_cast<sal_uInt16>(nPageSize) );
+        for ( n = 1; n < nCols; n++ )
         {
-            bEven = false;
-            break;
+            short nDiff = nColWidth -
+                rCol.CalcPrtColWidth( n, static_cast<sal_uInt16>(nPageSize) );
+
+            if ( nDiff > 10 || nDiff < -10 )      // Tolerance: 10 tw
+            {
+                bEven = false;
+                break;
+            }
         }
     }
 


More information about the Libreoffice-commits mailing list