diff options
author | Justin Luth <justin.luth@collabora.com> | 2020-03-26 09:33:08 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2020-03-28 08:50:08 +0100 |
commit | 35b3a3eb001ec8ff8c808ad6d990a583163ad365 (patch) | |
tree | 87a63ad86687ceeec7f596c104145fe72315877a /sw | |
parent | 70adbc53e88e5b99032d63065410716c54b4f96f (diff) |
tdf#80635 ww8import:1 take float table CENTER to inlined table
Since SW has problems with floating tables, any unnecessarily
floated tables are converted to inline. However, the
positioning of the tables is mostly lost. So the choice is
either to refuse to inline a strangely positioned table
or else to transfer the positioning onto the inlined table.
Transferring is easier said than done. But for centered tables,
it is easy to copy that.
Change-Id: I8a6deaa63c45277c30ffa12613c8ed125a45d607
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91188
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ww8export/data/tdf107773.doc (renamed from sw/qa/extras/ww8import/data/tdf107773.doc) | bin | 29184 -> 29184 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export2.cxx | 14 | ||||
-rw-r--r-- | sw/qa/extras/ww8import/ww8import.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par2.cxx | 9 |
4 files changed, 23 insertions, 8 deletions
diff --git a/sw/qa/extras/ww8import/data/tdf107773.doc b/sw/qa/extras/ww8export/data/tdf107773.doc Binary files differindex 31c7b7c5c121..31c7b7c5c121 100644 --- a/sw/qa/extras/ww8import/data/tdf107773.doc +++ b/sw/qa/extras/ww8export/data/tdf107773.doc diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx index 9abcdf7a9eef..b477b03bbeaa 100644 --- a/sw/qa/extras/ww8export/ww8export2.cxx +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -252,6 +252,20 @@ DECLARE_WW8EXPORT_TEST(testTdf116570_exportFootnote, "tdf116570_exportFootnote.o CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of paragraphs in first footnote", 2, getParagraphs(xFootnoteText) ); } +DECLARE_WW8EXPORT_TEST(testTdf107773, "tdf107773.doc") +{ + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); + // This was 1, multi-page table was imported as a floating one. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), xDrawPage->getCount()); + + // tdf#80635 - transfer the float orientation to the table. + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Horizontal Orientation", text::HoriOrientation::CENTER, getProperty<sal_Int16>(xTable, "HoriOrient")); +} + DECLARE_WW8EXPORT_TEST(testTdf112074_RTLtableJustification, "tdf112074_RTLtableJustification.doc") { uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index 7f68b083cd88..1313eff345aa 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -79,14 +79,6 @@ DECLARE_WW8IMPORT_TEST(testFloatingTableSectionColumns, "floating-table-section- CPPUNIT_ASSERT( tableWidth.toInt32() > 10000 ); } -DECLARE_WW8IMPORT_TEST(testTdf107773, "tdf107773.doc") -{ - uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); - // This was 1, multi-page table was imported as a floating one. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), xDrawPage->getCount()); -} - DECLARE_WW8IMPORT_TEST(testTdf124601, "tdf124601.doc") { // Without the accompanying fix in place, this test would have failed, as the importer lost the diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 6f417543014d..3b1615793482 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -2423,6 +2423,15 @@ void WW8TabDesc::CreateSwTable() m_xTmpPos.reset(new SwPosition(*m_pIo->m_pPaM->GetPoint())); + // Because SW cannot handle multi-page floating frames, + // _any unnecessary_ floating tables have been converted to inline. + if ( m_pIo->m_xSFlyPara && !m_pIo->m_xSFlyPara->pFlyFormat ) + { + // Get the table orientation from the fly + if ( m_pIo->m_xSFlyPara->eHAlign == text::HoriOrientation::CENTER ) + m_eOri = m_pIo->m_xSFlyPara->eHAlign; + } + // The table is small: The number of columns is the lowest count of // columns of the origin, because inserting is faster than deleting. // The number of rows is the count of bands because (identically) |