summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2015-11-01 10:03:50 +1000
committerCaolán McNamara <caolanm@redhat.com>2015-11-10 12:34:42 +0000
commita6ae84cc296d4d28e9a48a57406e955138c87a80 (patch)
tree063b41de6b566f80742d6a1b057417d7c7fb479d /sw
parent96a6b7bb1a073b6d2a5c01712b2c9a818c53c77a (diff)
tdf#70318: Prevent extra empty paragraph in clipboard RTF content
Change-Id: Icbd163bac65cbb9e4ad59697b87f6c979ecb41cc Reviewed-on: https://gerrit.libreoffice.org/19718 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx2
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx6
2 files changed, 5 insertions, 3 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index b9b3e93b6add..3049531915de 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -527,6 +527,8 @@ void SwUiWriterTest::testExportRTF()
CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aData.indexOf("aaa"));
CPPUNIT_ASSERT(aData.indexOf("bbb") != -1);
CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aData.indexOf("ccc"));
+ // Ensure there's no extra newline
+ CPPUNIT_ASSERT(aData.endsWith(OString("bbb}") + OString(SAL_NEWLINE_STRING) + OString("}")));
}
void SwUiWriterTest::testFdo74981()
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 52cdf24cccc8..47f63db0b742 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -273,9 +273,9 @@ void RtfAttributeOutput::StartParagraph(ww8::WW8TableNodeInfo::Pointer_t pTextNo
void RtfAttributeOutput::EndParagraph(ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner)
{
bool bLastPara = false;
- if (m_rExport.m_nTextTyp == TXT_FTN || m_rExport.m_nTextTyp == TXT_EDN)
+ if (m_rExport.m_nTextTyp == TXT_FTN || m_rExport.m_nTextTyp == TXT_EDN || m_rExport.m_pDoc->IsClipBoard())
{
- // We're ending a paragraph that is the last paragraph of a footnote or endnote.
+ // We're ending a paragraph that is the last paragraph of a footnote or endnote, or of clipboard.
bLastPara = m_rExport.m_nCurrentNodeIndex && m_rExport.m_nCurrentNodeIndex == m_rExport.m_pCurPam->End()->nNode.GetIndex();
}
@@ -290,7 +290,7 @@ void RtfAttributeOutput::EndParagraph(ww8::WW8TableNodeInfoInner::Pointer_t pTex
else
{
aParagraph->append(SAL_NEWLINE_STRING);
- // RTF_PAR at the end of the footnote would cause an additional empty paragraph.
+ // RTF_PAR at the end of the footnote or clipboard, would cause an additional empty paragraph.
if (!bLastPara)
{
aParagraph->append(OOO_STRING_SVTOOLS_RTF_PAR);