Kaydet (Commit) 61ed5a1f authored tarafından Pallavi Jadhav's avatar Pallavi Jadhav Kaydeden (comit) Miklos Vajna

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/11160Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 3ee78b9c
......@@ -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();
......
......@@ -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())
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment