diff options
author | Pallavi Jadhav <pallavi.jadhav@synerzip.com> | 2014-08-28 12:23:20 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-09-01 00:54:10 -0500 |
commit | 61ed5a1f959a7903cfb56dc293dcc511ea28d15e (patch) | |
tree | 8c99dea58e0d803d1325d700478af71186650a7a | |
parent | 3ee78b9c4e9e68d8c88792b08a11288df7d1e9b0 (diff) |
fdo#83048: DOCX: Corrupt: LO exports wrong SDT properties of Date
Issue :
-File was getting corrupt due to wrong SDT Properties were getting export
and only one SDT tag was getting written.
-Issue file contained a Date SDT and a FieldChar SDT(Page numbers)
-Issue was at Import side.
LO GRAB BAGS Properties of SDT using PARA_GRAB_BAG or CHAR_GRAB_BAG
-For Date SDT it should be grab bagged using CHAR_GRAB_BAG in order to get
correct data inside <w:sdtPr>
But LO was handling it with PARA_GRAB_BAG due to which wrong properties were
getting written and
file was getting corrupt.
Implementation :
-Added a check for Date SDT to handle it through CHAR_GRAB_BAG
-Now correct SDT properties are getting exported due to which Date is getting
written inside an SDT tag.
-Added UT at export side.
Change-Id: Ibcfb6dbbec1c23ffd14ba924ab56dc4122b98595
Reviewed-on: https://gerrit.libreoffice.org/11160
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/fdo83048.docx | bin | 0 -> 29731 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 12 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo83048.docx b/sw/qa/extras/ooxmlexport/data/fdo83048.docx Binary files differnew file mode 100644 index 000000000000..3ef6d995fa52 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/fdo83048.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index 59ae8959886f..27de7ee532e5 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -659,6 +659,18 @@ DECLARE_OOXMLEXPORT_TEST(test2colHeader, "2col-header.docx") CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xPageStyle, "HeaderIsOn")); } +DECLARE_OOXMLEXPORT_TEST(testfdo83048, "fdo83048.docx") +{ + // Issue was wrong SDT properties were getting exported for Date SDT + xmlDocPtr pXmlDoc = parseExport("word/footer1.xml"); + if (!pXmlDoc) + return; + + // Make sure Date is inside SDT tag. + // This will happen only if right SDT properties are exported. + assertXPath(pXmlDoc, "/w:ftr/w:sdt/w:sdtContent/w:p[1]/w:sdt/w:sdtContent/w:r[1]/w:t", "1/2/2013"); +} + DECLARE_OOXMLEXPORT_TEST(testSdt2Run, "sdt-2-run.docx") { xmlDocPtr pXmlDoc = parseExport(); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index b5ce4a317578..8a4910e8915b 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -2961,6 +2961,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_text") || m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_dataBinding") || m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_citation") || + m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_date") || (m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_id") && m_pImpl->m_pSdtHelper->getInteropGrabBagSize() == 1)) && !m_pImpl->m_pSdtHelper->isOutsideAParagraph()) { |