sw/source/writerfilter/dmapper/DomainMapper.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
New commits: commit 52c6bbfc381c37ea6400f768f7d4773da9ba6873 Author: Justin Luth <[email protected]> AuthorDate: Wed Jan 14 15:16:10 2026 -0500 Commit: Justin Luth <[email protected]> CommitDate: Tue Jan 20 03:45:36 2026 +0100 tdf#170322 writerfilter: if dataBinding, then not richText When a content control is not defined, that means that it is a richText control. If it was plainText, it would have contained a <w:text/> entry. However, in practice, if there is a <w:dataBinding> then MS Word treats it as plainText. The biggest problem here is that we don't really support blockSdt richText very well. Although we round-trip it, we don't display it as a content control in the application. So I'm not about to change _unknown to _richText, but just add in the bits that I've learned. I was trying to prove that the change I made to avoid fields being inside a plainText field (because MS Word considers those documents to be corrupt). Change-Id: I7cd2d8240ca92589741e347dc54301dd221f400a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197485 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Justin Luth <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197414 Tested-by: Jenkins diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx b/sw/source/writerfilter/dmapper/DomainMapper.cxx index 23f9914fb5d2..05b089ddc5fa 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx @@ -1271,7 +1271,12 @@ void DomainMapper::lcl_attribute(Id nName, const Value & val) if (m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::unknown) { - // Still not determined content type? and it is even not unsupported? Then it is plain text field + // If the SdtControlType is not defined, it really OUGHT to be richText + // (although the presense of dataBinding gets treated as plainText by MS Word). + // HOWEVER, richText blockSDT is not working as a content control yet, + // so here we just convert blockSDT richText into plainText instead. + + // Most likely this will just be changed again elsewhere. m_pImpl->m_pSdtHelper->setControlType(SdtControlType::plainText); } if (nName == NS_ooxml::LN_CT_SdtRun_sdtContent) @@ -3428,6 +3433,14 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) case NS_ooxml::LN_CT_SdtPr_tabIndex: case NS_ooxml::LN_CT_SdtPr_lock: { + if (nSprmId == NS_ooxml::LN_CT_SdtPr_dataBinding) + { + // Although the absense of a <w:text/> element should mean that the control is richText, + // in practice, the presense of a dataBinding element makes it plainText + if (m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::richText) + m_pImpl->m_pSdtHelper->setControlType(SdtControlType::plainText); + } + if (!m_pImpl->GetSdtStarts().empty()) { if (nSprmId == NS_ooxml::LN_CT_SdtPr_showingPlcHdr)
