sw/qa/extras/ooxmlexport/data/tdf121669_equalColumns.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 10 ++++++++++ sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx | 2 +- sw/source/filter/ww8/ww8atr.cxx | 8 ++++++-- 4 files changed, 17 insertions(+), 3 deletions(-)
New commits: commit c223bbd3ec70aacf7c9dcefdef9c2bc4ae5d1f3e Author: Justin Luth <justin_l...@sil.org> AuthorDate: Thu Jan 21 16:19:35 2021 +0300 Commit: Gabor Kelemen <kelemen.gab...@nisz.hu> CommitDate: Wed Mar 3 18:26:15 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_l...@sil.org> Reviewed-by: Miklos Vajna <vmik...@collabora.com> (cherry picked from commit 9e41002701285dc89a4dc8c91619a51071995172) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109811 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> (cherry picked from commit fdb42d82d1240d3ba274f3f25a1072d0044d3c5c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111891 Tested-by: Gabor Kelemen <kelemen.gab...@nisz.hu> Reviewed-by: Gabor Kelemen <kelemen.gab...@nisz.hu> 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 ff1e2cb45038..8ca940e9de28 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -12,6 +12,7 @@ #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/text/RelOrientation.hpp> +#include <com/sun/star/text/XTextColumns.hpp> char const DATA_DIRECTORY[] = "/sw/qa/extras/ooxmlexport/data/"; @@ -150,6 +151,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135973, "tdf135973.odt") } } +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_EXPORTONLY_TEST(testTdf136441_commentInFootnote, "tdf136441_commentInFootnote.odt") { // failed to load without error if footnote contained a comment. diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx index 645091e56323..98a1240c9404 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx @@ -251,7 +251,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 e081b730f037..7a8026c55813 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -4702,8 +4702,11 @@ void AttributeOutputBase::FormatColumns( const SwFormatCol& rCol ) } - // look if all columns are equal - bool bEven = true; + // look if all columns are equal + bool bEven = rCol.IsOrtho(); + if (!bEven) + { + bEven = true; sal_uInt16 n; sal_uInt16 nColWidth = rCol.CalcPrtColWidth( 0, static_cast<sal_uInt16>(nPageSize) ); for ( n = 1; n < nCols; n++ ) @@ -4717,6 +4720,7 @@ void AttributeOutputBase::FormatColumns( const SwFormatCol& rCol ) break; } } + } FormatColumns_Impl( nCols, rCol, bEven, nPageSize ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits