Kaydet (Commit) 79fb61ef authored tarafından Michael Stahl's avatar Michael Stahl

tdf#92379: svx: don't overwrite fo:background-color on ODF import

getSvxBrushItemFromSourceSet() is called once for each property of a
frame style that is set, and the "solid" fill-style is set by first
applying the BackColorRGB and then BackTransparency property.  So there
is an intermediate state that has fill-style NONE but a XFillColorItem
set - don't reset the color to white in that case!

Apparently writerfilter generally relies on the current reset-to-AUTO
implementation (loads of test failures), so for now limit the fix for
when we know that a frame style is imported from ODF.

(regression from 3d399b0e)

Change-Id: Ia987fe586ec819a1f3cd85acdbfb03c74ca0ec2c
üst ece9da2f
......@@ -46,7 +46,8 @@ SVX_DLLPUBLIC void setSvxBrushItemAsFillAttributesToTargetSet(
SVX_DLLPUBLIC SvxBrushItem getSvxBrushItemFromSourceSet(
const SfxItemSet& rSourceSet,
sal_uInt16 nBackgroundID,
bool bSearchInParents = true);
bool bSearchInParents = true,
bool bXMLImportHack = false);
#endif // _UNOBRUSHITEMHELPER_HXX
......
......@@ -192,7 +192,7 @@ SvxBrushItem getSvxBrushItemForSolid(const SfxItemSet& rSourceSet, bool bSearchI
}
//UUUU
SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt16 nBackgroundID, bool bSearchInParents)
SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt16 nBackgroundID, bool bSearchInParents, bool bXMLImportHack)
{
const XFillStyleItem* pXFillStyleItem(static_cast< const XFillStyleItem* >(rSourceSet.GetItem(XATTR_FILLSTYLE, bSearchInParents)));
......@@ -201,8 +201,8 @@ SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt
// no fill, still need to rescue the evtl. set RGB color, but use as transparent color (we have drawing::FillStyle_NONE)
Color aFillColor(static_cast< const XFillColorItem& >(rSourceSet.Get(XATTR_FILLCOLOR, bSearchInParents)).GetColorValue());
// when fill style is none, then don't allow anything other than 0 or auto.
if (aFillColor.GetColor() != 0)
// for writerfilter: when fill style is none, then don't allow anything other than 0 or auto.
if (!bXMLImportHack && aFillColor.GetColor() != 0)
aFillColor.SetColor(COL_AUTO);
aFillColor.SetTransparency(0xff);
......
......@@ -1761,7 +1761,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
{
//UUUU
SfxItemSet& rStyleSet = rBase.GetItemSet();
const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet, RES_BACKGROUND));
const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet, RES_BACKGROUND, true, pDoc->IsInXMLImport()));
SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
aChangedBrushItem.PutValue(aValue, nMemberId);
......@@ -4297,7 +4297,7 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle(
case RES_BACKGROUND:
{
//UUUU
const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND));
const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, true, pDocShell->GetDoc()->IsInXMLImport()));
SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
aChangedBrushItem.PutValue(aValue, nMemberId);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment