From 555bc780c83114220012e198b5471a0d7452fb32 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 9 Jan 2013 15:29:29 +0100 Subject: fdo#58933 RTF import: avoid fake pars / cells when having graphic inside cells Regression from 8063e36115a11ddf3db05928db9287947beee74d. --- 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(-) create mode 100644 sw/qa/extras/rtfimport/data/fdo58933.rtf diff --git a/sw/qa/extras/rtfimport/data/fdo58933.rtf b/sw/qa/extras/rtfimport/data/fdo58933.rtf new file mode 100644 index 000000000000..7568e274f03d --- /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 88e679743f84..296a89ecedca 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}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -1014,6 +1016,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 xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference 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 d7422a061cf2..4964791cf040 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -817,15 +817,16 @@ int RTFDocumentImpl::resolvePict(bool bInline) writerfilter::Reference::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; } -- cgit v1.2.3