writerfilter/source/dmapper/DomainMapper_Impl.cxx | 15 ++++++++------- writerfilter/source/dmapper/DomainMapper_Impl.hxx | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-)
New commits: commit a290d025339ef92b93ba6d287658ba784a818220 Author: Michael Stahl <[email protected]> AuthorDate: Tue Jan 14 16:46:58 2020 +0100 Commit: Miklos Vajna <[email protected]> CommitDate: Thu Jan 16 10:21:55 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) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86785 Tested-by: Jenkins Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit cf226535f9903a048b1c105b180ae3a50a776e68) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86797 Reviewed-by: Xisco FaulĂ <[email protected]> Signed-off-by: Xisco Fauli <[email protected]> Change-Id: If5928b14dd35f7dd509370c2b8eef4c31bd149dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86810 Reviewed-by: Thorsten Behrens <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Miklos Vajna <[email protected]> diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 8c3638423c93..be95eba34308 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -254,7 +254,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( ), @@ -1866,7 +1866,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) { @@ -1878,8 +1878,9 @@ 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_bStartIndex || m_bStartBibliography || m_bStartGenericField) + if (m_bStartIndex || m_bStartBibliography || m_bStartGenericField != 0) xTOCTextCursor->goLeft(1, false); + } xTextRange = xTextAppend->insertTextPortion(rString, aValues, xTOCTextCursor); SAL_WARN_IF(!xTextRange.is(), "writerfilter.dmapper", "insertTextPortion failed"); if (!xTextRange.is()) @@ -1887,7 +1888,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)); } @@ -5266,7 +5267,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 @@ -5689,9 +5690,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 c8de67b69674..28598fdd0790 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 [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
