diff --git a/sw/qa/extras/rtfimport/data/n825305.rtf b/sw/qa/extras/rtfimport/data/n825305.rtf new file mode 100755 index 000000000000..72a6b52a4016 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/n825305.rtf @@ -0,0 +1,76 @@ +{\rtf +\viewkind1\margl360\margr360 +\margt360\margb360\paperw12240\paperh15840\pard +{\shp +{\*\shpinst\shpleft555\shpright1185\shptop5715\shpbottom5970\shpbxpage +\shpbypage\shpwr3\shpz1 +{\sp +{\sn shapeType} +{\sv 1} +} +{\sp +{\sn fLine} +{\sv 1} +} +{\sp + +{\sn lineWidth} +{\sv 0} +} +{\sp +{\sn lineColor} +{\sv 10485760} +} +{\sp +{\sn lineDashing +} +{\sv 0} +} +{\sp +{\sn fFilled} +{\sv 1} +} +{\sp +{\sn fillColor} +{\sv 10485760} +} +} +} +{\shp +{\*\shpinst\shpleft780\shpright1425\shptop5790\shpbottom6030\shpbxpage +\shpbypage\shpwr3\shpz2 +{\sp +{\sn shapeType} +{\sv 202} +} +{\sp +{\sn dxTextLeft} +{\sv +0} +} +{\sp +{\sn dxTextRight} +{\sv 0} +} +{\sp +{\sn dyTextTop} +{\sv 0} +} +{\sp +{\sn +dyTextBottom} +{\sv 0} +} +{\sp +{\sn fLine} +{\sv 0} +} +{\shptxt\plain\pard\f29\fs20 Ln # +\par} +{\sp +{\sn fFilled} +{\sv 0} +} +} +} +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 165a4f92dd07..23fdf54c9099 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -142,6 +142,7 @@ public: void testPageBackground(); void testFdo62044(); void testPoshPosv(); + void testN825305(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -271,6 +272,7 @@ void Test::run() {"page-background.rtf", &Test::testPageBackground}, {"fdo62044.rtf", &Test::testFdo62044}, {"posh-posv.rtf", &Test::testPoshPosv}, + {"n825305.rtf", &Test::testN825305}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -1284,6 +1286,18 @@ void Test::testPoshPosv() CPPUNIT_ASSERT_EQUAL(true, getProperty(xDraws->getByIndex(0), "FrameIsAutomaticHeight")); } +void Test::testN825305() +{ + // The problem was that the textbox wasn't transparent, due to unimplemented fFilled == 0. + uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference xPropertyState(xDraws->getByIndex(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty(xDraws->getByIndex(1), "BackColorTransparency")); + beans::PropertyState ePropertyState = xPropertyState->getPropertyState("BackColorTransparency"); + // Was beans::PropertyState_DEFAULT_VALUE. + CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, ePropertyState); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 36c4cb1f602a..1b62df3ff071 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -121,6 +121,8 @@ void RTFSdrImport::applyProperty(uno::Reference xShape, OUStrin sal_Int16 nHoriOrient = 0; sal_Int16 nVertOrient = 0; boost::optional obFitShapeToText; + bool bFilled = true; + if (aKey == "posh") { switch (aValue.toInt32()) @@ -163,6 +165,9 @@ void RTFSdrImport::applyProperty(uno::Reference xShape, OUStrin } else if (aKey == "fFitShapeToText") obFitShapeToText.reset(aValue.toInt32() == 1); + else if (aKey == "fFilled") + bFilled = aValue.toInt32() == 1; + if (nHoriOrient != 0) xPropertySet->setPropertyValue("HoriOrient", uno::makeAny(nHoriOrient)); if (nVertOrient != 0) @@ -172,6 +177,8 @@ void RTFSdrImport::applyProperty(uno::Reference xShape, OUStrin xPropertySet->setPropertyValue("SizeType", uno::makeAny(*obFitShapeToText ? text::SizeType::MIN : text::SizeType::FIX)); xPropertySet->setPropertyValue("FrameIsAutomaticHeight", uno::makeAny(*obFitShapeToText)); } + if (!bFilled) + xPropertySet->setPropertyValue("BackColorTransparency", uno::makeAny(sal_Int32(100))); } void RTFSdrImport::resolve(RTFShape& rShape, bool bClose) @@ -452,7 +459,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose) else if (i->first == "shadowOffsetX") // EMUs to points aShadowModel.moOffset.set(OUString::number(i->second.toDouble() / 12700) + "pt"); - else if (i->first == "posh" || i->first == "posv" || i->first == "fFitShapeToText") + else if (i->first == "posh" || i->first == "posv" || i->first == "fFitShapeToText" || i->first == "fFilled") applyProperty(xShape, i->first, i->second); else if (i->first == "posrelh") {