sw/qa/extras/rtfimport/data/background.rtf | 39 ++++++++++++++++++++++++++++ sw/qa/extras/rtfimport/rtfimport.cxx | 7 +++++ writerfilter/source/rtftok/rtfsdrimport.cxx | 5 +++ 3 files changed, 51 insertions(+)
New commits: commit e8d10f215e9da65617988a9a471be18775afad00 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Sun Dec 29 16:15:03 2013 +0100 fdo#41109 RTF shape import: handle fBehindDocument property Change-Id: I9bf24eb2d3087e855d54c0ee7aba4e98dc856cc2 diff --git a/sw/qa/extras/rtfimport/data/background.rtf b/sw/qa/extras/rtfimport/data/background.rtf new file mode 100644 index 0000000..2dbe9fe --- /dev/null +++ b/sw/qa/extras/rtfimport/data/background.rtf @@ -0,0 +1,39 @@ +{\rtf1 +{\shp +{\*\shpinst\shpleft2633\shptop-97\shpright4853\shpbottom893\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt1\shpz1\shplid1027 +{\sp +{\sn shapeType} +{\sv 1} +} +{\sp +{\sn fillColor} +{\sv 5880731} +} +{\sp +{\sn fFilled} +{\sv 1} +} +{\sp +{\sn fBehindDocument} +{\sv 1} +} +} +} +{\shp +{\*\shpinst\shpleft488\shptop-97\shpright2003\shpbottom743\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplid1026 +{\sp +{\sn shapeType} +{\sv 1} +} +{\sp +{\sn fillColor} +{\sv 5066944} +} +{\sp +{\sn fFilled} +{\sv 1} +} +} +} +First should be foreground, the second should be background.\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 3553bf9..a5ab93d 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1398,6 +1398,13 @@ DECLARE_RTFIMPORT_TEST(testShpzDhgt, "shpz-dhgt.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00ff00), getProperty<sal_Int32>(getShape(2), "FillColor")); } +DECLARE_RTFIMPORT_TEST(testBackground, "background.rtf") +{ + // The first shape wasn't in the foreground. + CPPUNIT_ASSERT_EQUAL(true, bool(getProperty<sal_Bool>(getShape(1), "Opaque"))); + CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(getShape(2), "Opaque"))); +} + 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 84d541e..c13e104 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -239,6 +239,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose) oox::vml::FillModel aFillModel; // Gradient. oox::vml::ShadowModel aShadowModel; // Shadow. + bool bOpaque = true; + // The spec doesn't state what is the default for shapeType, Word seems to implement it as a rectangle. if (std::find_if(rShape.aProperties.begin(), rShape.aProperties.end(), @@ -535,6 +537,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose) oRelRight.reset(TWIP_TO_MM100(i->second.toInt32())); else if (i->first == "relBottom") oRelBottom.reset(TWIP_TO_MM100(i->second.toInt32())); + else if (i->first == "fBehindDocument") + bOpaque = !i->second.toInt32(); else SAL_INFO("writerfilter", "TODO handle shape property '" << i->first << "':'" << i->second << "'"); } @@ -669,6 +673,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose) oox::PropertySet(xShape).setProperties(aPropMap); } xPropertySet->setPropertyValue("AnchorType", uno::makeAny(text::TextContentAnchorType_AT_CHARACTER)); + xPropertySet->setPropertyValue("Opaque", uno::makeAny(bOpaque)); } if (m_rImport.isInBackground()) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits