summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2019-01-11 13:01:26 +0300
committerAndras Timar <andras.timar@collabora.com>2019-06-12 11:15:45 +0200
commit2c53920bda4f8289d1cc083161a39923f6871cfa (patch)
tree7f31f8a3c7a098d8594b02a7a43799836eb15473 /sw
parente4ec7597954a17e714d2986832ec9a084bda88e5 (diff)
tdf#120145 ww8import: ignoreCols if section is inserted
Otherwise, the column setting is duplicated both in the section and in the page style. Change-Id: I14383c646e709a3653f1054f0d4170a2963529c1 Reviewed-on: https://gerrit.libreoffice.org/66151 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> (cherry picked from commit 84fefd7c295fc05499ca222dff50c2fe4e0fb27e) Reviewed-on: https://gerrit.libreoffice.org/66217 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit 0e863f5529318e07f46568150e489cb0bef9b616)
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ww8import/ww8import.cxx16
-rw-r--r--sw/source/filter/ww8/ww8par.cxx2
2 files changed, 15 insertions, 3 deletions
diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx
index 31cfce841d3c..abbdedbea194 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -9,6 +9,7 @@
#include <swmodeltestbase.hxx>
+#include <com/sun/star/text/XTextColumns.hpp>
#include <com/sun/star/text/XTextTablesSupplier.hpp>
#include <ndtxt.hxx>
#include <viscrs.hxx>
@@ -33,12 +34,23 @@ DECLARE_WW8IMPORT_TEST(testFloatingTableSectionMargins, "floating-table-section-
{
sal_Int32 pageLeft = parseDump("/root/page[2]/infos/bounds", "left").toInt32();
sal_Int32 pageWidth = parseDump("/root/page[2]/infos/bounds", "width").toInt32();
- sal_Int32 tableLeft = parseDump("/root/page[2]/body/column/body/section/column/body/txt[2]/anchored/fly/tab/infos/bounds", "left").toInt32();
- sal_Int32 tableWidth = parseDump("/root/page[2]/body/column/body/section/column/body/txt[2]/anchored/fly/tab/infos/bounds", "width").toInt32();
+ sal_Int32 tableLeft = parseDump("//tab/infos/bounds", "left").toInt32();
+ sal_Int32 tableWidth = parseDump("//tab/infos/bounds", "width").toInt32();
CPPUNIT_ASSERT( pageWidth > 0 );
CPPUNIT_ASSERT( tableWidth > 0 );
// The table's resulting position should be roughly centered.
CPPUNIT_ASSERT( abs(( pageLeft + pageWidth / 2 ) - ( tableLeft + tableWidth / 2 )) < 20 );
+
+ uno::Reference<beans::XPropertySet> xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(2), "TextSection");
+ CPPUNIT_ASSERT(xTextSection.is());
+ uno::Reference<text::XTextColumns> xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns");
+ OUString pageStyleName = getProperty<OUString>(getParagraph(2), "PageStyleName");
+ uno::Reference<style::XStyle> pageStyle( getStyles("PageStyles")->getByName(pageStyleName), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(pageStyleName), uno::UNO_QUERY);
+ uno::Reference<text::XTextColumns> xPageColumns = getProperty< uno::Reference<text::XTextColumns> >(xPageStyle, "TextColumns");
+
+ //either one or the other should get the column's, not both.
+ CPPUNIT_ASSERT( xTextColumns->getColumnCount() != xPageColumns->getColumnCount());
}
DECLARE_WW8IMPORT_TEST(testN816593, "n816593.doc")
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index b09cf7ded47f..ad340445d383 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4480,7 +4480,7 @@ void wwSectionManager::InsertSegments()
descriptor.
*/
- bool bIgnoreCols = false;
+ bool bIgnoreCols = bInsertSection;
bool bThisAndNextAreCompatible = (aNext == aEnd) ||
((aIter->GetPageWidth() == aNext->GetPageWidth()) &&
(aIter->GetPageHeight() == aNext->GetPageHeight()) &&