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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jan 9 11:19:28 PST 2013


 sw/qa/extras/rtfimport/data/fdo58933.rtf       |   28 +++++++++++++++++++++++++
 sw/qa/extras/rtfimport/rtfimport.cxx           |   12 ++++++++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    7 +++---
 3 files changed, 44 insertions(+), 3 deletions(-)

New commits:
commit 075a1e6fdaebd441be4cb46fbc30ef7ded4cabaa
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Jan 9 15:29:29 2013 +0100

    fdo#58933 RTF import: avoid fake pars / cells when having graphic inside cells
    
    Regression from 8063e36115a11ddf3db05928db9287947beee74d.
    (cherry picked from commit 555bc780c83114220012e198b5471a0d7452fb32)
    
    Change-Id: I9974368cfd9c38bbcce68f3b36e0eedfcbef5672
    Reviewed-on: https://gerrit.libreoffice.org/1617
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/qa/extras/rtfimport/data/fdo58933.rtf b/sw/qa/extras/rtfimport/data/fdo58933.rtf
new file mode 100644
index 0000000..7568e27
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo58933.rtf
@@ -0,0 +1,28 @@
+{\rtf1
+{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;
+\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;
+\red192\green192\blue192;\red255\green255\blue255;}
+\ltrrow\trowd \cellx3415\cellx9652
+\pard\plain \ltrpar
+\intbl 
+{\*\shppict
+{\pict
+{\*\picprop\shplid1025
+{\sp
+{\sn shapeType}
+{\sv 75}
+}
+}
+\picscalex100\picscaley100\piccropl0\piccropr0\piccropt0\piccropb0\picw2646\pich1138\picwgoal1500\pichgoal645\pngblip\bliptag583511825
+{\*\blipuid 22c7af11751b66cef5cb11d41959e206}
+47494638396110001000d5ff00000000ffffffc0c0c0555f00ffffaafcfcfcf6f6f6eaeaeae6e6e6e4e4e4e3e3e3c2c2c2c1c1c1bcbcbcb5b5b5b3b3b3b0b0b0adadada5a5a5a2a2a2a1a1a19f9f9f9494948a8a8a8888888686867b7b7b6c6c6c5c5c5c4e4e4e4b4b4b4747474646463d3d3d3c3c3c2e2e2e2525251b1b1b18181810101009090906060603030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000021f90401000002002c0000000010001000000684408170482c0a06c8a4728924389f506833b281302a8e6b164b18103024c52111504cca67332102e0042e9a40d9319f8300a343c1200f54e47f7e2a00001e0b0a7d0d728a010d838400261a7c0d94947784252700127e9d159f6c8411140019080ea7a9a85f842122281612b1b3b25d6b1f29291d0fbbbdbc5d5e51c34e4cc64a46c94341003b}
+}
+\cell
+\pard \intbl foo\cell
+\pard \intbl 
+\trowd \cellx3415 \cellx9652\row
+\trowd \cellx9652\pard \intbl bar\cell
+\pard \intbl
+\trowd \cellx9652\row
+\pard \par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 367df3e..68b7aa5 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -134,6 +134,7 @@ public:
     void testFdo57678();
     void testFdo45183();
     void testFdo54612();
+    void testFdo58933();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -218,6 +219,7 @@ void Test::run()
         {"fdo57678.rtf", &Test::testFdo57678},
         {"fdo45183.rtf", &Test::testFdo45183},
         {"fdo54612.rtf", &Test::testFdo54612},
+        {"fdo58933.rtf", &Test::testFdo58933},
     };
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
@@ -1013,6 +1015,16 @@ void Test::testFdo54612()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xDraws->getCount());
 }
 
+void Test::testFdo58933()
+{
+    // The problem was that the table had an additional cell in its first line.
+    uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+    uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+    // This was 4.
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getCellNames().getLength());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index ffb583f..c961c7d 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -816,15 +816,16 @@ int RTFDocumentImpl::resolvePict(bool bInline)
     writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aAttributes, aSprms));
     checkFirstRun();
     if (!m_pCurrentBuffer)
+    {
         Mapper().props(pProperties);
+        // Make sure we don't loose these properties with a too early reset.
+        m_bHadPicture = true;
+    }
     else
     {
         RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms));
         m_pCurrentBuffer->push_back(make_pair(BUFFER_PROPS, pValue));
     }
-
-    // Make sure we don't loose these properties with a too early reset.
-    m_bHadPicture = true;
     return 0;
 }
 


More information about the Libreoffice-commits mailing list