[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
Justin Luth (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jan 25 16:31:32 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 fdb42d82d1240d3ba274f3f25a1072d0044d3c5c
Author: Justin Luth <justin_luth at sil.org>
AuthorDate: Thu Jan 21 16:19:35 2021 +0300
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon Jan 25 17:28:19 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>
(cherry picked from commit 9e41002701285dc89a4dc8c91619a51071995172)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109811
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
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 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;
+ }
}
}
More information about the Libreoffice-commits
mailing list