diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-11-29 17:12:54 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-11-29 17:31:43 +0100 |
commit | 049933c035157129cc0409bb100dfc5353847a63 (patch) | |
tree | 16908dfee4f95d47751db72cbfc39fbf30c73361 | |
parent | c506650b21c628e603ce7dc3dc30238c480342d2 (diff) |
sw: fix RTF export of text frames anchored to empty paragraphs
Regression from d4069372484f18b242a42a1996767f57b031fff6
Change-Id: I28e095819e0c2f1a4b110741ace366329937f863
Reported-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | sw/qa/extras/rtfexport/data/textframes.odt | bin | 0 -> 8853 bytes | |||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 11 |
3 files changed, 19 insertions, 2 deletions
diff --git a/sw/qa/extras/rtfexport/data/textframes.odt b/sw/qa/extras/rtfexport/data/textframes.odt Binary files differnew file mode 100644 index 000000000000..301744af3ebd --- /dev/null +++ b/sw/qa/extras/rtfexport/data/textframes.odt diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index c2d88301988f..f79b13f5bd4e 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -66,6 +66,7 @@ public: void testMathRuns(); void testFdo53113(); void testFdo55939(); + void testTextFrames(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -107,6 +108,7 @@ void Test::run() {"math-runs.rtf", &Test::testMathRuns}, {"fdo53113.odt", &Test::testFdo53113}, {"fdo55939.odt", &Test::testFdo55939}, + {"textframes.odt", &Test::testTextFrames}, }; // Don't test the first import of these, for some reason those tests fail const char* aBlacklist[] = { @@ -439,6 +441,14 @@ void Test::testFdo55939() getRun(xParagraph, 3, " Text after the footnote."); // However, this leading space is intentional and OK. } +void Test::testTextFrames() +{ + // The output was simply invalid, so let's check if all 3 frames were imported back. + uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xIndexAccess->getCount()); +} + 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 b9315295a5f0..e39e1919b99e 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -386,7 +386,7 @@ void RtfAttributeOutput::EndParagraphProperties() void RtfAttributeOutput::StartRun( const SwRedlineData* pRedlineData, bool bSingleEmptyRun ) { - SAL_INFO("sw.rtf", OSL_THIS_FUNC); + SAL_INFO("sw.rtf", OSL_THIS_FUNC << ", bSingleEmptyRun: " << bSingleEmptyRun); m_bInRun = true; m_bSingleEmptyRun = bSingleEmptyRun; @@ -424,7 +424,7 @@ void RtfAttributeOutput::EndRunProperties( const SwRedlineData* /*pRedlineData*/ void RtfAttributeOutput::RunText( const String& rText, rtl_TextEncoding /*eCharSet*/ ) { - SAL_INFO("sw.rtf", OSL_THIS_FUNC); + SAL_INFO("sw.rtf", OSL_THIS_FUNC << ", rText: " << rText); RawText( rText, 0, m_rExport.eCurrentEncoding ); } @@ -1515,6 +1515,11 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi * would be there, causing a problem later. */ OString aSave = m_aRun.makeStringAndClear(); + // Also back m_bInRun and m_bSingleEmptyRun up. + bool bInRunOrig = m_bInRun; + m_bInRun = false; + bool bSingleEmptyRunOrig = m_bSingleEmptyRun; + m_bSingleEmptyRun = false; m_rExport.bRTFFlySyntax = true; const SwFrmFmt& rFrmFmt = rFrame.GetFrmFmt( ); @@ -1530,6 +1535,8 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi m_rExport.bRTFFlySyntax = false; m_aRun->append(aSave); m_aRunText.clear(); + m_bInRun = bInRunOrig; + m_bSingleEmptyRun = bSingleEmptyRunOrig; } m_rExport.mpParentFrame = NULL; |