diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-12-29 15:21:51 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-12-29 16:37:57 +0100 |
commit | 851f933a03ed75d5938452832aa9198855847dc7 (patch) | |
tree | 418b99c465789dd3f67927334f5146241eb6dbb7 | |
parent | 241eef7ca9b863ceb1f7f457a4bb2931b5d37f17 (diff) |
fdo#41109 RTF shape import: shpz has priority over dhgt
And not the other way around, how
24ee3df385cf2aa95cd888581c84fdf90cc682dc (RTF import: fix priority
handling of shpz vs dhgt, 2012-04-10) did, this time with a reproducer.
Change-Id: I9412341c6b35ca2760e4490a18f11bc6a0e0b78a
(cherry picked from commit ff7ac1a9b82bc20fe6e3d82322e53a7024edb84f)
-rw-r--r-- | sw/qa/extras/rtfimport/data/shpz-dhgt.rtf | 43 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 9 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfsdrimport.cxx | 6 |
3 files changed, 55 insertions, 3 deletions
diff --git a/sw/qa/extras/rtfimport/data/shpz-dhgt.rtf b/sw/qa/extras/rtfimport/data/shpz-dhgt.rtf new file mode 100644 index 000000000000..63df566bc9b2 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/shpz-dhgt.rtf @@ -0,0 +1,43 @@ +{\rtf1 +{\shp +{\*\shpinst\shpleft1898\shptop1043\shpright4598\shpbottom2123\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz1\shplid1027 +{\sp +{\sn shapeType} +{\sv 1} +} +{\sp +{\sn fillColor} +{\sv 65280} +} +{\sp +{\sn fFilled} +{\sv 1} +} +{\sp +{\sn dhgt} +{\sv 5} +} +} +} +{\shp +{\*\shpinst\shpleft563\shptop518\shpright2243\shpbottom1448\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplid1026 +{\sp +{\sn shapeType} +{\sv 1} +} +{\sp +{\sn fillColor} +{\sv 255} +} +{\sp +{\sn fFilled} +{\sv 1} +} +{\sp +{\sn dhgt} +{\sv 10} +} +} +} +\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index a8932c5a0038..130715d484c8 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1391,6 +1391,15 @@ DECLARE_RTFIMPORT_TEST(testFdo65090, "fdo65090.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators").getLength()); } +DECLARE_RTFIMPORT_TEST(testShpzDhgt, "shpz-dhgt.rtf") +{ + // Test that shpz has priority over dhght and not the other way around. + // Drawpage is sorted by ZOrder, so first should be red (back). + CPPUNIT_ASSERT_EQUAL(sal_Int32(0xff0000), getProperty<sal_Int32>(getShape(1), "FillColor")); + // Second (front) should be green. + CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00ff00), getProperty<sal_Int32>(getShape(2), "FillColor")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 3d9df8b1aaf0..84d541ee2f51 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -450,9 +450,9 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose) aViewBox.Height = i->second.toInt32(); else if ( i->first == "dhgt" ) { - resolveDhgt(xPropertySet, i->second.toInt32()); - // dhgt is Word 2007, \shpz is Word 97-2003, the previous has priority. - rShape.oZ.reset(); + // dhgt is Word 2007, \shpz is Word 97-2003, the later has priority. + if (!rShape.oZ) + resolveDhgt(xPropertySet, i->second.toInt32()); } // These are in EMU, convert to mm100. else if (i->first == "dxTextLeft") |