diff options
-rwxr-xr-x | sw/qa/extras/ww8export/data/tdf101826_xattrTextBoxFill.doc | bin | 0 -> 55296 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export3.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8graf.cxx | 27 |
3 files changed, 35 insertions, 2 deletions
diff --git a/sw/qa/extras/ww8export/data/tdf101826_xattrTextBoxFill.doc b/sw/qa/extras/ww8export/data/tdf101826_xattrTextBoxFill.doc Binary files differnew file mode 100755 index 000000000000..206f4830958a --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf101826_xattrTextBoxFill.doc diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index 239ce2bcbf2e..339ebd17e440 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -179,6 +179,16 @@ DECLARE_WW8EXPORT_TEST(testTdf121111_fillStyleNone, "tdf121111_fillStyleNone.doc CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(xText, "FillStyle")); } +DECLARE_WW8EXPORT_TEST(testTdf101826_xattrTextBoxFill, "tdf101826_xattrTextBoxFill.doc") +{ + //Basic 1 Color Fill: gradient from yellow(FFFF00) to brown(767600) currently saves as mid-color + CPPUNIT_ASSERT_MESSAGE("background color", Color(0xFF, 0xFF, 0x00) != getProperty<Color>(getShape(1), "BackColor")); + //Basic 2 Color Fill: gradient from yellow(FFFF00) to green(00B050) currently saves as mid-color + CPPUNIT_ASSERT_MESSAGE("background color", Color(0xFF, 0xFF, 0x00) != getProperty<Color>(getShape(4), "BackColor")); + //Basic Picture Fill: Tux image + CPPUNIT_ASSERT_EQUAL_MESSAGE("background image", drawing::FillStyle_BITMAP, getProperty<drawing::FillStyle>(getShape(5), "FillStyle")); +} + DECLARE_WW8EXPORT_TEST(testTdf123433_fillStyleStop, "tdf123433_fillStyleStop.doc") { uno::Reference<text::XTextRange> xText(getParagraph(12)); diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 49440291710a..551376439e05 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -1691,6 +1691,29 @@ void SwWW8ImplReader::MatchSdrItemsIntoFlySet( SdrObject const * pSdrObj, rFlySet.Put( *pPoolItem ); } + // take new XATTR items directly. Skip old RES_BACKGROUND if new FILLSTYLE taken. + bool bSkipResBackground = false; + SfxItemPool* pPool = rFlySet.GetPool(); + if ( pPool ) + { + for ( sal_uInt16 i = XATTR_START; i < XATTR_END; ++i ) + { + // Not all Fly types support XATTRs - skip unsupported attributes + SfxItemPool* pAttrPool = pPool->GetMasterPool(); + while ( pAttrPool && !pAttrPool->IsInRange(i) ) + pAttrPool = pAttrPool->GetSecondaryPool(); + if ( !pAttrPool ) + continue; + + if ( SfxItemState::SET == rOldSet.GetItemState(i, false, &pPoolItem) ) + { + rFlySet.Put( *pPoolItem ); + if ( i == XATTR_FILLSTYLE ) + bSkipResBackground = true; + } + } + } + // now calculate the borders and build the box: The unit is needed for the // frame SIZE! SvxBoxItem aBox(sw::util::ItemGet<SvxBoxItem>(rFlySet, RES_BOX)); @@ -1817,7 +1840,7 @@ void SwWW8ImplReader::MatchSdrItemsIntoFlySet( SdrObject const * pSdrObj, // Separate transparency eState = rOldSet.GetItemState(XATTR_FILLTRANSPARENCE, true, &pItem); - if (eState == SfxItemState::SET) + if (!bSkipResBackground && eState == SfxItemState::SET) { sal_uInt16 nRes = WW8ITEMVALUE(rOldSet, XATTR_FILLTRANSPARENCE, XFillTransparenceItem); @@ -1828,7 +1851,7 @@ void SwWW8ImplReader::MatchSdrItemsIntoFlySet( SdrObject const * pSdrObj, // Background: SvxBrushItem eState = rOldSet.GetItemState(XATTR_FILLSTYLE, true, &pItem); - if (eState == SfxItemState::SET) + if (!bSkipResBackground && eState == SfxItemState::SET) { const drawing::FillStyle eFill = static_cast<const XFillStyleItem*>(pItem)->GetValue(); |