[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Mon Oct 21 06:16:06 PDT 2013


 sw/qa/extras/rtfimport/data/fdo70221.rtf       |binary
 sw/qa/extras/rtfimport/rtfimport.cxx           |   10 ++++++++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    1 +
 3 files changed, 11 insertions(+)

New commits:
commit 11726693c3d57e86e391f60370f1b42030ef69ea
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Oct 21 09:31:55 2013 +0200

    fdo#70221 fix RTF import of multi-group pictures
    
    Pictures typically have a single RTF group, so we imported them at the
    end of that group. Though multiple inner groups are also allowed, so
    make sure we only do the import at the very end, instead of at the end
    of all inner groups as well, resulting in multiple (fake) pictures.
    
    Regression from 13c00ce322e78eb4e0f50ab84ded19cd6aae1ded (Enable the
    writerfilter-based RTF import in non-experimental mode, 2011-08-18).
    
    Change-Id: Id895b2c6d3b824d09d89bfa01ce59aba76c55d42
    (cherry picked from commit a35fa8d8b127cb23ebff3952291742bf28477c74)
    Reviewed-on: https://gerrit.libreoffice.org/6361
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/qa/extras/rtfimport/data/fdo70221.rtf b/sw/qa/extras/rtfimport/data/fdo70221.rtf
new file mode 100644
index 0000000..1ca7939
Binary files /dev/null and b/sw/qa/extras/rtfimport/data/fdo70221.rtf differ
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index e79d282..687baac 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -160,6 +160,7 @@ public:
     void testFdo68076();
     void testFdo68291();
     void testFdo69384();
+    void testFdo70221();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -304,6 +305,7 @@ void Test::run()
         {"fdo68076.rtf", &Test::testFdo68076},
         {"fdo68291.odt", &Test::testFdo68291},
         {"hello.rtf", &Test::testFdo69384},
+        {"fdo70221.rtf", &Test::testFdo70221},
     };
     header();
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1478,6 +1480,14 @@ void Test::testFdo69384()
     getStyles("ParagraphStyles")->getByName("Text body justified");
 }
 
+void Test::testFdo70221()
+{
+    uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+    // The picture was imported twice.
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 59e138b..5e7ea2a 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3727,6 +3727,7 @@ int RTFDocumentImpl::pushState()
         case DESTINATION_SHAPETEXT:
         case DESTINATION_FORMFIELD:
         case DESTINATION_FIELDINSTRUCTION:
+        case DESTINATION_PICT:
             m_aStates.top().nDestinationState = DESTINATION_NORMAL;
             break;
         case DESTINATION_MNUM:


More information about the Libreoffice-commits mailing list