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-16 11:03:04 +0100
commitcad3c33af1ac772d4653cc512086e4de7315cf9c (patch)
tree8f48ee84b66dccb64874458cc4024d0c8e2fe1c0
parent3f6f4ebc6f162690481a5641a7f6fe35c3d99906 (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;
}