[Libreoffice-commits] .: sw/qa sw/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Thu Aug 2 08:08:29 PDT 2012


 sw/qa/extras/ww8export/data/fdo46020.odt |binary
 sw/qa/extras/ww8export/ww8export.cxx     |   11 +++++++++++
 sw/source/filter/ww8/wrtw8nds.cxx        |    4 +++-
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit e3aca9772f4e1f9fcabecbe5bf22123259b3143a
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Thu Aug 2 14:11:50 2012 +0200

    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

diff --git a/sw/qa/extras/ww8export/data/fdo46020.odt b/sw/qa/extras/ww8export/data/fdo46020.odt
new file mode 100644
index 0000000..478c931
Binary files /dev/null and b/sw/qa/extras/ww8export/data/fdo46020.odt differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index 58692a6..f8fbba9 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -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();
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 09969f5..efb6e2a 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -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();
 }
 


More information about the Libreoffice-commits mailing list