diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/rtfexport/data/tdf66543.rtf | 8 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport3.cxx | 9 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfexport.cxx | 8 |
4 files changed, 31 insertions, 2 deletions
diff --git a/sw/qa/extras/rtfexport/data/tdf66543.rtf b/sw/qa/extras/rtfexport/data/tdf66543.rtf new file mode 100644 index 000000000000..19d742bb1fc9 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf66543.rtf @@ -0,0 +1,8 @@ +{\rtf1 +\sectd \linemod3\linex0\linestarts2 +\pard\plain +This is the first line. \par +This is the second line.\par +This is the third line.\par +This is the fourth line.\par +} diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx index 3a5105f03357..6ada28d4476f 100644 --- a/sw/qa/extras/rtfexport/rtfexport3.cxx +++ b/sw/qa/extras/rtfexport/rtfexport3.cxx @@ -199,6 +199,15 @@ DECLARE_RTFEXPORT_TEST(testTdf121623, "tdf121623.rtf") CPPUNIT_ASSERT_EQUAL(1, getPages()); } +DECLARE_RTFEXPORT_TEST(testTdf66543, "tdf66543.rtf") +{ + // Without the accompanying fix in place, this test would have failed with + // 'Expected: 2; Actual : 3' after import (off-by-one), then with + // 'Expected: 2; Actual : 0' (export not implemented). + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), + getProperty<sal_Int32>(getParagraph(1), "ParaLineNumberStartValue")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index dd5ccc9e9de2..f55f4a7db918 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -1200,7 +1200,7 @@ void RtfAttributeOutput::SectionFormProtection(bool bProtected) m_aSectionBreaks.append(static_cast<sal_Int32>(!bProtected)); } -void RtfAttributeOutput::SectionLineNumbering(sal_uLong /*nRestartNo*/, +void RtfAttributeOutput::SectionLineNumbering(sal_uLong nRestartNo, const SwLineNumberInfo& rLnNumInfo) { m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_LINEMOD); @@ -1209,6 +1209,12 @@ void RtfAttributeOutput::SectionLineNumbering(sal_uLong /*nRestartNo*/, m_rExport.OutLong(rLnNumInfo.GetPosFromLeft()); if (!rLnNumInfo.IsRestartEachPage()) m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_LINECONT); + + if (nRestartNo > 0) + { + m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_LINESTARTS); + m_rExport.OutLong(nRestartNo); + } } void RtfAttributeOutput::SectionTitlePage() diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index 6d095309d73f..4e8b344c30df 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -852,7 +852,13 @@ ErrCode RtfExport::ExportDocument_Impl() // line numbering const SwLineNumberInfo& rLnNumInfo = m_pDoc->GetLineNumberInfo(); if (rLnNumInfo.IsPaintLineNumbers()) - AttrOutput().SectionLineNumbering(0, rLnNumInfo); + { + sal_uLong nLnNumRestartNo = 0; + if (const WW8_SepInfo* pSectionInfo = m_pSections->CurrentSectionInfo()) + nLnNumRestartNo = pSectionInfo->nLnNumRestartNo; + + AttrOutput().SectionLineNumbering(nLnNumRestartNo, rLnNumInfo); + } { // write the footnotes and endnotes-out Info |