summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2021-01-21 16:19:35 +0300
committerMiklos Vajna <vmiklos@collabora.com>2021-01-22 14:40:58 +0100
commit9e41002701285dc89a4dc8c91619a51071995172 (patch)
treef4783152097bc7155d08a457cde30914922dcf4b /sw
parente32075d09e1407cebe0f2247868294d5eb4583f4 (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>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf121669_equalColumns.docxbin0 -> 20227 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport15.cxx9
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx2
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx24
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
new file mode 100644
index 000000000000..4f962e1bddf6
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf121669_equalColumns.docx
Binary files 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;
+ }
}
}