summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-08-21 18:28:23 +0200
committerMichael Stahl <mstahl@redhat.com>2015-08-22 01:00:03 +0200
commit79fb61efb847405fa47235002b52ee8efad5e339 (patch)
tree8ae2763d18c65cf465b77ce248202c96139b2bc5
parentece9da2f47def7ed5cd5e04add0eeb7a90a6e1b6 (diff)
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 3d399b0e45720354fc64dc3d121ee486e01eff89) Change-Id: Ia987fe586ec819a1f3cd85acdbfb03c74ca0ec2c
-rw-r--r--include/svx/unobrushitemhelper.hxx3
-rw-r--r--svx/source/unodraw/unobrushitemhelper.cxx6
-rw-r--r--sw/source/core/unocore/unostyle.cxx4
3 files changed, 7 insertions, 6 deletions
diff --git a/include/svx/unobrushitemhelper.hxx b/include/svx/unobrushitemhelper.hxx
index eea95b60e6d6..4055c4584008 100644
--- a/include/svx/unobrushitemhelper.hxx
+++ b/include/svx/unobrushitemhelper.hxx
@@ -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
diff --git a/svx/source/unodraw/unobrushitemhelper.cxx b/svx/source/unodraw/unobrushitemhelper.cxx
index 42b3d5f7c139..1ae4c1475ef2 100644
--- a/svx/source/unodraw/unobrushitemhelper.cxx
+++ b/svx/source/unodraw/unobrushitemhelper.cxx
@@ -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);
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index a17eaf175360..da3d56ff5bb8 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -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);