summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2016-01-13 22:07:35 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2016-01-15 21:42:45 +0100
commit82d23aef19210f982508c521eecff3a5e8bc63a8 (patch)
tree91917b7e8fd2c39ab4c3bf6a4141056aeffe5f85
parentb213708400c4a177cd0a88a5191be75d582a4ae4 (diff)
refactor out to limit scope: FN_UNO_IS_AUTO_UPDATE
... also check type of args and throw if it doesnt match Change-Id: Ic7a45aeab58b79abf3baee4bd3bf6f78fe3fa116
-rw-r--r--sw/source/core/unocore/unostyle.cxx19
1 files changed, 12 insertions, 7 deletions
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index f13332f2a4c6..6531b06c5179 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1662,7 +1662,17 @@ void SwXStyle::SetPropertyValue<RES_TEXT_VERT_ADJUST>(const SfxItemPropertySimpl
if(pPageDesc)
pPageDesc->SetVerticalAdjustment(rValue.get<drawing::TextVerticalAdjust>());
}
-
+template<>
+void SwXStyle::SetPropertyValue<FN_UNO_IS_AUTO_UPDATE>(const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
+{
+ if(!rValue.has<bool>())
+ throw lang::IllegalArgumentException();
+ const bool bAuto(rValue.get<bool>());
+ if(SFX_STYLE_FAMILY_PARA == m_rEntry.m_eFamily)
+ o_rStyleBase.getNewBase()->GetCollection()->SetAutoUpdateFormat(bAuto);
+ else if(SFX_STYLE_FAMILY_FRAME == m_rEntry.m_eFamily)
+ o_rStyleBase.getNewBase()->GetFrameFormat()->SetAutoUpdateFormat(bAuto);
+}
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)
{
SfxStyleSheetBasePool* pBasePool = m_pBasePool;
@@ -1725,12 +1735,7 @@ void SwXStyle::SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, const
break;
case FN_UNO_IS_AUTO_UPDATE:
{
- bool bAuto = *static_cast<sal_Bool const *>(aValue.getValue());
- if(SFX_STYLE_FAMILY_PARA == eFamily)
- rBase.getNewBase()->GetCollection()->SetAutoUpdateFormat(bAuto);
- else if(SFX_STYLE_FAMILY_FRAME == eFamily)
- rBase.getNewBase()->GetFrameFormat()->SetAutoUpdateFormat(bAuto);
-
+ SetPropertyValue<FN_UNO_IS_AUTO_UPDATE>(rEntry, rPropSet, rValue, rBase);
bDone = true;
break;
}