fdo#46020: fixed missing footnote docx/doc/rtf export

Don't skip a next position when parsing a paragraph into runs to export.

Change-Id: If7e887ea84ad24256b37aa96187bc30ea154632b
This commit is contained in:
Cédric Bosdonnat 2012-08-02 14:11:50 +02:00
parent 77e7145091
commit e3aca9772f
3 changed files with 14 additions and 1 deletions

Binary file not shown.

View file

@ -42,11 +42,13 @@ class Test : public SwModelTestBase
public:
void testN325936();
void testFdo45724();
void testFdo46020();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
CPPUNIT_TEST(testN325936);
CPPUNIT_TEST(testFdo45724);
CPPUNIT_TEST(testFdo46020);
#endif
CPPUNIT_TEST_SUITE_END();
@ -95,6 +97,15 @@ void Test::testFdo45724()
CPPUNIT_ASSERT_EQUAL(OUString("xxx"), xComponent->getCurrentValue().get<OUString>());
}
void Test::testFdo46020()
{
// The footnote in that document wasn't exported, check that it is actually exported
roundtrip("fdo46020.odt");
uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xFootnotes->getCount());
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();

View file

@ -1622,8 +1622,10 @@ void MSWordExportBase::UpdatePosition( SwWW8AttrIter* aAttrIter, xub_StrLen nAkt
xub_StrLen nNextPos;
// go to next attribute if no bookmark is found or if the bookmark is behind the next attribute position
// It may happend that the WhereNext() wasn't used in the previous increment because there was a
// bookmark before it. Use that position before trying to find another one.
bool bNextBookmark = NearestBookmark( nNextPos, nAktPos, true );
if( !bNextBookmark || nNextPos > aAttrIter->WhereNext() )
if( nAktPos == aAttrIter->WhereNext() && ( !bNextBookmark || nNextPos > aAttrIter->WhereNext() ) )
aAttrIter->NextPos();
}