summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2016-01-02 05:01:29 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2016-01-15 21:42:41 +0100
commit5f98d3bc9b029d05830bb6c4fea3e4d2dcde1da0 (patch)
tree604aa66d9a51b1467866701039f0aa9373297ab3
parent3c3599ee96a47c78c04809b51a13ab8aeee88acb (diff)
refactor out to limit scope: RES_BACKGROUND
Change-Id: Ic50f66a4a08dab6fd55a14475d1e9a4947e16048
-rw-r--r--sw/source/core/unocore/unostyle.cxx42
1 files changed, 21 insertions, 21 deletions
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 3c88bd6e2dc2..5b9bcd260b32 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1480,6 +1480,24 @@ void SwXStyle::SetPropertyValue<XATTR_FILLGRADIENT>(const SfxItemPropertySimpleE
else
lcl_SetDefaultWay(rEntry, rPropSet, aValue, o_rStyleBase);
}
+template<>
+void SwXStyle::SetPropertyValue<RES_BACKGROUND>(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
+{
+ SfxItemSet& rStyleSet = o_rStyleBase.GetItemSet();
+ const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet, RES_BACKGROUND, true, m_pDoc->IsInXMLImport()));
+ SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
+
+ uno::Any aValue(rValue);
+ const auto nMemberId(lcl_TranslateMetric(rEntry, m_pDoc, aValue));
+ aChangedBrushItem.PutValue(aValue, nMemberId);
+
+ // 0xff is already the default - but if BackTransparent is set
+ // to true, it must be applied in the item set on ODF import
+ // to potentially override parent style, which is unknown yet
+ if(aChangedBrushItem == aOriginalBrushItem && (MID_GRAPHIC_TRANSPARENT != nMemberId || !aValue.has<bool>() || !aValue.get<bool>()))
+ return;
+ setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet);
+}
static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
const SfxItemPropertySet& rPropSet,
@@ -1508,29 +1526,9 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
case XATTR_FILLHATCH:
case XATTR_FILLBITMAP:
case XATTR_FILLFLOATTRANSPARENCE:
- assert(false);
- break;
case RES_BACKGROUND:
- {
- //UUUU
- SfxItemSet& rStyleSet = rBase.GetItemSet();
- const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet, RES_BACKGROUND, true, pDoc->IsInXMLImport()));
- SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
-
- aChangedBrushItem.PutValue(aValue, nMemberId);
-
- if (!(aChangedBrushItem == aOriginalBrushItem) ||
- // 0xff is already the default - but if BackTransparent is set
- // to true, it must be applied in the item set on ODF import
- // to potentially override parent style, which is unknown yet
- (MID_GRAPHIC_TRANSPARENT == nMemberId && aValue.has<bool>() && aValue.get<bool>()))
- {
- setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet);
- }
-
- bDone = true;
+ assert(false);
break;
- }
case OWN_ATTR_FILLBMP_MODE:
{
//UUUU
@@ -2027,6 +2025,8 @@ void SAL_CALL SwXStyle::SetPropertyValues_Impl(
// case XATTR_LINEEND:
// case XATTR_LINEDASH:
SetPropertyValue<XATTR_FILLGRADIENT>(*pEntry, *pPropSet, pValues[nProp], aBaseImpl);
+ case RES_BACKGROUND:
+ SetPropertyValue<RES_BACKGROUND>(*pEntry, *pPropSet, pValues[nProp], aBaseImpl);
default:
lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, m_pBasePool, m_pDoc, m_rEntry.m_eFamily);
}