summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-01-09 15:29:29 +0100
committerMichael Stahl <mstahl@redhat.com>2013-01-09 19:19:09 +0000
commit075a1e6fdaebd441be4cb46fbc30ef7ded4cabaa (patch)
tree61eb4902b73b978c029e42c3f8e2cbe7d6c5f4c8
parentcf9458096264f19cdd46e1543747e2d9dab90f8f (diff)
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@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--sw/qa/extras/rtfimport/data/fdo58933.rtf28
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx12
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx7
3 files changed, 44 insertions, 3 deletions
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 367df3ea5cb6..68b7aa5c6144 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 ffb583f8b240..c961c7dacdf0 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;
}