From 48b5b7641d0df960558082e8948da8598f801264 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 12 Mar 2014 11:42:34 +0100 Subject: bnc#865381 DOCX import: fix btLr cell direction when having vertical merge Change-Id: I527955671e1100f05da717bffe002131baaf0291 --- sw/qa/extras/ooxmlimport/data/bnc865381.docx | Bin 0 -> 19510 bytes sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 10 ++++++++++ .../source/dmapper/DomainMapperTableManager.cxx | 12 ++++++++---- 3 files changed, 18 insertions(+), 4 deletions(-) create mode 100755 sw/qa/extras/ooxmlimport/data/bnc865381.docx diff --git a/sw/qa/extras/ooxmlimport/data/bnc865381.docx b/sw/qa/extras/ooxmlimport/data/bnc865381.docx new file mode 100755 index 000000000000..bb125cc73095 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/bnc865381.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index bff4e1ee6f74..809e7639cfa9 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1100,6 +1100,16 @@ DECLARE_OOXMLIMPORT_TEST(testTbLrHeight, "tblr-height.docx") CPPUNIT_ASSERT_EQUAL(text::SizeType::FIX, getProperty(xTableRows->getByIndex(0), "SizeType")); } +DECLARE_OOXMLIMPORT_TEST(testBnc865381, "bnc865381.docx") +{ + uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference xTextTable(xTables->getByIndex(0), uno::UNO_QUERY); + uno::Reference xTableRows(xTextTable->getRows(), uno::UNO_QUERY); + // Second row has a vertically merged cell, make sure size type is MIN in that case (otherwise B2 is not readable). + CPPUNIT_ASSERT_EQUAL(text::SizeType::MIN, getProperty(xTableRows->getByIndex(1), "SizeType")); +} + DECLARE_OOXMLIMPORT_TEST(testFdo53985, "fdo53985.docx") { // Unhandled excetion prevented import of the rest of the document. diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index 103befa5fbea..773da178d9f4 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -346,10 +346,14 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm) SAL_INFO( "writerfilter", "Have inserted textDirection " << nIntValue ); // We're faking a text direction, so don't allow multiple lines. - TablePropertyMapPtr pRowPropMap( new TablePropertyMap ); - pRowPropMap->Insert(PROP_SIZE_TYPE, uno::makeAny(text::SizeType::FIX)); - m_bRowSizeTypeInserted = true; - insertRowProps(pRowPropMap); + if (!getCellProps() || getCellProps()->find(PROP_VERTICAL_MERGE) == getCellProps()->end()) + { + // Though in case there will be a vertical merge, don't do this, it hides text that is supposed to be visible. + TablePropertyMapPtr pRowPropMap( new TablePropertyMap ); + pRowPropMap->Insert(PROP_SIZE_TYPE, uno::makeAny(text::SizeType::FIX)); + m_bRowSizeTypeInserted = true; + insertRowProps(pRowPropMap); + } } break; case 4: // lrTbV -- cgit v1.2.3