diff options
-rw-r--r-- | sw/qa/extras/rtfimport/data/background.rtf | 39 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 7 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfsdrimport.cxx | 5 |
3 files changed, 51 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/background.rtf b/sw/qa/extras/rtfimport/data/background.rtf new file mode 100644 index 000000000000..2dbe9fe5f10b --- /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 3553bf97fc38..a5ab93d3df15 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 84d541ee2f51..c13e104b1d34 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()) |