summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-09-24 09:41:02 +0100
committerMiklos Vajna <vmiklos@suse.cz>2012-09-24 10:41:33 +0200
commitaf6b7d8ba30d395e5f4a17876526434cf0a06005 (patch)
treeb66020b08b0247b5afcc26accaf0469f6e21da13
parentda9acd209918ac26b44bddcf7b38b8887d23bfef (diff)
fdo#49655 fix RTF import of text in the middle of table definition
Usually table text comes after the \intbl control word, but it turns out text is allowed earlier. Make sure such text is buffered, otherwise we'll send paragraph / run properties to the dmapper in the middle of table properties, which is obviously not allowed. Change-Id: I34f1df7e171316a7d926179689627301860d492f
-rw-r--r--sw/qa/extras/rtfimport/data/fdo49655.rtf5
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx15
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx8
3 files changed, 28 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo49655.rtf b/sw/qa/extras/rtfimport/data/fdo49655.rtf
new file mode 100644
index 000000000000..60f90fc527c0
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo49655.rtf
@@ -0,0 +1,5 @@
+{\rtf1
+{\colortbl \red0\green0\blue0;\red128\green128\blue128;\red255\green255\blue255;}
+\trowd \clvertalt \clbrdrt\brdrw15\brdrs \clbrdrl\brdrw15\brdrs \clbrdrb\brdrw15\brdrs \clbrdrr\brdrw15\brdrs \clcbpat1\cellx9600 \intbl\qc\cf2\b Travaux Exceptionnels de Jardinage N 12.03.0005.TEJ \b0\cell \row
+}
+\pard\par
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 9d5676157a63..873213b66315 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -111,6 +111,7 @@ public:
void testFdo52052();
void testInk();
void testFdo52389();
+ void testFdo49655();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -161,6 +162,7 @@ public:
CPPUNIT_TEST(testFdo52052);
CPPUNIT_TEST(testInk);
CPPUNIT_TEST(testFdo52389);
+ CPPUNIT_TEST(testFdo49655);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -970,6 +972,19 @@ void Test::testFdo52389()
CPPUNIT_ASSERT_EQUAL(6, getLength());
}
+void Test::testFdo49655()
+{
+ /*
+ * The problem was that the table was not imported due to the ' ' string in the middle of the table definition.
+ *
+ * xray ThisComponent.TextTables.Count 'was 0
+ */
+ load("fdo49655.rtf");
+ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index f8200ff5907a..5e3365431b5b 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1006,6 +1006,14 @@ void RTFDocumentImpl::text(OUString& rString)
return;
}
+ // Are we in the middle of the table definition? (No cell defs yet, but we already have some cell props.)
+ if (m_aStates.top().aTableCellSprms.find(NS_ooxml::LN_CT_TcPrBase_vAlign).get() &&
+ m_aStates.top().nCells == 0)
+ {
+ m_aTableBuffer.push_back(make_pair(BUFFER_UTEXT, RTFValue::Pointer_t(new RTFValue(rString))));
+ return;
+ }
+
checkFirstRun();
checkNeedPap();