diff options
author | Justin Luth <justin.luth@collabora.com> | 2022-12-08 11:45:05 -0500 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-12-09 13:50:50 +0000 |
commit | a5098b222c9406af858fd6d94d0ceb2c3c2066a8 (patch) | |
tree | efd34bd39a2035f866db1bc722a47f5dadd76468 /sw/source/filter/ww8/docxattributeoutput.cxx | |
parent | 754b6ef15b8a93f73db4b293ee853668768c91e6 (diff) |
tdf#151548 sw content controls: preserve tag for block SDTs
The tag is critical for VBA access.
Although we do not yet import blockSdts as content controls,
losing this would break any VBA macros for MS Word.
So make sure it round-trips.
I can't imagine why it wasn't treated the same as alias.
I guess because Alias is seen, while tag appears to have
no valuable function (until VBA, where it becomes the most
likely ID field.)
Change-Id: I05a04faa9d2314c7b37c5b86f107bd1a16019509
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143830
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source/filter/ww8/docxattributeoutput.cxx')
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index dcafe422a0e8..95f137ec771f 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -615,6 +615,8 @@ void SdtBlockHelper::DeleteAndResetTheLists() m_pTextAttrs.clear(); if (!m_aAlias.isEmpty()) m_aAlias.clear(); + if (!m_aTag.isEmpty()) + m_aTag.clear(); if (!m_aPlaceHolderDocPart.isEmpty()) m_aPlaceHolderDocPart.clear(); if (!m_aColor.isEmpty()) @@ -719,6 +721,9 @@ void SdtBlockHelper::WriteExtraParams(const ::sax_fastparser::FSHelperPtr& pSeri if (!m_aAlias.isEmpty()) pSerializer->singleElementNS(XML_w, XML_alias, FSNS(XML_w, XML_val), m_aAlias); + + if (!m_aTag.isEmpty()) + pSerializer->singleElementNS(XML_w, XML_tag, FSNS(XML_w, XML_val), m_aTag); } void SdtBlockHelper::EndSdtBlock(const ::sax_fastparser::FSHelperPtr& pSerializer) @@ -828,6 +833,11 @@ void SdtBlockHelper::GetSdtParamsFromGrabBag(const uno::Sequence<beans::Property if (!(aPropertyValue.Value >>= m_aAlias)) SAL_WARN("sw.ww8", "DocxAttributeOutput::GrabBag: unexpected sdt alias value"); } + else if (aPropertyValue.Name == "ooxml:CT_SdtPr_tag" && m_aTag.isEmpty()) + { + if (!(aPropertyValue.Value >>= m_aTag)) + SAL_WARN("sw.ww8", "DocxAttributeOutput::GrabBag: unexpected sdt tag value"); + } else if (aPropertyValue.Name == "ooxml:CT_SdtPr_id") m_bHasId = true; else if (aPropertyValue.Name == "ooxml:CT_SdtPr_citation") |