diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2016-01-02 13:51:07 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2016-01-15 21:42:43 +0100 |
commit | 419124e2098d323571ca5644f3ed644236b885b9 (patch) | |
tree | 3dacc8828936261d5cedf820dbc9eccd9737a9e4 | |
parent | 2bdf87d03e1f12680a23799abb4ecaf325f34ac4 (diff) |
refactor out to limit scope: OWN_ATTR_FILLBMP_MODE
Change-Id: Ic515b7868c747d5ce5ff0856890aa0af9e567339
-rw-r--r-- | sw/source/core/unocore/unostyle.cxx | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 0a70e65536fa..1a158dad9d39 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1501,6 +1501,20 @@ void SwXStyle::SetPropertyValue<RES_BACKGROUND>(const SfxItemPropertySimpleEntry setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet); } +template<> +void SwXStyle::SetPropertyValue<OWN_ATTR_FILLBMP_MODE>(const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase) +{ + drawing::BitmapMode eMode; + if(!(rValue >>= eMode)) + { + if(!rValue.has<sal_Int32>()) + throw lang::IllegalArgumentException(); + eMode = ((drawing::BitmapMode)rValue.get<sal_Int32>()); + } + SfxItemSet& rStyleSet = o_rStyleBase.GetItemSet(); + rStyleSet.Put(XFillBmpStretchItem(drawing::BitmapMode_STRETCH == eMode)); + rStyleSet.Put(XFillBmpTileItem(drawing::BitmapMode_REPEAT == eMode)); +} void SwXStyle::SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& rBase) throw(beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception) { @@ -1535,30 +1549,9 @@ void SwXStyle::SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, const bDone = true; break; case OWN_ATTR_FILLBMP_MODE: - { - //UUUU - drawing::BitmapMode eMode; - - if(!(aValue >>= eMode)) - { - sal_Int32 nMode = 0; - - if(!(aValue >>= nMode)) - { - throw lang::IllegalArgumentException(); - } - - eMode = (drawing::BitmapMode)nMode; - } - - SfxItemSet& rStyleSet = rBase.GetItemSet(); - - rStyleSet.Put(XFillBmpStretchItem(drawing::BitmapMode_STRETCH == eMode)); - rStyleSet.Put(XFillBmpTileItem(drawing::BitmapMode_REPEAT == eMode)); - + SetPropertyValue<OWN_ATTR_FILLBMP_MODE>(rEntry, rPropSet, rValue, rBase); bDone = true; break; - } case RES_PAPER_BIN: { SfxPrinter *pPrinter = pDoc->getIDocumentDeviceAccess().getPrinter( true ); @@ -3312,7 +3305,6 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl( } default: { - //UUUU SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl); break; } |