diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2020-01-14 16:46:58 +0100 |
---|---|---|
committer | Xisco Faulí <xiscofauli@libreoffice.org> | 2020-01-14 21:20:39 +0100 |
commit | d8dc16940b71acb0f4d3eda0a716dd4c37f00d37 (patch) | |
tree | 3267443bc20dd6999b8328523222e0814cb21974 /writerfilter | |
parent | 0424ae2df464cbcf8997a85b53daeaded462b429 (diff) |
tdf#129805 writerfilter: fix import of nested generic field
The problem was that the end of the outer nested generic field did not
call PopFieldmark(), so the end of the field was at the end of the
document.
(regression from f610f9b611fe9f206b872ed06f7e859d688385fc)
Change-Id: If5928b14dd35f7dd509370c2b8eef4c31bd149dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86785
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
(cherry picked from commit cf226535f9903a048b1c105b180ae3a50a776e68)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86797
Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 16 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.hxx | 2 |
2 files changed, 10 insertions, 8 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 0f79bb73334e..4bf56a553924 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -257,7 +257,7 @@ DomainMapper_Impl::DomainMapper_Impl( m_bStartedTOC(false), m_bStartIndex(false), m_bStartBibliography(false), - m_bStartGenericField(false), + m_nStartGenericField(0), m_bTextInserted(false), m_sCurrentPermId(0), m_pLastSectionContext( ), @@ -1870,7 +1870,7 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, const Proper } else { - if (m_bStartTOC || m_bStartIndex || m_bStartBibliography || m_bStartGenericField) + if (m_bStartTOC || m_bStartIndex || m_bStartBibliography || m_nStartGenericField != 0) { if (IsInHeaderFooter() && !m_bStartTOCHeaderFooter) { @@ -1882,8 +1882,10 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, const Proper uno::Reference< text::XTextCursor > xTOCTextCursor = xTextAppend->getEnd()->getText( )->createTextCursor( ); assert(xTOCTextCursor.is()); xTOCTextCursor->gotoEnd(false); - if (m_bStartGenericField) + if (m_nStartGenericField != 0) + { xTOCTextCursor->goLeft(1, false); + } xTextRange = xTextAppend->insertTextPortion(rString, aValues, xTOCTextCursor); SAL_WARN_IF(!xTextRange.is(), "writerfilter.dmapper", "insertTextPortion failed"); if (!xTextRange.is()) @@ -1891,7 +1893,7 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, const Proper m_bTextInserted = true; xTOCTextCursor->gotoRange(xTextRange->getEnd(), true); mxTOCTextCursor = xTOCTextCursor; - if (!m_bStartGenericField) + if (m_nStartGenericField == 0) { m_aTextAppendStack.push(TextAppendContext(xTextAppend, xTOCTextCursor)); } @@ -5320,7 +5322,7 @@ void DomainMapper_Impl::CloseFieldCommand() InsertFieldmark(m_aTextAppendStack, xFormField, pContext->GetStartRange(), pContext->GetFieldId()); xFormField->setFieldType(ODF_UNHANDLED); - m_bStartGenericField = true; + ++m_nStartGenericField; pContext->SetFormField( xFormField ); uno::Reference<container::XNameContainer> const xNameCont(xFormField->getParameters()); // note: setting the code to empty string is *required* in @@ -5736,9 +5738,9 @@ void DomainMapper_Impl::PopFieldContext() } } } - else if(m_bStartGenericField) + else if (m_nStartGenericField != 0) { - m_bStartGenericField = false; + --m_nStartGenericField; PopFieldmark(m_aTextAppendStack, xCrsr, pContext->GetFieldId()); if(m_bTextInserted) { diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index 207fae7750ea..483f8f92715c 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -467,7 +467,7 @@ private: bool m_bStartedTOC; bool m_bStartIndex; bool m_bStartBibliography; - bool m_bStartGenericField; + unsigned int m_nStartGenericField; bool m_bTextInserted; LineNumberSettings m_aLineNumberSettings; |