diff options
-rw-r--r-- | sw/qa/extras/rtfimport/data/fdo59953.rtf | 16 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 12 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableManager.cxx | 5 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 4 |
4 files changed, 34 insertions, 3 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo59953.rtf b/sw/qa/extras/rtfimport/data/fdo59953.rtf new file mode 100644 index 000000000000..66432e32ab85 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo59953.rtf @@ -0,0 +1,16 @@ +{\rtf1\ansi\deff0 +\trowd\cellx7384\cellx9652 +\pard\intbl\sl0 +A1 +\cell +\pard\intbl\sl0\lin10 +B1 +\cell +\trowd\cellx7384\cellx9652\row +\trowd\cellx7384\cellx9652 +\pard\intbl A2\cell +\pard\intbl B2\cell +\trowd\cellx7384\cellx9652 +\row +\pard\itap0\sl0\lin14\rin8 \par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index a3a2f12e651a..446e9c925c01 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -142,6 +142,7 @@ public: void testFdo58646(); void testFdo59419(); void testFdo58076_2(); + void testFdo59953(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -255,6 +256,7 @@ void Test::run() {"fdo58646.rtf", &Test::testFdo58646}, {"fdo59419.rtf", &Test::testFdo59419}, {"fdo58076-2.rtf", &Test::testFdo58076_2}, + {"fdo59953.rtf", &Test::testFdo59953}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -1106,6 +1108,16 @@ void Test::testFdo58076_2() CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(8345)), getProperty<sal_Int32>(xDraws->getByIndex(0), "HoriOrientPosition")); } +void Test::testFdo59953() +{ + 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); + // Cell width of A1 was 4998 (e.g. not set / not wide enough, ~50% of total width) + uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int16(7650), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index 448d6e18fb4d..52fbd0ccb749 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -222,7 +222,10 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm) break; case NS_ooxml::LN_CT_TblGridBase_gridCol: { - getCurrentGrid()->push_back( ConversionHelper::convertTwipToMM100( nIntValue ) ); + if (nIntValue == -1) + getCurrentGrid()->clear(); + else + getCurrentGrid()->push_back( ConversionHelper::convertTwipToMM100( nIntValue ) ); } break; case NS_ooxml::LN_CT_TcPrBase_vMerge : //vertical merge diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 325ff4f6eb8c..9d5de81a8404 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -1719,8 +1719,7 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) case RTF_NESTROW: { // If the right edge of the last cell (row width) is smaller than the width of some other row, mimic the WW8 import: add a fake cell. - RTFValue::Pointer_t pLastCellx = m_aStates.top().aTableRowSprms.find(NS_ooxml::LN_CT_TblGridBase_gridCol, false); - if (pLastCellx.get() && pLastCellx->getInt() < m_nCellxMax) + if (nKeyword == RTF_ROW && m_aStates.top().nCellX < m_nCellxMax) dispatchValue(RTF_CELLX, m_nCellxMax); if (m_aStates.top().nCells) @@ -2140,6 +2139,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) break; case RTF_TROWD: m_aStates.top().aTableRowSprms = m_aDefaultState.aTableRowSprms; + m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, RTFValue::Pointer_t(new RTFValue(-1)), false); m_aStates.top().aTableRowAttributes = m_aDefaultState.aTableRowAttributes; m_aStates.top().nCellX = 0; // In case the table definition is in the middle of the row |