writerfilter/source/dmapper/DomainMapper_Impl.cxx | 16 +++++++++------- writerfilter/source/dmapper/DomainMapper_Impl.hxx | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-)
New commits: commit d8dc16940b71acb0f4d3eda0a716dd4c37f00d37 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Tue Jan 14 16:46:58 2020 +0100 Commit: Xisco FaulĂ <xiscofa...@libreoffice.org> CommitDate: Tue Jan 14 21:20:39 2020 +0100 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.st...@cib.de> (cherry picked from commit cf226535f9903a048b1c105b180ae3a50a776e68) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86797 Reviewed-by: Xisco FaulĂ <xiscofa...@libreoffice.org> 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits