diff options
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/inc/dmapper/resourcemodel.hxx | 1 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 5 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.hxx | 2 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 9 |
4 files changed, 14 insertions, 3 deletions
diff --git a/writerfilter/inc/dmapper/resourcemodel.hxx b/writerfilter/inc/dmapper/resourcemodel.hxx index 695c6c9420d7..9cd5af27e329 100644 --- a/writerfilter/inc/dmapper/resourcemodel.hxx +++ b/writerfilter/inc/dmapper/resourcemodel.hxx @@ -220,6 +220,7 @@ public: virtual void endParagraphGroup() = 0; virtual void markLastParagraphInSection(){}; + virtual void markLastParagraph() {} // When finishing this paragraph, do not add new paragraph /** Receives start mark for group with the same character properties. diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 7e81cfd430c2..46d52005fa81 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -4417,8 +4417,6 @@ void DomainMapper::lcl_utext(const sal_Unicode *const data_, size_t len) xContext->Erase(PROP_NUMBERING_LEVEL); } finishParagraph(bRemove, bNoNumbering); - if (bRemove) - m_pImpl->RemoveLastParagraph(); m_pImpl->SetParaSectpr(false); } @@ -4947,6 +4945,9 @@ void DomainMapper::finishParagraph(const bool bRemove, const bool bNoNumbering) if (m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::datePicker) m_pImpl->m_pSdtHelper->createDateContentControl(); m_pImpl->finishParagraph(m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH), bRemove, bNoNumbering); + if (bRemove || mbIsLastPara) + m_pImpl->RemoveLastParagraph(); + mbIsLastPara = false; // handle other subdocuments } void DomainMapper::commentProps(const OUString& sId, const CommentProperties& rProps) diff --git a/writerfilter/source/dmapper/DomainMapper.hxx b/writerfilter/source/dmapper/DomainMapper.hxx index f9c163ab1f29..e19dcd44bb41 100644 --- a/writerfilter/source/dmapper/DomainMapper.hxx +++ b/writerfilter/source/dmapper/DomainMapper.hxx @@ -83,6 +83,7 @@ public: // Stream virtual void markLastParagraphInSection() override; + virtual void markLastParagraph() override { mbIsLastPara = true; } virtual void markLastSectionGroup() override; // BinaryObj @@ -188,6 +189,7 @@ private: bool mbIsSplitPara; bool mbHasControls; bool mbWasShapeInPara; + bool mbIsLastPara = false; std::unique_ptr< GraphicZOrderHelper > m_zOrderHelper; OUString m_sGlossaryEntryName; }; diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 1d0c2d7dde4c..52c8311fcb96 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -3654,8 +3654,15 @@ RTFError RTFDocumentImpl::popState() // \par means an empty paragraph at the end of footnotes/endnotes, but // not in case of other substreams, like headers. if (m_bNeedCr && m_nStreamType != NS_ooxml::LN_footnote - && m_nStreamType != NS_ooxml::LN_endnote && m_bIsNewDoc) + && m_nStreamType != NS_ooxml::LN_endnote) + { + if (!m_bIsNewDoc) + { + // Make sure all the paragraph settings are set, but do not add next paragraph + Mapper().markLastParagraph(); + } dispatchSymbol(RTFKeyword::PAR); + } if (m_bNeedSect) // may be set by dispatchSymbol above! sectBreak(true); else if (!m_pSuperstream) |