summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-01-14 16:46:58 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-01-16 10:21:55 +0100
commita290d025339ef92b93ba6d287658ba784a818220 (patch)
tree86e0263b8608f2f2a2368f5ddea4891119eaab24
parent9b39977e4133d4430f0969115902a6fd1fac91f2 (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) 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> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Change-Id: If5928b14dd35f7dd509370c2b8eef4c31bd149dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86810 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx15
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.hxx2
2 files changed, 9 insertions, 8 deletions
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;