summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-10-25 16:59:52 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-10-25 18:37:16 +0200
commit411f9007e20f8035bd2ab7bbc807c61892a5c64c (patch)
tree0c2ae6a5968c8e1841e5b4c012b4c4689cf99cba /sw
parent638bb3a63ecc8f50fe6d82b510221b771dbb1c83 (diff)
fdo#55939 fix RTF export of footnotes
Regression from d4069372484f18b242a42a1996767f57b031fff6. Change-Id: I58e8d48ac3222b795f7edfd0e74ecd86ea36f380
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/rtfexport/data/fdo55939.odtbin0 -> 8853 bytes
-rw-r--r--sw/qa/extras/rtfexport/rtfexport.cxx13
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx5
3 files changed, 17 insertions, 1 deletions
diff --git a/sw/qa/extras/rtfexport/data/fdo55939.odt b/sw/qa/extras/rtfexport/data/fdo55939.odt
new file mode 100644
index 000000000000..53584035beaf
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/fdo55939.odt
Binary files differ
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 2300c9959ece..7381fe28513f 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 00558fe5afe0..b9315295a5f0 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());