summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-01-16 13:15:01 +0600
committerXisco Fauli <xiscofauli@libreoffice.org>2024-01-17 12:59:33 +0100
commit806d07ffa3fa8e0810a00d570c7cfa844cc226ee (patch)
tree302f32b33c177ffe37d4c2a0028267b3965af276 /writerfilter/source/dmapper
parent2797c7f803792f3539fc86ac5af06da23ec7cc2e (diff)
tdf#135083: make sure to apply pending paragraph properties, even without
... trailing \par. Commit a6ae84cc296d4d28e9a48a57406e955138c87a80 (tdf#70318: Prevent extra empty paragraph in clipboard RTF content, 2015-11-10) made sure to not emit trailing \par for RTF clipboard content. The problem was, that in the absense of the \par, the settings of the last paragraph were not applied (this happens in DomainMapper_Impl::finishParagraph). This change makes sure to call dispatchSymbol(RTFKeyword::PAR) (which eventually calls the mentioned method and applies pending para properties). Since this also adds a new paragraph (which needs to be avoided), a new flag is introduced, set by Stream::markLastParagraph. Its purpose is to make sure that all properties are applied to para, as opposed to bRemove argument to DomainMapper::finishParagraph, which prevents setting some properties (e.g., related to numbering - see DomainMapper::lcl_utext). Change-Id: Ia5e368e540c30f95058c81a280a62205aa85398b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162154 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162191 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'writerfilter/source/dmapper')
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx5
-rw-r--r--writerfilter/source/dmapper/DomainMapper.hxx2
2 files changed, 5 insertions, 2 deletions
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;
};