sw: fix RTF export of text frames anchored to empty paragraphs
Regression from d406937248
Change-Id: I28e095819e0c2f1a4b110741ace366329937f863
Reported-by: Michael Stahl <mstahl@redhat.com>
This commit is contained in:
parent
c506650b21
commit
049933c035
3 changed files with 19 additions and 2 deletions
BIN
sw/qa/extras/rtfexport/data/textframes.odt
Normal file
BIN
sw/qa/extras/rtfexport/data/textframes.odt
Normal file
Binary file not shown.
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue