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

fdo#61193 fix crash on RTF paste of footnote

Regression from 232ad2f2.

Change-Id: Ia0873851979df5bba0a4693f044aab2aeff2b8e4
üst b1e023ab
{\rtf1\ansi text.{\footnote footnote}}
......@@ -150,6 +150,7 @@ public:
void testFdo62288();
void testFdo37716();
void testFdo51916();
void testFdo61193();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
......@@ -272,6 +273,7 @@ void Test::run()
{"fdo62288.rtf", &Test::testFdo62288},
{"fdo37716.rtf", &Test::testFdo37716},
{"fdo51916.rtf", &Test::testFdo51916},
{"hello.rtf", &Test::testFdo61193},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
......@@ -926,6 +928,15 @@ void Test::testCopyPasteFootnote()
CPPUNIT_ASSERT_EQUAL(OUString("bbb"), xTextRange->getString());
}
void Test::testFdo61193()
{
// Pasting content that contained a footnote caused a crash.
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY);
uno::Reference<text::XTextRange> xEnd = xText->getEnd();
paste("fdo61193.rtf", xEnd);
}
void Test::testShptxtPard()
{
// The problem was that \pard inside \shptxt caused loss of shape text
......
......@@ -722,6 +722,8 @@ void lcl_AddRangeAndStyle(
void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
{
PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
if (m_aTextAppendStack.empty())
return;
TextAppendContext& rAppendContext = m_aTextAppendStack.top();
// n#779642: ignore fly frame inside table as it could lead to messy situations
if( rAppendContext.pLastParagraphProperties.get() && rAppendContext.pLastParagraphProperties->IsFrameMode()
......@@ -965,6 +967,8 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
#endif
ParagraphPropertyMap* pParaContext = dynamic_cast< ParagraphPropertyMap* >( pPropertyMap.get() );
if (!m_aTextAppendStack.size())
return;
TextAppendContext& rAppendContext = m_aTextAppendStack.top();
uno::Reference< text::XTextAppend > xTextAppend;
if (!m_aTextAppendStack.empty())
......@@ -1449,14 +1453,14 @@ void DomainMapper_Impl::PushFootOrEndnote( bool bIsFootnote )
}
appendTextContent( uno::Reference< text::XTextContent >( xFootnoteText, uno::UNO_QUERY_THROW ), aFontProperties );
m_aTextAppendStack.push(TextAppendContext(uno::Reference< text::XTextAppend >( xFootnoteText, uno::UNO_QUERY_THROW ),
m_bIsNewDoc ? uno::Reference<text::XTextCursor>() : m_xBodyText->createTextCursorByRange(xFootnoteText->getStart())));
m_bIsNewDoc ? uno::Reference<text::XTextCursor>() : xFootnoteText->createTextCursorByRange(xFootnoteText->getStart())));
// Redlines for the footnote anchor
CheckRedline( xFootnote->getAnchor( ) );
}
catch( const uno::Exception& )
catch( const uno::Exception& e )
{
OSL_FAIL( "exception in PushFootOrEndnote" );
SAL_WARN("writerfilter", "exception in PushFootOrEndnote: " << e.Message);
}
}
......
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