sw/qa/extras/ooxmlexport/data/sdt-date-duplicate.docx |binary sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx | 9 +++++++++ writerfilter/source/dmapper/SdtHelper.cxx | 2 ++ 3 files changed, 11 insertions(+)
New commits: commit 8fea536cebefe319a7fd5971b28e0936ac91ecb9 Author: Miklos Vajna <[email protected]> Date: Thu Jul 31 17:20:43 2014 +0200 SdtHelper::createDateControl: clear the property list after reading it Otherwise it may happen that the property list will be read twice, and on export we'll create two <w:sdt> for a single imported one. Change-Id: I57ab595f956c5e808fc73fe644ee3e249a1fc1ed diff --git a/sw/qa/extras/ooxmlexport/data/sdt-date-duplicate.docx b/sw/qa/extras/ooxmlexport/data/sdt-date-duplicate.docx new file mode 100644 index 0000000..038ab11 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/sdt-date-duplicate.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx index 73fab54..2e5844a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx @@ -550,6 +550,15 @@ DECLARE_OOXMLEXPORT_TEST(testTableStart2Sdt, "table-start-2-sdt.docx") } } +DECLARE_OOXMLEXPORT_TEST(testSdtDateDuplicate, "sdt-date-duplicate.docx") +{ + if (xmlDocPtr pXmlDoc = parseExport()) + { + // Single <w:sdt> was exported as 2 <w:sdt> elements. + assertXPath(pXmlDoc, "//w:sdt", 1); + } +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/SdtHelper.cxx b/writerfilter/source/dmapper/SdtHelper.cxx index bf268a3..693b248 100644 --- a/writerfilter/source/dmapper/SdtHelper.cxx +++ b/writerfilter/source/dmapper/SdtHelper.cxx @@ -131,6 +131,8 @@ void SdtHelper::createDateControl(OUString& rContentText, beans::PropertyValue a aGrabBag["CharFormat"] <<= aCharFormat.Value; // merge in properties like ooxml:CT_SdtPr_alias and friends. aGrabBag.update(comphelper::SequenceAsHashMap(m_aGrabBag)); + // and empty the property list, so they won't end up on the next sdt as well + m_aGrabBag.realloc(0); std::vector<OUString> aItems; createControlShape(lcl_getOptimalWidth(m_rDM_Impl.GetStyleSheetTable(), rContentText, aItems), xControlModel, aGrabBag.getAsConstPropertyValueList()); _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
