diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-09-12 09:50:04 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-09-12 10:20:23 +0200 |
commit | 52803dca4714494f58034c8636cb2d71ad32c2d0 (patch) | |
tree | 9e73ac0d37c5315c0cbbf8816bce6651424d0476 | |
parent | 422f873ba8ec3ad7d4a6dd054cbde4d9d7d3a5cb (diff) |
fdo#44984 RTF import: handle form fields inside tables
Change-Id: I84b3d5186e99b8313cfb32398869de028a267b49
-rwxr-xr-x | sw/qa/extras/rtfimport/data/fdo44984.rtf | 30 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 10 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 12 |
3 files changed, 50 insertions, 2 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo44984.rtf b/sw/qa/extras/rtfimport/data/fdo44984.rtf new file mode 100755 index 000000000000..a61d9ee6fed2 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo44984.rtf @@ -0,0 +1,30 @@ +{\rtf1 +\pard\plain +{A\par \ltrrow} +\trowd \cellx954 +\pard \intbl +{\field\flddirty\fldpriv +{\*\fldinst +{\rtlch +\fcs1 \af4\afs16 \ltrch\fcs0 \f4\fs16\insrsid7932335 +\hich\af4\dbch\af31505\loch\f4 FORMCHECKBOX } +{ +\rtlch\fcs1 \af4\afs16 \ltrch\fcs0 \f4\fs16\insrsid7932335 +{\*\datafield 6500000014000000114b6f6e74726f6c6c6be473746368656e3100000000000000000000000000} +{\*\formfield +{\fftype1\ffres25\fftypetxt0\ffhps20 +{\*\ffname Kontrollk\'e4stchen1} +\ffdefres0} +} +} +} +{\fldrslt } +} +{B \cell } +\pard \intbl +\row +\pard +{ +C +\par } +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 1dda1c45b972..e12464499b6c 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1941,6 +1941,16 @@ DECLARE_RTFIMPORT_TEST(testFdo82114, "fdo82114.rtf") CPPUNIT_ASSERT_EQUAL(aExpected, aActual); } +DECLARE_RTFIMPORT_TEST(testFdo44984, "fdo44984.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(0), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); + // This was Text, i.e. the checkbox field portion was missing. + CPPUNIT_ASSERT_EQUAL(OUString("TextFieldStartEnd"), getProperty<OUString>(getRun(getParagraphOfText(1, xCell->getText()), 1), "TextPortionType")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 4cad765d549f..836943eeb502 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -4922,8 +4922,16 @@ int RTFDocumentImpl::popState() RTFSprms aFFAttributes; RTFSprms aFFSprms; aFFSprms.set(NS_ooxml::LN_ffdata, pValue); - writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aFFAttributes, aFFSprms)); - Mapper().props(pProperties); + if (!m_aStates.top().pCurrentBuffer) + { + writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aFFAttributes, aFFSprms)); + Mapper().props(pProperties); + } + else + { + RTFValue::Pointer_t pFFValue(new RTFValue(aFFAttributes, aFFSprms)); + m_aStates.top().pCurrentBuffer->push_back(Buf_t(BUFFER_PROPS, pFFValue)); + } m_aFormfieldAttributes.clear(); m_aFormfieldSprms.clear(); singleChar(0x14); |