Kaydet (Commit) 049933c0 authored tarafından Miklos Vajna's avatar Miklos Vajna

sw: fix RTF export of text frames anchored to empty paragraphs

Regression from d4069372

Change-Id: I28e095819e0c2f1a4b110741ace366329937f863
Reported-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst c506650b
...@@ -66,6 +66,7 @@ public: ...@@ -66,6 +66,7 @@ public:
void testMathRuns(); void testMathRuns();
void testFdo53113(); void testFdo53113();
void testFdo55939(); void testFdo55939();
void testTextFrames();
CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT) #if !defined(MACOSX) && !defined(WNT)
...@@ -107,6 +108,7 @@ void Test::run() ...@@ -107,6 +108,7 @@ void Test::run()
{"math-runs.rtf", &Test::testMathRuns}, {"math-runs.rtf", &Test::testMathRuns},
{"fdo53113.odt", &Test::testFdo53113}, {"fdo53113.odt", &Test::testFdo53113},
{"fdo55939.odt", &Test::testFdo55939}, {"fdo55939.odt", &Test::testFdo55939},
{"textframes.odt", &Test::testTextFrames},
}; };
// Don't test the first import of these, for some reason those tests fail // Don't test the first import of these, for some reason those tests fail
const char* aBlacklist[] = { const char* aBlacklist[] = {
...@@ -439,6 +441,14 @@ void Test::testFdo55939() ...@@ -439,6 +441,14 @@ void Test::testFdo55939()
getRun(xParagraph, 3, " Text after the footnote."); // However, this leading space is intentional and OK. 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_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -386,7 +386,7 @@ void RtfAttributeOutput::EndParagraphProperties() ...@@ -386,7 +386,7 @@ void RtfAttributeOutput::EndParagraphProperties()
void RtfAttributeOutput::StartRun( const SwRedlineData* pRedlineData, bool bSingleEmptyRun ) 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_bInRun = true;
m_bSingleEmptyRun = bSingleEmptyRun; m_bSingleEmptyRun = bSingleEmptyRun;
...@@ -424,7 +424,7 @@ void RtfAttributeOutput::EndRunProperties( const SwRedlineData* /*pRedlineData*/ ...@@ -424,7 +424,7 @@ void RtfAttributeOutput::EndRunProperties( const SwRedlineData* /*pRedlineData*/
void RtfAttributeOutput::RunText( const String& rText, rtl_TextEncoding /*eCharSet*/ ) 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 ); RawText( rText, 0, m_rExport.eCurrentEncoding );
} }
...@@ -1515,6 +1515,11 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi ...@@ -1515,6 +1515,11 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
* would be there, causing a problem later. * would be there, causing a problem later.
*/ */
OString aSave = m_aRun.makeStringAndClear(); 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; m_rExport.bRTFFlySyntax = true;
const SwFrmFmt& rFrmFmt = rFrame.GetFrmFmt( ); const SwFrmFmt& rFrmFmt = rFrame.GetFrmFmt( );
...@@ -1530,6 +1535,8 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi ...@@ -1530,6 +1535,8 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
m_rExport.bRTFFlySyntax = false; m_rExport.bRTFFlySyntax = false;
m_aRun->append(aSave); m_aRun->append(aSave);
m_aRunText.clear(); m_aRunText.clear();
m_bInRun = bInRunOrig;
m_bSingleEmptyRun = bSingleEmptyRunOrig;
} }
m_rExport.mpParentFrame = NULL; m_rExport.mpParentFrame = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment