diff options
author | Justin Luth <justin_luth@sil.org> | 2021-01-21 16:19:35 +0300 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-01-25 17:28:19 +0100 |
commit | fdb42d82d1240d3ba274f3f25a1072d0044d3c5c (patch) | |
tree | c1deba6d2224c7f64e14630b8dab24f276ae294e /sw | |
parent | f2b04cd11cda4d9828e5af1a4160c08bab45496e (diff) |
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@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 9e41002701285dc89a4dc8c91619a51071995172)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109811
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf121669_equalColumns.docx | bin | 0 -> 20227 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 9 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 24 |
4 files changed, 24 insertions, 11 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf121669_equalColumns.docx b/sw/qa/extras/ooxmlexport/data/tdf121669_equalColumns.docx Binary files differnew file mode 100644 index 000000000000..4f962e1bddf6 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf121669_equalColumns.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index c875d560e592..4c8f05e945d4 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -560,6 +560,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 1a94982df7e9..240678318f9a 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 fb26419025e0..c1959186979c 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -4661,18 +4661,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; + } } } |