sw/qa/extras/rtfexport/data/textframes.odt |binary sw/qa/extras/rtfexport/rtfexport.cxx | 10 ++++++++++ sw/source/filter/ww8/rtfattributeoutput.cxx | 11 +++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-)
New commits: commit 049933c035157129cc0409bb100dfc5353847a63 Author: Miklos Vajna <vmik...@suse.cz> Date: Thu Nov 29 17:12:54 2012 +0100 sw: fix RTF export of text frames anchored to empty paragraphs Regression from d4069372484f18b242a42a1996767f57b031fff6 Change-Id: I28e095819e0c2f1a4b110741ace366329937f863 Reported-by: Michael Stahl <mst...@redhat.com> diff --git a/sw/qa/extras/rtfexport/data/textframes.odt b/sw/qa/extras/rtfexport/data/textframes.odt new file mode 100644 index 0000000..301744a Binary files /dev/null and b/sw/qa/extras/rtfexport/data/textframes.odt differ diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index c2d8830..f79b13f 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 b931529..e39e191 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits