diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 5eeb6c570331..8f33efdb29cb 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -3870,6 +3870,12 @@
true
+
+
+ Experimental: force all fields in RTF/DOCX to be imported as dumb generic enhanced fields.
+
+ false
+
Specifies if LO should create MSO lock files next to the LO lock files
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index cb46699fad95..5ad13d6145e5 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3111,8 +3111,10 @@ void DomainMapper::lcl_text(const sal_uInt8 * data_, size_t len)
m_pImpl->SetCustomFtnMark( false );
//otherwise ignore sText
}
- else if( m_pImpl->IsOpenFieldCommand() )
+ else if (m_pImpl->IsOpenFieldCommand() && !m_pImpl->IsForceGenericFields())
+ {
m_pImpl->AppendFieldCommand(sText);
+ }
else if( m_pImpl->IsOpenField() && m_pImpl->IsFieldResultAsString())
/*depending on the success of the field insert operation this result will be
set at the field or directly inserted into the text*/
@@ -3380,8 +3382,10 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
pContext->GetFootnote()->setLabel( sText );
//otherwise ignore sText
}
- else if( m_pImpl->IsOpenFieldCommand() )
+ else if (m_pImpl->IsOpenFieldCommand() && !m_pImpl->IsForceGenericFields())
+ {
m_pImpl->AppendFieldCommand(sText);
+ }
else if( m_pImpl->IsOpenField() && m_pImpl->IsFieldResultAsString())
/*depending on the success of the field insert operation this result will be
set at the field or directly inserted into the text*/
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index f23775bc8731..9df643e07f4f 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -193,6 +193,7 @@ DomainMapper_Impl::DomainMapper_Impl(
m_xTextDocument( xModel, uno::UNO_QUERY ),
m_xTextFactory( xModel, uno::UNO_QUERY ),
m_xComponentContext( xContext ),
+ m_bForceGenericFields(!utl::ConfigManager::IsFuzzing() && officecfg::Office::Common::Filter::Microsoft::Import::ForceImportWWFieldsAsGenericFields::get(m_xComponentContext)),
m_bSetUserFieldContent( false ),
m_bSetCitation( false ),
m_bSetDateValue( false ),
@@ -4354,7 +4355,7 @@ void DomainMapper_Impl::CloseFieldCommand()
FieldConversionMap_t::const_iterator const aIt =
aFieldConversionMap.find(std::get<0>(field));
- if(aIt != aFieldConversionMap.end())
+ if (aIt != aFieldConversionMap.end() && !m_bForceGenericFields)
{
pContext->SetFieldId(aIt->second.eFieldId);
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 6f5aaedd1fed..813d45bab770 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -418,6 +418,7 @@ private:
std::stack m_aAnchoredStack;
std::stack m_aHeaderFooterStack;
std::stack m_aFieldStack;
+ bool m_bForceGenericFields;
bool m_bSetUserFieldContent;
bool m_bSetCitation;
bool m_bSetDateValue;
@@ -1000,6 +1001,8 @@ public:
bool IsDiscardHeaderFooter() const;
+ bool IsForceGenericFields() const { return m_bForceGenericFields; }
+
void SetParaAutoBefore(bool bParaAutoBefore) { m_bParaAutoBefore = bParaAutoBefore; }
/// Forget about the previous paragraph, as it's not inside the same