diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-04-20 16:38:32 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-04-24 15:53:53 +0000 |
commit | ffc80d79bf7c209607741cf6211dbe706990fea8 (patch) | |
tree | 458ca9aa8c9bada93c9f45abae9007110d1621c6 | |
parent | 6ccddc00775a5ec20b7b0bc35232ecbbbfd53958 (diff) |
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.
(cherry picked from commit 5e2708a5a8cad3c2f4578742264610abab677395)
Conflicts:
sw/qa/extras/rtfexport/rtfexport.cxx
Change-Id: Ieae1fb53f9528fc74d037d2fd783b3979b17cab8
Reviewed-on: https://gerrit.libreoffice.org/15506
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sw/qa/extras/rtfexport/data/tdf80708.rtf | 15 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport.cxx | 11 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 2 |
3 files changed, 27 insertions, 1 deletions
diff --git a/sw/qa/extras/rtfexport/data/tdf80708.rtf b/sw/qa/extras/rtfexport/data/tdf80708.rtf new file mode 100644 index 000000000000..30b6174ede03 --- /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 bbd969d27622..2a13b4b75f0a 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -18,6 +18,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> @@ -858,6 +859,16 @@ DECLARE_RTFEXPORT_TEST(testTdf88583, "tdf88583.odt") CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x00cc00), getProperty<sal_Int32>(getParagraph(1), "FillColor")); } +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 84b031a60859..7071e7b8d1f9 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -245,7 +245,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); } @@ -882,6 +881,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); |