oox/source/token/namespaces-strict.txt | 1 oox/source/token/namespaces.txt | 1 oox/source/token/tokens.txt | 1 sw/qa/extras/ooxmlexport/data/tdf137466.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 15 ++++ sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 2 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 4 - sw/qa/extras/ooxmlexport/ooxmlw14export.cxx | 2 sw/qa/inc/swmodeltestbase.hxx | 1 sw/source/filter/ww8/docxattributeoutput.cxx | 89 ++++++++++++++++++++++++--- sw/source/filter/ww8/docxattributeoutput.hxx | 6 + sw/source/filter/ww8/docxexport.cxx | 3 writerfilter/CustomTarget_source.mk | 1 writerfilter/source/dmapper/DomainMapper.cxx | 20 +++++- writerfilter/source/ooxml/model.xml | 37 ++++++++++- 15 files changed, 165 insertions(+), 18 deletions(-)
New commits: commit f7a42a0712b1b7dcf141f55fd8b024afc109fd1c Author: Vasily Melenchuk <vasily.melenc...@cib.de> AuthorDate: Tue Nov 16 11:50:03 2021 +0300 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Mon Dec 20 12:43:44 2021 +0100 tdf#137466: docx: support w:placeholder & w15:color in w:sdtPr Content controls in Word can contain some other elements which are not supported by Writer. Put them into grabbag and write back to DOCX on save to avoid losing quite sensitive data. Test testSimpleSdts is modified: testcase is actully containing 4 sdt elements with ids in input and output. Change-Id: I1f9addd03ed828bf375ccac5188a004f011e8a0d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125271 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Reviewed-by: Vasily Melenchuk <vasily.melenc...@cib.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127126 Tested-by: Thorsten Behrens <thorsten.behr...@allotropia.de> Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/oox/source/token/namespaces-strict.txt b/oox/source/token/namespaces-strict.txt index d6990e5bdf91..36841732372e 100644 --- a/oox/source/token/namespaces-strict.txt +++ b/oox/source/token/namespaces-strict.txt @@ -84,6 +84,7 @@ p14 http://schemas.microsoft.com/office/powerpoint/2010/main # MSO 2012/2013 extensions --------------------------------------------------------- +w15 http://schemas.microsoft.com/office/word/2012/wordml p15 http://schemas.microsoft.com/office/powerpoint/2012/main x12ac http://schemas.microsoft.com/office/spreadsheetml/2011/1/ac diff --git a/oox/source/token/namespaces.txt b/oox/source/token/namespaces.txt index 604541129469..20d283415069 100644 --- a/oox/source/token/namespaces.txt +++ b/oox/source/token/namespaces.txt @@ -84,6 +84,7 @@ p14 http://schemas.microsoft.com/office/powerpoint/2010/main # MSO 2012/2013 extensions --------------------------------------------------------- +w15 http://schemas.microsoft.com/office/word/2012/wordml p15 http://schemas.microsoft.com/office/powerpoint/2012/main x12ac http://schemas.microsoft.com/office/spreadsheetml/2011/1/ac diff --git a/oox/source/token/tokens.txt b/oox/source/token/tokens.txt index 3929d8c93808..ceadddd3afb9 100644 --- a/oox/source/token/tokens.txt +++ b/oox/source/token/tokens.txt @@ -5672,6 +5672,7 @@ vt w w10 w14 +w15 wAfter wArH wBefore diff --git a/sw/qa/extras/ooxmlexport/data/tdf137466.docx b/sw/qa/extras/ooxmlexport/data/tdf137466.docx new file mode 100644 index 000000000000..3c5977251bda Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf137466.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index 881d22174c8b..10634568908c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -149,6 +149,21 @@ DECLARE_OOXMLEXPORT_TEST(testTdf81507, "tdf81507.docx") xmlXPathFreeObject(pXmlObj); } +DECLARE_OOXMLEXPORT_TEST(testTdf137466, "tdf137466.docx") +{ + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + if (!pXmlDoc) + return; // initial import, no futher checks + + // Ensure that we have <w:placeholder><w:docPart v:val="xxxx"/></w:placeholder> + OUString sDocPart = getXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:placeholder/w:docPart", "val"); + CPPUNIT_ASSERT_EQUAL(OUString("DefaultPlaceholder_-1854013440"), sDocPart); + + // Ensure that we have <w15:color v:val="xxxx"/> + OUString sColor = getXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w15:color", "val"); + CPPUNIT_ASSERT_EQUAL(OUString("FF0000"), sColor); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index c39c7d747b83..1323cf5a9bba 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -1071,7 +1071,7 @@ DECLARE_OOXMLEXPORT_TEST(testSimpleSdts, "simple-sdts.docx") return; assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:text", 1); - assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:id", 3); + assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:id", 4); assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:picture", 1); assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:group", 1); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:citation", 1); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index cc0295a36294..ede5fd171b5f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -535,12 +535,12 @@ DECLARE_OOXMLEXPORT_TEST(testFDO79062, "fdo79062.docx") xmlDocPtr pXmlFootNotes = parseExport("word/footnotes.xml"); if (!pXmlFootNotes) return; - assertXPath(pXmlFootNotes, "/w:footnotes", "Ignorable", "w14 wp14"); + assertXPath(pXmlFootNotes, "/w:footnotes", "Ignorable", "w14 wp14 w15"); xmlDocPtr pXmlEndNotes = parseExport("word/endnotes.xml"); if (!pXmlEndNotes) return; - assertXPath(pXmlEndNotes, "/w:endnotes", "Ignorable", "w14 wp14"); + assertXPath(pXmlEndNotes, "/w:endnotes", "Ignorable", "w14 wp14 w15"); //tdf#93121 don't add fake tabs in front of extra footnote paragraphs uno::Reference<text::XFootnotesSupplier> xFootnoteSupp(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx b/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx index f6939083c456..ef6aaaebbb09 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx @@ -260,7 +260,7 @@ DECLARE_OOXMLEXPORT_TEST(Test_McIgnorable, "TextEffects_StylisticSets_CntxtAlts. if (!pXmlDocument) return; - assertXPath(pXmlDocument, "/w:document", "Ignorable", "w14 wp14"); + assertXPath(pXmlDocument, "/w:document", "Ignorable", "w14 wp14 w15"); xmlDocPtr pXmlStyles = parseExport("word/styles.xml"); if (!pXmlStyles) diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx index 38f8e95a4a40..8d4b25f1cf32 100644 --- a/sw/qa/inc/swmodeltestbase.hxx +++ b/sw/qa/inc/swmodeltestbase.hxx @@ -955,6 +955,7 @@ protected: xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("pic"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/picture")); xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("rels"), BAD_CAST("http://schemas.openxmlformats.org/package/2006/relationships")); xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("w14"), BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordml")); + xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("w15"), BAD_CAST("http://schemas.microsoft.com/office/word/2012/wordml")); xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("m"), BAD_CAST("http://schemas.openxmlformats.org/officeDocument/2006/math")); xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("ContentType"), BAD_CAST("http://schemas.openxmlformats.org/package/2006/content-types")); xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("lc"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas")); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 6018a64df1af..78673d876df9 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -555,7 +555,7 @@ static void lcl_deleteAndResetTheLists( rtl::Reference<sax_fastparser::FastAttributeList>& pSdtPrTokenChildren, rtl::Reference<sax_fastparser::FastAttributeList>& pSdtPrDataBindingAttrs, rtl::Reference<sax_fastparser::FastAttributeList>& pSdtPrTextAttrs, - OUString& rSdtPrAlias) + OUString& rSdtPrAlias, OUString& rSdtPrPlaceholderDocPart, OUString& rColor) { if( pSdtPrTokenChildren.is() ) pSdtPrTokenChildren.clear(); @@ -565,6 +565,10 @@ static void lcl_deleteAndResetTheLists( pSdtPrTextAttrs.clear(); if (!rSdtPrAlias.isEmpty()) rSdtPrAlias.clear(); + if (!rSdtPrPlaceholderDocPart.isEmpty()) + rSdtPrPlaceholderDocPart.clear(); + if (!rColor.isEmpty()) + rColor.clear(); } void DocxAttributeOutput::PopulateFrameProperties(const SwFrameFormat* pFrameFormat, const Size& rSize) @@ -761,14 +765,20 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT m_pSerializer->endElementNS( XML_w, XML_p ); // on export sdt blocks are never nested ATM if( !m_bAnchorLinkedToNode && !m_bStartedParaSdt ) - WriteSdtBlock( m_nParagraphSdtPrToken, m_pParagraphSdtPrTokenChildren, m_pParagraphSdtPrTokenAttributes, m_pParagraphSdtPrDataBindingAttrs, m_pParagraphSdtPrTextAttrs, m_aParagraphSdtPrAlias, /*bPara=*/true ); + WriteSdtBlock(m_nParagraphSdtPrToken, m_pParagraphSdtPrTokenChildren, + m_pParagraphSdtPrTokenAttributes, m_pParagraphSdtPrDataBindingAttrs, + m_pParagraphSdtPrTextAttrs, m_aParagraphSdtPrAlias, + m_aParagraphSdtPrPlaceHolderDocPart, m_aParagraphSdtPrColor, /*bPara=*/true); else { //These should be written out to the actual Node and not to the anchor. //Clear them as they will be repopulated when the node is processed. m_nParagraphSdtPrToken = 0; m_bParagraphSdtHasId = false; - lcl_deleteAndResetTheLists( m_pParagraphSdtPrTokenChildren, m_pParagraphSdtPrDataBindingAttrs, m_pParagraphSdtPrTextAttrs, m_aParagraphSdtPrAlias ); + lcl_deleteAndResetTheLists(m_pParagraphSdtPrTokenChildren, + m_pParagraphSdtPrDataBindingAttrs, m_pParagraphSdtPrTextAttrs, + m_aParagraphSdtPrAlias, m_aParagraphSdtPrPlaceHolderDocPart, + m_aParagraphSdtPrColor); } //sdtcontent is written so Set m_bParagraphHasDrawing to false @@ -802,9 +812,11 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken, rtl::Reference<sax_fastparser::FastAttributeList>& pSdtPrDataBindingAttrs, rtl::Reference<sax_fastparser::FastAttributeList>& pSdtPrTextAttrs, OUString& rSdtPrAlias, + OUString& rSdtPrPlaceholderDocPart, + OUString& rColor, bool bPara ) { - if( nSdtPrToken <= 0 && !pSdtPrDataBindingAttrs.is() ) + if( nSdtPrToken <= 0 && !pSdtPrDataBindingAttrs.is() && !m_bParagraphSdtHasId) return; // sdt start mark @@ -866,6 +878,17 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken, m_pSerializer->singleElementNS(XML_w, XML_text, xAttrList); } + if (!rSdtPrPlaceholderDocPart.isEmpty()) + { + m_pSerializer->startElementNS(XML_w, XML_placeholder); + m_pSerializer->singleElementNS(XML_w, XML_docPart, FSNS(XML_w, XML_val), rSdtPrPlaceholderDocPart.toUtf8()); + m_pSerializer->endElementNS(XML_w, XML_placeholder); + } + if (!rColor.isEmpty()) + { + m_pSerializer->singleElementNS(XML_w15, XML_color, FSNS(XML_w, XML_val), rColor.toUtf8()); + } + if (!rSdtPrAlias.isEmpty()) m_pSerializer->singleElementNS(XML_w, XML_alias, FSNS(XML_w, XML_val), rSdtPrAlias.toUtf8()); @@ -897,7 +920,7 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken, pSdtPrDataBindingAttrs.clear(); pSdtPrTextAttrs.clear(); rSdtPrAlias.clear(); - + m_bParagraphSdtHasId = false; } void DocxAttributeOutput::EndSdtBlock() @@ -1541,14 +1564,18 @@ void DocxAttributeOutput::EndRun(const SwTextNode* pNode, sal_Int32 nPos, bool / if ( !m_bAnchorLinkedToNode && !m_bStartedCharSdt ) { rtl::Reference<sax_fastparser::FastAttributeList> pRunSdtPrTokenAttributes; - WriteSdtBlock( m_nRunSdtPrToken, m_pRunSdtPrTokenChildren, pRunSdtPrTokenAttributes, m_pRunSdtPrDataBindingAttrs, m_pRunSdtPrTextAttrs, m_aRunSdtPrAlias, /*bPara=*/false ); + WriteSdtBlock(m_nRunSdtPrToken, m_pRunSdtPrTokenChildren, pRunSdtPrTokenAttributes, + m_pRunSdtPrDataBindingAttrs, m_pRunSdtPrTextAttrs, m_aRunSdtPrAlias, + m_aRunSdtPrPlaceHolderDocPart, m_aRunSdtPrColor, /*bPara=*/false); } else { //These should be written out to the actual Node and not to the anchor. //Clear them as they will be repopulated when the node is processed. m_nRunSdtPrToken = 0; - lcl_deleteAndResetTheLists( m_pRunSdtPrTokenChildren, m_pRunSdtPrDataBindingAttrs, m_pRunSdtPrTextAttrs, m_aRunSdtPrAlias ); + lcl_deleteAndResetTheLists(m_pRunSdtPrTokenChildren, m_pRunSdtPrDataBindingAttrs, + m_pRunSdtPrTextAttrs, m_aRunSdtPrAlias, + m_aRunSdtPrPlaceHolderDocPart, m_aRunSdtPrColor); } if (bCloseEarlierSDT) @@ -9030,7 +9057,7 @@ void DocxAttributeOutput::ParaGrabBag(const SfxGrabBagItem& rItem) for (const auto& rProp : std::as_const(aGrabBag)) { OUString sValue = rProp.Value.get<OUString>(); - if (rProp.Name == "ooxml:LN_CT_SdtText_multiLine") + if (rProp.Name == "ooxml:CT_SdtText_multiLine") AddToAttrList(m_pParagraphSdtPrTextAttrs, FSNS(XML_w, XML_multiLine), OUStringToOString(sValue, RTL_TEXTENCODING_UTF8).getStr()); @@ -9063,6 +9090,28 @@ void DocxAttributeOutput::ParaGrabBag(const SfxGrabBagItem& rItem) OUStringToOString( sValue, RTL_TEXTENCODING_UTF8 ).getStr() ); } } + else if (aPropertyValue.Name == "ooxml:CT_SdtPlaceholder_docPart") + { + uno::Sequence<beans::PropertyValue> aGrabBag; + aPropertyValue.Value >>= aGrabBag; + for (const auto& rProp : std::as_const(aGrabBag)) + { + OUString sValue = rProp.Value.get<OUString>(); + if (rProp.Name == "ooxml:CT_SdtPlaceholder_docPart_val") + m_aParagraphSdtPrPlaceHolderDocPart = sValue; + } + } + else if (aPropertyValue.Name == "ooxml:CT_SdtPr_color") + { + uno::Sequence<beans::PropertyValue> aGrabBag; + aPropertyValue.Value >>= aGrabBag; + for (const auto& rProp : std::as_const(aGrabBag)) + { + OUString sValue = rProp.Value.get<OUString>(); + if (rProp.Name == "ooxml:CT_SdtColor_val") + m_aParagraphSdtPrColor = sValue; + } + } else if (aPropertyValue.Name == "ooxml:CT_SdtPr_alias" && m_aParagraphSdtPrAlias.isEmpty()) { if (!(aPropertyValue.Value >>= m_aParagraphSdtPrAlias)) @@ -9264,7 +9313,7 @@ void DocxAttributeOutput::CharGrabBag( const SfxGrabBagItem& rItem ) for (const auto& rProp : std::as_const(aGrabBag)) { OUString sValue = rProp.Value.get<OUString>(); - if (rProp.Name == "ooxml:LN_CT_SdtText_multiLine") + if (rProp.Name == "ooxml:CT_SdtText_multiLine") AddToAttrList(m_pRunSdtPrTextAttrs, FSNS(XML_w, XML_multiLine), OUStringToOString(sValue, RTL_TEXTENCODING_UTF8).getStr()); @@ -9291,6 +9340,28 @@ void DocxAttributeOutput::CharGrabBag( const SfxGrabBagItem& rItem ) OUStringToOString( sValue, RTL_TEXTENCODING_UTF8 ).getStr() ); } } + else if (aPropertyValue.Name == "ooxml:CT_SdtPlaceholder_docPart") + { + uno::Sequence<beans::PropertyValue> aGrabBag; + aPropertyValue.Value >>= aGrabBag; + for (const auto& rProp : std::as_const(aGrabBag)) + { + OUString sValue = rProp.Value.get<OUString>(); + if (rProp.Name == "ooxml:CT_SdtPlaceholder_docPart_val") + m_aRunSdtPrPlaceHolderDocPart = sValue; + } + } + else if (aPropertyValue.Name == "ooxml:CT_SdtPr_color") + { + uno::Sequence<beans::PropertyValue> aGrabBag; + aPropertyValue.Value >>= aGrabBag; + for (const auto& rProp : std::as_const(aGrabBag)) + { + OUString sValue = rProp.Value.get<OUString>(); + if (rProp.Name == "ooxml:CT_SdtColor_val") + m_aRunSdtPrColor = sValue; + } + } else if (aPropertyValue.Name == "ooxml:CT_SdtPr_alias" && m_aRunSdtPrAlias.isEmpty()) { if (!(aPropertyValue.Value >>= m_aRunSdtPrAlias)) diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index 4323b72a6a84..415a7944e5f5 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -714,6 +714,8 @@ private: rtl::Reference<sax_fastparser::FastAttributeList>& pSdtPrDataBindingAttrs, rtl::Reference<sax_fastparser::FastAttributeList>& pSdtPrTextAttrs, OUString& rSdtPrAlias, + OUString& rSdtPrPlaceholderDocPart, + OUString& rColor, bool bPara); /// Closes a currently open SDT block. void EndSdtBlock(); @@ -970,9 +972,13 @@ private: rtl::Reference<sax_fastparser::FastAttributeList> m_pRunSdtPrTextAttrs; /// Value of the <w:alias> paragraph SDT element. OUString m_aParagraphSdtPrAlias; + OUString m_aParagraphSdtPrPlaceHolderDocPart; + OUString m_aParagraphSdtPrColor; /// Same as m_aParagraphSdtPrAlias, but its content is available till the SDT is closed. OUString m_aStartedParagraphSdtPrAlias; OUString m_aRunSdtPrAlias; + OUString m_aRunSdtPrPlaceHolderDocPart; + OUString m_aRunSdtPrColor; /// Currently paragraph SDT has a <w:id> child element. bool m_bParagraphSdtHasId; diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index a48f4fb7b59e..16099587bbf8 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -1591,7 +1591,8 @@ XFastAttributeListRef DocxExport::MainXmlNamespaces() pAttr->add( FSNS( XML_xmlns, XML_mc ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(mce)), RTL_TEXTENCODING_UTF8).getStr() ); pAttr->add( FSNS( XML_xmlns, XML_wp14 ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(wp14)), RTL_TEXTENCODING_UTF8).getStr() ); pAttr->add( FSNS( XML_xmlns, XML_w14 ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(w14)), RTL_TEXTENCODING_UTF8).getStr() ); - pAttr->add( FSNS( XML_mc, XML_Ignorable ), "w14 wp14" ); + pAttr->add( FSNS( XML_xmlns, XML_w15 ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(w15)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_mc, XML_Ignorable ), "w14 wp14 w15" ); return XFastAttributeListRef( pAttr ); } diff --git a/writerfilter/CustomTarget_source.mk b/writerfilter/CustomTarget_source.mk index 8d7b3d22b690..d0085654a146 100644 --- a/writerfilter/CustomTarget_source.mk +++ b/writerfilter/CustomTarget_source.mk @@ -41,6 +41,7 @@ writerfilter_OOXMLNAMESPACES= \ vml-wordprocessingDrawing \ wp14 \ w14 \ + w15 \ a14 \ wml diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index d0e152492870..e204795de260 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1105,8 +1105,14 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) case NS_ooxml::LN_CT_DataBinding_storeItemID: m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_DataBinding_storeItemID", sStringValue); break; + case NS_ooxml::LN_CT_SdtPlaceholder_docPart_val: + m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtPlaceholder_docPart_val", sStringValue); + break; + case NS_ooxml::LN_CT_SdtColor_val: + m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtColor_val", sStringValue); + break; case NS_ooxml::LN_CT_SdtText_multiLine: - m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:LN_CT_SdtText_multiLine", sStringValue); + m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtText_multiLine", sStringValue); break; case NS_ooxml::LN_CT_PTab_leader: case NS_ooxml::LN_CT_PTab_relativeTo: @@ -2499,6 +2505,14 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) pProperties->resolve(*this); } break; + case NS_ooxml::LN_CT_SdtPr_placeholder: + { + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); + if (pProperties) + pProperties->resolve(*this); + } + break; + break; case NS_ooxml::LN_CT_SdtPr_date: { resolveSprmProps(*this, rSprm); @@ -2534,6 +2548,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) case NS_ooxml::LN_CT_SdtPr_text: case NS_ooxml::LN_CT_SdtPr_id: case NS_ooxml::LN_CT_SdtPr_alias: + case NS_ooxml::LN_CT_SdtPlaceholder_docPart: + case NS_ooxml::LN_CT_SdtPr_color: { // this is an unsupported SDT property, create a grab bag for it OUString sName; @@ -2550,6 +2566,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) case NS_ooxml::LN_CT_SdtPr_text: sName = "ooxml:CT_SdtPr_text"; break; case NS_ooxml::LN_CT_SdtPr_id: sName = "ooxml:CT_SdtPr_id"; break; case NS_ooxml::LN_CT_SdtPr_alias: sName = "ooxml:CT_SdtPr_alias"; break; + case NS_ooxml::LN_CT_SdtPlaceholder_docPart: sName = "ooxml:CT_SdtPlaceholder_docPart"; break; + case NS_ooxml::LN_CT_SdtPr_color: sName = "ooxml:CT_SdtPr_color"; break; default: assert(false); }; enableInteropGrabBag(sName); diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml index 4a1ba3988de3..6be08d0cb307 100644 --- a/writerfilter/source/ooxml/model.xml +++ b/writerfilter/source/ooxml/model.xml @@ -26,6 +26,7 @@ xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" + xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" @@ -5353,6 +5354,13 @@ <element name="cntxtAlts" tokenid="ooxml:cntxtAlts_cntxtAlts"/> </resource> </namespace> + <namespace name="w15"> + <grammar xmlns="http://relaxng.org/ns/structure/1.0" ns="http://schemas.microsoft.com/office/word/2012/wordml"> + <define name="ST_LongHexNumber"> + <data type="hexBinary"/> + </define> + </grammar> + </namespace> <namespace name="a14"> <grammar xmlns="http://relaxng.org/ns/structure/1.0" ns="http://schemas.microsoft.com/office/drawing/2010/main"> <!-- Simple types --> @@ -13853,9 +13861,14 @@ <data type="string"/> </attribute> </define> - <define name="CT_Placeholder"> + <define name="CT_SdtPlaceholderDocPart"> + <attribute name="val"> + <data type="string"/> + </attribute> + </define> + <define name="CT_SdtPlaceholder"> <element name="docPart"> - <ref name="CT_String"/> + <ref name="CT_SdtPlaceholderDocPart"/> </element> </define> <define name="CT_SdtText"> @@ -13874,6 +13887,11 @@ <data type="string"/> </attribute> </define> + <define name="CT_SdtColor"> + <attribute name="val"> + <data type="string"/> + </attribute> + </define> <define name="CT_SdtPr"> <choice> <element name="rPr"> @@ -13886,7 +13904,7 @@ <ref name="CT_Lock"/> </element> <element name="placeholder"> - <ref name="CT_Placeholder"/> + <ref name="CT_SdtPlaceholder"/> </element> <element name="showingPlcHdr"> <ref name="CT_OnOff"/> @@ -13942,6 +13960,9 @@ <element name="bibliography"> <ref name="CT_Empty"/> </element> + <element name="w15:color"> + <ref name="CT_SdtColor"/> + </element> </choice> </define> <define name="CT_SdtEndPr"> @@ -18153,11 +18174,17 @@ <resource name="CT_SdtText" resource="Properties"> <attribute name="multiLine" tokenid="ooxml:CT_SdtText_multiLine"/> </resource> + <resource name="CT_SdtPlaceholder" resource="Properties"> + <attribute name="docPart" tokenid="ooxml:CT_SdtPlaceholder_docPart"/> + </resource> <resource name="CT_DataBinding" resource="Properties"> <attribute name="prefixMappings" tokenid="ooxml:CT_DataBinding_prefixMappings"/> <attribute name="xpath" tokenid="ooxml:CT_DataBinding_xpath"/> <attribute name="storeItemID" tokenid="ooxml:CT_DataBinding_storeItemID"/> </resource> + <resource name="CT_SdtColor" resource="Properties"> + <attribute name="val" tokenid="ooxml:CT_SdtColor_val"/> + </resource> <resource name="CT_SdtPr" resource="Properties"> <element name="rPr" tokenid="ooxml:CT_SdtPr_rPr"/> <element name="alias" tokenid="ooxml:CT_SdtPr_alias"/> @@ -18181,6 +18208,7 @@ <element name="citation" tokenid="ooxml:CT_SdtPr_citation"/> <element name="group" tokenid="ooxml:CT_SdtPr_group"/> <element name="bibliography" tokenid="ooxml:CT_SdtPr_bibliography"/> + <element name="w15:color" tokenid="ooxml:CT_SdtPr_color"/> </resource> <resource name="CT_SdtEndPr" resource="Properties"> <element name="rPr" tokenid="ooxml:CT_SdtEndPr_rPr"/> @@ -18245,6 +18273,9 @@ <attribute name="displayText" tokenid="ooxml:CT_SdtListItem_displayText"/> <attribute name="value" tokenid="ooxml:CT_SdtListItem_value"/> </resource> + <resource name="CT_SdtPlaceholderDocPart" resource="Properties"> + <attribute name="val" tokenid="ooxml:CT_SdtPlaceholder_docPart_val"/> + </resource> <resource name="CT_Attr" resource="Properties"> <attribute name="uri" tokenid="ooxml:CT_Attr_uri"/> <attribute name="name" tokenid="ooxml:CT_Attr_name"/>