sw/qa/extras/rtfexport/data/tdf80708.rtf | 15 +++++++++++++++ sw/qa/extras/rtfexport/rtfexport.cxx | 11 +++++++++++ sw/source/filter/ww8/rtfattributeoutput.cxx | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-)
New commits: commit 5e2708a5a8cad3c2f4578742264610abab677395 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Mon Apr 20 16:38:32 2015 +0200 tdf#80708 RTF export: fix unexpected table row break Regression from commit 1f77a5e8d5bf8a7f1b7bd7206996d2b2efc59462 (n#203704 fix RTF export table output for subtables, 2012-02-08), the problem is that RtfAttributeOutput::StartTableRow() has two callers depending on if it's the first or a later row, but the m_bTableRowEnded flag storing if that method is called is only set in one case. Fix the problem by moving the update of the flag to the method itself. Change-Id: Ieae1fb53f9528fc74d037d2fd783b3979b17cab8 diff --git a/sw/qa/extras/rtfexport/data/tdf80708.rtf b/sw/qa/extras/rtfexport/data/tdf80708.rtf new file mode 100644 index 0000000..30b6174 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf80708.rtf @@ -0,0 +1,15 @@ +{\rtf1 +\pard\plain +{first table} +\par \trowd\trql\trleft-108\ltrrow\trrh-374\trkeep\trpaddft3\trpaddt0\trpaddfl3\trpaddl0\trpaddfb3\trpaddb0\trpaddfr3\trpaddr0\clbrdrl\brdrhair\brdrcf1\cellx296\clbrdrl\brdrhair\brdrcf1\clbrdrr\brdrhair\brdrcf1\cellx702\pard\plain +{A1} +\cell\pard\plain \s0\ql +{A2} +\cell\row\pard\pard\plain \s42\ql +{\rtlch \ltrch\loch\lang2067 second table} +\par \trowd\trql\trleft-108\ltrrow\trrh-561\trkeep\trpaddft3\trpaddt0\trpaddfl3\trpaddl0\trpaddfb3\trpaddb0\trpaddfr3\trpaddr0\clbrdrl\brdrhair\brdrcf1\cellx296\clbrdrl\brdrhair\brdrcf1\clbrdrr\brdrhair\brdrcf1\cellx702\pard\plain \s0\ql +{A1} +\cell\pard\plain \s0\ql +{A2} +\cell\row\pard\pard\plain\par +} diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 47a91db..20f2a7d 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -20,6 +20,7 @@ #include <com/sun/star/table/ShadowFormat.hpp> #include <com/sun/star/text/FontEmphasis.hpp> #include <com/sun/star/text/RelOrientation.hpp> +#include <com/sun/star/text/TableColumnSeparator.hpp> #include <com/sun/star/text/TextContentAnchorType.hpp> #include <com/sun/star/text/XFootnotesSupplier.hpp> #include <com/sun/star/text/XPageCursor.hpp> @@ -878,6 +879,16 @@ DECLARE_RTFEXPORT_TEST(testHyphpar, "hyphpar.rtf") CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(getParagraph(2), "ParaIsHyphenation")); } +DECLARE_RTFEXPORT_TEST(testTdf80708, "tdf80708.rtf") +{ + 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(1), uno::UNO_QUERY); + uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY); + // This was 2, i.e. the second table had 3 cols, now 2 as expected. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators").getLength()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 2a18d90..96c1b2c 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -235,7 +235,6 @@ void RtfAttributeOutput::StartParagraph(ww8::WW8TableNodeInfo::Pointer_t pTextNo // In case of subtables, we may not get the first cell. if (pDeepInner && (pDeepInner->getCell() == 0 || m_bTableRowEnded)) { - m_bTableRowEnded = false; StartTableRow(pDeepInner); } @@ -873,6 +872,7 @@ void RtfAttributeOutput::StartTableRow(ww8::WW8TableNodeInfoInner::Pointer_t pTa { sal_uInt32 nCurrentDepth = pTableTextNodeInfoInner->getDepth(); SAL_INFO("sw.rtf", OSL_THIS_FUNC << ", (depth is " << nCurrentDepth << ")"); + m_bTableRowEnded = false; TableDefinition(pTableTextNodeInfoInner); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits