writerfilter: add config to import all fields as generic, incl. commands
Change-Id: I02d178de3672200b69e60ba5841c993fa0d797f9 Reviewed-on: https://gerrit.libreoffice.org/80076 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
This commit is contained in:
committed by
Michael Stahl
parent
94e0b8407b
commit
ddd08c8996
@@ -3870,6 +3870,12 @@
|
||||
</info>
|
||||
<value>true</value>
|
||||
</prop>
|
||||
<prop oor:name="ForceImportWWFieldsAsGenericFields" oor:type="xs:boolean" oor:nillable="false">
|
||||
<info>
|
||||
<desc>Experimental: force all fields in RTF/DOCX to be imported as dumb generic enhanced fields.</desc>
|
||||
</info>
|
||||
<value>false</value>
|
||||
</prop>
|
||||
<prop oor:name="CreateMSOLockFiles" oor:type="xs:boolean" oor:nillable="false">
|
||||
<info>
|
||||
<desc>Specifies if LO should create MSO lock files next to the LO lock files
|
||||
|
||||
@@ -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*/
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -418,6 +418,7 @@ private:
|
||||
std::stack<AnchoredContext> m_aAnchoredStack;
|
||||
std::stack<HeaderFooterContext> m_aHeaderFooterStack;
|
||||
std::stack<FieldContextPtr> 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
|
||||
|
||||
Reference in New Issue
Block a user