diff options
-rw-r--r-- | svx/source/unodraw/unobrushitemhelper.cxx | 27 | ||||
-rw-r--r-- | sw/qa/extras/odfimport/data/PageBackground.odt | bin | 13175 -> 13301 bytes | |||
-rw-r--r-- | sw/qa/extras/odfimport/odfimport.cxx | 6 |
3 files changed, 20 insertions, 13 deletions
diff --git a/svx/source/unodraw/unobrushitemhelper.cxx b/svx/source/unodraw/unobrushitemhelper.cxx index 4a2ec1d3c0c8..d10aab649ee0 100644 --- a/svx/source/unodraw/unobrushitemhelper.cxx +++ b/svx/source/unodraw/unobrushitemhelper.cxx @@ -50,19 +50,8 @@ void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, SfxI const sal_uInt8 nTransparency(rBrush.GetColor().GetTransparency()); - if(0xff != nTransparency) - { - // we have a color fill - const Color aColor(rBrush.GetColor().GetRGBColor()); - - rToSet.Put(XFillStyleItem(drawing::FillStyle_SOLID)); - rToSet.Put(XFillColorItem(OUString(), aColor)); - - // #125189# nTransparency is in range [0..254], convert to [0..100] which is used in - // XFillTransparenceItem (caution with the range which is in an *item-specific* range) - rToSet.Put(XFillTransparenceItem((((sal_Int32)nTransparency * 100) + 127) / 254)); - } - else if(GPOS_NONE != rBrush.GetGraphicPos()) + // tdf#89478 check for image first + if (GPOS_NONE != rBrush.GetGraphicPos()) { // we have a graphic fill, set fill style rToSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP)); @@ -131,6 +120,18 @@ void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, SfxI rToSet.Put(XFillTransparenceItem(nGraphicTransparency)); } } + else if (0xff != nTransparency) + { + // we have a color fill + const Color aColor(rBrush.GetColor().GetRGBColor()); + + rToSet.Put(XFillStyleItem(drawing::FillStyle_SOLID)); + rToSet.Put(XFillColorItem(OUString(), aColor)); + + // #125189# nTransparency is in range [0..254], convert to [0..100] which is used in + // XFillTransparenceItem (caution with the range which is in an *item-specific* range) + rToSet.Put(XFillTransparenceItem((((sal_Int32)nTransparency * 100) + 127) / 254)); + } else { // GPOS_NONE == rBrush.GetGraphicPos() && 0xff == rBrush.GetColor().GetTransparency(), diff --git a/sw/qa/extras/odfimport/data/PageBackground.odt b/sw/qa/extras/odfimport/data/PageBackground.odt Binary files differindex dbb1082d2b77..3733d5baed20 100644 --- a/sw/qa/extras/odfimport/data/PageBackground.odt +++ b/sw/qa/extras/odfimport/data/PageBackground.odt diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index a4de654390ae..5db4370ed701 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -315,6 +315,12 @@ DECLARE_ODFIMPORT_TEST(testPageBackground, "PageBackground.odt") CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_BITMAP, getProperty<drawing::FillStyle>(xPropertySet, "FillStyle")); CPPUNIT_ASSERT_EQUAL(OUString("Sky"), getProperty<OUString>(xPropertySet, "FillBitmapName")); CPPUNIT_ASSERT_EQUAL(drawing::BitmapMode_REPEAT, getProperty<drawing::BitmapMode>(xPropertySet, "FillBitmapMode")); + + uno::Reference<beans::XPropertySet> xPropertySetOld(getStyles("PageStyles")->getByName("OldStandard"), uno::UNO_QUERY); + // The background image was overridden by color + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_BITMAP, getProperty<drawing::FillStyle>(xPropertySetOld, "FillStyle")); + CPPUNIT_ASSERT_EQUAL(OUString("Sky"), getProperty<OUString>(xPropertySetOld, "FillBitmapName")); + CPPUNIT_ASSERT_EQUAL(drawing::BitmapMode_REPEAT, getProperty<drawing::BitmapMode>(xPropertySetOld, "FillBitmapMode")); } DECLARE_ODFIMPORT_TEST(testFdo56272, "fdo56272.odt") |