[Libreoffice-commits] core.git: sw/qa writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Fri Sep 12 01:22:01 PDT 2014
sw/qa/extras/rtfimport/data/fdo44984.rtf | 30 +++++++++++++++++++++++++
sw/qa/extras/rtfimport/rtfimport.cxx | 10 ++++++++
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 12 ++++++++--
3 files changed, 50 insertions(+), 2 deletions(-)
New commits:
commit 52803dca4714494f58034c8636cb2d71ad32c2d0
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Sep 12 09:50:04 2014 +0200
fdo#44984 RTF import: handle form fields inside tables
Change-Id: I84b3d5186e99b8313cfb32398869de028a267b49
diff --git a/sw/qa/extras/rtfimport/data/fdo44984.rtf b/sw/qa/extras/rtfimport/data/fdo44984.rtf
new file mode 100755
index 0000000..a61d9ee
--- /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 1dda1c4..e124644 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 4cad765..836943ee 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);
More information about the Libreoffice-commits
mailing list