sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 4 ++++ sw/source/filter/ww8/docxattributeoutput.cxx | 9 ++++++++- writerfilter/source/dmapper/SdtHelper.cxx | 21 ++++++++++----------- 3 files changed, 22 insertions(+), 12 deletions(-)
New commits: commit e400b3af070d2ec592d78ce64ba10bc5f091ce6a Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Jul 18 16:46:43 2014 +0200 DOCX export: handle <w:alias> for the date SDT Change-Id: I97d4331a5e49815cc03e8579b50a076b37530f96 diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index e7934b2..87fdbd6 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -3360,8 +3360,12 @@ DECLARE_OOXMLEXPORT_TEST(testSdtAlias, "sdt-alias.docx") DECLARE_OOXMLEXPORT_TEST(testSdtDateCharformat, "sdt-date-charformat.docx") { if (xmlDocPtr pXmlDoc = parseExport()) + { // character formatting (bold) was missing, this was 0 assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r/w:rPr/w:b", 1); + // alias was also missing. + assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:alias", 1); + } } DECLARE_OOXMLEXPORT_TEST(testFooterBodyDistance, "footer-body-distance.docx") diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 92e4a96..dcdb99a 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4216,7 +4216,7 @@ void DocxAttributeOutput::WritePostponedFormControl(const SdrObject* pObject) // gather component properties Date aOriginalDate(Date::EMPTY); - OUString sOriginalContent, sDateFormat; + OUString sOriginalContent, sDateFormat, sAlias; OUString sLocale("en-US"); uno::Sequence<beans::PropertyValue> aGrabBag; uno::Reference<beans::XPropertySet> xShapePropertySet(pFormObj->getUnoShape(), uno::UNO_QUERY); @@ -4241,6 +4241,8 @@ void DocxAttributeOutput::WritePostponedFormControl(const SdrObject* pObject) } else if (aGrabBag[i].Name == "CharFormat") aGrabBag[i].Value >>= aCharFormat; + else if (aGrabBag[i].Name == "ooxml:CT_SdtPr_alias") + aGrabBag[i].Value >>= sAlias; } } uno::Reference<beans::XPropertySet> xPropertySet(xControlModel, uno::UNO_QUERY); @@ -4274,6 +4276,11 @@ void DocxAttributeOutput::WritePostponedFormControl(const SdrObject* pObject) m_pSerializer->startElementNS(XML_w, XML_sdt, FSEND); m_pSerializer->startElementNS(XML_w, XML_sdtPr, FSEND); + if (!sAlias.isEmpty()) + m_pSerializer->singleElementNS(XML_w, XML_alias, + FSNS(XML_w, XML_val), OUStringToOString(sAlias, RTL_TEXTENCODING_UTF8), + FSEND); + if (bHasDate) m_pSerializer->startElementNS(XML_w, XML_date, FSNS( XML_w, XML_fullDate ), sDate.getStr(), commit 085ab61bfd63d7610f2ccc52aa2483d795c9bc1a Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Jul 18 16:41:09 2014 +0200 DOCX import: handle <w:alias> for the date SDT Change-Id: I4a58fd9fc1db4e0fd3f9e2142fc208cec9f99f9d diff --git a/writerfilter/source/dmapper/SdtHelper.cxx b/writerfilter/source/dmapper/SdtHelper.cxx index 18c3c06..2b1a111 100644 --- a/writerfilter/source/dmapper/SdtHelper.cxx +++ b/writerfilter/source/dmapper/SdtHelper.cxx @@ -128,6 +128,8 @@ void SdtHelper::createDateControl(OUString& rContentText, beans::PropertyValue a aGrabBag["DateFormat"] <<= sDateFormat; aGrabBag["Locale"] <<= m_sLocale.makeStringAndClear(); aGrabBag["CharFormat"] <<= aCharFormat.Value; + // merge in properties like ooxml:CT_SdtPr_alias and friends. + aGrabBag.update(comphelper::SequenceAsHashMap(m_aGrabBag)); std::vector<OUString> aItems; createControlShape(lcl_getOptimalWidth(m_rDM_Impl.GetStyleSheetTable(), rContentText, aItems), xControlModel, aGrabBag.getAsConstPropertyValueList()); commit 7916ca62209ee32c46c264b8cbf0a28b1c23a2a8 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Jul 18 16:38:45 2014 +0200 Use comphelper::SequenceAsHashMap Change-Id: I398881187001393a84e407157041d3a7d254b708 diff --git a/writerfilter/source/dmapper/SdtHelper.cxx b/writerfilter/source/dmapper/SdtHelper.cxx index aeb129d..18c3c06 100644 --- a/writerfilter/source/dmapper/SdtHelper.cxx +++ b/writerfilter/source/dmapper/SdtHelper.cxx @@ -12,6 +12,7 @@ #include <com/sun/star/drawing/XControlShape.hpp> #include <com/sun/star/text/VertOrientation.hpp> +#include <comphelper/sequenceashashmap.hxx> #include <editeng/unoprnms.hxx> #include <vcl/outdev.hxx> #include <vcl/svapp.hxx> @@ -121,19 +122,15 @@ void SdtHelper::createDateControl(OUString& rContentText, beans::PropertyValue a xPropertySet->setPropertyValue("HelpText", uno::makeAny(rContentText)); // append date format to grab bag - uno::Sequence<beans::PropertyValue> aGrabBag(5); - aGrabBag[0].Name = "OriginalDate"; - aGrabBag[0].Value = uno::makeAny(aDate); - aGrabBag[1].Name = "OriginalContent"; - aGrabBag[1].Value = uno::makeAny(rContentText); - aGrabBag[2].Name = "DateFormat"; - aGrabBag[2].Value = uno::makeAny(sDateFormat); - aGrabBag[3].Name = "Locale"; - aGrabBag[3].Value = uno::makeAny(m_sLocale.makeStringAndClear()); - aGrabBag[4] = aCharFormat; + comphelper::SequenceAsHashMap aGrabBag; + aGrabBag["OriginalDate"] <<= aDate; + aGrabBag["OriginalContent"] <<= rContentText; + aGrabBag["DateFormat"] <<= sDateFormat; + aGrabBag["Locale"] <<= m_sLocale.makeStringAndClear(); + aGrabBag["CharFormat"] <<= aCharFormat.Value; std::vector<OUString> aItems; - createControlShape(lcl_getOptimalWidth(m_rDM_Impl.GetStyleSheetTable(), rContentText, aItems), xControlModel, aGrabBag); + createControlShape(lcl_getOptimalWidth(m_rDM_Impl.GetStyleSheetTable(), rContentText, aItems), xControlModel, aGrabBag.getAsConstPropertyValueList()); } void SdtHelper::createControlShape(awt::Size aSize, uno::Reference<awt::XControlModel> xControlModel) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits