[Libreoffice-commits] core.git: sw/qa writerfilter/source

Pallavi Jadhav pallavi.jadhav at synerzip.com
Sun Aug 31 22:54:34 PDT 2014


 sw/qa/extras/ooxmlexport/data/fdo83048.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx    |   12 ++++++++++++
 writerfilter/source/dmapper/DomainMapper.cxx |    1 +
 3 files changed, 13 insertions(+)

New commits:
commit 61ed5a1f959a7903cfb56dc293dcc511ea28d15e
Author: Pallavi Jadhav <pallavi.jadhav at synerzip.com>
Date:   Thu Aug 28 12:23:20 2014 +0530

    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 at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/ooxmlexport/data/fdo83048.docx b/sw/qa/extras/ooxmlexport/data/fdo83048.docx
new file mode 100644
index 0000000..3ef6d99
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo83048.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 59ae895..27de7ee 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 b5ce4a3..8a4910e 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())
         {


More information about the Libreoffice-commits mailing list