sw/qa/extras/rtfexport/data/fdo55939.odt |binary sw/qa/extras/rtfexport/rtfexport.cxx | 13 +++++++++++++ sw/source/filter/ww8/rtfattributeoutput.cxx | 5 ++++- 3 files changed, 17 insertions(+), 1 deletion(-)
New commits: commit 411f9007e20f8035bd2ab7bbc807c61892a5c64c Author: Miklos Vajna <[email protected]> Date: Thu Oct 25 16:59:52 2012 +0200 fdo#55939 fix RTF export of footnotes Regression from d4069372484f18b242a42a1996767f57b031fff6. Change-Id: I58e8d48ac3222b795f7edfd0e74ecd86ea36f380 diff --git a/sw/qa/extras/rtfexport/data/fdo55939.odt b/sw/qa/extras/rtfexport/data/fdo55939.odt new file mode 100644 index 0000000..5358403 Binary files /dev/null and b/sw/qa/extras/rtfexport/data/fdo55939.odt differ diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 2300c99..7381fe2 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -66,6 +66,7 @@ public: void testMathVerticalstacks(); void testMathRuns(); void testFdo53113(); + void testFdo55939(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -106,6 +107,7 @@ void Test::run() {"math-vertical-stacks.rtf", &Test::testMathVerticalstacks}, {"math-runs.rtf", &Test::testMathRuns}, {"fdo53113.odt", &Test::testFdo53113}, + {"fdo55939.odt", &Test::testFdo55939}, }; // Don't test the first import of these, for some reason those tests fail const char* aBlacklist[] = { @@ -426,6 +428,17 @@ void Test::testFdo53113() CPPUNIT_ASSERT_EQUAL(sal_Int32(102), aPairs[1].Second.Value.get<sal_Int32>()); } +void Test::testFdo55939() +{ + // The problem was that the exported RTF was invalid. + uno::Reference<text::XTextRange> xParagraph(getParagraph(1)); + getRun(xParagraph, 1, "Main text before footnote."); + // Why the tab has to be removed here? + CPPUNIT_ASSERT_EQUAL(OUString("Footnote text."), + getProperty< uno::Reference<text::XTextRange> >(getRun(xParagraph, 2), "Footnote")->getText()->getString().replaceAll("\t", "")); + getRun(xParagraph, 3, " Text after the footnote."); // However, this leading space is intentional and OK. +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 00558fe..b931529 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -2331,17 +2331,20 @@ void RtfAttributeOutput::TextFootnote_Impl( const SwFmtFtn& rFootnote ) /* * The footnote contains a whole paragraph, so we have to: - * 1) Reset, then later restore the contents of our run buffer. + * 1) Reset, then later restore the contents of our run buffer and run state. * 2) Buffer the output of the whole paragraph, as we do so for section headers already. */ const SwNodeIndex* pIndex = rFootnote.GetTxtFtn()->GetStartNode(); RtfStringBuffer aRun = m_aRun; m_aRun.clear(); + bool bInRunOrig = m_bInRun; + m_bInRun = false; m_bBufferSectionHeaders = true; m_rExport.WriteSpecialText( pIndex->GetIndex() + 1, pIndex->GetNode().EndOfSectionIndex(), !rFootnote.IsEndNote() ? TXT_FTN : TXT_EDN); m_bBufferSectionHeaders = false; + m_bInRun = bInRunOrig; m_aRun = aRun; m_aRun->append(m_aSectionHeaders.makeStringAndClear()); _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
