summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-07-18 16:46:43 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-07-18 17:05:57 +0200
commite400b3af070d2ec592d78ce64ba10bc5f091ce6a (patch)
tree55d1fad8e738cd2da7cf22306ca64c14bc989e42
parent085ab61bfd63d7610f2ccc52aa2483d795c9bc1a (diff)
DOCX export: handle <w:alias> for the date SDT
Change-Id: I97d4331a5e49815cc03e8579b50a076b37530f96
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx4
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx9
2 files changed, 12 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index e7934b2e79c4..87fdbd635418 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 92e4a963a198..dcdb99ada084 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(),