summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/ooxmlexport/data/simple-sdts.docxbin25212 -> 25424 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx1
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx8
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx5
-rw-r--r--writerfilter/source/dmapper/SdtHelper.cxx5
-rw-r--r--writerfilter/source/dmapper/SdtHelper.hxx1
6 files changed, 19 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/simple-sdts.docx b/sw/qa/extras/ooxmlexport/data/simple-sdts.docx
index 294ae7934870..95c5d00a6a50 100644
--- a/sw/qa/extras/ooxmlexport/data/simple-sdts.docx
+++ b/sw/qa/extras/ooxmlexport/data/simple-sdts.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index bac36e4ab488..557a3f58a195 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2920,6 +2920,7 @@ DECLARE_OOXMLEXPORT_TEST(testSimpleSdts, "simple-sdts.docx")
return;
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:text", 1);
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:id", 1);
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:sdt/w:sdtPr/w:citation", 1);
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 48366e4a9f75..546b0a4ef7e1 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -406,6 +406,11 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken, ::sax_fastparse
m_pSerializer->endElement( nSdtPrToken );
}
+ else if( nSdtPrToken == FSNS( XML_w, XML_id ) )
+ //Word won't open a document with an empty id tag, we fill it with a random number
+ m_pSerializer->singleElement( nSdtPrToken,
+ FSNS(XML_w, XML_val), OString::number( rand() ),
+ FSEND );
else if( nSdtPrToken > 0 )
m_pSerializer->singleElement( nSdtPrToken, FSEND );
@@ -7141,6 +7146,9 @@ void DocxAttributeOutput::CharGrabBag( const SfxGrabBagItem& rItem )
}
else if (aPropertyValue.Name == "ooxml:CT_SdtPr_text")
m_nRunSdtPrToken = FSNS( XML_w, XML_text );
+ else if (aPropertyValue.Name == "ooxml:CT_SdtPr_id" && m_nRunSdtPrToken == 0)
+ // only write id token as a marker if no other exist
+ m_nRunSdtPrToken = FSNS( XML_w, XML_id );
}
}
else
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index ed3dc13953b5..f36db6570a0b 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2251,6 +2251,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext )
case NS_ooxml::LN_CT_SdtPr_citation:
case NS_ooxml::LN_CT_SdtPr_group:
case NS_ooxml::LN_CT_SdtPr_text:
+ case NS_ooxml::LN_CT_SdtPr_id:
{
// this is an unsupported SDT property, create a grab bag for it
OUString sName = OUString::createFromAscii((*QNameToString::Instance())(nSprmId).c_str());
@@ -2669,7 +2670,9 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
// save them in the paragraph interop grab bag
if(m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_checkbox") ||
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_dataBinding") ||
+ (m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_id") &&
+ m_pImpl->m_pSdtHelper->getInteropGrabBagSize() == 1))
m_pImpl->GetTopContextOfType(CONTEXT_CHARACTER)->Insert(PROP_SDTPR,
uno::makeAny(m_pImpl->m_pSdtHelper->getInteropGrabBagAndClear()), true, CHAR_GRAB_BAG);
else
diff --git a/writerfilter/source/dmapper/SdtHelper.cxx b/writerfilter/source/dmapper/SdtHelper.cxx
index daf9b81455da..22f11986fef7 100644
--- a/writerfilter/source/dmapper/SdtHelper.cxx
+++ b/writerfilter/source/dmapper/SdtHelper.cxx
@@ -215,6 +215,11 @@ bool SdtHelper::isInteropGrabBagEmpty()
return m_aGrabBag.getLength() == 0;
}
+sal_Int32 SdtHelper::getInteropGrabBagSize()
+{
+ return m_aGrabBag.getLength();
+}
+
bool SdtHelper::containedInInteropGrabBag(OUString rValueName)
{
for (sal_Int32 i=0; i < m_aGrabBag.getLength(); ++i)
diff --git a/writerfilter/source/dmapper/SdtHelper.hxx b/writerfilter/source/dmapper/SdtHelper.hxx
index a69628729ad2..cfdd875e7b6b 100644
--- a/writerfilter/source/dmapper/SdtHelper.hxx
+++ b/writerfilter/source/dmapper/SdtHelper.hxx
@@ -88,6 +88,7 @@ public:
com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> getInteropGrabBagAndClear();
bool isInteropGrabBagEmpty();
bool containedInInteropGrabBag(OUString rValueName);
+ sal_Int32 getInteropGrabBagSize();
};
} // namespace dmapper