diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2016-01-02 18:53:45 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2016-01-15 21:42:45 +0100 |
commit | b213708400c4a177cd0a88a5191be75d582a4ae4 (patch) | |
tree | 786c535ca28a3aa20f335eff4324d85b457b3672 | |
parent | afcb3d2a01c322cbc2cef0be47d3f23f93c3273c (diff) |
refactor out to limit scope: RES_TEXT_VERT_ADJUST
Change-Id: I030c6854e925c2a51b8c40de38e889a96c5ae32d
-rw-r--r-- | sw/source/core/unocore/unostyle.cxx | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 88e96fb5526d..f13332f2a4c6 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1653,6 +1653,15 @@ void SwXStyle::SetPropertyValue<RES_PAGEDESC>(const SfxItemPropertySimpleEntry& rStyleSet.Put(*pNewDesc); } } +template<> +void SwXStyle::SetPropertyValue<RES_TEXT_VERT_ADJUST>(const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase) +{ + if(!m_pDoc || !rValue.has<drawing::TextVerticalAdjust>() || !o_rStyleBase.GetOldPageDesc()) + return; + SwPageDesc* pPageDesc = m_pDoc->FindPageDesc(o_rStyleBase.GetOldPageDesc()->GetName()); + if(pPageDesc) + pPageDesc->SetVerticalAdjustment(rValue.get<drawing::TextVerticalAdjust>()); +} 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) { @@ -1711,21 +1720,9 @@ void SwXStyle::SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, const bDone = true; break; case RES_TEXT_VERT_ADJUST: - { - if( pDoc ) - { - const SwPageDesc* pOldPageDesc = rBase.GetOldPageDesc(); - SwPageDesc* pPageDesc = pOldPageDesc ? pDoc->FindPageDesc(pOldPageDesc->GetName()) : nullptr; - if (pPageDesc) - { - drawing::TextVerticalAdjust nVA; - rValue >>= nVA; - pPageDesc->SetVerticalAdjustment( nVA ); - } - } + SetPropertyValue<RES_TEXT_VERT_ADJUST>(rEntry, rPropSet, rValue, rBase); bDone = true; break; - } case FN_UNO_IS_AUTO_UPDATE: { bool bAuto = *static_cast<sal_Bool const *>(aValue.getValue()); |